summaryrefslogtreecommitdiffstats
path: root/tests/functions.sh
diff options
context:
space:
mode:
authorKarel Zak2007-05-16 00:41:14 +0200
committerKarel Zak2007-05-18 13:09:12 +0200
commit09892fb60a33d010fc56efad8cc7b3d88dd58581 (patch)
treed09391c6c546b8d15569bfd76f061175d7d35df5 /tests/functions.sh
parenttests: fix dependence on blkid (diff)
downloadkernel-qcow2-util-linux-09892fb60a33d010fc56efad8cc7b3d88dd58581.tar.gz
kernel-qcow2-util-linux-09892fb60a33d010fc56efad8cc7b3d88dd58581.tar.xz
kernel-qcow2-util-linux-09892fb60a33d010fc56efad8cc7b3d88dd58581.zip
tests: code refactoring -- new ts_skip_nonroot function
The patch moves "if $UID != 0" test to a new function. That's better than duplicate the code on many places. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'tests/functions.sh')
-rw-r--r--tests/functions.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/functions.sh b/tests/functions.sh
index c04022b3b..969592f7e 100644
--- a/tests/functions.sh
+++ b/tests/functions.sh
@@ -9,6 +9,12 @@ function ts_skip {
exit 0
}
+function ts_skip_nonroot {
+ if [ $UID != 0 ]; then
+ ts_skip "not root permissions"
+ fi
+}
+
function ts_failed {
if [ x"$1" == x"" ]; then
echo " FAILED ($TS_NAME)"