summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-06-03 16:52:57 +0200
committerDavid Sterba <dsterba@suse.com>2016-06-03 17:01:36 +0200
commit933de7e03439b3599f493b8baf94a5ea7befccdb (patch)
treec1d1b3ab56d476dcb9c83f263e75242d60bedb8c /tests
parente5f80994640df9abdb181c6db1513d8de744c73c (diff)
btrfs-progs: tests: 004-ext2-backup-superblock-ranges, drop unnecessary root privs
We really use root only for mount/umount and access to the ext2_saved image (that has 0600). Also switch to common variable so we can use helpers. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/convert-tests/004-ext2-backup-superblock-ranges/test.sh21
1 files changed, 11 insertions, 10 deletions
diff --git a/tests/convert-tests/004-ext2-backup-superblock-ranges/test.sh b/tests/convert-tests/004-ext2-backup-superblock-ranges/test.sh
index 493e4db5..bc6b5ea6 100755
--- a/tests/convert-tests/004-ext2-backup-superblock-ranges/test.sh
+++ b/tests/convert-tests/004-ext2-backup-superblock-ranges/test.sh
@@ -22,18 +22,19 @@ setup_root_helper
prepare_test_dev 512M
for src in $(find . -iname "*.e2image.raw.xz"); do
- extracted=$(extract_image "$src")
- run_check $SUDO_HELPER e2fsck -n -f $extracted
- run_check $SUDO_HELPER $TOP/btrfs-convert $extracted
- run_check $SUDO_HELPER $TOP/btrfs check $extracted
- run_check $SUDO_HELPER $TOP/btrfs-show-super $extracted
+ TEST_DEV=$(extract_image "$src")
+ run_check e2fsck -n -f $TEST_DEV
+ run_check $TOP/btrfs-convert $TEST_DEV
+ run_check $TOP/btrfs check $TEST_DEV
+ run_check $TOP/btrfs-show-super $TEST_DEV
- run_check $SUDO_HELPER mount -o loop $extracted $TEST_MNT
+ run_check_mount_test_dev
run_check $SUDO_HELPER e2fsck -n -f $TEST_MNT/ext2_saved/image
run_check $SUDO_HELPER umount $TEST_MNT
- run_check $SUDO_HELPER $TOP/btrfs check $extracted
- run_check $SUDO_HELPER $TOP/btrfs-convert -r $extracted
- run_check $SUDO_HELPER e2fsck -n -f $extracted
- rm -f $extracted
+ run_check $TOP/btrfs check $TEST_DEV
+ run_check $TOP/btrfs-convert -r $TEST_DEV
+ run_check e2fsck -n -f $TEST_DEV
+
+ rm -f $TEST_DEV
done