summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/core/utils/concurrencytest.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2020-02-19 18:19:49 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-02-21 09:39:00 +0000
commitc569157d9d8aa43eddb98e9fbe66339bf7f20958 (patch)
tree671587e101ad4c141a21e5f776de2b6fe14bde15 /meta/lib/oeqa/core/utils/concurrencytest.py
parentdba8c1d5ef0b574b7772d59e5992bfad8b7cca13 (diff)
downloadpoky-c569157d9d8aa43eddb98e9fbe66339bf7f20958.tar.gz
oeqa/selftest: Standardise seperate builddir for concurrent and non-concurrent selftest
Currently oe-selftest reuses the current build directory and the concurrent version run with -j does not. Standardise and use a separate new build directory in both cases. This will lead to simpler code and more reliable user run tests. (From OE-Core rev: 50238b0717b04e0a1fa69d618e8c8aa8445a80b0) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/core/utils/concurrencytest.py')
-rw-r--r--meta/lib/oeqa/core/utils/concurrencytest.py35
1 files changed, 3 insertions, 32 deletions
diff --git a/meta/lib/oeqa/core/utils/concurrencytest.py b/meta/lib/oeqa/core/utils/concurrencytest.py
index 0d9c01e6d4..fac59f765a 100644
--- a/meta/lib/oeqa/core/utils/concurrencytest.py
+++ b/meta/lib/oeqa/core/utils/concurrencytest.py
@@ -177,9 +177,10 @@ class dummybuf(object):
177# 177#
178class ConcurrentTestSuite(unittest.TestSuite): 178class ConcurrentTestSuite(unittest.TestSuite):
179 179
180 def __init__(self, suite, processes): 180 def __init__(self, suite, processes, setupfunc):
181 super(ConcurrentTestSuite, self).__init__([suite]) 181 super(ConcurrentTestSuite, self).__init__([suite])
182 self.processes = processes 182 self.processes = processes
183 self.setupfunc = setupfunc
183 184
184 def run(self, result): 185 def run(self, result):
185 tests, totaltests = fork_for_tests(self.processes, self) 186 tests, totaltests = fork_for_tests(self.processes, self)
@@ -272,37 +273,7 @@ def fork_for_tests(concurrency_num, suite):
272 stream = os.fdopen(c2pwrite, 'wb', 1) 273 stream = os.fdopen(c2pwrite, 'wb', 1)
273 os.close(c2pread) 274 os.close(c2pread)
274 275
275 # Create a new separate BUILDDIR for each group of tests 276 (builddir, newbuilddir) = suite.setupfunc("-st-" + str(ourpid), selftestdir, process_suite)
276 if 'BUILDDIR' in os.environ:
277 builddir = os.environ['BUILDDIR']
278 newbuilddir = builddir + "-st-" + str(ourpid)
279 newselftestdir = newbuilddir + "/meta-selftest"
280
281 bb.utils.mkdirhier(newbuilddir)
282 oe.path.copytree(builddir + "/conf", newbuilddir + "/conf")
283 oe.path.copytree(builddir + "/cache", newbuilddir + "/cache")
284 oe.path.copytree(selftestdir, newselftestdir)
285
286 for e in os.environ:
287 if builddir in os.environ[e]:
288 os.environ[e] = os.environ[e].replace(builddir, newbuilddir)
289
290 subprocess.check_output("git init; git add *; git commit -a -m 'initial'", cwd=newselftestdir, shell=True)
291
292 # Tried to used bitbake-layers add/remove but it requires recipe parsing and hence is too slow
293 subprocess.check_output("sed %s/conf/bblayers.conf -i -e 's#%s#%s#g'" % (newbuilddir, selftestdir, newselftestdir), cwd=newbuilddir, shell=True)
294
295 os.chdir(newbuilddir)
296
297 for t in process_suite:
298 if not hasattr(t, "tc"):
299 continue
300 cp = t.tc.config_paths
301 for p in cp:
302 if selftestdir in cp[p] and newselftestdir not in cp[p]:
303 cp[p] = cp[p].replace(selftestdir, newselftestdir)
304 if builddir in cp[p] and newbuilddir not in cp[p]:
305 cp[p] = cp[p].replace(builddir, newbuilddir)
306 277
307 # Leave stderr and stdout open so we can see test noise 278 # Leave stderr and stdout open so we can see test noise
308 # Close stdin so that the child goes away if it decides to 279 # Close stdin so that the child goes away if it decides to