From: Cyril H. <su...@li...> - 2012-11-14 08:56:42
|
The branch, master, has been updated via 619d8625898a9ca8572e6da0f28875c9eb09d37c (commit) via de2e6566934feea613b7cd9f959742071d4597f1 (commit) via c1474e50551f1dabeeddbfd91f96e82d15bc5790 (commit) from 14259b0f1b320e2016c20ec2113ae8df5026d62a (commit) - Log ----------------------------------------------------------------- commit 619d8625898a9ca8572e6da0f28875c9eb09d37c Author: Jin Li <ji...@wi...> Date: Mon Nov 12 15:34:01 2012 +0800 Fix cpuhotplug test case cpuhotplug05 Check whether sar is available befor run test Signed-off-by: Jin Li <ji...@wi...> Signed-off-by: Wanlong Gao <gao...@cn...> commit de2e6566934feea613b7cd9f959742071d4597f1 Author: Jin Li <ji...@wi...> Date: Mon Nov 12 15:34:00 2012 +0800 Fix cpuhotplug test case cpuhotplug03 Fix test case cpuhotplug03 as follows: 1. Avoid to check whether the cpu0 is on. 2. Check the cpu before turn it on Signed-off-by: Jin Li <ji...@wi...> Signed-off-by: Wanlong Gao <gao...@cn...> commit c1474e50551f1dabeeddbfd91f96e82d15bc5790 Author: Jin Li <ji...@wi...> Date: Wed Nov 14 15:57:35 2012 +0800 Fix cpuhotplug test case cpuhotplug01 Fix for case cpuhotplug01: 1. Give all available parameters to function migrate_irq. 2. Add the INFO note for the IRQ whose IRQ affinity is NOT permitted to changed. 3. Remove the variable cpustate and related code in function do_clean. The cpu, which was off before the test start, has been closed correctly in do_clean. 4. Add test case PASS at the end of the passed case Signed-off-by: Jin Li <ji...@wi...> Signed-off-by: Wanlong Gao <gao...@cn...> ----------------------------------------------------------------------- Summary of changes: .../hotplug/cpu_hotplug/functional/cpuhotplug01.sh | 13 ++++------- .../hotplug/cpu_hotplug/functional/cpuhotplug03.sh | 21 +++++++++++++------ .../hotplug/cpu_hotplug/functional/cpuhotplug05.sh | 5 ++++ .../kernel/hotplug/cpu_hotplug/include/hotplug.fns | 12 +++++++--- 4 files changed, 32 insertions(+), 19 deletions(-) diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh index acf7df1..07379dc 100755 --- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh +++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh @@ -54,14 +54,12 @@ if ! cpu_is_valid "${CPU_TO_TEST}" ; then fi CPU_COUNT=0 -cpustate=1 if ! cpu_is_online "${CPU_TO_TEST}" ; then if ! online_cpu ${CPU_TO_TEST} ; then tst_resm TFAIL "Could not online cpu $CPU_TO_TEST" exit_clean 1 fi - cpustate=0 fi # do_clean() @@ -81,11 +79,6 @@ do_clean() offline_cpu $offline_cpu : $(( CPU_COUNT -= 1 )) done - if [ "x${cpustate}" = x1 ]; then - online_cpu ${CPU_TO_TEST} - else - offline_cpu ${CPU_TO_TEST} - fi } @@ -98,7 +91,7 @@ do_offline() CPU=${1#cpu} # Migrate some irq's this way first. IRQS=`get_all_irqs` - migrate_irq ${CPU} ${IRQS} + migrate_irq "${CPU}" "${IRQS}" offline_cpu ${CPU} if [ $? -ne 0 ]; then if [ "$CPU" -ne 0 ]; then @@ -191,4 +184,8 @@ do done +if [ "$RC" -eq 0 ];then + tst_resm TPASS "online and offline cpu${CPU} when writing disk" +fi + exit_clean $RC diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh index ca636d1..516a21f 100755 --- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh +++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh @@ -60,15 +60,22 @@ until [ $TST_COUNT -gt $TST_TOTAL ]; do # Turns on all CPUs and saves their states for i in $( get_all_cpus ); do - if ! online_cpu $1; then - : $(( cpu += 1 )) - eval "on_${cpu}=$i" - fi + if [ "$i" = "cpu0" ]; then + continue + fi + if ! cpu_is_online $i; then + if ! online_cpu $i; then + tst_resm TFAIL "Could not online cpu $i" + exit_clean 1 + fi + : $(( cpu += 1 )) + eval "on_${cpu}=$i" + fi : $(( number_of_cpus += 1 )) done if ! offline_cpu ${CPU_TO_TEST} ; then - tst_resm TBAIL "CPU${CPU_TO_TEST} cannot be offlined" + tst_resm TFAIL "CPU${CPU_TO_TEST} cannot be offlined" exit_clean 1 fi @@ -90,7 +97,7 @@ until [ $TST_COUNT -gt $TST_TOTAL ]; do tst_resm TINFO "Onlining CPU ${CPU_TO_TEST}" online_cpu ${CPU_TO_TEST} RC=$? - if [ $RC -eq 0 ]; then + if [ $RC -ne 0 ]; then tst_resm TFAIL "CPU${CPU_TO_TEST} cannot be onlined" exit_clean 1 fi @@ -101,7 +108,7 @@ until [ $TST_COUNT -gt $TST_TOTAL ]; do ps -o psr -o command --no-headers -C do_spin_loop RC=$? NUM=`ps -o psr -o command --no-headers -C do_spin_loop | sed -e "s/^ *//" | cut -d' ' -f 1 | grep "^${CPU_TO_TEST}$" | wc -l` - if [ $RC -eq 0 ]; then + if [ $RC -ne 0 ]; then tst_resm TBROK "No do_spin_loop processes found on any processor" elif [ $NUM -lt 1 ]; then tst_resm TFAIL "No do_spin_loop processes found on CPU${CPU_TO_TEST}" diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh index ad57efe..e64b91c 100755 --- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh +++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh @@ -27,6 +27,11 @@ Desc: Does sar behave properly during CPU hotplug events? EOF +which sar > /dev/null 2>&1 || { + tst_resm TCONF "sar does not exist" + exit_clean 1 +} + # Verify the specified CPU is available if ! cpu_is_valid "${CPU_TO_TEST}" ; then tst_resm TBROK"CPU${CPU_TO_TEST} not found" diff --git a/testcases/kernel/hotplug/cpu_hotplug/include/hotplug.fns b/testcases/kernel/hotplug/cpu_hotplug/include/hotplug.fns index 8a7cc32..6b3c933 100644 --- a/testcases/kernel/hotplug/cpu_hotplug/include/hotplug.fns +++ b/testcases/kernel/hotplug/cpu_hotplug/include/hotplug.fns @@ -1,3 +1,5 @@ +#!/bin/sh + # hotplug.fns - Collection of functions for hotplugging # operations. @@ -27,7 +29,8 @@ migrate_irq() IRQS=$2 for irq in ${IRQS} do - echo $MASK > /proc/irq/${irq}/smp_affinity + echo $MASK > /proc/irq/${irq}/smp_affinity || \ + tst_resm TINFO "It is NOT permitted to change the IRQ $irq smp_affinity" done } @@ -106,7 +109,8 @@ offline_cpu() get_all_cpus() { [ -d /sys/devices/system/cpu/cpu0 ] || return 1 - ls -dr /sys/devices/system/cpu/cpu[0-9]* || return 2 + ls -dr /sys/devices/system/cpu/cpu[0-9]* | \ + sed "s/\/sys\/devices\/system\/cpu\///g" || return 2 } @@ -183,8 +187,8 @@ cpu_is_valid() # cpu_is_online(CPU) # -# Returns a true value if the given CPU number is currently online, -# false otherwise. This function requires the system's CPUs have +# Returns a 0 value if the given CPU number is currently online, +# 1 otherwise. This function requires the system's CPUs have # hotplug capabilities. # cpu_is_online() hooks/post-receive -- ltp |