summaryrefslogtreecommitdiffstats
path: root/lib/oeqa/selftest
diff options
context:
space:
mode:
Diffstat (limited to 'lib/oeqa/selftest')
-rw-r--r--lib/oeqa/selftest/cases/updater.py50
1 files changed, 48 insertions, 2 deletions
diff --git a/lib/oeqa/selftest/cases/updater.py b/lib/oeqa/selftest/cases/updater.py
index adb4061..1850d98 100644
--- a/lib/oeqa/selftest/cases/updater.py
+++ b/lib/oeqa/selftest/cases/updater.py
@@ -504,14 +504,60 @@ 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())
545
546 def test_secondary_listening(self):
547 print('Checking aktualizr-secondary is present')
548 stdout, stderr, retcode = self.qemu_command('echo test | nc localhost 9030')
549 self.assertEqual(retcode, 0, "Unable to connect to secondary")
507 550
508def qemu_launch(efi=False, machine=None): 551def qemu_launch(efi=False, machine=None, imagename=None):
509 logger = logging.getLogger("selftest") 552 logger = logging.getLogger("selftest")
510 logger.info('Running bitbake to build core-image-minimal') 553 logger.info('Running bitbake to build core-image-minimal')
511 bitbake('core-image-minimal') 554 bitbake('core-image-minimal')
512 # Create empty object. 555 # Create empty object.
513 args = type('', (), {})() 556 args = type('', (), {})()
514 args.imagename = 'core-image-minimal' 557 if imagename:
558 args.imagename = imagename
559 else:
560 args.imagename = 'core-image-minimal'
515 args.mac = None 561 args.mac = None
516 # Could use DEPLOY_DIR_IMAGE here but it's already in the machine 562 # Could use DEPLOY_DIR_IMAGE here but it's already in the machine
517 # subdirectory. 563 # subdirectory.