summaryrefslogtreecommitdiffstats
path: root/lib/oeqa/selftest/cases/updater.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/oeqa/selftest/cases/updater.py')
-rw-r--r--lib/oeqa/selftest/cases/updater.py27
1 files changed, 19 insertions, 8 deletions
diff --git a/lib/oeqa/selftest/cases/updater.py b/lib/oeqa/selftest/cases/updater.py
index e459ffb..2efef15 100644
--- a/lib/oeqa/selftest/cases/updater.py
+++ b/lib/oeqa/selftest/cases/updater.py
@@ -150,6 +150,8 @@ class AutoProvTests(OESelftestTestCase):
150 self.meta_qemu = None 150 self.meta_qemu = None
151 self.append_config('MACHINE = "qemux86-64"') 151 self.append_config('MACHINE = "qemux86-64"')
152 self.append_config('SOTA_CLIENT_PROV = " aktualizr-auto-prov "') 152 self.append_config('SOTA_CLIENT_PROV = " aktualizr-auto-prov "')
153 # Test aktualizr-example-interface package.
154 self.append_config('IMAGE_INSTALL_append = " aktualizr-examples aktualizr-example-interface "')
153 self.qemu, self.s = qemu_launch(machine='qemux86-64') 155 self.qemu, self.s = qemu_launch(machine='qemux86-64')
154 156
155 def tearDownLocal(self): 157 def tearDownLocal(self):
@@ -174,15 +176,21 @@ class AutoProvTests(OESelftestTestCase):
174 print(value) 176 print(value)
175 print('Checking output of aktualizr-info:') 177 print('Checking output of aktualizr-info:')
176 ran_ok = False 178 ran_ok = False
177 for delay in [0, 1, 2, 5, 10, 15]: 179 for delay in [1, 2, 5, 10, 15]:
178 sleep(delay)
179 stdout, stderr, retcode = self.qemu_command('aktualizr-info') 180 stdout, stderr, retcode = self.qemu_command('aktualizr-info')
180 if retcode == 0 and stderr == b'': 181 if retcode == 0 and stderr == b'':
181 ran_ok = True 182 ran_ok = True
182 break 183 break
184 sleep(delay)
183 self.assertTrue(ran_ok, 'aktualizr-info failed: ' + stderr.decode() + stdout.decode()) 185 self.assertTrue(ran_ok, 'aktualizr-info failed: ' + stderr.decode() + stdout.decode())
184 186
185 verifyProvisioned(self, machine) 187 verifyProvisioned(self, machine)
188 # Test aktualizr-example-interface package.
189 stdout, stderr, retcode = self.qemu_command('aktualizr-info')
190 self.assertIn(b'hardware ID: example1', stdout,
191 'Legacy secondary initialization failed: ' + stderr.decode() + stdout.decode())
192 self.assertIn(b'hardware ID: example2', stdout,
193 'Legacy secondary initialization failed: ' + stderr.decode() + stdout.decode())
186 194
187 195
188class RpiTests(OESelftestTestCase): 196class RpiTests(OESelftestTestCase):
@@ -312,12 +320,12 @@ class GrubTests(OESelftestTestCase):
312 print(value) 320 print(value)
313 print('Checking output of aktualizr-info:') 321 print('Checking output of aktualizr-info:')
314 ran_ok = False 322 ran_ok = False
315 for delay in [0, 1, 2, 5, 10, 15]: 323 for delay in [1, 2, 5, 10, 15]:
316 sleep(delay)
317 stdout, stderr, retcode = self.qemu_command('aktualizr-info') 324 stdout, stderr, retcode = self.qemu_command('aktualizr-info')
318 if retcode == 0 and stderr == b'': 325 if retcode == 0 and stderr == b'':
319 ran_ok = True 326 ran_ok = True
320 break 327 break
328 sleep(delay)
321 self.assertTrue(ran_ok, 'aktualizr-info failed: ' + stderr.decode() + stdout.decode()) 329 self.assertTrue(ran_ok, 'aktualizr-info failed: ' + stderr.decode() + stdout.decode())
322 330
323 verifyProvisioned(self, machine) 331 verifyProvisioned(self, machine)
@@ -364,11 +372,12 @@ class ImplProvTests(OESelftestTestCase):
364 print(value) 372 print(value)
365 print('Checking output of aktualizr-info:') 373 print('Checking output of aktualizr-info:')
366 ran_ok = False 374 ran_ok = False
367 for delay in [0, 1, 2, 5, 10, 15]: 375 for delay in [1, 2, 5, 10, 15]:
368 stdout, stderr, retcode = self.qemu_command('aktualizr-info') 376 stdout, stderr, retcode = self.qemu_command('aktualizr-info')
369 if retcode == 0 and stderr == b'': 377 if retcode == 0 and stderr == b'':
370 ran_ok = True 378 ran_ok = True
371 break 379 break
380 sleep(delay)
372 self.assertTrue(ran_ok, 'aktualizr-info failed: ' + stderr.decode() + stdout.decode()) 381 self.assertTrue(ran_ok, 'aktualizr-info failed: ' + stderr.decode() + stdout.decode())
373 # Verify that device has NOT yet provisioned. 382 # Verify that device has NOT yet provisioned.
374 self.assertIn(b'Couldn\'t load device ID', stdout, 383 self.assertIn(b'Couldn\'t load device ID', stdout,
@@ -435,11 +444,12 @@ class HsmTests(OESelftestTestCase):
435 print(value) 444 print(value)
436 print('Checking output of aktualizr-info:') 445 print('Checking output of aktualizr-info:')
437 ran_ok = False 446 ran_ok = False
438 for delay in [0, 1, 2, 5, 10, 15]: 447 for delay in [1, 2, 5, 10, 15]:
439 stdout, stderr, retcode = self.qemu_command('aktualizr-info') 448 stdout, stderr, retcode = self.qemu_command('aktualizr-info')
440 if retcode == 0 and stderr == b'': 449 if retcode == 0 and stderr == b'':
441 ran_ok = True 450 ran_ok = True
442 break 451 break
452 sleep(delay)
443 self.assertTrue(ran_ok, 'aktualizr-info failed: ' + stderr.decode() + stdout.decode()) 453 self.assertTrue(ran_ok, 'aktualizr-info failed: ' + stderr.decode() + stdout.decode())
444 # Verify that device has NOT yet provisioned. 454 # Verify that device has NOT yet provisioned.
445 self.assertIn(b'Couldn\'t load device ID', stdout, 455 self.assertIn(b'Couldn\'t load device ID', stdout,
@@ -589,6 +599,7 @@ class PrimaryTests(OESelftestTestCase):
589 self.assertEqual(retcode, 0, "Unable to run aktualizr --help") 599 self.assertEqual(retcode, 0, "Unable to run aktualizr --help")
590 self.assertEqual(stderr, b'', 'Error: ' + stderr.decode()) 600 self.assertEqual(stderr, b'', 'Error: ' + stderr.decode())
591 601
602
592def qemu_launch(efi=False, machine=None, imagename=None): 603def qemu_launch(efi=False, machine=None, imagename=None):
593 logger = logging.getLogger("selftest") 604 logger = logging.getLogger("selftest")
594 logger.info('Running bitbake to build core-image-minimal') 605 logger.info('Running bitbake to build core-image-minimal')
@@ -660,12 +671,12 @@ def akt_native_run(testInst, cmd, **kwargs):
660def verifyProvisioned(testInst, machine): 671def verifyProvisioned(testInst, machine):
661 # Verify that device HAS provisioned. 672 # Verify that device HAS provisioned.
662 ran_ok = False 673 ran_ok = False
663 for delay in [5, 5, 5, 5, 10]: 674 for delay in [5, 5, 5, 5, 10, 10, 10, 10]:
664 sleep(delay)
665 stdout, stderr, retcode = testInst.qemu_command('aktualizr-info') 675 stdout, stderr, retcode = testInst.qemu_command('aktualizr-info')
666 if retcode == 0 and stderr == b'' and stdout.decode().find('Fetched metadata: yes') >= 0: 676 if retcode == 0 and stderr == b'' and stdout.decode().find('Fetched metadata: yes') >= 0:
667 ran_ok = True 677 ran_ok = True
668 break 678 break
679 sleep(delay)
669 testInst.assertIn(b'Device ID: ', stdout, 'Provisioning failed: ' + stderr.decode() + stdout.decode()) 680 testInst.assertIn(b'Device ID: ', stdout, 'Provisioning failed: ' + stderr.decode() + stdout.decode())
670 testInst.assertIn(b'Primary ecu hardware ID: ' + machine.encode(), stdout, 681 testInst.assertIn(b'Primary ecu hardware ID: ' + machine.encode(), stdout,
671 'Provisioning failed: ' + stderr.decode() + stdout.decode()) 682 'Provisioning failed: ' + stderr.decode() + stdout.decode())