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:
David Sterba 2016-11-18 15:02:50 +01:00
parent a2214e582c
commit 6572f884ba
7 changed files with 12 additions and 12 deletions

View File

@ -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
}

View File

@ -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"

View File

@ -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()

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
}