mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-24 15:12:47 +00:00
btrfs-progs: tests: use the root helper for various info retrieval commands
The current user might not be able to peek into the loop files directly, use the helper. Discovered by running tests in travis. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
a2214e582c
commit
6572f884ba
@ -60,12 +60,12 @@ test_run()
|
||||
run_check $SUDO_HELPER umount $TEST_MNT
|
||||
|
||||
test_image_dump
|
||||
run_check $TOP/btrfs filesystem show $dev1
|
||||
run_check $SUDO_HELPER $TOP/btrfs filesystem show $dev1
|
||||
# create a degraded raid1 filesystem, check must succeed
|
||||
# btrfs-image must not loop
|
||||
run_mayfail wipefs -a $dev2
|
||||
run_check $SUDO_HELPER losetup -d $dev2
|
||||
run_check $TOP/btrfs filesystem show $dev1
|
||||
run_check $SUDO_HELPER $TOP/btrfs filesystem show $dev1
|
||||
|
||||
test_image_dump
|
||||
}
|
||||
|
@ -14,11 +14,11 @@ prepare_test_dev
|
||||
run_check truncate -s 2G "$TEST_DEV"
|
||||
run_check mkfs.ext4 -F "$TEST_DEV"
|
||||
run_check $TOP/btrfs-convert "$TEST_DEV"
|
||||
run_check $TOP/btrfs inspect-internal dump-tree "$TEST_DEV"
|
||||
run_check $SUDO_HELPER $TOP/btrfs inspect-internal dump-tree "$TEST_DEV"
|
||||
run_check_mount_test_dev
|
||||
run_check $SUDO_HELPER $TOP/btrfs subvolume delete -c "$TEST_MNT/ext2_saved"
|
||||
run_check_umount_test_dev
|
||||
run_check $TOP/btrfs inspect-internal dump-tree "$TEST_DEV"
|
||||
run_check $SUDO_HELPER $TOP/btrfs inspect-internal dump-tree "$TEST_DEV"
|
||||
run_check_stdout $TOP/btrfs-convert --rollback "$TEST_DEV" |
|
||||
grep -q 'is it deleted' || _fail "unexpected rollback"
|
||||
|
||||
|
@ -38,16 +38,16 @@ cleanup_devices()
|
||||
test_do_mkfs()
|
||||
{
|
||||
run_check $SUDO_HELPER $TOP/mkfs.btrfs -f $@ ${devs[@]}
|
||||
run_check $TOP/btrfs inspect-internal dump-super $dev1
|
||||
run_check $SUDO_HELPER $TOP/btrfs inspect-internal dump-super $dev1
|
||||
run_check $SUDO_HELPER $TOP/btrfs check $dev1
|
||||
run_check $TOP/btrfs filesystem show
|
||||
run_check $SUDO_HELPER $TOP/btrfs filesystem show
|
||||
}
|
||||
|
||||
test_wipefs()
|
||||
{
|
||||
run_check wipefs -a $devtodel
|
||||
run_check $SUDO_HELPER wipefs -a $devtodel
|
||||
run_check $SUDO_HELPER losetup -d $devtodel
|
||||
run_check losetup -a
|
||||
run_check $SUDO_HELPER losetup --all
|
||||
run_check $TOP/btrfs filesystem show
|
||||
}
|
||||
test_delete_missing()
|
||||
|
@ -37,7 +37,7 @@ cleanup_devices()
|
||||
|
||||
test_get_info()
|
||||
{
|
||||
run_check $TOP/btrfs inspect-internal dump-super $dev1
|
||||
run_check $SUDO_HELPER $TOP/btrfs inspect-internal dump-super $dev1
|
||||
run_check $SUDO_HELPER $TOP/btrfs check $dev1
|
||||
run_check $SUDO_HELPER mount $dev1 $TEST_MNT
|
||||
run_check $TOP/btrfs filesystem df $TEST_MNT
|
||||
|
@ -32,7 +32,7 @@ run_check cat $rot
|
||||
# test
|
||||
run_check_stdout $SUDO_HELPER $TOP/mkfs.btrfs -f $@ $dmdev |
|
||||
grep -q 'SSD detected:.*yes' || _fail 'SSD not detected'
|
||||
run_check $TOP/btrfs inspect-internal dump-super $dmdev
|
||||
run_check $SUDO_HELPER $TOP/btrfs inspect-internal dump-super $dmdev
|
||||
|
||||
# cleanup
|
||||
run_check $SUDO_HELPER dmsetup remove $dmname
|
||||
|
@ -18,7 +18,7 @@ base=$(basename $loopdev)
|
||||
# expect partitions named like loop0p1 etc
|
||||
for looppart in $(ls /dev/$base?*); do
|
||||
run_check $SUDO_HELPER $TOP/mkfs.btrfs -f $looppart
|
||||
run_check $TOP/btrfs inspect-internal dump-super $looppart
|
||||
run_check $SUDO_HELPER $TOP/btrfs inspect-internal dump-super $looppart
|
||||
done
|
||||
|
||||
# cleanup
|
||||
|
@ -12,7 +12,7 @@ prepare_test_dev
|
||||
test_mkfs_single()
|
||||
{
|
||||
run_check $SUDO_HELPER $TOP/mkfs.btrfs -f "$@" $TEST_DEV
|
||||
run_check $TOP/btrfs inspect-internal dump-super $TEST_DEV
|
||||
run_check $SUDO_HELPER $TOP/btrfs inspect-internal dump-super $TEST_DEV
|
||||
run_check $SUDO_HELPER $TOP/btrfs check $TEST_DEV
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user