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>
#!/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"
./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
echo "zram compression ratio: $(echo "scale=2; $v / 100 " | bc):1: OK"
}
+check_prereqs
zram_load
zram_max_streams
zram_compress_alg
zram_sizes="1048576" # 1M
zram_mem_limits="1M"
+check_prereqs
zram_load
zram_max_streams
zram_set_disksizes
trap INT
+check_prereqs()
+{
+ local msg="skip all tests:"
+
+ if [ $UID != 0 ]; then
+ echo $msg must be run as root >&2
+ exit 0
+ fi
+}
+
zram_cleanup()
{
echo "zram cleanup"