diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2015-01-16 11:59:49 +0530 |
---|---|---|
committer | Viresh Kumar <viresh.kumar@linaro.org> | 2015-01-16 12:24:47 +0530 |
commit | af5c563efd3c5b8298ffd3d9da91e220a4151ebe (patch) | |
tree | fd848a80a9018837d7b734a7c9f7647925f0c66f | |
parent | 13e176f3b5a8b25bbe05cc9f28c4e8336fcb2440 (diff) |
cpufreq tests
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
-rwxr-xr-x | cpufreq.sh | 42 | ||||
-rwxr-xr-x | runme.sh | 10 |
2 files changed, 51 insertions, 1 deletions
@@ -248,3 +248,45 @@ cpufreq_basic_tests() # Test all frequencies shuffle_frequency_for_all_cpus 2 } + +# Suspend/resume +# $1: "suspend" or "hibernate", $2: loop count +do_suspend() +{ + echo "** Test: Running ${FUNCNAME[0]}: Trying $1 for $2 loops **" + echo "" + + # Is the directory available + if [ ! -d /sys/power/ -o ! -f /sys/power/state ]; then + echo "/sys/power/state not available" + return 1 + fi + + if [ $1 = "suspend" ]; then + filename="mem" + elif [ $1 = "hibernate" ]; then + filename="disk" + fi + + if [ -n $filename ]; then + present=$(cat /sys/power/state | grep $filename) + + if [ -z "$present" ]; then + echo "Tried to $1 but $filename isn't present in /sys/power/state" + return 1; + else + for i in `seq 1 $2`; do + echo "Starting $1" + echo $filename > /sys/power/state + echo "Came out of $1" + + echo "Do basic tests after finishing $1 to verify cpufreq state" + echo "" + cpufreq_basic_tests + done + fi + fi + + echo "------------------------------------------------" + echo "" +} @@ -11,7 +11,7 @@ source special-tests.sh FUNC=basic # do basic tests by default # Check validity of arguments -USAGE="Usage: $0 [-h] [-odgf args]\n\t[-h <help>]\n\t[-o <output-file-for-dump>]\n\t[-d <driver's module name: only with -f=modtest>] \n\t[-g <governor's module name: only with -f=modtest>] \n\t[-f <basic: cpufreq_basic_tests, sp1: governor_race, sp2: simple_lockdep, sp3: hotplug_with_updates, modtest: driver as module>]\n" +USAGE="Usage: $0 [-h] [-odgf args]\n\t[-h <help>]\n\t[-o <output-file-for-dump>]\n\t[-d <driver's module name: only with -f=modtest>] \n\t[-g <governor's module name: only with -f=modtest>] \n\t[-f <basic: cpufreq_basic_tests, suspend, hibernate, sp1: governor_race, sp2: simple_lockdep, sp3: hotplug_with_updates, modtest: driver as module>]\n" # Parse arguments parse_arguments() @@ -64,6 +64,14 @@ __run_func() cpufreq_basic_tests ;; + "suspend") + do_suspend "suspend" 2 + ;; + + "hibernate") + do_suspend "hibernate" 2 + ;; + "modtest") # Do we have modules in place? if [ -z $DRIVER_MOD ] && [ -z $GOVERNOR_MOD ]; then |