From: Omar Sandoval Date: Mon, 11 Jun 2018 18:51:37 +0000 (-0700) Subject: nbd: clean up common and nbd/001 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=1317367acb66b2f12fe053639689dfb1812fb66d;p=users%2Fsagi%2Fblktests.git nbd: clean up common and nbd/001 Signed-off-by: Omar Sandoval --- diff --git a/common/nbd b/common/nbd index e888435..e78d613 100644 --- a/common/nbd +++ b/common/nbd @@ -17,7 +17,15 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -_have_nbd_netlink_support() { +_have_nbd() { + _have_module nbd && _have_program nbd-server && \ + _have_program nbd-client +} + +_have_nbd_netlink() { + if ! _have_nbd; then + return 1 + fi if ! _have_program genl-ctrl-list; then return 1 fi @@ -28,10 +36,6 @@ _have_nbd_netlink_support() { return 0 } -_have_nbd_netlink() { - _have_nbd && _have_nbd_netlink_support -} - _start_nbd_server() { truncate -s 10G "${TMPDIR}/export" cat > "${TMPDIR}/nbd.conf" << EOF diff --git a/common/rc b/common/rc index 936b21d..7f17280 100644 --- a/common/rc +++ b/common/rc @@ -84,11 +84,6 @@ _have_loop() { _have_module loop && _have_program losetup } -_have_nbd() { - _have_module nbd && _have_program nbd-server && \ - _have_program nbd-client -} - _have_blktrace() { # CONFIG_BLK_DEV_IO_TRACE might still be disabled, but this is easier # to check. We can fix it if someone complains. diff --git a/tests/nbd/001 b/tests/nbd/001 index 8be760e..1df327e 100644 --- a/tests/nbd/001 +++ b/tests/nbd/001 @@ -18,8 +18,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -. common/nbd - DESCRIPTION="resize a connected nbd device" QUICK=1 @@ -30,16 +28,16 @@ requires() { test() { echo "Running ${TEST_NAME}" _start_nbd_server - nbd-client -N export localhost /dev/nbd0 > /dev/null 2>&1 - parted -s /dev/nbd0 print 2> /dev/null | grep 'Disk /dev/nbd0' + nbd-client -N export localhost /dev/nbd0 >> "$FULL" 2>&1 + parted -s /dev/nbd0 print 2>> "$FULL" | grep 'Disk /dev/nbd0' lsblk -n /dev/nbd0 echo "Setting size to 1gib" src/nbdsetsize /dev/nbd0 1073741824 lsblk -n /dev/nbd0 - parted -s /dev/nbd0 print 2> /dev/null | grep 'Disk /dev/nbd0' + parted -s /dev/nbd0 print 2>> "$FULL" | grep 'Disk /dev/nbd0' - nbd-client -d /dev/nbd0 > /dev/null 2>&1 + nbd-client -d /dev/nbd0 >> "$FULL" 2>&1 _stop_nbd_server } diff --git a/tests/nbd/group b/tests/nbd/group index 46739a0..0d4c1c4 100644 --- a/tests/nbd/group +++ b/tests/nbd/group @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +. common/nbd + group_requires() { _have_root && _have_nbd && modprobe nbd }