Nir Soffer has uploaded a new change for review.

Change subject: tests: Wait for child process in tearDown
......................................................................

tests: Wait for child process in tearDown

If the code fail to terminate a child process, we must wait for child
process before exiting from the test. Not waiting may cause the SIGCHLD
singal received when the test framework write to stderror, which fails
with EINTR.

Here is an example failure caused the missing wait, easily reproduced
using:

    for i in `seq 50`; do ./run_tests_local.sh utilsTests.py:TerminatingTests; 
done

======================================================================
ERROR: test_terminating_with_kill_exception (utilsTests.TerminatingTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/nose/case.py", line 133, in run
    self.runTest(result)
  File "/usr/lib/python2.7/site-packages/nose/case.py", line 151, in runTest
    test(result)
  File "/usr/lib64/python2.7/unittest/case.py", line 431, in __call__
    return self.run(*args, **kwds)
  File "/usr/lib64/python2.7/unittest/case.py", line 406, in run
    result.addSuccess(self)
  File "/usr/lib/python2.7/site-packages/nose/proxy.py", line 165, in addSuccess
    self.result.addSuccess(self.test)
  File "/home/nsoffer/src/vdsm/tests/testlib.py", line 309, in addSuccess
    self._writeResult(test, 'OK', TermColor.green, '.', True)
  File "/home/nsoffer/src/vdsm/tests/testlib.py", line 302, in _writeResult
    self.stream.writeln()
  File "/usr/lib64/python2.7/unittest/runner.py", line 25, in writeln
    self.write('\n') # text-mode streams translate to \r\n if needed
IOError: [Errno 4] Interrupted system call
-------------------- >> begin captured logging << --------------------
2016-10-10 20:01:08,738 DEBUG   [root] (MainThread) /usr/bin/taskset --cpu-list 
0-3 sleep 2 (cwd None)
2016-10-10 20:01:08,739 DEBUG   [root] (MainThread) Terminating process pid=5854
2016-10-10 20:01:08,739 ERROR   [root] (MainThread) Failed to kill process 5854
Traceback (most recent call last):
  File "/home/nsoffer/src/vdsm/lib/vdsm/utils.py", line 740, in terminating
    proc.kill()
  File "/home/nsoffer/src/vdsm/tests/utilsTests.py", line 119, in fake_kill
    raise FakeKillError("fake kill exception")
FakeKillError: fake kill exception
--------------------- >> end captured logging << ---------------------

Change-Id: I248fa0b1c2129f69164be447402276d7908ed768
Signed-off-by: Nir Soffer <[email protected]>
---
M tests/utilsTests.py
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/22/65322/1

diff --git a/tests/utilsTests.py b/tests/utilsTests.py
index cdbfd7b..d8bc628 100644
--- a/tests/utilsTests.py
+++ b/tests/utilsTests.py
@@ -105,6 +105,7 @@
     def tearDown(self):
         if self.proc.poll() is None:
             self.kill_proc()
+            self.proc.wait()
 
     def test_terminating(self):
         with utils.terminating(self.proc):


-- 
To view, visit https://gerrit.ovirt.org/65322
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I248fa0b1c2129f69164be447402276d7908ed768
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <[email protected]>
_______________________________________________
vdsm-patches mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to