[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1441021316-20794-1-git-send-email-naresh.kamboju@linaro.org>
Date: Mon, 31 Aug 2015 17:11:55 +0530
From: naresh.kamboju@...aro.org
To: naresh.kamboju@...aro.org, linux-kernel@...r.kernel.org
Cc: tyler.baker@...aro.org, milosz.wasilewski@...aro.org,
shuahkh@....samsung.com, alexey.kodanev@...cle.com
Subject: [PATCH 1/2] selftests/zram: must be run as root
From: Naresh Kamboju <naresh.kamboju@...aro.org>
Adding new functionality check_prereqs() to check test must be run as root
Signed-off-by: Naresh Kamboju <naresh.kamboju@...aro.org>
---
tools/testing/selftests/zram/zram.sh | 12 ++++++++++++
tools/testing/selftests/zram/zram01.sh | 1 +
tools/testing/selftests/zram/zram02.sh | 1 +
tools/testing/selftests/zram/zram_lib.sh | 10 ++++++++++
4 files changed, 24 insertions(+)
diff --git a/tools/testing/selftests/zram/zram.sh b/tools/testing/selftests/zram/zram.sh
index 6ea4b6a..20de9a7 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
diff --git a/tools/testing/selftests/zram/zram01.sh b/tools/testing/selftests/zram/zram01.sh
index 2a2475d..b9566a6 100755
--- a/tools/testing/selftests/zram/zram01.sh
+++ b/tools/testing/selftests/zram/zram01.sh
@@ -79,6 +79,7 @@ zram_fill_fs()
echo "zram compression ratio: $(echo "scale=2; $v / 100 " | bc):1: OK"
}
+check_prereqs
zram_load
zram_max_streams
zram_compress_alg
diff --git a/tools/testing/selftests/zram/zram02.sh b/tools/testing/selftests/zram/zram02.sh
index 96e82dc..74569b8 100755
--- a/tools/testing/selftests/zram/zram02.sh
+++ b/tools/testing/selftests/zram/zram02.sh
@@ -37,6 +37,7 @@ zram_max_streams="2"
zram_sizes="1048576" # 1M
zram_mem_limits="1M"
+check_prereqs
zram_load
zram_max_streams
zram_set_disksizes
diff --git a/tools/testing/selftests/zram/zram_lib.sh b/tools/testing/selftests/zram/zram_lib.sh
index 3b6abf1..424e68e 100755
--- a/tools/testing/selftests/zram/zram_lib.sh
+++ b/tools/testing/selftests/zram/zram_lib.sh
@@ -20,6 +20,16 @@ dev_mounted=-1
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"
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists