2010/12/12 関 和輝 <[email protected]>:
> Hi,
>
> I found the test04 of testcases/kernel/numa/numa01.sh can become either
> PASS or FAIL on the same system.
> As a result of examining the following lines of the shell,
> I noticed the execution way of these processings is wrong.
>
>  - Here is a part of a problem in the shell.
>  ---------------------------------------------------------------------------
>   numactl --physcpubind=$run_on_cpu support_numa $PAUSE & #just waits for
> sigint
>   pid=$!
>   running_on_cpu=$(awk '{ print $39; }' /proc/$pid/stat)
>  ---------------------------------------------------------------------------
>
> The following shows the root cause:
>
>  (A) : numactl --physcpubind=$run_on_cpu support_numa $PAUSE &
>  (B) : running_on_cpu=$(awk '{ print $39; }' /proc/$pid/stat)
>
> If (B) completes its execution before (A) binds a certain CPU,
> (B) doesn't set the number of expected CPU and then the test becomes FAIL.
> Therefore, (B) must start after (A) binds a certain CPU.
>
> I made the patch which executes (B) after cmm field of /proc/$pid/stat
> changes from "(numactl)" into "(support_numa)".
>
>  - Example of changing cmm field of /proc/$pid/stat
>  ---------------------------------------------------------------------------
>    [before (A) binds CPU]
>     # awk '{ print $2; }' /proc/$pid/stat
>       (numactl)
>       ^^^^^^^^^
>       cmm field
>
>    [after (A) bound CPU]
>     # awk '{ print $2; }' /proc/$pid/stat
>       (support_numa)
>  ---------------------------------------------------------------------------
>
> Please apply this patch.
>
> ---
>  testcases/kernel/numa/numa01.sh |    4 ++++
>  1 file changed, 4 insertions(+)
>
> Index: ltp-70a3216/testcases/kernel/numa/numa01.sh
> ===================================================================
> --- ltp-70a3216.orig/testcases/kernel/numa/numa01.sh    2010-12-01
> 10:50:43.000000000 +0900
> +++ ltp-70a3216/testcases/kernel/numa/numa01.sh 2010-12-01
> 10:51:55.000000000 +0900
> @@ -471,6 +471,10 @@ test04()
>     run_on_cpu=$[$[$no_of_cpus+1]/2]
>     numactl --physcpubind=$run_on_cpu support_numa $PAUSE & #just waits for
> sigint
>     pid=$!
> +    var=`awk '{ print $2; }' /proc/$pid/stat`
> +    while [ $var == "(numactl)" ];do
> +        var=`awk '{ print $2; }' /proc/$pid/stat`
> +    done
>     # Warning !! 39 represents cpu number, on which process pid is
> currently running and
>     # this may change if Some more fields are added in the middle, may be
> in future
>     running_on_cpu=$(awk '{ print $39; }' /proc/$pid/stat)
>
> Best regards,
> K Seki
>
>
>
> ------------------------------------------------------------------------------
> Lotusphere 2011
> Register now for Lotusphere 2011 and learn how
> to connect the dots, take your collaborative environment
> to the next level, and enter the era of Social Business.
> http://p.sf.net/sfu/lotusphere-d2d
> _______________________________________________
> Ltp-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ltp-list
>

The patch applied (for future reference) is:

$ git diff testcases/kernel/numa/numa01.sh
diff --git a/testcases/kernel/numa/numa01.sh b/testcases/kernel/numa/numa01.sh
index 6cc0754..151d25b 100644
--- a/testcases/kernel/numa/numa01.sh
+++ b/testcases/kernel/numa/numa01.sh
@@ -471,6 +471,10 @@ test04()
     run_on_cpu=$[$[$no_of_cpus+1]/2]
     numactl --physcpubind=$run_on_cpu support_numa $PAUSE & #just
waits for sigint
     pid=$!
+    var=`awk '{ print $2 }' /proc/$pid/stat`
+    while [ $var = '(numactl)' ]; do
+        var=`awk '{ print $2 }' /proc/$pid/stat`
+    done
     # Warning !! 39 represents cpu number, on which process pid is
currently running and
     # this may change if Some more fields are added in the middle,
may be in future
     running_on_cpu=$(awk '{ print $39; }' /proc/$pid/stat)

    Please note that I didn't use `==' in the while branch condition
(bashism) and the ; was unnecessary in the awk expression.
Thanks,
-Garrett

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to