Bug 3121

Summary: TestRunner frysk.sys.TestCallPtrace on FC6 clones itself?
Product: frysk Reporter: Mark Wielaard <mark>
Component: generalAssignee: Andrew Cagney <cagney>
Status: RESOLVED FIXED    
Severity: normal CC: cagney
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:
Bug Depends on: 3126    
Bug Blocks: 1582    

Description Mark Wielaard 2006-08-24 12:02:36 UTC
Just wanted to mention that I noticed an odd thing on fc6 when using the
TestRunner inside a frysk CVS checkout. If TestRunner is used on
anything that uses ptrace it seems the process gets forked and executed
twice. So: $ ./TestRunner frysk.sys.proc.TestStatus
Goes fine and gets run nicely as is. But if any test is included that
uses ptrace then you will see a second (and maybe more!) run a little
later after the original TestRunner is finished like:

$ ./TestRunner frysk.sys.TestCallPtrace
Running testChildContinue(frysk.sys.TestCallPtrace) ...PASS
Running testAttach(frysk.sys.TestCallPtrace) ...PASS

Time: 0.003

OK (2 tests)
[[ ... insert 5 second delay ...]]]
$ DETACHED PROCESS: EXITING
FAIL
  junit.framework.AssertionFailedError

Time: 5.006
There was 1 failure:
1)
testAttach(frysk.sys.TestCallPtrace)junit.framework.AssertionFailedError
   at frysk.sys.TestCallPtrace.testAttach(TestRunner)
   at frysk.junit.Runner.<init>(TestRunner)
   at TestRunner.main(TestRunner)

FAILURES!!!
Tests run: 2,  Failures: 1,  Errors: 0

Note that in a make check this second run isn't noticed to fail by make.
So you might see some random messages indicating failures and then
having make check succeed anyway. This might explain some of the
different reports we were seeing where people claimed things did or did
not fail.

I haven't figured out yet what exactly seems to cause these ghost
TestRunner forks to happen. But it is either related to ptrace or maybe
when using a test that spawns a helper binary. I am not really
investigating atm, but if someone wants I can take a closer look.

$ cat /etc/redhat-release
Fedora Core release 5.91 (FC6 Test2)
$ uname -a
Linux hermans.wildebeest.org 2.6.17-1.2583.fc6 #1 SMP Tue Aug 22 00:29:50 EDT
2006 i686 i686 i386 GNU/Linux
$ cat frysk/common/version.in
0.0.1.2006.08.23
Comment 1 Mark Wielaard 2006-08-25 07:53:33 UTC
*** Bug 3126 has been marked as a duplicate of this bug. ***
Comment 2 Mark Wielaard 2006-08-30 09:10:37 UTC
Solved by:

2006-08-22  Andrew Cagney  <cagney@redhat.com>

        * TestLib.java (tearDown): For terminated threads, re-reap their
        pid.
        * TestBreakpoints.java (tearDown): Delete code using the event
        loop to reap children.
        (setUp): Do not add to Manager .host .observableProcRemovedXXX
        .addObserver.

2006-08-22  Mark Wielaard  <mark@klomp.org>

        * TestBreakpoints.java (tearDown): Add more comments about child
        process creation and dead.

2006-08-21  Mark Wielaard  <mark@klomp.org>

        * TestBreakpoints.java: Implements Observer.
        (procTerminated): New boolean field.
        (setup): Add observableProcRemoved to manager.host.
        (tearDown): Make sure proc is really gone.
        (update): New method.