On 05/25/2011 03:03 AM, Caspar Zhang wrote:
> On 05/25/2011 02:30 AM, Sandip Bhattacharya wrote:
>> I am getting repeated failures on RHEL 6.0 for the fork13 test. Has
>> anybody else run this test on RHEL 6? This is with the latest patch for
>> fork13.c incorporated into the source.
>>
>> Here is the output that I am getting. The "wait return value" error is
>> intermittent.
>>
>>     <<<test_start>>>
>>     tag=fork13 stime=1306261161
>>     cmdline="fork13 -c 2 -i 1000000"
>>     contacts=""
>>     analysis=exit
>>     <<<test_output>>>
>>     fork13      1  TFAIL  :  Unexpected pid sequence: previous fork: 
>> pid=14676, current fork: pid=14676 for iteration=75939.
>>     fork13      1  TFAIL  :  Wait return value: expected pid=14678, got 
>> 21800, iteration 78525.

I got the second FAIL too, and this FAIL often happens when running the test 
with -C option.
See this: 

./fork13 -c 3 -I 1
fork13      1  TPASS  :  5729 pids forked, all passed
fork13      1  TFAIL  :  Wait return value: expected pid=10511, got 32132, 
iteration 2957.
fork13      1  TPASS  :  2755 pids forked, all passed

That is because the first process is the father of the other two processes, and 
when the father calls wait(), any of the children could be waited.
So I think we should use waitpid() instead of wait().

>>     incrementing stop
>>     <<<execution_status>>>
>>     initiation_status="ok"
>>     duration=13 termination_type=exited termination_id=1 corefile=no
>>     cutime=258 cstime=2550
>>     <<<test_end>>>
>>
>> I understand that this is a test to check a pid reuse race condition. So
>> if this test fails, is it very naive to assume that the kernel doesn't have 
>> the
>> patch which fixes this issue? [1] Or could there be a problem with the
>> test itself?
>>
>> [1] 
>> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5fdee8c4a5e1800489ce61963208f8cc55e42ea1
> 
> Hi, the above commit was not included in RHEL6.0 kernel, which caused
> the test producing TFAIL. The test itself was OK.
> 
> Thanks,
> Caspar
> 

Here is the patch.
Please comment!

Signed-off-by: Tang Chen <[email protected]>
---
 testcases/kernel/syscalls/fork/fork13.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/testcases/kernel/syscalls/fork/fork13.c 
b/testcases/kernel/syscalls/fork/fork13.c
index 4804ea1..7fcf3d1 100644
--- a/testcases/kernel/syscalls/fork/fork13.c
+++ b/testcases/kernel/syscalls/fork/fork13.c
@@ -114,7 +114,7 @@ void check(void)
                        }
                        last_pid = pid;
 
-                       reaped = wait(&status);
+                       reaped = waitpid(pid, &status, 0);
                        if (reaped != pid) {
                                tst_resm(TFAIL,
                                        "Wait return value: expected pid=%d, "
-- 
1.7.4

-- 
Best Regards,
Tang chen

------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to