summaryrefslogtreecommitdiffstats
path: root/lib/oeqa/selftest/cases/updater_minnowboard.py
diff options
context:
space:
mode:
authorLaurent Bonnans <laurent.bonnans@here.com>2019-03-19 16:45:34 +0100
committerLaurent Bonnans <laurent.bonnans@here.com>2019-03-20 14:13:41 +0100
commit8b98e1e0f908ef30f5a4459f2bd62442d2b6649b (patch)
tree59d17466158dbba27c0371294819fa52e94861e1 /lib/oeqa/selftest/cases/updater_minnowboard.py
parentececedcbd58a7cd04eea0a7faf7b04939536a555 (diff)
downloadmeta-updater-8b98e1e0f908ef30f5a4459f2bd62442d2b6649b.tar.gz
Split oe-selftests by target machines
To allow for more targeted testing Signed-off-by: Laurent Bonnans <laurent.bonnans@here.com>
Diffstat (limited to 'lib/oeqa/selftest/cases/updater_minnowboard.py')
-rw-r--r--lib/oeqa/selftest/cases/updater_minnowboard.py71
1 files changed, 71 insertions, 0 deletions
diff --git a/lib/oeqa/selftest/cases/updater_minnowboard.py b/lib/oeqa/selftest/cases/updater_minnowboard.py
new file mode 100644
index 0000000..97b2a86
--- /dev/null
+++ b/lib/oeqa/selftest/cases/updater_minnowboard.py
@@ -0,0 +1,71 @@
1import os
2import re
3from time import sleep
4
5from oeqa.selftest.case import OESelftestTestCase
6from oeqa.utils.commands import runCmd, bitbake, get_bb_var
7from testutils import qemu_launch, qemu_send_command, qemu_terminate, verifyProvisioned
8
9
10class MinnowTests(OESelftestTestCase):
11
12 def setUpLocal(self):
13 layer_intel = "meta-intel"
14 layer_minnow = "meta-updater-minnowboard"
15 result = runCmd('bitbake-layers show-layers')
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 luck.
19 path = os.path.abspath(os.path.dirname(__file__))
20 metadir = path + "/../../../../../"
21 if re.search(layer_intel, result.output) is None:
22 self.meta_intel = metadir + layer_intel
23 runCmd('bitbake-layers add-layer "%s"' % self.meta_intel)
24 else:
25 self.meta_intel = None
26 if re.search(layer_minnow, result.output) is None:
27 self.meta_minnow = metadir + layer_minnow
28 runCmd('bitbake-layers add-layer "%s"' % self.meta_minnow)
29 else:
30 self.meta_minnow = None
31 self.append_config('MACHINE = "intel-corei7-64"')
32 self.append_config('OSTREE_BOOTLOADER = "grub"')
33 self.append_config('SOTA_CLIENT_PROV = " aktualizr-auto-prov "')
34 self.qemu, self.s = qemu_launch(efi=True, machine='intel-corei7-64')
35
36 def tearDownLocal(self):
37 qemu_terminate(self.s)
38 if self.meta_intel:
39 runCmd('bitbake-layers remove-layer "%s"' % self.meta_intel, ignore_status=True)
40 if self.meta_minnow:
41 runCmd('bitbake-layers remove-layer "%s"' % self.meta_minnow, ignore_status=True)
42
43 def qemu_command(self, command):
44 return qemu_send_command(self.qemu.ssh_port, command)
45
46 def test_provisioning(self):
47 print('Checking machine name (hostname) of device:')
48 stdout, stderr, retcode = self.qemu_command('hostname')
49 self.assertEqual(retcode, 0, "Unable to check hostname. " +
50 "Is an ssh daemon (such as dropbear or openssh) installed on the device?")
51 machine = get_bb_var('MACHINE', 'core-image-minimal')
52 self.assertEqual(stderr, b'', 'Error: ' + stderr.decode())
53 # Strip off line ending.
54 value = stdout.decode()[:-1]
55 self.assertEqual(value, machine,
56 'MACHINE does not match hostname: ' + machine + ', ' + value +
57 '\nIs TianoCore ovmf installed on your host machine?')
58 print(value)
59 print('Checking output of aktualizr-info:')
60 ran_ok = False
61 for delay in [1, 2, 5, 10, 15]:
62 stdout, stderr, retcode = self.qemu_command('aktualizr-info')
63 if retcode == 0 and stderr == b'':
64 ran_ok = True
65 break
66 sleep(delay)
67 self.assertTrue(ran_ok, 'aktualizr-info failed: ' + stderr.decode() + stdout.decode())
68
69 verifyProvisioned(self, machine)
70
71# vim:set ts=4 sw=4 sts=4 expandtab: