btrfs-progs/tests/fsck-tests/060-degraded-check/test.sh
Josef Bacik ecb66fd754 btrfs-progs: tests: fix fsck-tests/060 to run without root
We need to call the setup_root_helper before we start messing with the
loop devices.

Reviewed-by: Neal Gompa <neal@gompa.dev>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-04-12 01:56:41 +02:00

37 lines
903 B
Bash
Executable File

#!/bin/bash
#
# Make sure "btrfs check" can handle degraded raid5.
#
source "$TEST_TOP/common"
check_prereq btrfs
check_prereq mkfs.btrfs
check_global_prereq losetup
check_global_prereq wipefs
setup_root_helper
setup_loopdevs 3
prepare_loopdevs
dev1=${loopdevs[1]}
dev2=${loopdevs[2]}
dev3=${loopdevs[3]}
# Run 1: victim is dev1
run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f -m raid5 -d raid5 "${loopdevs[@]}"
run_check $SUDO_HELPER wipefs -fa $dev1
run_check $SUDO_HELPER "$TOP/btrfs" check $dev2
# Run 2: victim is dev2
run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f -m raid5 -d raid5 "${loopdevs[@]}"
run_check $SUDO_HELPER wipefs -fa $dev2
run_check $SUDO_HELPER "$TOP/btrfs" check $dev3
# Run 3: victim is dev3
run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f -m raid5 -d raid5 "${loopdevs[@]}"
run_check $SUDO_HELPER wipefs -fa $dev3
run_check $SUDO_HELPER "$TOP/btrfs" check $dev1
cleanup_loopdevs