summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/oeqa/selftest/cases/updater.py45
1 files changed, 43 insertions, 2 deletions
diff --git a/lib/oeqa/selftest/cases/updater.py b/lib/oeqa/selftest/cases/updater.py
index adb4061..a5072e8 100644
--- a/lib/oeqa/selftest/cases/updater.py
+++ b/lib/oeqa/selftest/cases/updater.py
@@ -504,14 +504,55 @@ class HsmTests(OESelftestTestCase):
504 504
505 verifyProvisioned(self, machine) 505 verifyProvisioned(self, machine)
506 506
507class SecondaryTests(OESelftestTestCase):
508 @classmethod
509 def setUpClass(cls):
510 super(SecondaryTests, cls).setUpClass()
511 logger = logging.getLogger("selftest")
512 logger.info('Running bitbake to build secondary-image')
513 bitbake('secondary-image')
514
515 def setUpLocal(self):
516 layer = "meta-updater-qemux86-64"
517 result = runCmd('bitbake-layers show-layers')
518 if re.search(layer, result.output) is None:
519 # Assume the directory layout for finding other layers. We could also
520 # make assumptions by using 'show-layers', but either way, if the
521 # layers we need aren't where we expect them, we are out of like.
522 path = os.path.abspath(os.path.dirname(__file__))
523 metadir = path + "/../../../../../"
524 self.meta_qemu = metadir + layer
525 runCmd('bitbake-layers add-layer "%s"' % self.meta_qemu)
526 else:
527 self.meta_qemu = None
528 self.append_config('MACHINE = "qemux86-64"')
529 self.append_config('SOTA_CLIENT_PROV = " aktualizr-auto-prov "')
530 self.qemu, self.s = qemu_launch(machine='qemux86-64', imagename='secondary-image')
531
532 def tearDownLocal(self):
533 qemu_terminate(self.s)
534 if self.meta_qemu:
535 runCmd('bitbake-layers remove-layer "%s"' % self.meta_qemu, ignore_status=True)
536
537 def qemu_command(self, command):
538 return qemu_send_command(self.qemu.ssh_port, command)
539
540 def test_secondary_present(self):
541 print('Checking aktualizr-secondary is present')
542 stdout, stderr, retcode = self.qemu_command('aktualizr-secondary --help')
543 self.assertEqual(retcode, 0, "Unable to run aktualizr-secondary --help")
544 self.assertEqual(stderr, b'', 'Error: ' + stderr.decode())
507 545
508def qemu_launch(efi=False, machine=None): 546def qemu_launch(efi=False, machine=None, imagename=None):
509 logger = logging.getLogger("selftest") 547 logger = logging.getLogger("selftest")
510 logger.info('Running bitbake to build core-image-minimal') 548 logger.info('Running bitbake to build core-image-minimal')
511 bitbake('core-image-minimal') 549 bitbake('core-image-minimal')
512 # Create empty object. 550 # Create empty object.
513 args = type('', (), {})() 551 args = type('', (), {})()
514 args.imagename = 'core-image-minimal' 552 if imagename:
553 args.imagename = imagename
554 else:
555 args.imagename = 'core-image-minimal'
515 args.mac = None 556 args.mac = None
516 # Could use DEPLOY_DIR_IMAGE here but it's already in the machine 557 # Could use DEPLOY_DIR_IMAGE here but it's already in the machine
517 # subdirectory. 558 # subdirectory.