summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/core/utils/concurrencytest.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/core/utils/concurrencytest.py')
-rw-r--r--meta/lib/oeqa/core/utils/concurrencytest.py23
1 files changed, 4 insertions, 19 deletions
diff --git a/meta/lib/oeqa/core/utils/concurrencytest.py b/meta/lib/oeqa/core/utils/concurrencytest.py
index 01c39830f9..b2eb68fb02 100644
--- a/meta/lib/oeqa/core/utils/concurrencytest.py
+++ b/meta/lib/oeqa/core/utils/concurrencytest.py
@@ -183,10 +183,11 @@ class dummybuf(object):
183# 183#
184class ConcurrentTestSuite(unittest.TestSuite): 184class ConcurrentTestSuite(unittest.TestSuite):
185 185
186 def __init__(self, suite, processes, setupfunc): 186 def __init__(self, suite, processes, setupfunc, removefunc):
187 super(ConcurrentTestSuite, self).__init__([suite]) 187 super(ConcurrentTestSuite, self).__init__([suite])
188 self.processes = processes 188 self.processes = processes
189 self.setupfunc = setupfunc 189 self.setupfunc = setupfunc
190 self.removefunc = removefunc
190 191
191 def run(self, result): 192 def run(self, result):
192 tests, totaltests = fork_for_tests(self.processes, self) 193 tests, totaltests = fork_for_tests(self.processes, self)
@@ -237,22 +238,6 @@ class ConcurrentTestSuite(unittest.TestSuite):
237 finally: 238 finally:
238 queue.put(test) 239 queue.put(test)
239 240
240def removebuilddir(d):
241 delay = 5
242 while delay and os.path.exists(d + "/bitbake.lock"):
243 time.sleep(1)
244 delay = delay - 1
245 # Deleting these directories takes a lot of time, use autobuilder
246 # clobberdir if its available
247 clobberdir = os.path.expanduser("~/yocto-autobuilder-helper/janitor/clobberdir")
248 if os.path.exists(clobberdir):
249 try:
250 subprocess.check_call([clobberdir, d])
251 return
252 except subprocess.CalledProcessError:
253 pass
254 bb.utils.prunedir(d, ionice=True)
255
256def fork_for_tests(concurrency_num, suite): 241def fork_for_tests(concurrency_num, suite):
257 result = [] 242 result = []
258 if 'BUILDDIR' in os.environ: 243 if 'BUILDDIR' in os.environ:
@@ -297,7 +282,7 @@ def fork_for_tests(concurrency_num, suite):
297 if ourpid != os.getpid(): 282 if ourpid != os.getpid():
298 os._exit(0) 283 os._exit(0)
299 if newbuilddir and unittest_result.wasSuccessful(): 284 if newbuilddir and unittest_result.wasSuccessful():
300 removebuilddir(newbuilddir) 285 suite.removefunc(newbuilddir)
301 except: 286 except:
302 # Don't do anything with process children 287 # Don't do anything with process children
303 if ourpid != os.getpid(): 288 if ourpid != os.getpid():
@@ -313,7 +298,7 @@ def fork_for_tests(concurrency_num, suite):
313 sys.stderr.write(traceback.format_exc()) 298 sys.stderr.write(traceback.format_exc())
314 finally: 299 finally:
315 if newbuilddir: 300 if newbuilddir:
316 removebuilddir(newbuilddir) 301 suite.removefunc(newbuilddir)
317 stream.flush() 302 stream.flush()
318 os._exit(1) 303 os._exit(1)
319 stream.flush() 304 stream.flush()