From f541f59e9a3185a3a0247bfc2d8fe439de754155 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Sat, 21 Mar 2020 00:34:16 +0100 Subject: [PATCH] btrfs-progs: tests: check if subvolume delete by id is supported Skip the test 013-subvolume-delete-by-id if the first valid attempt to use the ioctl fails with 'Inappropriate ioctl for device'. Signed-off-by: David Sterba --- tests/cli-tests/013-subvolume-delete-by-id/test.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/cli-tests/013-subvolume-delete-by-id/test.sh b/tests/cli-tests/013-subvolume-delete-by-id/test.sh index 158af820..d762b095 100755 --- a/tests/cli-tests/013-subvolume-delete-by-id/test.sh +++ b/tests/cli-tests/013-subvolume-delete-by-id/test.sh @@ -27,10 +27,18 @@ run_mustfail "subvolume delete --subvolid expects only one extra argument, the m $SUDO_HELPER "$TOP/btrfs" subvolume delete --subvolid 256 "$TEST_MNT" "$TEST_MNT" # Delete the recently created subvol using the subvolid -run_check $SUDO_HELPER "$TOP/btrfs" subvolume delete --subvolid 256 "$TEST_MNT" - +# (First run is conditional to check for kernel support) +out=$(run_mayfail_stdout $SUDO_HELPER "$TOP/btrfs" subvolume delete --subvolid 256 "$TEST_MNT") +ret="$?" run_check_umount_test_dev +if [ "$ret" != 0 ]; then + if echo "$out" | grep -q 'Inappropriate ioctl for device'; then + _not_run "subvolume delete --subvolid not supported" + fi + _fail "$out" +fi + run_check_mount_test_dev -o subvol=subvol2 # When the subvolume subvol3 is mounted, subvol2 is not reachable by the # current mount point, but "subvolume delete --subvolid" should be able to