Hi :
Cause the output of sar only include "0.00" when cpu is offline.
>From b2bec59fa0491389e208d4c2175b337b1152a628 Mon Sep 17 00:00:00 2001
From: Liao Guoqi <b25230@BJ-boardfarm.(none)>
Date: Thu, 17 Oct 2013 11:15:43 +0800
Subject: [PATCH] Cause 'sar' output changed, so update pattern matching
---
.../hotplug/cpu_hotplug/functional/cpuhotplug05.sh | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh
b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh
index e64b91c..e893f04 100755
--- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh
+++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh
@@ -57,8 +57,8 @@ until [ $TST_COUNT -gt $TST_TOTAL ]; do
sleep 2
SAR_PID=$!
- # Verify that SAR has correctly listed the missing CPU as 'nan'
- while ! grep -iq nan $TMP/log_$$; do
+ # Verify that SAR has correctly listed the missing CPU
+ while ! awk '{print $8}' $TMP/log_$$|grep -i "^0.00"; do
tst_resm TFAIL "CPU${CPU_TO_TEST} Not Found on SAR!"
exit_clean 1
done
@@ -66,7 +66,7 @@ until [ $TST_COUNT -gt $TST_TOTAL ]; do
sleep .5
# Verify that at least some of the CPUs are offline
- NUMBER_CPU_OFF=$(grep "$time" $TMP/log_$$ | grep -i nan | wc -l)
+ NUMBER_CPU_OFF=$(grep "$time" $TMP/log_$$ | awk '{print $8}' |grep -i
"^0.00" | wc -l)
if [ ${NUMBER_CPU_OFF} -eq 0 ]; then
tst_resm TBROK "no CPUs found offline"
exit_clean 1
@@ -83,7 +83,7 @@ until [ $TST_COUNT -gt $TST_TOTAL ]; do
sleep .5
# Check that SAR registered the change in CPU online/offline states
- NEW_NUMBER_CPU_OFF=$(grep "$time" $TMP/log_$$ | grep -i nan | wc -l)
+ NEW_NUMBER_CPU_OFF=$(grep "$time" $TMP/log_$$|awk '{print $8}'|grep -i
"^0.00"| wc -l)
: $(( NUMBER_CPU_OFF -= 1 ))
if [ "$NUMBER_CPU_OFF" = "$NEW_NUMBER_CPU_OFF" ]; then
tst_resm TPASS "CPU was found after turned on."
--
1.7.9.5
B.R.
Guoqi
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Wednesday, October 16, 2013 7:22 PM
To: Liao Guoqi-B25230
Cc: [email protected]
Subject: Re: [LTP] "cpu_hotplug/functional/cpuhotplug05.sh" failed
Hi!
> When I run cpuhotplug05 cases on our platform(powerpc), it failed:
> Name: cpuhotplug05
> Date: Wed Oct 16 10:49:31 UTC 2013
> Desc: Does sar behave properly during CPU hotplug events?
>
> CPU is 1
> cpuhotplug05 1 TFAIL : CPU1 Not Found on SAR!
>
> After some investigation:
>
> the following code:
>
> while ! grep -iq nan $TMP/log_$$; do
>
> tst_resm TFAIL "CPU${CPU_TO_TEST} Not Found on SAR!"
>
> exit_clean 1
>
> done
>
> root cause:
> output of command "sar" has been changed, the log from "sar" output did NOT
> include "nan".
>
> Enrionment:
> Sysstat version: 10.1.4
> Ltp version: 20130109-r0
It looks like the sar parameters and output changes from time to time.
On my system (systat 10.0.5) sar does not accept zero as a inifinte count and
needs to be executed as 'sar -P ALL 1' instead of 'sar -P ALL 1 0'.
I guess that the only solution is to switch on systat version and change
expectations accordingly. Feel free to send a patch.
--
Cyril Hrubis
[email protected]
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list