summaryrefslogtreecommitdiffstats
path: root/lib/oeqa/selftest/cases/updater_qemux86_64_ptest.py
diff options
context:
space:
mode:
authorPatrick Vacek <patrickvacek@gmail.com>2019-04-15 13:40:49 +0200
committerGitHub <noreply@github.com>2019-04-15 13:40:49 +0200
commit8cc72a845e34e46d232c070280f42b5b695560d7 (patch)
tree8bb8ee285865949722184c4e117c556f3083ad7f /lib/oeqa/selftest/cases/updater_qemux86_64_ptest.py
parent121bb090d7336c8a9180f9908fb011adda05f70c (diff)
parentff4ef176490bb9f6234a4ed475f1daaf8587c7f9 (diff)
downloadmeta-updater-8cc72a845e34e46d232c070280f42b5b695560d7.tar.gz
Merge pull request #508 from advancedtelematic/test/oe-selftest-ptest
Add oe-selftest for aktualizr ptest run on qemu
Diffstat (limited to 'lib/oeqa/selftest/cases/updater_qemux86_64_ptest.py')
-rw-r--r--lib/oeqa/selftest/cases/updater_qemux86_64_ptest.py52
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..a04032c
--- /dev/null
+++ b/lib/oeqa/selftest/cases/updater_qemux86_64_ptest.py
@@ -0,0 +1,52 @@
1# pylint: disable=C0111,C0325
2import os
3import re
4
5from oeqa.selftest.case import OESelftestTestCase
6from oeqa.utils.commands import runCmd
7from testutils import qemu_launch, qemu_send_command, qemu_terminate
8
9
10class 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 self.assertEqual(retcode, 0)
45
46 has_failure = re.search('^FAIL', output, flags=re.MULTILINE) is not None
47 if has_failure:
48 print("Full test suite log:")
49 stdout, stderr, retcode = self.qemu_command('cat /tmp/aktualizr-ptest.log', timeout=None)
50 print(stdout.decode())
51
52 self.assertFalse(has_failure)