tests: add a check if tests requiring it are run by root

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2015-04-01 13:25:36 +02:00
parent 3360b2a404
commit 01cb587161
2 changed files with 11 additions and 0 deletions

View File

@ -298,3 +298,12 @@ os_repository_new_commit ()
ostree --repo=${test_tmpdir}/testos-repo commit --add-metadata-string "version=${version}" -b testos/buildmaster/x86_64-runtime -s "Build"
cd ${test_tmpdir}
}
check_root_test ()
{
if test "$(id -u)" != "0"; then
echo 1>&2 "$0 can be run only as root"
echo "1..0"
exit 0
fi
}

View File

@ -21,6 +21,8 @@ set -e
. $(dirname $0)/libtest.sh
check_root_test
echo "1..1"
setup_os_repository "archive-z2" "syslinux"