cpuhotplug05.sh: fix invalid usage of sar

Message ID 1428493449-9784-1-git-send-email-chase.qi@linaro.org
State New
Headers show

Commit Message

chase.qi@linaro.org April 8, 2015, 11:44 a.m.
Use 24-hour time to unify time format.

Fix invalid usage of sar.

Increase the sleep time after online_cpu to
adapt embedded hardware.

Signed-off-by: Chase Qi <chase.qi@linaro.org>
---
 .../kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh   | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Patch hide | download patch | download mbox

diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh
index bb0e896..f088d25 100755
--- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh
+++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh
@@ -5,6 +5,7 @@ 
 
 export TCID="cpuhotplug05"
 export TST_TOTAL=1
+export LC_TIME="POSIX"
 
 # Includes:
 . test.sh
@@ -80,11 +81,11 @@  TST_CLEANUP=do_clean
 until [ $LOOP_COUNT -gt $HOTPLUG05_LOOPS ]; do
 
 	# Start up SAR and give it a couple cycles to run
-	sar 1 0 &>/dev/null &
+	sar 1 &>/dev/null &
 	sleep 2
 	if ps -C sar &>/dev/null; then
 		pkill sar
-		sar -P ALL 1 0 > $TMP/log_$$ &
+		sar -P ALL 1 > $TMP/log_$$ &
 	else
 		sar -P ALL 1 > $TMP/log_$$ &
 	fi
@@ -92,14 +93,14 @@  until [ $LOOP_COUNT -gt $HOTPLUG05_LOOPS ]; do
 	SAR_PID=$!
 
 	# Verify that SAR has correctly listed the missing CPU
-	while ! awk '{print $9}' $TMP/log_$$ | grep -i "^0.00"; do
+	while ! awk '{print $8}' $TMP/log_$$ | grep -i "^0.00"; do
 		tst_brkm TBROK "CPU${CPU_TO_TEST} Not Found on SAR!"
 	done
 	time=`date +%X`
 	sleep .5
 
 	# Verify that at least some of the CPUs are offline
-	NUMBER_CPU_OFF=$(grep "$time" $TMP/log_$$ | awk '{print $9}' \
+	NUMBER_CPU_OFF=$(grep "$time" $TMP/log_$$ | awk '{print $8}' \
 		|grep -i "^0.00" | wc -l)
 	if [ ${NUMBER_CPU_OFF} -eq 0 ]; then
 		tst_brkm TBROK "no CPUs found offline"
@@ -110,12 +111,12 @@  until [ $LOOP_COUNT -gt $HOTPLUG05_LOOPS ]; do
 		tst_brkm TBROK "CPU${CPU_TO_TEST} cannot be onlined line"
 	fi
 
-	sleep 1
+	sleep 2
 	time=$(date +%T)
 	sleep .5
 
 	# Check that SAR registered the change in CPU online/offline states
-	NEW_NUMBER_CPU_OFF=$(grep "$time" $TMP/log_$$|awk '{print $9}' \
+	NEW_NUMBER_CPU_OFF=$(grep "$time" $TMP/log_$$|awk '{print $8}' \
 		| grep -i "^0.00"| wc -l)
 	NUMBER_CPU_OFF=$((NUMBER_CPU_OFF-1))
 	if [ "$NUMBER_CPU_OFF" != "$NEW_NUMBER_CPU_OFF" ]; then