summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2017-10-10 14:57:26 +0200
committerDavid Sterba <dsterba@suse.com>2017-10-13 20:15:47 +0200
commita69c1917c255c453cecf8d693471324a77d8a1aa (patch)
treec56cc0b69cddc4276f7a16bdf3f6f6b0c694d12c /tests
parent0a694ff4b0bf37b6ade11184401420af002faffd (diff)
btrfs-progs: tests: fsck/007 fix so check --force works
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/cli-tests/007-check-force/test.sh12
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/cli-tests/007-check-force/test.sh b/tests/cli-tests/007-check-force/test.sh
index 8b60033f..12b30205 100755
--- a/tests/cli-tests/007-check-force/test.sh
+++ b/tests/cli-tests/007-check-force/test.sh
@@ -8,9 +8,15 @@ check_prereq mkfs.btrfs
check_prereq btrfs
setup_root_helper
-prepare_test_dev
-run_check "$TOP/mkfs.btrfs" -f "$TEST_DEV"
+# we need to use a real block device, because the check opens the device in
+# exclusive mode, that unfortunatelly behaves differently for direct file
+# access and for the real /dev/loop0 device
+setup_loopdevs 1
+prepare_loopdevs
+TEST_DEV=${loopdevs[1]}
+
+run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$TEST_DEV"
run_check_mount_test_dev
run_mustfail "checking mounted filesystem without --force" \
$SUDO_HELPER "$TOP/btrfs" check "$TEST_DEV"
@@ -22,3 +28,5 @@ run_check $SUDO_HELPER "$TOP/btrfs" check "$TEST_DEV"
run_check $SUDO_HELPER "$TOP/btrfs" check --force "$TEST_DEV"
run_mustfail "--force --repair on unmounted filesystem" \
$SUDO_HELPER "$TOP/btrfs" check --force --repair "$TEST_DEV"
+
+cleanup_loopdevs