diff mbox series

[2/4] btrfs-progs: fix fsck-tests/057 to run without root

Message ID 2af7c2b6d02828efdb5821e1219eb34cd710e432.1681150198.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: make some of the fsck-tests run without root | expand

Commit Message

Josef Bacik April 10, 2023, 6:11 p.m. UTC
The setup_root_helper needs to be called before messing with the loop
devices, and btrfs check needs to be run with $SUDO_HELPER.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 tests/fsck-tests/057-seed-false-alerts/test.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/tests/fsck-tests/057-seed-false-alerts/test.sh b/tests/fsck-tests/057-seed-false-alerts/test.sh
index 1d5ad878..4af83c92 100755
--- a/tests/fsck-tests/057-seed-false-alerts/test.sh
+++ b/tests/fsck-tests/057-seed-false-alerts/test.sh
@@ -10,14 +10,14 @@  check_prereq mkfs.btrfs
 check_prereq btrfstune
 check_global_prereq losetup
 
+setup_root_helper
+
 setup_loopdevs 2
 prepare_loopdevs
 dev1=${loopdevs[1]}
 dev2=${loopdevs[2]}
 TEST_DEV=$dev1
 
-setup_root_helper
-
 run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$dev1"
 run_check $SUDO_HELPER "$TOP/btrfstune" -S 1 "$dev1"
 run_check_mount_test_dev
@@ -32,8 +32,8 @@  sprouted_output=$(_mktemp btrfs-progs-sprouted-check-stdout.XXXXXX)
 
 # The false alerts are just warnings, so we need to save and filter
 # the output
-run_check_stdout "$TOP/btrfs" check "$dev1" >> "$seed_output"
-run_check_stdout "$TOP/btrfs" check "$dev2" >> "$sprouted_output"
+run_check_stdout $SUDO_HELPER "$TOP/btrfs" check "$dev1" >> "$seed_output"
+run_check_stdout $SUDO_HELPER "$TOP/btrfs" check "$dev2" >> "$sprouted_output"
 
 # There should be no warning for both seed and sprouted fs
 if grep -q "WARNING" "$seed_output"; then