aboutsummaryrefslogtreecommitdiff
path: root/cpu-freq-tests.sh
diff options
context:
space:
mode:
Diffstat (limited to 'cpu-freq-tests.sh')
-rwxr-xr-xcpu-freq-tests.sh16
1 files changed, 14 insertions, 2 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