diff options
author | Patrick Vacek <patrickvacek@gmail.com> | 2018-02-28 11:23:07 +0100 |
---|---|---|
committer | Patrick Vacek <patrickvacek@gmail.com> | 2018-04-12 12:21:06 +0200 |
commit | 3d20655edde35ba4b9913b26b92d68ecefb4280b (patch) | |
tree | d5e7363e24738cd13a0ce6014aea7d89a231b5d7 | |
parent | fc4939673066b28c0a856538028109fc4ffbc96f (diff) | |
download | meta-updater-3d20655edde35ba4b9913b26b92d68ecefb4280b.tar.gz |
Add qemu layer for qemu tests if not present.
The layers required for the grub test are now also only added if not
already present.
This should make the tests runnable from an environment configured for
raspberry pi.
Cherry-pick of 0fb122d88290a7476d694547f4d05a15d5ec38d1 from rocko.
-rw-r--r-- | lib/oeqa/selftest/updater.py | 61 |
1 files changed, 53 insertions, 8 deletions
diff --git a/lib/oeqa/selftest/updater.py b/lib/oeqa/selftest/updater.py index 1b51c1a..6c0d31e 100644 --- a/lib/oeqa/selftest/updater.py +++ b/lib/oeqa/selftest/updater.py | |||
@@ -137,10 +137,22 @@ class AutoProvTests(oeSelfTest): | |||
137 | def setUpLocal(self): | 137 | def setUpLocal(self): |
138 | self.append_config('MACHINE = "qemux86-64"') | 138 | self.append_config('MACHINE = "qemux86-64"') |
139 | self.append_config('SOTA_CLIENT_PROV = " aktualizr-auto-prov "') | 139 | self.append_config('SOTA_CLIENT_PROV = " aktualizr-auto-prov "') |
140 | layer = "meta-updater-qemux86-64" | ||
141 | result = runCmd('bitbake-layers show-layers') | ||
142 | if re.search(layer, result.output) is None: | ||
143 | # This is a bit of a hack but I can't see a better option. | ||
144 | path = os.path.abspath(os.path.dirname(__file__)) | ||
145 | metadir = path + "/../../../../" | ||
146 | self.meta_qemu = metadir + layer | ||
147 | runCmd('bitbake-layers add-layer "%s"' % self.meta_qemu) | ||
148 | else: | ||
149 | self.meta_qemu = None | ||
140 | self.qemu, self.s = qemu_launch(machine='qemux86-64') | 150 | self.qemu, self.s = qemu_launch(machine='qemux86-64') |
141 | 151 | ||
142 | def tearDownLocal(self): | 152 | def tearDownLocal(self): |
143 | qemu_terminate(self.s) | 153 | qemu_terminate(self.s) |
154 | if self.meta_qemu: | ||
155 | runCmd('bitbake-layers remove-layer "%s"' % self.meta_qemu, ignore_status=True) | ||
144 | 156 | ||
145 | def qemu_command(self, command): | 157 | def qemu_command(self, command): |
146 | return qemu_send_command(self.qemu.ssh_port, command) | 158 | return qemu_send_command(self.qemu.ssh_port, command) |
@@ -176,19 +188,30 @@ class GrubTests(oeSelfTest): | |||
176 | self.append_config('MACHINE = "intel-corei7-64"') | 188 | self.append_config('MACHINE = "intel-corei7-64"') |
177 | self.append_config('OSTREE_BOOTLOADER = "grub"') | 189 | self.append_config('OSTREE_BOOTLOADER = "grub"') |
178 | self.append_config('SOTA_CLIENT_PROV = " aktualizr-auto-prov "') | 190 | self.append_config('SOTA_CLIENT_PROV = " aktualizr-auto-prov "') |
191 | layer_intel = "meta-intel" | ||
192 | layer_minnow = "meta-updater-minnowboard" | ||
193 | result = runCmd('bitbake-layers show-layers') | ||
179 | # This is a bit of a hack but I can't see a better option. | 194 | # This is a bit of a hack but I can't see a better option. |
180 | path = os.path.abspath(os.path.dirname(__file__)) | 195 | path = os.path.abspath(os.path.dirname(__file__)) |
181 | metadir = path + "/../../../../" | 196 | metadir = path + "/../../../../" |
182 | self.meta_intel = metadir + "meta-intel" | 197 | if re.search(layer_intel, result.output) is None: |
183 | self.meta_minnow = metadir + "meta-updater-minnowboard" | 198 | self.meta_intel = metadir + layer_intel |
184 | runCmd('bitbake-layers add-layer "%s"' % self.meta_intel) | 199 | runCmd('bitbake-layers add-layer "%s"' % self.meta_intel) |
185 | runCmd('bitbake-layers add-layer "%s"' % self.meta_minnow) | 200 | else: |
201 | self.meta_intel = None | ||
202 | if re.search(layer_minnow, result.output) is None: | ||
203 | self.meta_minnow = metadir + layer_minnow | ||
204 | runCmd('bitbake-layers add-layer "%s"' % self.meta_minnow) | ||
205 | else: | ||
206 | self.meta_minnow = None | ||
186 | self.qemu, self.s = qemu_launch(efi=True, machine='intel-corei7-64') | 207 | self.qemu, self.s = qemu_launch(efi=True, machine='intel-corei7-64') |
187 | 208 | ||
188 | def tearDownLocal(self): | 209 | def tearDownLocal(self): |
189 | qemu_terminate(self.s) | 210 | qemu_terminate(self.s) |
190 | runCmd('bitbake-layers remove-layer "%s"' % self.meta_intel, ignore_status=True) | 211 | if self.meta_intel: |
191 | runCmd('bitbake-layers remove-layer "%s"' % self.meta_minnow, ignore_status=True) | 212 | runCmd('bitbake-layers remove-layer "%s"' % self.meta_intel, ignore_status=True) |
213 | if self.meta_minnow: | ||
214 | runCmd('bitbake-layers remove-layer "%s"' % self.meta_minnow, ignore_status=True) | ||
192 | 215 | ||
193 | def qemu_command(self, command): | 216 | def qemu_command(self, command): |
194 | return qemu_send_command(self.qemu.ssh_port, command) | 217 | return qemu_send_command(self.qemu.ssh_port, command) |
@@ -225,11 +248,22 @@ class ImplProvTests(oeSelfTest): | |||
225 | def setUpLocal(self): | 248 | def setUpLocal(self): |
226 | self.append_config('MACHINE = "qemux86-64"') | 249 | self.append_config('MACHINE = "qemux86-64"') |
227 | self.append_config('SOTA_CLIENT_PROV = " aktualizr-implicit-prov "') | 250 | self.append_config('SOTA_CLIENT_PROV = " aktualizr-implicit-prov "') |
228 | # note: this will build aktualizr-native as a side-effect | 251 | layer = "meta-updater-qemux86-64" |
252 | result = runCmd('bitbake-layers show-layers') | ||
253 | if re.search(layer, result.output) is None: | ||
254 | # This is a bit of a hack but I can't see a better option. | ||
255 | path = os.path.abspath(os.path.dirname(__file__)) | ||
256 | metadir = path + "/../../../../" | ||
257 | self.meta_qemu = metadir + layer | ||
258 | runCmd('bitbake-layers add-layer "%s"' % self.meta_qemu) | ||
259 | else: | ||
260 | self.meta_qemu = None | ||
229 | self.qemu, self.s = qemu_launch(machine='qemux86-64') | 261 | self.qemu, self.s = qemu_launch(machine='qemux86-64') |
230 | 262 | ||
231 | def tearDownLocal(self): | 263 | def tearDownLocal(self): |
232 | qemu_terminate(self.s) | 264 | qemu_terminate(self.s) |
265 | if self.meta_qemu: | ||
266 | runCmd('bitbake-layers remove-layer "%s"' % self.meta_qemu, ignore_status=True) | ||
233 | 267 | ||
234 | def qemu_command(self, command): | 268 | def qemu_command(self, command): |
235 | return qemu_send_command(self.qemu.ssh_port, command) | 269 | return qemu_send_command(self.qemu.ssh_port, command) |
@@ -282,11 +316,22 @@ class HsmTests(oeSelfTest): | |||
282 | self.append_config('MACHINE = "qemux86-64"') | 316 | self.append_config('MACHINE = "qemux86-64"') |
283 | self.append_config('SOTA_CLIENT_PROV = "aktualizr-hsm-prov"') | 317 | self.append_config('SOTA_CLIENT_PROV = "aktualizr-hsm-prov"') |
284 | self.append_config('SOTA_CLIENT_FEATURES = "hsm"') | 318 | self.append_config('SOTA_CLIENT_FEATURES = "hsm"') |
285 | # note: this will build aktualizr-native as a side-effect | 319 | layer = "meta-updater-qemux86-64" |
320 | result = runCmd('bitbake-layers show-layers') | ||
321 | if re.search(layer, result.output) is None: | ||
322 | # This is a bit of a hack but I can't see a better option. | ||
323 | path = os.path.abspath(os.path.dirname(__file__)) | ||
324 | metadir = path + "/../../../../" | ||
325 | self.meta_qemu = metadir + layer | ||
326 | runCmd('bitbake-layers add-layer "%s"' % self.meta_qemu) | ||
327 | else: | ||
328 | self.meta_qemu = None | ||
286 | self.qemu, self.s = qemu_launch(machine='qemux86-64') | 329 | self.qemu, self.s = qemu_launch(machine='qemux86-64') |
287 | 330 | ||
288 | def tearDownLocal(self): | 331 | def tearDownLocal(self): |
289 | qemu_terminate(self.s) | 332 | qemu_terminate(self.s) |
333 | if self.meta_qemu: | ||
334 | runCmd('bitbake-layers remove-layer "%s"' % self.meta_qemu, ignore_status=True) | ||
290 | 335 | ||
291 | def qemu_command(self, command): | 336 | def qemu_command(self, command): |
292 | return qemu_send_command(self.qemu.ssh_port, command) | 337 | return qemu_send_command(self.qemu.ssh_port, command) |