Skip to contentSkip to conversation

tests: skip u_direct_io if losetup fails

PATCH RESEND Applied Darrick J. Wong 2 participants 2 messages Aug 5, 2021 – Aug 6, 2021

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 tests: skip u_direct_io if losetup fails

From: Darrick J. Wong <[email protected]>

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.

---
 tests/u_direct_io/script |    5 +++++
 1 file changed, 5 insertions(+)
tests/u_direct_io/script +5 -0
index 0b5d7083..b4f07752 100644
@@ -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
#1 lore raw
Quoted 9 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

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.

Quoted 3 lines

Fix the test to skip out if we can't create a loop device.

Applied, thanks.

- Ted