diff --git a/tests/cli-tests.sh b/tests/cli-tests.sh index 72f7865a..86dda87b 100755 --- a/tests/cli-tests.sh +++ b/tests/cli-tests.sh @@ -20,6 +20,7 @@ export TEST_DEV rm -f $RESULTS check_prereq btrfs +check_kernel_support # The tests are driven by their custom script called 'test.sh' diff --git a/tests/common b/tests/common index 420286d6..c20fec88 100644 --- a/tests/common +++ b/tests/common @@ -280,10 +280,20 @@ run_check_umount_test_dev() run_check $SUDO_HELPER umount "$@" "$TEST_DEV" } +check_kernel_support() +{ + if ! grep -iq 'btrfs' /proc/filesystems; then + echo "WARNING: btrfs filesystem not listed in /proc/filesystems, some tests might fail" + return 1 + fi + return 0 +} + init_env() { TEST_MNT="${TEST_MNT:-$TOP/tests/mnt}" export TEST_MNT mkdir -p "$TEST_MNT" || { echo "Failed mkdir -p $TEST_MNT"; exit 1; } + } init_env diff --git a/tests/convert-tests.sh b/tests/convert-tests.sh index 0e025f99..db149724 100755 --- a/tests/convert-tests.sh +++ b/tests/convert-tests.sh @@ -21,6 +21,8 @@ export TEST_DEV rm -f $RESULTS +check_kernel_support + run_one_test() { local testdir local testname diff --git a/tests/fsck-tests.sh b/tests/fsck-tests.sh index d1cd7329..69ec57a0 100755 --- a/tests/fsck-tests.sh +++ b/tests/fsck-tests.sh @@ -23,6 +23,7 @@ rm -f $RESULTS check_prereq btrfs-corrupt-block check_prereq btrfs-image check_prereq btrfs +check_kernel_support run_one_test() { local testname diff --git a/tests/misc-tests.sh b/tests/misc-tests.sh index eefe8a81..fd19c2f9 100755 --- a/tests/misc-tests.sh +++ b/tests/misc-tests.sh @@ -24,6 +24,7 @@ check_prereq btrfs-corrupt-block check_prereq btrfs-image check_prereq btrfstune check_prereq btrfs +check_kernel_support # The tests are driven by their custom script called 'test.sh' diff --git a/tests/mkfs-tests.sh b/tests/mkfs-tests.sh index 1afc0282..3c5465fa 100755 --- a/tests/mkfs-tests.sh +++ b/tests/mkfs-tests.sh @@ -21,6 +21,7 @@ rm -f $RESULTS check_prereq mkfs.btrfs check_prereq btrfs +check_kernel_support # The tests are driven by their custom script called 'test.sh'