diff options
author | juraj.linkes <juraj.linkes@pantheon.tech> | 2018-08-30 10:51:45 +0200 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2018-08-30 13:57:39 +0000 |
commit | 5e2c54d02906a7b4787a1f41b59baf97c3a4a840 (patch) | |
tree | d82ae15bd4afe0ffae4424ba9d88e7c3d79c4ece /test/framework.py | |
parent | 93a5dd17232e42bea2fc9dcf59c652a9da31b2b3 (diff) |
Fix hanging test runner when child process dies
When fixing the test summary after a test run doesn't finish properly I
introduced a bug where child process which died would leave the whole
run hanging. This patch fixed the bug while still having the correct
test summary.
Change-Id: I206b1a7dab4032d24cbc50667b8dd0bdcebb67a6
Signed-off-by: juraj.linkes <juraj.linkes@pantheon.tech>
Diffstat (limited to 'test/framework.py')
-rw-r--r-- | test/framework.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/test/framework.py b/test/framework.py index 308842da6bc..f7a155f41cb 100644 --- a/test/framework.py +++ b/test/framework.py @@ -1015,6 +1015,12 @@ class VppTestResult(unittest.TestResult): if logger: logger.error(e) + def send_results_through_pipe(self): + if hasattr(self, 'test_framework_results_pipe'): + pipe = self.test_framework_results_pipe + if pipe: + pipe.send(self) + def addFailure(self, test, err): """ Record a test failed result @@ -1087,7 +1093,7 @@ class VppTestResult(unittest.TestResult): def stopTest(self, test): """ - Stop a test + Called when the given test has been run :param test: @@ -1101,6 +1107,7 @@ class VppTestResult(unittest.TestResult): else: self.stream.writeln("%-73s%s" % (self.getDescription(test), self.result_string)) + self.send_results_through_pipe() def printErrors(self): """ @@ -1137,7 +1144,8 @@ class VppTestRunner(unittest.TextTestRunner): return VppTestResult def __init__(self, keep_alive_pipe=None, descriptions=True, verbosity=1, - failfast=False, buffer=False, resultclass=None): + results_pipe=None, failfast=False, buffer=False, + resultclass=None): # ignore stream setting here, use hard-coded stdout to be in sync # with prints from VppTestCase methods ... super(VppTestRunner, self).__init__(sys.stdout, descriptions, @@ -1146,6 +1154,8 @@ class VppTestRunner(unittest.TextTestRunner): reporter = KeepAliveReporter() reporter.pipe = keep_alive_pipe + VppTestResult.test_framework_results_pipe = results_pipe + def run(self, test): """ Run the tests |