Skip to content

Commit

Permalink
tests/rnbd: Implement RNBD regression test
Browse files Browse the repository at this point in the history
This test case has been in my possession for quite some time.
I am upstreaming it now because it has once again detected a regression in
a recent kernel release[0].

It's just stupid to connect and disconnect RNBD on localhost and expect
no dmesg exceptions, with some attempts actually succeeding.

rnbd/002 (Start Stop RNBD repeatedly)                        [passed]
    runtime                   13.252s  ...  13.099s
    start/stop success ratio  100/100  ...  100/100

[0] https://lore.kernel.org/linux-rdma/[email protected]/

Signed-off-by: Li Zhijian <[email protected]>
Reviewed-by: Jack Wang <[email protected]>
Signed-off-by: Shin'ichiro Kawasaki <[email protected]>
  • Loading branch information
zhijianli88 authored and kawasaki committed Jan 9, 2025
1 parent 881b86d commit f6c0fd9
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
47 changes: 47 additions & 0 deletions tests/rnbd/002
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-3.0+
# Copyright (c) 2024 FUJITSU LIMITED. All Rights Reserved.
#
# Commit 667db86bcbe8 ("RDMA/rtrs: Register ib event handler") introduced a
# new element .deinit but never used it at all that lead to a
# 'list_add corruption' kernel warning.
#
# This test is intended to check whether the current kernel is affected.
# The following patch resolves this issue.
# RDMA/rtrs: Add missing deinit() call
#
. tests/rnbd/rc

DESCRIPTION="Start Stop RNBD repeatedly"
CHECK_DMESG=1
QUICK=1

requires() {
_have_rnbd
_have_loop
}

test_start_stop_repeatedly()
{
_setup_rnbd || return

local loop_dev i j=0
loop_dev="$(losetup -f)"

for ((i=0;i<100;i++))
do
_start_rnbd_client "${loop_dev}" &>/dev/null
# Always stop it so that the next start has change to work
_stop_rnbd_client &>/dev/null && ((j++))
done

TEST_RUN["start/stop success ratio"]="${j}/${i}"

_cleanup_rnbd
}

test() {
echo "Running ${TEST_NAME}"
test_start_stop_repeatedly
echo "Test complete"
}
2 changes: 2 additions & 0 deletions tests/rnbd/002.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Running rnbd/002
Test complete

0 comments on commit f6c0fd9

Please sign in to comment.