Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Naresh Kamboju and committed by
Shuah Khan
2dfb28e3 9fae100c

+24
+12
tools/testing/selftests/zram/zram.sh
··· 1 1 #!/bin/bash 2 2 TCID="zram.sh" 3 3 4 + check_prereqs() 5 + { 6 + local msg="skip all tests:" 7 + 8 + if [ $UID != 0 ]; then 9 + echo $msg must be run as root >&2 10 + exit 0 11 + fi 12 + } 13 + 4 14 run_zram () { 5 15 echo "--------------------" 6 16 echo "running zram tests" ··· 19 9 echo "" 20 10 ./zram02.sh 21 11 } 12 + 13 + check_prereqs 22 14 23 15 # check zram module exists 24 16 MODULE_PATH=/lib/modules/`uname -r`/kernel/drivers/block/zram/zram.ko
+1
tools/testing/selftests/zram/zram01.sh
··· 79 79 echo "zram compression ratio: $(echo "scale=2; $v / 100 " | bc):1: OK" 80 80 } 81 81 82 + check_prereqs 82 83 zram_load 83 84 zram_max_streams 84 85 zram_compress_alg
+1
tools/testing/selftests/zram/zram02.sh
··· 37 37 zram_sizes="1048576" # 1M 38 38 zram_mem_limits="1M" 39 39 40 + check_prereqs 40 41 zram_load 41 42 zram_max_streams 42 43 zram_set_disksizes
+10
tools/testing/selftests/zram/zram_lib.sh
··· 20 20 21 21 trap INT 22 22 23 + check_prereqs() 24 + { 25 + local msg="skip all tests:" 26 + 27 + if [ $UID != 0 ]; then 28 + echo $msg must be run as root >&2 29 + exit 0 30 + fi 31 + } 32 + 23 33 zram_cleanup() 24 34 { 25 35 echo "zram cleanup"