1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
import os
import re
from oeqa.selftest.case import OESelftestTestCase
from oeqa.utils.commands import runCmd, get_bb_var
from testutils import qemu_launch, qemu_send_command, qemu_terminate, verifyProvisioned
class MinnowTests(OESelftestTestCase):
def setUpLocal(self):
layer_intel = "meta-intel"
layer_minnow = "meta-updater-minnowboard"
result = runCmd('bitbake-layers show-layers')
# Assume the directory layout for finding other layers. We could also
# make assumptions by using 'show-layers', but either way, if the
# layers we need aren't where we expect them, we are out of luck.
path = os.path.abspath(os.path.dirname(__file__))
metadir = path + "/../../../../../"
if re.search(layer_intel, result.output) is None:
self.meta_intel = metadir + layer_intel
runCmd('bitbake-layers add-layer "%s"' % self.meta_intel)
else:
self.meta_intel = None
if re.search(layer_minnow, result.output) is None:
self.meta_minnow = metadir + layer_minnow
runCmd('bitbake-layers add-layer "%s"' % self.meta_minnow)
else:
self.meta_minnow = None
self.append_config('MACHINE = "intel-corei7-64"')
self.append_config('OSTREE_BOOTLOADER = "grub"')
self.append_config('SOTA_CLIENT_PROV = " aktualizr-shared-prov "')
self.qemu, self.s = qemu_launch(efi=True, machine='intel-corei7-64')
def tearDownLocal(self):
qemu_terminate(self.s)
if self.meta_intel:
runCmd('bitbake-layers remove-layer "%s"' % self.meta_intel, ignore_status=True)
if self.meta_minnow:
runCmd('bitbake-layers remove-layer "%s"' % self.meta_minnow, ignore_status=True)
def qemu_command(self, command):
return qemu_send_command(self.qemu.ssh_port, command)
def test_provisioning(self):
print('Checking machine name (hostname) of device:')
stdout, stderr, retcode = self.qemu_command('hostname')
self.assertEqual(retcode, 0, "Unable to check hostname. " +
"Is an ssh daemon (such as dropbear or openssh) installed on the device?")
machine = get_bb_var('MACHINE', 'core-image-minimal')
self.assertEqual(stderr, b'', 'Error: ' + stderr.decode())
# Strip off line ending.
value = stdout.decode()[:-1]
self.assertEqual(value, machine,
'MACHINE does not match hostname: ' + machine + ', ' + value +
'\nIs TianoCore ovmf installed on your host machine?')
verifyProvisioned(self, machine)
# vim:set ts=4 sw=4 sts=4 expandtab:
|