• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2#
3# Special test cases reported by people
4
5# Testcase 1: Reported here: http://marc.info/?l=linux-pm&m=140618592709858&w=2
6
7# protect against multiple inclusion
8if [ $FILE_SPECIAL ]; then
9	return 0
10else
11	FILE_SPECIAL=DONE
12fi
13
14source cpu.sh
15source cpufreq.sh
16source governor.sh
17
18# Test 1
19# $1: policy
20__simple_lockdep()
21{
22	# switch to ondemand
23	__switch_governor $1 "ondemand"
24
25	# cat ondemand files
26	local ondir=$(find_gov_directory $1 "ondemand")
27	if [ -z $ondir ]; then
28		printf "${FUNCNAME[0]}Ondemand directory not created, quit"
29		return
30	fi
31
32	cat $ondir/*
33
34	# switch to conservative
35	__switch_governor $1 "conservative"
36}
37
38simple_lockdep()
39{
40	printf "** Test: Running ${FUNCNAME[0]} **\n"
41
42	for_each_policy __simple_lockdep
43}
44
45# Test 2
46# $1: policy
47__concurrent_lockdep()
48{
49	for i in `seq 0 100`; do
50		__simple_lockdep $1
51	done
52}
53
54concurrent_lockdep()
55{
56	printf "** Test: Running ${FUNCNAME[0]} **\n"
57
58	for_each_policy_concurrent __concurrent_lockdep
59}
60
61# Test 3
62quick_shuffle()
63{
64	# this is called concurrently from governor_race
65	for I in `seq 1000`
66	do
67		echo ondemand | sudo tee $CPUFREQROOT/policy*/scaling_governor &
68		echo userspace | sudo tee $CPUFREQROOT/policy*/scaling_governor &
69	done
70}
71
72governor_race()
73{
74	printf "** Test: Running ${FUNCNAME[0]} **\n"
75
76	# run 8 concurrent instances
77	for I in `seq 8`
78	do
79		quick_shuffle &
80	done
81}
82
83# Test 4
84# $1: cpu
85hotplug_with_updates_cpu()
86{
87	local filepath="$CPUROOT/$1/cpufreq"
88
89	# switch to ondemand
90	__switch_governor_for_cpu $1 "ondemand"
91
92	for i in `seq 1 5000`
93	do
94		reboot_cpu $1
95	done &
96
97	local freqs=$(cat $filepath/scaling_available_frequencies)
98	local oldfreq=$(cat $filepath/scaling_min_freq)
99
100	for j in `seq 1 5000`
101	do
102		# Set all frequencies one-by-one
103		for freq in $freqs; do
104			echo $freq > $filepath/scaling_min_freq
105		done
106	done
107
108	# restore old freq
109	echo $oldfreq > $filepath/scaling_min_freq
110}
111
112hotplug_with_updates()
113{
114	for_each_non_boot_cpu hotplug_with_updates_cpu
115}
116