mirror of
https://github.com/kdave/btrfs-progs
synced 2025-04-11 03:31:17 +00:00
btrfs-progs: tests, add support for running commands under root
Most of the checks run fine without root, but some of them may need to do a mount test or access the data. Add the support to selectively run commands under root, hardcoded to sudo for now. Signed-off-by: David Sterba <dsterba@suse.cz>
This commit is contained in:
parent
e6bc739148
commit
522e13d6d9
15
tests/common
15
tests/common
@ -47,3 +47,18 @@ check_all_images()
|
|||||||
rm $i.restored
|
rm $i.restored
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# some tests need to mount the recovered image and do verifications call
|
||||||
|
# 'setup_root_helper' and then check for have_root_helper == 1 if the test
|
||||||
|
# needs to fail otherwise; using sudo by default for now
|
||||||
|
sudo=
|
||||||
|
have_root_helper=0
|
||||||
|
export sudo
|
||||||
|
export have_root_helper
|
||||||
|
setup_root_helper()
|
||||||
|
{
|
||||||
|
if [ $UID != 0 ]; then
|
||||||
|
sudo=sudo
|
||||||
|
fi
|
||||||
|
have_root_helper=1
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user