aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaresh Kamboju <naresh.kamboju@linaro.org>2015-10-10 15:26:07 +0530
committerNaresh Kamboju <naresh.kamboju@linaro.org>2015-10-10 15:26:07 +0530
commit9740cd33ff5fdbf342130512f242687561d1f549 (patch)
tree7c88f56a1111f4416cbd7fa935155e8a8b4a6588
parent096282933e785b4ff528b5f5270437c85d6e647c (diff)
cpu-freq-test: adding function check_root
Signed-off-by: Naresh Kamboju <naresh.kamboju@linaro.org>
-rwxr-xr-xcpu-freq-tests.sh16
-rwxr-xr-xcpu-governor-tests.sh4
-rwxr-xr-xcpu-tests.sh2
3 files changed, 17 insertions, 5 deletions
diff --git a/cpu-freq-tests.sh b/cpu-freq-tests.sh
index 5a7ac27..5f15ead 100755
--- a/cpu-freq-tests.sh
+++ b/cpu-freq-tests.sh
@@ -7,13 +7,23 @@ else
FILE_CPU_FREQ_TESTS=DONE
fi
-source cpu-tests.sh
-source cpu-governor-tests.sh
+. cpu-tests.sh
+. cpu-governor-tests.sh
# GLOBALS
CPU_PATH="/sys/devices/system/cpu"
GLOBAL_CPUFREQ="/sys/devices/system/cpu/cpufreq"
+check_root()
+{
+ local msg="skip all tests:"
+ local uid=$(id -u)
+
+ if [ $uid -ne 0 ]; then
+ echo $msg must be run as root >&2
+ exit 0
+ fi
+}
# GENERIC HELPERS
# $1: cpu
@@ -213,6 +223,7 @@ dmesg_dumps()
# Basic cpufreq tests
cpufreq_basic_tests()
{
+ echo "===================================="
echo "*** RUNNING CPUFREQ SANITY TESTS ***"
echo "===================================="
echo ""
@@ -244,5 +255,6 @@ cpufreq_basic_tests()
shuffle_frequency_for_all_cpus 1
}
clear_dumps
+check_root
cpufreq_basic_tests 2>&1 | tee $0.output.txt
dmesg_dumps
diff --git a/cpu-governor-tests.sh b/cpu-governor-tests.sh
index 5842e9f..b7207d7 100755
--- a/cpu-governor-tests.sh
+++ b/cpu-governor-tests.sh
@@ -9,8 +9,8 @@ else
FILE_CPU_GOVERNOR_TESTS=DONE
fi
-source cpu-tests.sh
-source cpu-freq-tests.sh
+. cpu-tests.sh
+. cpu-freq-tests.sh
# Find governor's directory path
# $1: cpu, $2: governor
diff --git a/cpu-tests.sh b/cpu-tests.sh
index 3b1723c..fee1047 100755
--- a/cpu-tests.sh
+++ b/cpu-tests.sh
@@ -9,7 +9,7 @@ else
FILE_CPU_TESTS=DONE
fi
-source cpu-freq-tests.sh
+. cpu-freq-tests.sh
offline_cpu()
{