summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/core
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/core')
-rw-r--r--meta/lib/oeqa/core/utils/concurrencytest.py27
1 files changed, 23 insertions, 4 deletions
diff --git a/meta/lib/oeqa/core/utils/concurrencytest.py b/meta/lib/oeqa/core/utils/concurrencytest.py
index e050818f0f..df8d5d0c8d 100644
--- a/meta/lib/oeqa/core/utils/concurrencytest.py
+++ b/meta/lib/oeqa/core/utils/concurrencytest.py
@@ -19,6 +19,7 @@ import testtools
19import threading 19import threading
20import time 20import time
21import io 21import io
22import subunit
22 23
23from queue import Queue 24from queue import Queue
24from itertools import cycle 25from itertools import cycle
@@ -51,10 +52,11 @@ class BBThreadsafeForwardingResult(ThreadsafeForwardingResult):
51 def _add_result_with_semaphore(self, method, test, *args, **kwargs): 52 def _add_result_with_semaphore(self, method, test, *args, **kwargs):
52 self.semaphore.acquire() 53 self.semaphore.acquire()
53 try: 54 try:
54 self.result.starttime[test.id()] = self._test_start.timestamp() 55 if self._test_start:
55 self.result.threadprogress[self.threadnum].append(test.id()) 56 self.result.starttime[test.id()] = self._test_start.timestamp()
56 totalprogress = sum(len(x) for x in self.result.threadprogress.values()) 57 self.result.threadprogress[self.threadnum].append(test.id())
57 self.result.progressinfo[test.id()] = "%s: %s/%s %s/%s (%ss) (%s)" % ( 58 totalprogress = sum(len(x) for x in self.result.threadprogress.values())
59 self.result.progressinfo[test.id()] = "%s: %s/%s %s/%s (%ss) (%s)" % (
58 self.threadnum, 60 self.threadnum,
59 len(self.result.threadprogress[self.threadnum]), 61 len(self.result.threadprogress[self.threadnum]),
60 self.totalinprocess, 62 self.totalinprocess,
@@ -67,6 +69,23 @@ class BBThreadsafeForwardingResult(ThreadsafeForwardingResult):
67 super(BBThreadsafeForwardingResult, self)._add_result_with_semaphore(method, test, *args, **kwargs) 69 super(BBThreadsafeForwardingResult, self)._add_result_with_semaphore(method, test, *args, **kwargs)
68 70
69# 71#
72# We have to patch subunit since it doesn't understand how to handle addError
73# outside of a running test case. This can happen if classSetUp() fails
74# for a class of tests. This unfortunately has horrible internal knowledge.
75#
76def outSideTestaddError(self, offset, line):
77 """An 'error:' directive has been read."""
78 test_name = line[offset:-1].decode('utf8')
79 self.parser._current_test = subunit.RemotedTestCase(test_name)
80 self.parser.current_test_description = test_name
81 self.parser._state = self.parser._reading_error_details
82 self.parser._reading_error_details.set_simple()
83 self.parser.subunitLineReceived(line)
84
85subunit._OutSideTest.addError = outSideTestaddError
86
87
88#
70# A dummy structure to add to io.StringIO so that the .buffer object 89# A dummy structure to add to io.StringIO so that the .buffer object
71# is available and accepts writes. This allows unittest with buffer=True 90# is available and accepts writes. This allows unittest with buffer=True
72# to interact ok with subunit which wants to access sys.stdout.buffer. 91# to interact ok with subunit which wants to access sys.stdout.buffer.