diff options
author | Patrick Vacek <patrickvacek@gmail.com> | 2019-05-02 14:25:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-02 14:25:25 +0200 |
commit | 438814dec075da891ed37a57c8b5138b43f56818 (patch) | |
tree | db8d7522d1f46d2048d290e82a1205b5e302ad17 /lib/oeqa/selftest/cases/updater_minnowboard.py | |
parent | 2d2e46834af68b1c22ad0a022001c117caa4929c (diff) | |
parent | 180f7c764ae9dbe85bfd281f62f6086cf95e5b7a (diff) | |
download | meta-updater-438814dec075da891ed37a57c8b5138b43f56818.tar.gz |
Merge pull request #513 from advancedtelematic/fix/thud/backport
Fix/thud/backport
Diffstat (limited to 'lib/oeqa/selftest/cases/updater_minnowboard.py')
-rw-r--r-- | lib/oeqa/selftest/cases/updater_minnowboard.py | 60 |
1 files changed, 60 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..f5df584 --- /dev/null +++ b/lib/oeqa/selftest/cases/updater_minnowboard.py | |||
@@ -0,0 +1,60 @@ | |||
1 | import os | ||
2 | import re | ||
3 | |||
4 | from oeqa.selftest.case import OESelftestTestCase | ||
5 | from oeqa.utils.commands import runCmd, get_bb_var | ||
6 | from testutils import qemu_launch, qemu_send_command, qemu_terminate, verifyProvisioned | ||
7 | |||
8 | |||
9 | class MinnowTests(OESelftestTestCase): | ||
10 | |||
11 | def setUpLocal(self): | ||
12 | layer_intel = "meta-intel" | ||
13 | layer_minnow = "meta-updater-minnowboard" | ||
14 | result = runCmd('bitbake-layers show-layers') | ||
15 | # Assume the directory layout for finding other layers. We could also | ||
16 | # make assumptions by using 'show-layers', but either way, if the | ||
17 | # layers we need aren't where we expect them, we are out of luck. | ||
18 | path = os.path.abspath(os.path.dirname(__file__)) | ||
19 | metadir = path + "/../../../../../" | ||
20 | if re.search(layer_intel, result.output) is None: | ||
21 | self.meta_intel = metadir + layer_intel | ||
22 | runCmd('bitbake-layers add-layer "%s"' % self.meta_intel) | ||
23 | else: | ||
24 | self.meta_intel = None | ||
25 | if re.search(layer_minnow, result.output) is None: | ||
26 | self.meta_minnow = metadir + layer_minnow | ||
27 | runCmd('bitbake-layers add-layer "%s"' % self.meta_minnow) | ||
28 | else: | ||
29 | self.meta_minnow = None | ||
30 | self.append_config('MACHINE = "intel-corei7-64"') | ||
31 | self.append_config('OSTREE_BOOTLOADER = "grub"') | ||
32 | self.append_config('SOTA_CLIENT_PROV = " aktualizr-auto-prov "') | ||
33 | self.qemu, self.s = qemu_launch(efi=True, machine='intel-corei7-64') | ||
34 | |||
35 | def tearDownLocal(self): | ||
36 | qemu_terminate(self.s) | ||
37 | if self.meta_intel: | ||
38 | runCmd('bitbake-layers remove-layer "%s"' % self.meta_intel, ignore_status=True) | ||
39 | if self.meta_minnow: | ||
40 | runCmd('bitbake-layers remove-layer "%s"' % self.meta_minnow, ignore_status=True) | ||
41 | |||
42 | def qemu_command(self, command): | ||
43 | return qemu_send_command(self.qemu.ssh_port, command) | ||
44 | |||
45 | def test_provisioning(self): | ||
46 | print('Checking machine name (hostname) of device:') | ||
47 | stdout, stderr, retcode = self.qemu_command('hostname') | ||
48 | self.assertEqual(retcode, 0, "Unable to check hostname. " + | ||
49 | "Is an ssh daemon (such as dropbear or openssh) installed on the device?") | ||
50 | machine = get_bb_var('MACHINE', 'core-image-minimal') | ||
51 | self.assertEqual(stderr, b'', 'Error: ' + stderr.decode()) | ||
52 | # Strip off line ending. | ||
53 | value = stdout.decode()[:-1] | ||
54 | self.assertEqual(value, machine, | ||
55 | 'MACHINE does not match hostname: ' + machine + ', ' + value + | ||
56 | '\nIs TianoCore ovmf installed on your host machine?') | ||
57 | |||
58 | verifyProvisioned(self, machine) | ||
59 | |||
60 | # vim:set ts=4 sw=4 sts=4 expandtab: | ||