summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib')
-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 f050289e61..1a58d35ba0 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
@@ -50,10 +51,11 @@ class BBThreadsafeForwardingResult(ThreadsafeForwardingResult):
50 def _add_result_with_semaphore(self, method, test, *args, **kwargs): 51 def _add_result_with_semaphore(self, method, test, *args, **kwargs):
51 self.semaphore.acquire() 52 self.semaphore.acquire()
52 try: 53 try:
53 self.result.starttime[test.id()] = self._test_start.timestamp() 54 if self._test_start:
54 self.result.threadprogress[self.threadnum].append(test.id()) 55 self.result.starttime[test.id()] = self._test_start.timestamp()
55 totalprogress = sum(len(x) for x in self.result.threadprogress.values()) 56 self.result.threadprogress[self.threadnum].append(test.id())
56 self.result.progressinfo[test.id()] = "%s: %s/%s %s/%s (%ss) (%s)" % ( 57 totalprogress = sum(len(x) for x in self.result.threadprogress.values())
58 self.result.progressinfo[test.id()] = "%s: %s/%s %s/%s (%ss) (%s)" % (
57 self.threadnum, 59 self.threadnum,
58 len(self.result.threadprogress[self.threadnum]), 60 len(self.result.threadprogress[self.threadnum]),
59 self.totalinprocess, 61 self.totalinprocess,
@@ -66,6 +68,23 @@ class BBThreadsafeForwardingResult(ThreadsafeForwardingResult):
66 super(BBThreadsafeForwardingResult, self)._add_result_with_semaphore(method, test, *args, **kwargs) 68 super(BBThreadsafeForwardingResult, self)._add_result_with_semaphore(method, test, *args, **kwargs)
67 69
68# 70#
71# We have to patch subunit since it doesn't understand how to handle addError
72# outside of a running test case. This can happen if classSetUp() fails
73# for a class of tests. This unfortunately has horrible internal knowledge.
74#
75def outSideTestaddError(self, offset, line):
76 """An 'error:' directive has been read."""
77 test_name = line[offset:-1].decode('utf8')
78 self.parser._current_test = subunit.RemotedTestCase(test_name)
79 self.parser.current_test_description = test_name
80 self.parser._state = self.parser._reading_error_details
81 self.parser._reading_error_details.set_simple()
82 self.parser.subunitLineReceived(line)
83
84subunit._OutSideTest.addError = outSideTestaddError
85
86
87#
69# A dummy structure to add to io.StringIO so that the .buffer object 88# A dummy structure to add to io.StringIO so that the .buffer object
70# is available and accepts writes. This allows unittest with buffer=True 89# is available and accepts writes. This allows unittest with buffer=True
71# to interact ok with subunit which wants to access sys.stdout.buffer. 90# to interact ok with subunit which wants to access sys.stdout.buffer.