summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Luck <ben+qa@advancedtelematic.com>2018-02-16 15:17:02 +0100
committerGitHub <noreply@github.com>2018-02-16 15:17:02 +0100
commit89fc3e0a978b7cfc37ec858600174e77a0b7113d (patch)
treefa4f11fe318f3bd1d003b68a8fdf7f6530010ec4
parent366af5da9829d4cfc4f92b7ad30610ecf72ae4c8 (diff)
parent2dbeaf315ff9cf8cce1d0a3276fd561163db6237 (diff)
downloadmeta-updater-89fc3e0a978b7cfc37ec858600174e77a0b7113d.tar.gz
Merge pull request #257 from advancedtelematic/test/oe-selftest-backport
Test/oe selftest backport
-rw-r--r--lib/oeqa/selftest/updater.py59
-rw-r--r--recipes-core/ovmf/files/0001-Compare-c-string-with-NULL-instead-of-a-literal.patch25
-rw-r--r--recipes-core/ovmf/ovmf_%.bbappend3
-rw-r--r--scripts/qemucommand.py2
4 files changed, 71 insertions, 18 deletions
diff --git a/lib/oeqa/selftest/updater.py b/lib/oeqa/selftest/updater.py
index f28349f..0962cb7 100644
--- a/lib/oeqa/selftest/updater.py
+++ b/lib/oeqa/selftest/updater.py
@@ -1,8 +1,9 @@
1import unittest 1# pylint: disable=C0111,C0325
2import os 2import os
3import logging 3import logging
4import subprocess 4import subprocess
5import time 5import unittest
6from time import sleep
6 7
7from oeqa.selftest.base import oeSelfTest 8from oeqa.selftest.base import oeSelfTest
8from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars 9from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars
@@ -49,11 +50,11 @@ class GeneralTests(oeSelfTest):
49 50
50 def test_feature_sota(self): 51 def test_feature_sota(self):
51 result = get_bb_var('DISTRO_FEATURES').find('sota') 52 result = get_bb_var('DISTRO_FEATURES').find('sota')
52 self.assertNotEqual(result, -1, 'Feature "sota" not set at DISTRO_FEATURES'); 53 self.assertNotEqual(result, -1, 'Feature "sota" not set at DISTRO_FEATURES')
53 54
54 def test_feature_systemd(self): 55 def test_feature_systemd(self):
55 result = get_bb_var('DISTRO_FEATURES').find('systemd') 56 result = get_bb_var('DISTRO_FEATURES').find('systemd')
56 self.assertNotEqual(result, -1, 'Feature "systemd" not set at DISTRO_FEATURES'); 57 self.assertNotEqual(result, -1, 'Feature "systemd" not set at DISTRO_FEATURES')
57 58
58 def test_credentials(self): 59 def test_credentials(self):
59 bitbake('core-image-minimal') 60 bitbake('core-image-minimal')
@@ -66,7 +67,8 @@ class GeneralTests(oeSelfTest):
66 deploydir = get_bb_var('DEPLOY_DIR_IMAGE') 67 deploydir = get_bb_var('DEPLOY_DIR_IMAGE')
67 imagename = get_bb_var('IMAGE_LINK_NAME', 'core-image-minimal') 68 imagename = get_bb_var('IMAGE_LINK_NAME', 'core-image-minimal')
68 # Check if the credentials are included in the output image 69 # Check if the credentials are included in the output image
69 result = runCmd('tar -jtvf %s/%s.tar.bz2 | grep sota_provisioning_credentials.zip' % (deploydir, imagename), ignore_status=True) 70 result = runCmd('tar -jtvf %s/%s.tar.bz2 | grep sota_provisioning_credentials.zip' %
71 (deploydir, imagename), ignore_status=True)
70 self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output) 72 self.assertEqual(result.status, 0, "Status not equal to 0. output: %s" % result.output)
71 73
72 def test_java(self): 74 def test_java(self):
@@ -99,7 +101,7 @@ class GeneralTests(oeSelfTest):
99 self.assertEqual(result.output, 'ERROR: Unable to find any package producing path /usr/bin/man') 101 self.assertEqual(result.output, 'ERROR: Unable to find any package producing path /usr/bin/man')
100 path2 = os.path.realpath(image_path) 102 path2 = os.path.realpath(image_path)
101 size2 = os.path.getsize(path2) 103 size2 = os.path.getsize(path2)
102 logger.info('Second image %s has size %i' % (path2, size2)) 104 logger.info('Second image %s has size %i', path2, size2)
103 self.assertNotEqual(path1, path2, "Image paths are identical; image was not rebuilt.") 105 self.assertNotEqual(path1, path2, "Image paths are identical; image was not rebuilt.")
104 self.assertNotEqual(size1, size2, "Image sizes are identical; image was not rebuilt.") 106 self.assertNotEqual(size1, size2, "Image sizes are identical; image was not rebuilt.")
105 107
@@ -114,14 +116,17 @@ class QemuTests(oeSelfTest):
114 def tearDownClass(cls): 116 def tearDownClass(cls):
115 qemu_terminate(cls.s) 117 qemu_terminate(cls.s)
116 118
119 def run_command(self, command):
120 return qemu_send_command(self.qemu.ssh_port, command)
121
117 def test_hostname(self): 122 def test_hostname(self):
118 print('') 123 print('')
119 print('Checking machine name (hostname) of device:') 124 print('Checking machine name (hostname) of device:')
120 value, err = qemu_send_command(self.qemu.ssh_port, 'hostname') 125 stdout, stderr, retcode = self.run_command('hostname')
121 machine = get_bb_var('MACHINE', 'core-image-minimal') 126 machine = get_bb_var('MACHINE', 'core-image-minimal')
122 self.assertEqual(err, b'', 'Error: ' + err.decode()) 127 self.assertEqual(stderr, b'', 'Error: ' + stderr.decode())
123 # Strip off line ending. 128 # Strip off line ending.
124 value_str = value.decode()[:-1] 129 value_str = stdout.decode()[:-1]
125 self.assertEqual(value_str, machine, 130 self.assertEqual(value_str, machine,
126 'MACHINE does not match hostname: ' + machine + ', ' + value_str) 131 'MACHINE does not match hostname: ' + machine + ', ' + value_str)
127 print(value_str) 132 print(value_str)
@@ -129,9 +134,26 @@ class QemuTests(oeSelfTest):
129 def test_var_sota(self): 134 def test_var_sota(self):
130 print('') 135 print('')
131 print('Checking contents of /var/sota:') 136 print('Checking contents of /var/sota:')
132 value, err = qemu_send_command(self.qemu.ssh_port, 'ls /var/sota') 137 stdout, stderr, retcode = self.run_command('ls /var/sota')
133 self.assertEqual(err, b'', 'Error: ' + err.decode()) 138 self.assertEqual(stderr, b'', 'Error: ' + stderr.decode())
134 print(value.decode()) 139 self.assertEqual(retcode, 0)
140 print(stdout.decode())
141
142 def test_aktualizr_info(self):
143 print('Checking output of aktualizr-info:')
144 ran_ok = False
145 for delay in [0, 1, 2, 5, 10, 15]:
146 sleep(delay)
147 try:
148 stdout, stderr, retcode = self.run_command('aktualizr-info')
149 if retcode == 0 and stderr == b'':
150 ran_ok = True
151 break
152 except IOError as e:
153 print(e)
154 if not ran_ok:
155 print(stdout.decode())
156 print(stderr.decode())
135 157
136class GrubTests(oeSelfTest): 158class GrubTests(oeSelfTest):
137 159
@@ -155,13 +177,15 @@ class GrubTests(oeSelfTest):
155 def test_grub(self): 177 def test_grub(self):
156 print('') 178 print('')
157 print('Checking machine name (hostname) of device:') 179 print('Checking machine name (hostname) of device:')
158 value, err = qemu_send_command(self.qemu.ssh_port, 'hostname') 180 value, err, retcode = qemu_send_command(self.qemu.ssh_port, 'hostname')
159 machine = get_bb_var('MACHINE', 'core-image-minimal') 181 machine = get_bb_var('MACHINE', 'core-image-minimal')
160 self.assertEqual(err, b'', 'Error: ' + err.decode()) 182 self.assertEqual(err, b'', 'Error: ' + err.decode())
183 self.assertEqual(retcode, 0)
161 # Strip off line ending. 184 # Strip off line ending.
162 value_str = value.decode()[:-1] 185 value_str = value.decode()[:-1]
163 self.assertEqual(value_str, machine, 186 self.assertEqual(value_str, machine,
164 'MACHINE does not match hostname: ' + machine + ', ' + value_str) 187 'MACHINE does not match hostname: ' + machine + ', ' + value_str +
188 '\nIs tianocore ovmf installed?')
165 print(value_str) 189 print(value_str)
166 190
167 191
@@ -189,7 +213,7 @@ def qemu_launch(efi=False, machine=None):
189 cmdline = qemu.command_line() 213 cmdline = qemu.command_line()
190 print('Booting image with run-qemu-ota...') 214 print('Booting image with run-qemu-ota...')
191 s = subprocess.Popen(cmdline) 215 s = subprocess.Popen(cmdline)
192 time.sleep(10) 216 sleep(10)
193 return qemu, s 217 return qemu, s
194 218
195def qemu_terminate(s): 219def qemu_terminate(s):
@@ -202,6 +226,7 @@ def qemu_send_command(port, command):
202 command = ['ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@localhost -p ' + 226 command = ['ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@localhost -p ' +
203 str(port) + ' "' + command + '"'] 227 str(port) + ' "' + command + '"']
204 s2 = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) 228 s2 = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
205 value, err = s2.communicate() 229 stdout, stderr = s2.communicate()
206 return value, err 230 return stdout, stderr, s2.returncode
207 231
232# vim:set ts=4 sw=4 sts=4 expandtab:
diff --git a/recipes-core/ovmf/files/0001-Compare-c-string-with-NULL-instead-of-a-literal.patch b/recipes-core/ovmf/files/0001-Compare-c-string-with-NULL-instead-of-a-literal.patch
new file mode 100644
index 0000000..6bdaf7e
--- /dev/null
+++ b/recipes-core/ovmf/files/0001-Compare-c-string-with-NULL-instead-of-a-literal.patch
@@ -0,0 +1,25 @@
1From 6c730f3da7490ffbba5ad17af29ca44ed167cbfc Mon Sep 17 00:00:00 2001
2From: Patrick Vacek <patrickvacek@gmail.com>
3Date: Tue, 13 Feb 2018 16:38:15 +0100
4Subject: [PATCH] Compare c-string with NULL instead of a literal.
5
6---
7 BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp | 2 +-
8 1 file changed, 1 insertion(+), 1 deletion(-)
9
10diff --git a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
11index 3ca57ed741..4fa066dd9f 100644
12--- a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
13+++ b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
14@@ -3372,7 +3372,7 @@ CVfrStringDB::GetVarStoreNameFormStringId (
15 UINT8 BlockType;
16 EFI_HII_STRING_PACKAGE_HDR *PkgHeader;
17
18- if (mStringFileName == '\0' ) {
19+ if (mStringFileName == NULL ) {
20 return NULL;
21 }
22
23--
242.14.1
25
diff --git a/recipes-core/ovmf/ovmf_%.bbappend b/recipes-core/ovmf/ovmf_%.bbappend
new file mode 100644
index 0000000..142fc53
--- /dev/null
+++ b/recipes-core/ovmf/ovmf_%.bbappend
@@ -0,0 +1,3 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
2
3SRC_URI_append = "file://0001-Compare-c-string-with-NULL-instead-of-a-literal.patch"
diff --git a/scripts/qemucommand.py b/scripts/qemucommand.py
index 9a893d8..7ae9381 100644
--- a/scripts/qemucommand.py
+++ b/scripts/qemucommand.py
@@ -96,7 +96,7 @@ class QemuCommand(object):
96 "-serial", "tcp:127.0.0.1:%d,server,nowait" % self.serial_port, 96 "-serial", "tcp:127.0.0.1:%d,server,nowait" % self.serial_port,
97 "-m", "1G", 97 "-m", "1G",
98 "-usb", 98 "-usb",
99 "-usbdevice", "tablet", 99 "-device", "usb-tablet",
100 "-show-cursor", 100 "-show-cursor",
101 "-vga", "std", 101 "-vga", "std",
102 "-net", netuser, 102 "-net", netuser,