aboutsummaryrefslogtreecommitdiff
path: root/runme.sh
blob: 703105240313a023724e7e50d3e1c30901270ef4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/bash

# parameters:
# - $1: Name of the output file with all the logs, dump.txt by default.

source cpu.sh
source governor.sh
source special-tests.sh

OUTFILE=dump
FUNC=basic	# do basic tests by default

# Check validity of arguments
USAGE="Usage: $0 [-h] [-of args] [-h <help>] [-o <output-file-for-dump>] [-d <driver's module name: only with -f=modtest>] [-g <governor's module name: only with -f=modtest>] [-f <basic: cpufreq_basic_tests, sp1: governor_race, sp2: simple_lockdep, sp3: hotplug_with_updates>, mod_test: driver as module]"

# Parse arguments
parse_arguments()
{
	while getopts hf:o: arguments 2>/dev/null
	do
		case $arguments in
			h) # --help
				echo "$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
				echo "$USAGE "
				exit 1
				;;
		esac
	done
}

# Run isolation test for $FUNC
__run_func()
{
	case "$FUNC" in
		"basic")
		cpufreq_basic_tests
		;;

		"modtest")
		# Do we have modules in place?
		if [ ! $DRIVER_MOD -a ! $GOVERNOR_MOD ]; then
			echo "No driver or governor module passed with -d or -g"
			return;
		fi

		if [ $DRIVER_MOD -a $GOVERNOR_MOD ]; then
			module_test $DRIVER_MOD $GOVERNOR_MOD
		elif [ $DRIVER_MOD ]; then
			module_driver_test $DRIVER_MOD
		elif [ $GOVERNOR_MOD ]; then
			module_governor_test $GOVERNOR_MOD
		fi
		;;

		"sp1")
		governor_race
		;;

		"sp2")
		simple_lockdep
		;;

		"sp3")
		hotplug_with_updates
		;;

		*)
		echo "Invalid [-f] function type"
		;;
	esac
}

# Takes dumps as well
run_func()
{
	# clear dumps first, we will append it later
	clear_dumps

	__run_func >> $OUTFILE
	dmesg_dumps $OUTFILE
}

# Parse isol arguments
parse_arguments $@

# Run requested functions
run_func