From: Darrick J. Wong Date: Thu, 5 Aug 2021 15:43:28 +0000 (-0700) Subject: tests: skip u_direct_io if losetup fails X-Git-Tag: v1.46.4~40 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=40ef5e29113b10447f226a3e4a028d7d19c2bffc;p=tools%2Fe2fsprogs.git tests: skip u_direct_io if losetup fails This new test requires a loop device to run testing. While it checks for some "obvious" parameters that might cause the test to fail such as not being root and no losetup executable, it doesn't actually check that the losetup -a call succeeds. This causes a test regression in my package building container (where there is only a minimal /dev with no loop devices available) so I can't build debian packages. Fix the test to skip out if we can't create a loop device. Signed-off-by: Darrick J. Wong Signed-off-by: Theodore Ts'o --- diff --git a/tests/u_direct_io/script b/tests/u_direct_io/script index 0b5d708..b4f0775 100644 --- a/tests/u_direct_io/script +++ b/tests/u_direct_io/script @@ -9,6 +9,11 @@ elif test ! -x $DEBUGFS_EXE; then else dd if=/dev/zero of=$TMPFILE bs=1M count=128 > /dev/null 2>&1 LOOP=$(losetup --show --sector-size 4096 -f $TMPFILE) + if [ ! -b "$LOOP" ]; then + echo "$test_name: $DESCRIPTION: skipped (no loop devices)" + rm -f $TMPFILE + exit 0 + fi echo mke2fs -F -o Linux -t ext4 -O ^metadata_csum,^uninit_bg -D \$LOOP > $OUT $MKE2FS -F -o Linux -t ext4 -O ^metadata_csum,^uninit_bg -D $LOOP 2>&1 | \ sed -f $cmd_dir/filter.sed >> $OUT