[qmtest] Test Completion With Running Processes
Mark Mitchell
mark at codesourcery.com
Sun Feb 8 20:59:57 UTC 2004
Scott Lowrey wrote:
> I've noticed a discrepancy in the behavior between running tests on
> the command line and running them via the GUI.
>
> Scenario:
>
> Test code spawns several subprocesses. Exception occurs while
> executing test code. Bug in the test class (mine) leaves one process
> outstanding.
>
> Result:
>
> If this test is run via the command line ('qmtest run'), the exception
> is properly noted and the test ends with an ERROR result. The
> outstanding process remains as an orphan.
>
> If this test is run via the GUI, the browser loops waiting for the
> test to end.
>
> Obviously, QMTest is waiting for all processes associated with it to
> end before declaring the test complete. That is a Good Thing, I
> think. But why does the command-line test come back as soon as the
> exception occurs, in spite of the outstanding process?
I'm not sure exactly what's causing the difference in behavior you're
seeing.
The code in qm/executable.py is what handles executing subprocesses. It
contains logic to start the subprocesses in their own process group so
that it can kill the entire process group if and when necessary.
The key difference in the GUI environment is probably that the GUI is
running from within its own thread. I suspect that something is going
wrong with signal-delivery to the GUI thread and that is causing the
difference.
The normal process control logic does *not* wait for all subprocesses to
exit; just the main subprocess. However, once the main subprocess exits
it should kill the entire process group. (See TimeoutExecutable.Run).
Of course, if the subprocesses intentionally create new process groups
for their children, or move themselves into different process groups,
this logic will not be able to kill all of the children.)
I don't think we can fix this with the information you've provided so far.
Thanks,
--
Mark Mitchell
CodeSourcery, LLC
(916) 791-8304
mark at codesourcery.com
More information about the qmtest
mailing list