On Wed, Jun 25, 2014 at 9:48 AM, Lisa Nguyen lisa.nguyen@linaro.org wrote:
Pass hotplug_cpu_start=0 to make check like these examples below:
sudo make -C cpuhotplug hotplug_cpu_start=0 check sudo make hotplug_cpu_start=0 check
to enable cpuhotplug to run on cpu0 to N.
This description doesn't match the behaviour of the scripts below i.e. It isn't behaving as the start cpu for all the hotplug tests. The current implementation only checks that if the hotplug_cpu_start is non-zero it allows hotplugging on all cpus.
So please rename the variable to hotplug_allow_cpu0 with a boolean (0/1 or yes/no) behaviour.
The hotplug_cpu_start variable will take the default value of 1 if no value is passed so cpuhotplug will run on cpu1 to N.
This fixes bug #49: https://bugs.linaro.org/show_bug.cgi?id=49
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org
Makefile | 4 +++- cpuhotplug/Makefile | 2 +- cpuhotplug/cpuhotplug_02.sh | 2 +- cpuhotplug/cpuhotplug_03.sh | 2 +- cpuhotplug/cpuhotplug_04.sh | 2 +- cpuhotplug/cpuhotplug_05.sh | 2 +- cpuhotplug/cpuhotplug_06.sh | 2 +- cpuhotplug/cpuhotplug_07.sh | 2 +- cpuhotplug/cpuhotplug_08.sh | 6 +++++- 9 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/Makefile b/Makefile index 731619d..24bbd59 100644 --- a/Makefile +++ b/Makefile @@ -22,13 +22,15 @@ # - initial API and implementation #
+hotplug_cpu_start?=1
If the semantics are changed as described above, this will become
hotplug_allow_cpu0?=0
all: @(cd utils; $(MAKE))
check: @(cd utils; $(MAKE) check) @(cd cpufreq; $(MAKE) check)
@(cd cpuhotplug; $(MAKE) check)
@(cd cpuhotplug; $(MAKE) hotplug_cpu_start=${hotplug_cpu_start} check) @(cd cpuidle; $(MAKE) check)
# @(cd suspend; $(MAKE) check) @(cd thermal; $(MAKE) check) diff --git a/cpuhotplug/Makefile b/cpuhotplug/Makefile index df0b8f4..a6670c3 100644 --- a/cpuhotplug/Makefile +++ b/cpuhotplug/Makefile @@ -21,5 +21,5 @@ # Daniel Lezcano daniel.lezcano@linaro.org (IBM Corporation) # - initial API and implementation #
+export hotplug_cpu_start?=1 include ../Test.mk diff --git a/cpuhotplug/cpuhotplug_02.sh b/cpuhotplug/cpuhotplug_02.sh index 3157307..3f678b9 100755 --- a/cpuhotplug/cpuhotplug_02.sh +++ b/cpuhotplug/cpuhotplug_02.sh @@ -33,7 +33,7 @@ check_state() { local state= shift 1
- if [ "$cpu" == "cpu0" ]; then
- if [[ "$cpu" == "cpu0" && $hotplug_cpu_start -ne 0 ]]; then
and this becomes
+ if [[ "$cpu" == "cpu0" && $hotplug_allow_cpu0 -eq 0 ]]; then
And while you're at it, can you please consolidate this check into a small library function so we don't have to change it 8 different scripts in the future?
return 0 fi
diff --git a/cpuhotplug/cpuhotplug_03.sh b/cpuhotplug/cpuhotplug_03.sh index 13a0ce9..57ff40e 100755 --- a/cpuhotplug/cpuhotplug_03.sh +++ b/cpuhotplug/cpuhotplug_03.sh @@ -33,7 +33,7 @@ check_affinity_fails() { local dirpath=$CPU_PATH/$1 local ret=
- if [ "$cpu" == "cpu0" ]; then
- if [[ "$cpu" == "cpu0" && $hotplug_cpu_start -ne 0 ]]; then return 0 fi
diff --git a/cpuhotplug/cpuhotplug_04.sh b/cpuhotplug/cpuhotplug_04.sh index 394a512..9c08fba 100755 --- a/cpuhotplug/cpuhotplug_04.sh +++ b/cpuhotplug/cpuhotplug_04.sh @@ -36,7 +36,7 @@ check_task_migrate() { local pid= local ret=
- if [ "$cpu" == "cpu0" ]; then
- if [[ "$cpu" == "cpu0" && $hotplug_cpu_start -ne 0 ]]; then return 0 fi
diff --git a/cpuhotplug/cpuhotplug_05.sh b/cpuhotplug/cpuhotplug_05.sh index a8eb312..f5eb994 100755 --- a/cpuhotplug/cpuhotplug_05.sh +++ b/cpuhotplug/cpuhotplug_05.sh @@ -32,7 +32,7 @@ check_procinfo() { local cpuid=${cpu:3} local ret=
- if [ "$cpu" == "cpu0" ]; then
- if [[ "$cpu" == "cpu0" && $hotplug_cpu_start -ne 0 ]]; then return 0 fi
diff --git a/cpuhotplug/cpuhotplug_06.sh b/cpuhotplug/cpuhotplug_06.sh index 347906d..93fbadd 100755 --- a/cpuhotplug/cpuhotplug_06.sh +++ b/cpuhotplug/cpuhotplug_06.sh @@ -32,7 +32,7 @@ check_procinfo() { local cpuid=${cpu:3} local ret=
- if [ "$cpu" == "cpu0" ]; then
- if [[ "$cpu" == "cpu0" && $hotplug_cpu_start -ne 0 ]]; then return 0 fi
diff --git a/cpuhotplug/cpuhotplug_07.sh b/cpuhotplug/cpuhotplug_07.sh index eaeba77..2457891 100755 --- a/cpuhotplug/cpuhotplug_07.sh +++ b/cpuhotplug/cpuhotplug_07.sh @@ -34,7 +34,7 @@ check_notification() { local pid= local ret=
- if [ "$cpu" == "cpu0" ]; then
- if [[ "$cpu" == "cpu0" && $hotplug_cpu_start -ne 0 ]]; then return 0 fi
diff --git a/cpuhotplug/cpuhotplug_08.sh b/cpuhotplug/cpuhotplug_08.sh index 9e2c355..52e1fc2 100755 --- a/cpuhotplug/cpuhotplug_08.sh +++ b/cpuhotplug/cpuhotplug_08.sh @@ -28,7 +28,11 @@ source ../include/functions.sh
function randomize() {
- echo $[ ( $RANDOM % $1 ) + 1 ]
- if [ $hotplug_cpu_start -ne 0 ]; then
echo $[ ( $RANDOM % $1 ) + 1 ]
- else
echo $[ ( $RANDOM % $1 ) ]
- fi
}
random_stress() {
1.7.9.5