diff options
author | Naresh Kamboju <naresh.kamboju@linaro.org> | 2015-08-31 17:11:55 +0530 |
---|---|---|
committer | Shuah Khan <shuahkh@osg.samsung.com> | 2015-09-01 10:51:32 -0600 |
commit | 2dfb28e3410d775a687d429f5cadf88e795e7eb6 (patch) | |
tree | bc3fa5bf6233989225c2e332bafeb10a89694439 /tools/testing/selftests/zram/zram.sh | |
parent | 9fae100cbd1049057bbc3e3180a6de339b9b73a9 (diff) | |
download | linux-2dfb28e3410d775a687d429f5cadf88e795e7eb6.tar.bz2 |
selftests/zram: must be run as root
Adding new functionality check_prereqs() to check test must be run as root
Signed-off-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Diffstat (limited to 'tools/testing/selftests/zram/zram.sh')
-rwxr-xr-x | tools/testing/selftests/zram/zram.sh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/testing/selftests/zram/zram.sh b/tools/testing/selftests/zram/zram.sh index 6ea4b6a5ccab..20de9a761269 100755 --- a/tools/testing/selftests/zram/zram.sh +++ b/tools/testing/selftests/zram/zram.sh @@ -1,6 +1,16 @@ #!/bin/bash TCID="zram.sh" +check_prereqs() +{ + local msg="skip all tests:" + + if [ $UID != 0 ]; then + echo $msg must be run as root >&2 + exit 0 + fi +} + run_zram () { echo "--------------------" echo "running zram tests" @@ -10,6 +20,8 @@ echo "" ./zram02.sh } +check_prereqs + # check zram module exists MODULE_PATH=/lib/modules/`uname -r`/kernel/drivers/block/zram/zram.ko if [ -f $MODULE_PATH ]; then |