summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/cpufreq/main.sh
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2017-01-13 12:06:47 +0530
committerShuah Khan <shuahkh@osg.samsung.com>2017-01-19 10:32:21 -0700
commit6751faf3d8338d525e8d9c35ae87cbfed48ce958 (patch)
tree2f16d7690aa6794e30a97cf99756ba267d2a5658 /tools/testing/selftests/cpufreq/main.sh
parentb03eaf8dbac5534590ec52612f789d8fb292af9c (diff)
selftest: cpufreq: Add support to test cpufreq modules
This patch adds support for cpufreq modules like cpufreq drivers and cpufreq governors. The tests will insert the modules in different orders and them perform basic cpufreq tests. The modules are then removed from the kernel. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Diffstat (limited to 'tools/testing/selftests/cpufreq/main.sh')
-rwxr-xr-xtools/testing/selftests/cpufreq/main.sh45
1 files changed, 40 insertions, 5 deletions
diff --git a/tools/testing/selftests/cpufreq/main.sh b/tools/testing/selftests/cpufreq/main.sh
index 9ff662f67ea4..2515867ac9de 100755
--- a/tools/testing/selftests/cpufreq/main.sh
+++ b/tools/testing/selftests/cpufreq/main.sh
@@ -3,6 +3,7 @@
source cpu.sh
source cpufreq.sh
source governor.sh
+source module.sh
FUNC=basic # do basic tests by default
OUTFILE=cpufreq_selftest
@@ -12,12 +13,15 @@ CPUFREQROOT=
helpme()
{
- printf "Usage: $0 [-h] [-to args]
+ printf "Usage: $0 [-h] [-todg args]
[-h <help>]
[-o <output-file-for-dump>]
[-t <basic: Basic cpufreq testing
suspend: suspend/resume,
- hibernate: hibernate/resume>]
+ hibernate: hibernate/resume,
+ modtest: test driver or governor modules. Only to be used with -d or -g options>]
+ [-d <driver's module name: only with \"-t modtest>\"]
+ [-g <governor's module name: only with \"-t modtest>\"]
\n"
exit 2
}
@@ -56,14 +60,14 @@ prerequisite()
parse_arguments()
{
- while getopts ht:o: arg
+ while getopts ht:o:d:g: arg
do
case $arg in
h) # --help
helpme
;;
- t) # --func_type (Function to perform: basic, suspend, hibernate (default: basic))
+ t) # --func_type (Function to perform: basic, suspend, hibernate, modtest (default: basic))
FUNC=$OPTARG
;;
@@ -71,6 +75,14 @@ parse_arguments()
OUTFILE=$OPTARG
;;
+ d) # --driver-mod-name (Name of the driver module)
+ DRIVER_MOD=$OPTARG
+ ;;
+
+ g) # --governor-mod-name (Name of the governor module)
+ GOVERNOR_MOD=$OPTARG
+ ;;
+
\?)
helpme
;;
@@ -83,7 +95,7 @@ do_test()
# Check if CPUs are managed by cpufreq or not
count=$(count_cpufreq_managed_cpus)
- if [ $count = 0 ]; then
+ if [ $count = 0 -a $FUNC != "modtest" ]; then
echo "No cpu is managed by cpufreq core, exiting"
exit 2;
fi
@@ -101,6 +113,29 @@ do_test()
do_suspend "hibernate" 1
;;
+ "modtest")
+ # Do we have modules in place?
+ if [ -z $DRIVER_MOD ] && [ -z $GOVERNOR_MOD ]; then
+ echo "No driver or governor module passed with -d or -g"
+ exit 2;
+ fi
+
+ if [ $DRIVER_MOD ]; then
+ if [ $GOVERNOR_MOD ]; then
+ module_test $DRIVER_MOD $GOVERNOR_MOD
+ else
+ module_driver_test $DRIVER_MOD
+ fi
+ else
+ if [ $count = 0 ]; then
+ echo "No cpu is managed by cpufreq core, exiting"
+ exit 2;
+ fi
+
+ module_governor_test $GOVERNOR_MOD
+ fi
+ ;;
+
*)
echo "Invalid [-f] function type"
helpme