time-schedule01 failed, because it sent SIGTERM to itself before
program exited, so the return value is not 0.

This patch makes the main process ignore SIGTERM.

before patching:
---------------------
# ./time-schedule
Started 0 hog processes
Number of yields: 23727
Syscall overhead: 0.7 us
Num switches during overhead check: 0
Minimum scheduling latency: 0.3 (-0.4) us
Median scheduling latency:  0.3 (922337203685477632.0) us
Average scheduling latency: 0.3 (-0.4) us
Maximum scheduling latency: 0.8 (0.1) us
Run queue size: 2, 3
Terminated
# echo $?
143

after patching:
---------------------
# ./time-schedule
Started 0 hog processes
Number of yields: 23624
Syscall overhead: 0.7 us
Num switches during overhead check: 0
Minimum scheduling latency: 0.3 (-0.4) us
Median scheduling latency:  0.3 (922337203685477632.0) us
Average scheduling latency: 0.3 (-0.4) us
Maximum scheduling latency: 0.8 (0.1) us
Run queue size: 2, 2
# echo $?
0

Signed-off-by: Li Zefan <[EMAIL PROTECTED]>
---
 time-schedule.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

--- ltp-full-20080430.orig/testcases/kernel/sched/tool/time-schedule.c  
2008-05-08 09:55:54.000000000 +0800
+++ ltp-full-20080430/testcases/kernel/sched/tool/time-schedule.c       
2008-06-03 13:11:40.000000000 +0800
@@ -109,6 +109,7 @@ int main (int argc, char **argv)
     double dcount = 0.0;
     unsigned long diffs[MAX_ITERATIONS];
     struct timeval before, after;
+    sigset_t set;
     static char *usage =
         "time-schedule [-h] [-thread] [-notest] [-pipe] [-fpu] [num_running]";
 
@@ -271,8 +272,13 @@ int main (int argc, char **argv)
     use_fpu_value (dcount);
     if (use_threads) fprintf (stderr, "Number of yields: %u\n", num_yields);
     if (num_switches > 0) fprintf (stderr, "Num switches: %lu\n",num_switches);
-    /*  Finish up  */
-    kill (0, SIGTERM);
+
+    /*  Terminate all child processes  */
+    sigemptyset (&set);
+    sigaddset (&set, SIGTERM);
+    sigprocmask (SIG_BLOCK, &set, NULL);
+
+    kill(0, SIGTERM);
     return (0);
 }   /*  End Function main  */
 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to