]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
Add warrning when test script is started by normal user
authorJan Safranek <jsafrane@redhat.com>
Thu, 26 Mar 2009 14:04:36 +0000 (15:04 +0100)
committerJan Safranek <jsafrane@redhat.com>
Thu, 26 Mar 2009 14:04:36 +0000 (15:04 +0100)
The runlibcgrouptest.sh will now whine when script is started by non-root
user. Root permissions are needed to create directories and mount the cgroups
there.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
tests/runlibcgrouptest.sh

index 4ddb52d629909605b0b3adda446187c66ac8a832..847f9323e5bd9fdc858b4b747b8e8d706de9bd46 100755 (executable)
@@ -325,6 +325,13 @@ runtest()
                exit $SKIP_TEST;
        fi;
 
+       MY_ID=`id -u`
+       if [ $MY_ID -ne 0 ]; then
+               echo "Only root can start this script."
+               echo " Exiting the testcase..."
+               exit $SKIP_TEST
+       fi
+
 # TestSet01: Run tests without mounting cgroup filesystem
        echo;
        echo Running first set of testcases;