diff options
author | Patrick Vacek <patrickvacek@gmail.com> | 2019-05-20 17:47:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-20 17:47:50 +0200 |
commit | cdf070e20556a13ecda308833fd5c314d20547ab (patch) | |
tree | f62f36ca4b7b2f26644f9d7f2fdb7e6fdee0154d /lib/oeqa/selftest/cases/updater_qemux86_64_ptest.py | |
parent | 195135f3d01fecc099bfec43d56b87c28c9aa8a0 (diff) | |
parent | 99992959999ce9f6ad5fdae5a96262a5e0e59b5e (diff) | |
download | meta-updater-cdf070e20556a13ecda308833fd5c314d20547ab.tar.gz |
Merge pull request #514 from advancedtelematic/fix/rocko/backport
Fix/rocko/backport
Diffstat (limited to 'lib/oeqa/selftest/cases/updater_qemux86_64_ptest.py')
-rw-r--r-- | lib/oeqa/selftest/cases/updater_qemux86_64_ptest.py | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/lib/oeqa/selftest/cases/updater_qemux86_64_ptest.py b/lib/oeqa/selftest/cases/updater_qemux86_64_ptest.py new file mode 100644 index 0000000..0f0f491 --- /dev/null +++ b/lib/oeqa/selftest/cases/updater_qemux86_64_ptest.py | |||
@@ -0,0 +1,52 @@ | |||
1 | # pylint: disable=C0111,C0325 | ||
2 | import os | ||
3 | import re | ||
4 | |||
5 | from oeqa.selftest.case import OESelftestTestCase | ||
6 | from oeqa.utils.commands import runCmd | ||
7 | from testutils import qemu_launch, qemu_send_command, qemu_terminate | ||
8 | |||
9 | |||
10 | class PtestTests(OESelftestTestCase): | ||
11 | |||
12 | def setUpLocal(self): | ||
13 | layer = "meta-updater-qemux86-64" | ||
14 | result = runCmd('bitbake-layers show-layers') | ||
15 | if re.search(layer, result.output) is None: | ||
16 | # Assume the directory layout for finding other layers. We could also | ||
17 | # make assumptions by using 'show-layers', but either way, if the | ||
18 | # layers we need aren't where we expect them, we are out of like. | ||
19 | path = os.path.abspath(os.path.dirname(__file__)) | ||
20 | metadir = path + "/../../../../../" | ||
21 | self.meta_qemu = metadir + layer | ||
22 | runCmd('bitbake-layers add-layer "%s"' % self.meta_qemu) | ||
23 | else: | ||
24 | self.meta_qemu = None | ||
25 | self.append_config('MACHINE = "qemux86-64"') | ||
26 | self.append_config('SYSTEMD_AUTO_ENABLE_aktualizr = "disable"') | ||
27 | self.append_config('PTEST_ENABLED_pn-aktualizr = "1"') | ||
28 | self.append_config('IMAGE_INSTALL_append += "aktualizr-ptest ptest-runner "') | ||
29 | self.qemu, self.s = qemu_launch(machine='qemux86-64') | ||
30 | |||
31 | def tearDownLocal(self): | ||
32 | qemu_terminate(self.s) | ||
33 | if self.meta_qemu: | ||
34 | runCmd('bitbake-layers remove-layer "%s"' % self.meta_qemu, ignore_status=True) | ||
35 | |||
36 | def qemu_command(self, command, timeout=60): | ||
37 | return qemu_send_command(self.qemu.ssh_port, command, timeout=timeout) | ||
38 | |||
39 | def test_run_ptests(self): | ||
40 | # simulate a login shell, so that /usr/sbin is in $PATH (from /etc/profile) | ||
41 | stdout, stderr, retcode = self.qemu_command('sh -l -c ptest-runner', timeout=None) | ||
42 | output = stdout.decode() | ||
43 | print(output) | ||
44 | |||
45 | has_failure = re.search('^FAIL', output, flags=re.MULTILINE) is not None | ||
46 | if has_failure: | ||
47 | print("Full test suite log:") | ||
48 | stdout, _, _ = self.qemu_command('cat /tmp/aktualizr-ptest.log || cat /tmp/aktualizr-ptest.log.tmp', timeout=None) | ||
49 | print(stdout.decode()) | ||
50 | |||
51 | self.assertEqual(retcode, 0) | ||
52 | self.assertFalse(has_failure) | ||