#!/bin/bash # parameters: # - $1: Name of the output file with all the logs, dump.txt by default. source cpu.sh source governor.sh source module.sh source special-tests.sh FUNC=basic # do basic tests by default # Check validity of arguments USAGE="Usage: $0 [-h] [-odgf args]\n\t[-h ]\n\t[-o ]\n\t[-d ] \n\t[-g ] \n\t[-f ]\n" # Parse arguments parse_arguments() { while getopts hd:g:f:o: arguments 2>/dev/null do case $arguments in h) # --help printf "$USAGE" exit 0 ;; f) # --func_type (Function to perform: basic, sp1, sp2, sp3, default: basic) FUNC=$OPTARG ;; o) # --output-file (Output file to store dumps) 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 ;; \?) # getopts issues an error message printf "$USAGE " exit 1 ;; esac done } # Run isolation test for $FUNC __run_func() { # Check if CPUs are managed by cpufreq or not count=$(count_cpufreq_managed_cpus) if [ $count = 0 -a $FUNC != "modtest" ]; then echo "No cpu is managed by cpufreq core, exiting" return; fi case "$FUNC" in "basic") 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 echo "No driver or governor module passed with -d or -g" return; 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" return; fi module_governor_test $GOVERNOR_MOD fi ;; "sp1") governor_race ;; "sp2") simple_lockdep ;; "sp3") hotplug_with_updates ;; "sp4") concurrent_lockdep ;; *) echo "Invalid [-f] function type" printf "$USAGE" ;; esac } # Takes dumps as well run_func() { if [ $OUTFILE ]; then # clear dumps first, we will append it later clear_dumps $OUTFILE __run_func >> $OUTFILE.txt dmesg_dumps $OUTFILE else __run_func fi } # Parse isol arguments parse_arguments $@ # Run requested functions run_func