]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
nbd: clean up common and nbd/001
authorOmar Sandoval <osandov@fb.com>
Mon, 11 Jun 2018 18:51:37 +0000 (11:51 -0700)
committerOmar Sandoval <osandov@fb.com>
Mon, 11 Jun 2018 18:53:02 +0000 (11:53 -0700)
Signed-off-by: Omar Sandoval <osandov@fb.com>
common/nbd
common/rc
tests/nbd/001
tests/nbd/group

index e88843504bd972f8639dc00a02ff011f5701adbb..e78d613d3697509d03c773b149af8c1275db8b27 100644 (file)
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-_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
index 936b21d191135b68738850e86b8279d3443c7be7..7f172802536449236231fb5412617d8d42f94e3b 100644 (file)
--- 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.
index 8be760eb807f285f454ada0bc68c03e089c1e97f..1df327e7d3ad056ce6cbda39128b0a037da2dd3b 100644 (file)
@@ -18,8 +18,6 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-. 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
 }
index 46739a01c276757068c60564005ea0d21b97d08c..0d4c1c47f2bcd2e6b6e892426951466e06d72ae5 100644 (file)
@@ -17,6 +17,8 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+. common/nbd
+
 group_requires() {
        _have_root && _have_nbd && modprobe nbd
 }