diff options
author | Patrick Vacek <patrickvacek@gmail.com> | 2017-11-17 14:11:10 +0100 |
---|---|---|
committer | Patrick Vacek <patrickvacek@gmail.com> | 2017-11-17 14:11:10 +0100 |
commit | 495a4a4ec6d540e1045852bc92ef46aa6a6bd9d9 (patch) | |
tree | 9d1d6988a69864d3038b6750a433bf76fbb91149 /lib | |
parent | 8da7de18c9b5a84bd594220121d9ab324427d057 (diff) | |
download | meta-updater-495a4a4ec6d540e1045852bc92ef46aa6a6bd9d9.tar.gz |
Test booting with grub.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/oeqa/selftest/updater.py | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/lib/oeqa/selftest/updater.py b/lib/oeqa/selftest/updater.py index 408f2c3..e3d4fc3 100644 --- a/lib/oeqa/selftest/updater.py +++ b/lib/oeqa/selftest/updater.py | |||
@@ -118,7 +118,7 @@ class QemuTests(oeSelfTest): | |||
118 | 118 | ||
119 | @classmethod | 119 | @classmethod |
120 | def setUpClass(cls): | 120 | def setUpClass(cls): |
121 | cls.qemu, cls.s = qemu_launch() | 121 | cls.qemu, cls.s = qemu_launch(machine='qemux86-64') |
122 | 122 | ||
123 | @classmethod | 123 | @classmethod |
124 | def tearDownClass(cls): | 124 | def tearDownClass(cls): |
@@ -143,8 +143,39 @@ class QemuTests(oeSelfTest): | |||
143 | self.assertEqual(err, b'', 'Error: ' + err.decode()) | 143 | self.assertEqual(err, b'', 'Error: ' + err.decode()) |
144 | print(value.decode()) | 144 | print(value.decode()) |
145 | 145 | ||
146 | class GrubTests(oeSelfTest): | ||
147 | |||
148 | def setUpLocal(self): | ||
149 | # This is a bit of a hack but I can't see a better option. | ||
150 | path = os.path.abspath(os.path.dirname(__file__)) | ||
151 | metadir = path + "/../../../../" | ||
152 | grub_config = 'OSTREE_BOOTLOADER = "grub"\nMACHINE = "intel-corei7-64"' | ||
153 | self.append_config(grub_config) | ||
154 | self.meta_intel = metadir + "meta-intel" | ||
155 | self.meta_minnow = metadir + "meta-updater-minnowboard" | ||
156 | runCmd('bitbake-layers add-layer "%s"' % self.meta_intel) | ||
157 | runCmd('bitbake-layers add-layer "%s"' % self.meta_minnow) | ||
158 | self.qemu, self.s = qemu_launch(efi=True, machine='intel-corei7-64') | ||
159 | |||
160 | def tearDownLocal(self): | ||
161 | qemu_terminate(self.s) | ||
162 | runCmd('bitbake-layers remove-layer "%s"' % self.meta_intel, ignore_status=True) | ||
163 | runCmd('bitbake-layers remove-layer "%s"' % self.meta_minnow, ignore_status=True) | ||
164 | |||
165 | def test_grub(self): | ||
166 | print('') | ||
167 | print('Checking machine name (hostname) of device:') | ||
168 | value, err = qemu_send_command(self.qemu.ssh_port, 'hostname') | ||
169 | machine = get_bb_var('MACHINE', 'core-image-minimal') | ||
170 | self.assertEqual(err, b'', 'Error: ' + err.decode()) | ||
171 | # Strip off line ending. | ||
172 | value_str = value.decode()[:-1] | ||
173 | self.assertEqual(value_str, machine, | ||
174 | 'MACHINE does not match hostname: ' + machine + ', ' + value_str) | ||
175 | print(value_str) | ||
176 | |||
146 | 177 | ||
147 | def qemu_launch(): | 178 | def qemu_launch(efi=False, machine=None): |
148 | logger = logging.getLogger("selftest") | 179 | logger = logging.getLogger("selftest") |
149 | logger.info('Running bitbake to build core-image-minimal') | 180 | logger.info('Running bitbake to build core-image-minimal') |
150 | bitbake('core-image-minimal') | 181 | bitbake('core-image-minimal') |
@@ -155,8 +186,8 @@ def qemu_launch(): | |||
155 | # Could use DEPLOY_DIR_IMAGE here but it's already in the machine | 186 | # Could use DEPLOY_DIR_IMAGE here but it's already in the machine |
156 | # subdirectory. | 187 | # subdirectory. |
157 | args.dir = 'tmp/deploy/images' | 188 | args.dir = 'tmp/deploy/images' |
158 | args.efi = False | 189 | args.efi = efi |
159 | args.machine = None | 190 | args.machine = machine |
160 | args.kvm = None # Autodetect | 191 | args.kvm = None # Autodetect |
161 | args.no_gui = True | 192 | args.no_gui = True |
162 | args.gdb = False | 193 | args.gdb = False |