summaryrefslogtreecommitdiff
path: root/tests/fsck-tests
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2015-01-14 18:13:21 +0100
committerDavid Sterba <dsterba@suse.cz>2015-01-14 18:34:18 +0100
commit8fa12c10e79da38c80af20f46a2b5daeab8f1f37 (patch)
tree0f355dbac70075492b78fe36407bc52470b44211 /tests/fsck-tests
parent522e13d6d92f0083c8739f1137faa40aa98d7b03 (diff)
btrfs-progs: tests, use the root helper in 012
We need it to mount/umount, to traverse lost+found and stat the results. Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'tests/fsck-tests')
-rwxr-xr-xtests/fsck-tests/012-leaf-corruption/test.sh16
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/fsck-tests/012-leaf-corruption/test.sh b/tests/fsck-tests/012-leaf-corruption/test.sh
index edf77193..896f717a 100755
--- a/tests/fsck-tests/012-leaf-corruption/test.sh
+++ b/tests/fsck-tests/012-leaf-corruption/test.sh
@@ -55,20 +55,20 @@ check_inode()
name=$5
# Check whether the inode exists
- exists=$(find $path -inum $ino)
+ exists=$($sudo find $path -inum $ino)
if [ -z "$exists" ]; then
_fail "inode $ino not recovered correctly"
fi
# Check inode type
- found_mode=$(printf "%o" 0x$(stat $exists -c %f))
+ found_mode=$(printf "%o" 0x$($sudo stat $exists -c %f))
if [ $found_mode -ne $mode ]; then
echo "$found_mode"
_fail "inode $ino modes not recovered"
fi
# Check inode size
- found_size=$(stat $exists -c %s)
+ found_size=$($sudo stat $exists -c %s)
if [ $mode -ne 41700 -a $found_size -ne $size ]; then
_fail "inode $ino size not recovered correctly"
fi
@@ -85,8 +85,8 @@ check_inode()
check_leaf_corrupt_no_data_ext()
{
image=$1
- if [ $UID -ne 0 ]; then
- echo " [NOTRUN] verify recovery. need root privilege"
+ if [ $have_root_helper -ne 1 ]; then
+ echo " [NOTRUN] root privileges needed to verify recovery"
exit 0
fi
if [ -z $TEST_MNT ]; then
@@ -94,7 +94,7 @@ check_leaf_corrupt_no_data_ext()
TEST_MNT="$(pwd)/tmp"
fi
mkdir -p $TEST_MNT || _fail "failed to create mount point"
- mount $image -o ro $TEST_MNT
+ $sudo mount $image -o ro $TEST_MNT
i=0
while [ $i -lt ${#leaf_no_data_ext_list[@]} ]; do
@@ -106,9 +106,11 @@ check_leaf_corrupt_no_data_ext()
${leaf_no_data_ext_list[i + 4]}
((i+=4))
done
- umount $TEST_MNT
+ $sudo umount $TEST_MNT
}
+setup_root_helper
+
generate_leaf_corrupt_no_data_ext test.img
check_image test.img
check_leaf_corrupt_no_data_ext test.img