diff options
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r-- | meta/lib/oeqa/core/utils/concurrencytest.py | 2 | ||||
-rw-r--r-- | meta/lib/oeqa/sdkext/testsdk.py | 7 | ||||
-rw-r--r-- | meta/lib/oeqa/selftest/cases/runtime_test.py | 2 | ||||
-rw-r--r-- | meta/lib/oeqa/selftest/cases/signing.py | 4 | ||||
-rw-r--r-- | meta/lib/oeqa/selftest/context.py | 6 | ||||
-rw-r--r-- | meta/lib/oeqa/targetcontrol.py | 7 | ||||
-rw-r--r-- | meta/lib/oeqa/utils/qemurunner.py | 16 |
7 files changed, 28 insertions, 16 deletions
diff --git a/meta/lib/oeqa/core/utils/concurrencytest.py b/meta/lib/oeqa/core/utils/concurrencytest.py index 0f7b3dcc11..e6b14da89d 100644 --- a/meta/lib/oeqa/core/utils/concurrencytest.py +++ b/meta/lib/oeqa/core/utils/concurrencytest.py | |||
@@ -261,7 +261,7 @@ def fork_for_tests(concurrency_num, suite): | |||
261 | oe.path.copytree(selftestdir, newselftestdir) | 261 | oe.path.copytree(selftestdir, newselftestdir) |
262 | 262 | ||
263 | for e in os.environ: | 263 | for e in os.environ: |
264 | if builddir in os.environ[e]: | 264 | if builddir + "/" in os.environ[e] or os.environ[e].endswith(builddir): |
265 | os.environ[e] = os.environ[e].replace(builddir, newbuilddir) | 265 | os.environ[e] = os.environ[e].replace(builddir, newbuilddir) |
266 | 266 | ||
267 | subprocess.check_output("git init; git add *; git commit -a -m 'initial'", cwd=newselftestdir, shell=True) | 267 | subprocess.check_output("git init; git add *; git commit -a -m 'initial'", cwd=newselftestdir, shell=True) |
diff --git a/meta/lib/oeqa/sdkext/testsdk.py b/meta/lib/oeqa/sdkext/testsdk.py index 785b5dda53..c5c46df6cd 100644 --- a/meta/lib/oeqa/sdkext/testsdk.py +++ b/meta/lib/oeqa/sdkext/testsdk.py | |||
@@ -25,11 +25,8 @@ class TestSDKExt(TestSDKBase): | |||
25 | 25 | ||
26 | subprocesstweak.errors_have_output() | 26 | subprocesstweak.errors_have_output() |
27 | 27 | ||
28 | # extensible sdk can be contaminated if native programs are | 28 | # We need the original PATH for testing the eSDK, not with our manipulations |
29 | # in PATH, i.e. use perl-native instead of eSDK one. | 29 | os.environ['PATH'] = d.getVar("BB_ORIGENV", False).getVar("PATH") |
30 | paths_to_avoid = [d.getVar('STAGING_DIR'), | ||
31 | d.getVar('BASE_WORKDIR')] | ||
32 | os.environ['PATH'] = avoid_paths_in_environ(paths_to_avoid) | ||
33 | 30 | ||
34 | tcname = d.expand("${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.sh") | 31 | tcname = d.expand("${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.sh") |
35 | if not os.path.exists(tcname): | 32 | if not os.path.exists(tcname): |
diff --git a/meta/lib/oeqa/selftest/cases/runtime_test.py b/meta/lib/oeqa/selftest/cases/runtime_test.py index 7d3922ce44..d4fea91350 100644 --- a/meta/lib/oeqa/selftest/cases/runtime_test.py +++ b/meta/lib/oeqa/selftest/cases/runtime_test.py | |||
@@ -166,7 +166,7 @@ class TestImage(OESelftestTestCase): | |||
166 | bitbake('core-image-full-cmdline socat') | 166 | bitbake('core-image-full-cmdline socat') |
167 | bitbake('-c testimage core-image-full-cmdline') | 167 | bitbake('-c testimage core-image-full-cmdline') |
168 | 168 | ||
169 | def test_testimage_virgl_gtk(self): | 169 | def disabled_test_testimage_virgl_gtk(self): |
170 | """ | 170 | """ |
171 | Summary: Check host-assisted accelerate OpenGL functionality in qemu with gtk frontend | 171 | Summary: Check host-assisted accelerate OpenGL functionality in qemu with gtk frontend |
172 | Expected: 1. Check that virgl kernel driver is loaded and 3d acceleration is enabled | 172 | Expected: 1. Check that virgl kernel driver is loaded and 3d acceleration is enabled |
diff --git a/meta/lib/oeqa/selftest/cases/signing.py b/meta/lib/oeqa/selftest/cases/signing.py index 5c4e01b2c3..5b8f9bbd38 100644 --- a/meta/lib/oeqa/selftest/cases/signing.py +++ b/meta/lib/oeqa/selftest/cases/signing.py | |||
@@ -44,7 +44,9 @@ class Signing(OESelftestTestCase): | |||
44 | origenv = os.environ.copy() | 44 | origenv = os.environ.copy() |
45 | 45 | ||
46 | for e in os.environ: | 46 | for e in os.environ: |
47 | if builddir in os.environ[e]: | 47 | if builddir + "/" in os.environ[e]: |
48 | os.environ[e] = os.environ[e].replace(builddir + "/", newbuilddir + "/") | ||
49 | if os.environ[e].endswith(builddir): | ||
48 | os.environ[e] = os.environ[e].replace(builddir, newbuilddir) | 50 | os.environ[e] = os.environ[e].replace(builddir, newbuilddir) |
49 | 51 | ||
50 | os.chdir(newbuilddir) | 52 | os.chdir(newbuilddir) |
diff --git a/meta/lib/oeqa/selftest/context.py b/meta/lib/oeqa/selftest/context.py index c4eb5d614e..3d3b19c6e8 100644 --- a/meta/lib/oeqa/selftest/context.py +++ b/meta/lib/oeqa/selftest/context.py | |||
@@ -280,11 +280,15 @@ class OESelftestTestContextExecutor(OETestContextExecutor): | |||
280 | return rc | 280 | return rc |
281 | 281 | ||
282 | def _signal_clean_handler(self, signum, frame): | 282 | def _signal_clean_handler(self, signum, frame): |
283 | sys.exit(1) | 283 | if self.ourpid == os.getpid(): |
284 | sys.exit(1) | ||
284 | 285 | ||
285 | def run(self, logger, args): | 286 | def run(self, logger, args): |
286 | self._process_args(logger, args) | 287 | self._process_args(logger, args) |
287 | 288 | ||
289 | # Setup a SIGTERM handler to allow restoration of files like local.conf and bblayers.conf | ||
290 | # but don't interfer with other processes | ||
291 | self.ourpid = os.getpid() | ||
288 | signal.signal(signal.SIGTERM, self._signal_clean_handler) | 292 | signal.signal(signal.SIGTERM, self._signal_clean_handler) |
289 | 293 | ||
290 | rc = None | 294 | rc = None |
diff --git a/meta/lib/oeqa/targetcontrol.py b/meta/lib/oeqa/targetcontrol.py index 1445e3ecfb..41557dc224 100644 --- a/meta/lib/oeqa/targetcontrol.py +++ b/meta/lib/oeqa/targetcontrol.py | |||
@@ -117,9 +117,9 @@ class QemuTarget(BaseTarget): | |||
117 | import oe.path | 117 | import oe.path |
118 | bb.utils.mkdirhier(self.testdir) | 118 | bb.utils.mkdirhier(self.testdir) |
119 | self.qemurunnerlog = os.path.join(self.testdir, 'qemurunner_log.%s' % self.datetime) | 119 | self.qemurunnerlog = os.path.join(self.testdir, 'qemurunner_log.%s' % self.datetime) |
120 | loggerhandler = logging.FileHandler(self.qemurunnerlog) | 120 | self.loggerhandler = logging.FileHandler(self.qemurunnerlog) |
121 | loggerhandler.setFormatter(logging.Formatter("%(levelname)s: %(message)s")) | 121 | self.loggerhandler.setFormatter(logging.Formatter("%(levelname)s: %(message)s")) |
122 | self.logger.addHandler(loggerhandler) | 122 | self.logger.addHandler(self.loggerhandler) |
123 | oe.path.symlink(os.path.basename(self.qemurunnerlog), os.path.join(self.testdir, 'qemurunner_log'), force=True) | 123 | oe.path.symlink(os.path.basename(self.qemurunnerlog), os.path.join(self.testdir, 'qemurunner_log'), force=True) |
124 | 124 | ||
125 | if d.getVar("DISTRO") == "poky-tiny": | 125 | if d.getVar("DISTRO") == "poky-tiny": |
@@ -182,6 +182,7 @@ class QemuTarget(BaseTarget): | |||
182 | 182 | ||
183 | def stop(self): | 183 | def stop(self): |
184 | self.runner.stop() | 184 | self.runner.stop() |
185 | self.logger.removeHandler(self.loggerhandler) | ||
185 | self.connection = None | 186 | self.connection = None |
186 | self.ip = None | 187 | self.ip = None |
187 | self.server_ip = None | 188 | self.server_ip = None |
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py index fe8b77d97a..3db177b001 100644 --- a/meta/lib/oeqa/utils/qemurunner.py +++ b/meta/lib/oeqa/utils/qemurunner.py | |||
@@ -35,6 +35,7 @@ class QemuRunner: | |||
35 | 35 | ||
36 | # Popen object for runqemu | 36 | # Popen object for runqemu |
37 | self.runqemu = None | 37 | self.runqemu = None |
38 | self.runqemu_exited = False | ||
38 | # pid of the qemu process that runqemu will start | 39 | # pid of the qemu process that runqemu will start |
39 | self.qemupid = None | 40 | self.qemupid = None |
40 | # target ip - from the command line or runqemu output | 41 | # target ip - from the command line or runqemu output |
@@ -102,7 +103,6 @@ class QemuRunner: | |||
102 | self.logger.debug("Output from runqemu:\n%s" % self.getOutput(self.runqemu.stdout)) | 103 | self.logger.debug("Output from runqemu:\n%s" % self.getOutput(self.runqemu.stdout)) |
103 | self.stop() | 104 | self.stop() |
104 | self._dump_host() | 105 | self._dump_host() |
105 | raise SystemExit | ||
106 | 106 | ||
107 | def start(self, qemuparams = None, get_ip = True, extra_bootparams = None, runqemuparams='', launch_cmd=None, discard_writes=True): | 107 | def start(self, qemuparams = None, get_ip = True, extra_bootparams = None, runqemuparams='', launch_cmd=None, discard_writes=True): |
108 | env = os.environ.copy() | 108 | env = os.environ.copy() |
@@ -206,6 +206,8 @@ class QemuRunner: | |||
206 | endtime = time.time() + self.runqemutime | 206 | endtime = time.time() + self.runqemutime |
207 | while not self.is_alive() and time.time() < endtime: | 207 | while not self.is_alive() and time.time() < endtime: |
208 | if self.runqemu.poll(): | 208 | if self.runqemu.poll(): |
209 | if self.runqemu_exited: | ||
210 | return False | ||
209 | if self.runqemu.returncode: | 211 | if self.runqemu.returncode: |
210 | # No point waiting any longer | 212 | # No point waiting any longer |
211 | self.logger.warning('runqemu exited with code %d' % self.runqemu.returncode) | 213 | self.logger.warning('runqemu exited with code %d' % self.runqemu.returncode) |
@@ -215,6 +217,9 @@ class QemuRunner: | |||
215 | return False | 217 | return False |
216 | time.sleep(0.5) | 218 | time.sleep(0.5) |
217 | 219 | ||
220 | if self.runqemu_exited: | ||
221 | return False | ||
222 | |||
218 | if not self.is_alive(): | 223 | if not self.is_alive(): |
219 | self.logger.error("Qemu pid didn't appear in %s seconds (%s)" % | 224 | self.logger.error("Qemu pid didn't appear in %s seconds (%s)" % |
220 | (self.runqemutime, time.strftime("%D %H:%M:%S"))) | 225 | (self.runqemutime, time.strftime("%D %H:%M:%S"))) |
@@ -385,7 +390,7 @@ class QemuRunner: | |||
385 | os.killpg(os.getpgid(self.runqemu.pid), signal.SIGKILL) | 390 | os.killpg(os.getpgid(self.runqemu.pid), signal.SIGKILL) |
386 | self.runqemu.stdin.close() | 391 | self.runqemu.stdin.close() |
387 | self.runqemu.stdout.close() | 392 | self.runqemu.stdout.close() |
388 | self.runqemu = None | 393 | self.runqemu_exited = True |
389 | 394 | ||
390 | if hasattr(self, 'server_socket') and self.server_socket: | 395 | if hasattr(self, 'server_socket') and self.server_socket: |
391 | self.server_socket.close() | 396 | self.server_socket.close() |
@@ -396,7 +401,10 @@ class QemuRunner: | |||
396 | self.qemupid = None | 401 | self.qemupid = None |
397 | self.ip = None | 402 | self.ip = None |
398 | if os.path.exists(self.qemu_pidfile): | 403 | if os.path.exists(self.qemu_pidfile): |
399 | os.remove(self.qemu_pidfile) | 404 | try: |
405 | os.remove(self.qemu_pidfile) | ||
406 | except FileNotFoundError as e: | ||
407 | self.logger.warning('qemu pidfile is no longer present') | ||
400 | if self.monitorpipe: | 408 | if self.monitorpipe: |
401 | self.monitorpipe.close() | 409 | self.monitorpipe.close() |
402 | 410 | ||
@@ -422,7 +430,7 @@ class QemuRunner: | |||
422 | return False | 430 | return False |
423 | 431 | ||
424 | def is_alive(self): | 432 | def is_alive(self): |
425 | if not self.runqemu or self.runqemu.poll() is not None: | 433 | if not self.runqemu or self.runqemu.poll() is not None or self.runqemu_exited: |
426 | return False | 434 | return False |
427 | if os.path.isfile(self.qemu_pidfile): | 435 | if os.path.isfile(self.qemu_pidfile): |
428 | # when handling pidfile, qemu creates the file, stat it, lock it and then write to it | 436 | # when handling pidfile, qemu creates the file, stat it, lock it and then write to it |