summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/functions.sh6
-rwxr-xr-xtests/ts-cramfs-mkfs6
-rwxr-xr-xtests/ts-hwclock-systohc4
-rwxr-xr-xtests/ts-ipcs-limits2
-rwxr-xr-xtests/ts-look-separator2
-rwxr-xr-xtests/ts-mkswap-doit5
-rwxr-xr-xtests/ts-mount-move5
-rwxr-xr-xtests/ts-mount-mtablock5
-rwxr-xr-xtests/ts-mount-remount5
-rwxr-xr-xtests/ts-mount-special5
10 files changed, 15 insertions, 30 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)"
diff --git a/tests/ts-cramfs-mkfs b/tests/ts-cramfs-mkfs
index 1f7156ee3..c1f46f116 100755
--- a/tests/ts-cramfs-mkfs
+++ b/tests/ts-cramfs-mkfs
@@ -24,14 +24,10 @@ TS_COMPONENT="mkfs.cramfs"
TS_DESC="mkfs"
ts_init
-
-if [ $UID != 0 ]; then
- ts_skip "not root permissions"
-fi
+ts_skip_nonroot
set -o pipefail
-
touch $TS_OUTPUT
IMAGE="$TS_OUTDIR/cramfs-loop.img"
diff --git a/tests/ts-hwclock-systohc b/tests/ts-hwclock-systohc
index 6171ab30c..43d663203 100755
--- a/tests/ts-hwclock-systohc
+++ b/tests/ts-hwclock-systohc
@@ -26,10 +26,8 @@ TS_DESC="systohc"
NTP_SERVER="0.fedora.pool.ntp.org"
ts_init
+ts_skip_nonroot
-if [ $UID != 0 ]; then
- ts_skip "not root permissions"
-fi
if [ -x "ntpdate" ]; then
ts_skip "cannot found ntpdate command"
fi
diff --git a/tests/ts-ipcs-limits b/tests/ts-ipcs-limits
index 542819f16..99a11c20f 100755
--- a/tests/ts-ipcs-limits
+++ b/tests/ts-ipcs-limits
@@ -8,7 +8,7 @@ TS_DESC="limits overflow"
if [ $UID != 0 ]; then
ts_init
- ts_skip "not root permissions"
+ ts_skip_nonroot
fi
. ts-ipcs.sh
diff --git a/tests/ts-look-separator b/tests/ts-look-separator
index d86e70779..e7772bb45 100755
--- a/tests/ts-look-separator
+++ b/tests/ts-look-separator
@@ -21,7 +21,7 @@ TS_DESC="separator"
ts_init
if [ ! -f "/usr/share/dict/words" ]; then
- ts_ignore "/usr/share/dict/words not such file"
+ ts_skip "/usr/share/dict/words not such file"
fi
touch $TS_OUTPUT
diff --git a/tests/ts-mkswap-doit b/tests/ts-mkswap-doit
index e4b5b7632..b3632b707 100755
--- a/tests/ts-mkswap-doit
+++ b/tests/ts-mkswap-doit
@@ -24,10 +24,7 @@ TS_COMPONENT="mkswap"
TS_DESC="doit"
ts_init
-
-if [ $UID != 0 ]; then
- ts_skip "not root permissions"
-fi
+ts_skip_nonroot
set -o pipefail
diff --git a/tests/ts-mount-move b/tests/ts-mount-move
index aa253b755..76400b449 100755
--- a/tests/ts-mount-move
+++ b/tests/ts-mount-move
@@ -11,10 +11,7 @@ TS_COMPONENT="mount"
TS_DESC="move "
ts_init
-
-if [ $UID != 0 ]; then
- ts_skip "not root permissions"
-fi
+ts_skip_nonroot
touch $TS_OUTPUT
diff --git a/tests/ts-mount-mtablock b/tests/ts-mount-mtablock
index dc9c8e478..5ef76f2b6 100755
--- a/tests/ts-mount-mtablock
+++ b/tests/ts-mount-mtablock
@@ -7,10 +7,7 @@ TS_COMPONENT="mount"
TS_DESC="mtablock"
ts_init
-
-if [ $UID != 0 ]; then
- ts_skip "not root permissions"
-fi
+ts_skip_nonroot
#
# Be careful with number of processes. Don't forget that there is time limit
diff --git a/tests/ts-mount-remount b/tests/ts-mount-remount
index 16e845824..28064e745 100755
--- a/tests/ts-mount-remount
+++ b/tests/ts-mount-remount
@@ -11,10 +11,7 @@ TS_COMPONENT="mount"
TS_DESC="remount"
ts_init
-
-if [ $UID != 0 ]; then
- ts_skip "not root permissions"
-fi
+ts_skip_nonroot
# clean up
test_cleanup() {
diff --git a/tests/ts-mount-special b/tests/ts-mount-special
index b2ea77d67..3fb193eab 100755
--- a/tests/ts-mount-special
+++ b/tests/ts-mount-special
@@ -13,13 +13,10 @@ TS_DESC="special program"
MOUNTER="/sbin/mount.mytest"
ts_init
+ts_skip_nonroot
touch $TS_OUTPUT
-if [ $UID != 0 ]; then
- ts_skip "not root permissions"
-fi
-
cat > $MOUNTER << EOF
#!/bin/bash
# This util-linux-ng regression test component