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.py30
1 files changed, 20 insertions, 10 deletions
diff --git a/lib/oeqa/selftest/cases/updater.py b/lib/oeqa/selftest/cases/updater.py
index e4b2fa5..92bf6fc 100644
--- a/lib/oeqa/selftest/cases/updater.py
+++ b/lib/oeqa/selftest/cases/updater.py
@@ -36,6 +36,10 @@ class GeneralTests(OESelftestTestCase):
36 result = get_bb_var('DISTRO_FEATURES').find('sota') 36 result = get_bb_var('DISTRO_FEATURES').find('sota')
37 self.assertNotEqual(result, -1, 'Feature "sota" not set at DISTRO_FEATURES') 37 self.assertNotEqual(result, -1, 'Feature "sota" not set at DISTRO_FEATURES')
38 38
39 def test_feature_usrmerge(self):
40 result = get_bb_var('DISTRO_FEATURES').find('usrmerge')
41 self.assertNotEqual(result, -1, 'Feature "sota" not set at DISTRO_FEATURES')
42
39 def test_feature_systemd(self): 43 def test_feature_systemd(self):
40 result = get_bb_var('DISTRO_FEATURES').find('systemd') 44 result = get_bb_var('DISTRO_FEATURES').find('systemd')
41 self.assertNotEqual(result, -1, 'Feature "systemd" not set at DISTRO_FEATURES') 45 self.assertNotEqual(result, -1, 'Feature "systemd" not set at DISTRO_FEATURES')
@@ -103,7 +107,7 @@ class AktualizrToolsTests(OESelftestTestCase):
103 bitbake('aktualizr-native') 107 bitbake('aktualizr-native')
104 108
105 def test_cert_provider_help(self): 109 def test_cert_provider_help(self):
106 akt_native_run(self, 'aktualizr_cert_provider --help') 110 akt_native_run(self, 'aktualizr-cert-provider --help')
107 111
108 def test_cert_provider_local_output(self): 112 def test_cert_provider_local_output(self):
109 logger = logging.getLogger("selftest") 113 logger = logging.getLogger("selftest")
@@ -115,7 +119,7 @@ class AktualizrToolsTests(OESelftestTestCase):
115 bb_vars_prov = get_bb_vars(['STAGING_DIR_HOST', 'libdir'], 'aktualizr-ca-implicit-prov') 119 bb_vars_prov = get_bb_vars(['STAGING_DIR_HOST', 'libdir'], 'aktualizr-ca-implicit-prov')
116 config = bb_vars_prov['STAGING_DIR_HOST'] + bb_vars_prov['libdir'] + '/sota/sota_implicit_prov_ca.toml' 120 config = bb_vars_prov['STAGING_DIR_HOST'] + bb_vars_prov['libdir'] + '/sota/sota_implicit_prov_ca.toml'
117 121
118 akt_native_run(self, 'aktualizr_cert_provider -c {creds} -r -l {temp} -g {config}' 122 akt_native_run(self, 'aktualizr-cert-provider -c {creds} -r -l {temp} -g {config}'
119 .format(creds=creds, temp=temp_dir, config=config)) 123 .format(creds=creds, temp=temp_dir, config=config))
120 124
121 # Might be nice if these names weren't hardcoded. 125 # Might be nice if these names weren't hardcoded.
@@ -285,9 +289,9 @@ class RpiTests(OESelftestTestCase):
285 289
286 def test_rpi(self): 290 def test_rpi(self):
287 logger = logging.getLogger("selftest") 291 logger = logging.getLogger("selftest")
288 logger.info('Running bitbake to build rpi-basic-image') 292 logger.info('Running bitbake to build core-image-minimal')
289 self.append_config('SOTA_CLIENT_PROV = "aktualizr-auto-prov"') 293 self.append_config('SOTA_CLIENT_PROV = "aktualizr-auto-prov"')
290 bitbake('rpi-basic-image') 294 bitbake('core-image-minimal')
291 credentials = get_bb_var('SOTA_PACKED_CREDENTIALS') 295 credentials = get_bb_var('SOTA_PACKED_CREDENTIALS')
292 # Skip the test if the variable SOTA_PACKED_CREDENTIALS is not set. 296 # Skip the test if the variable SOTA_PACKED_CREDENTIALS is not set.
293 if credentials is None: 297 if credentials is None:
@@ -295,7 +299,7 @@ class RpiTests(OESelftestTestCase):
295 # Check if the file exists. 299 # Check if the file exists.
296 self.assertTrue(os.path.isfile(credentials), "File %s does not exist" % credentials) 300 self.assertTrue(os.path.isfile(credentials), "File %s does not exist" % credentials)
297 deploydir = get_bb_var('DEPLOY_DIR_IMAGE') 301 deploydir = get_bb_var('DEPLOY_DIR_IMAGE')
298 imagename = get_bb_var('IMAGE_LINK_NAME', 'rpi-basic-image') 302 imagename = get_bb_var('IMAGE_LINK_NAME', 'core-image-minimal')
299 # Check if the credentials are included in the output image. 303 # Check if the credentials are included in the output image.
300 result = runCmd('tar -jtvf %s/%s.tar.bz2 | grep sota_provisioning_credentials.zip' % 304 result = runCmd('tar -jtvf %s/%s.tar.bz2 | grep sota_provisioning_credentials.zip' %
301 (deploydir, imagename), ignore_status=True) 305 (deploydir, imagename), ignore_status=True)
@@ -424,14 +428,14 @@ class ImplProvTests(OESelftestTestCase):
424 self.assertIn(b'Fetched metadata: no', stdout, 428 self.assertIn(b'Fetched metadata: no', stdout,
425 'Device already provisioned!? ' + stderr.decode() + stdout.decode()) 429 'Device already provisioned!? ' + stderr.decode() + stdout.decode())
426 430
427 # Run cert_provider. 431 # Run aktualizr-cert-provider.
428 bb_vars = get_bb_vars(['SOTA_PACKED_CREDENTIALS'], 'aktualizr-native') 432 bb_vars = get_bb_vars(['SOTA_PACKED_CREDENTIALS'], 'aktualizr-native')
429 creds = bb_vars['SOTA_PACKED_CREDENTIALS'] 433 creds = bb_vars['SOTA_PACKED_CREDENTIALS']
430 bb_vars_prov = get_bb_vars(['STAGING_DIR_HOST', 'libdir'], 'aktualizr-ca-implicit-prov') 434 bb_vars_prov = get_bb_vars(['STAGING_DIR_HOST', 'libdir'], 'aktualizr-ca-implicit-prov')
431 config = bb_vars_prov['STAGING_DIR_HOST'] + bb_vars_prov['libdir'] + '/sota/sota_implicit_prov_ca.toml' 435 config = bb_vars_prov['STAGING_DIR_HOST'] + bb_vars_prov['libdir'] + '/sota/sota_implicit_prov_ca.toml'
432 436
433 print('Provisining at root@localhost:%d' % self.qemu.ssh_port) 437 print('Provisining at root@localhost:%d' % self.qemu.ssh_port)
434 akt_native_run(self, 'aktualizr_cert_provider -c {creds} -t root@localhost -p {port} -s -u -r -g {config}' 438 akt_native_run(self, 'aktualizr-cert-provider -c {creds} -t root@localhost -p {port} -s -u -r -g {config}'
435 .format(creds=creds, port=self.qemu.ssh_port, config=config)) 439 .format(creds=creds, port=self.qemu.ssh_port, config=config))
436 440
437 verifyProvisioned(self, machine) 441 verifyProvisioned(self, machine)
@@ -509,13 +513,13 @@ class HsmTests(OESelftestTestCase):
509 self.assertNotEqual(retcode, 0, 'softhsm2-tool succeeded before initialization: ' + 513 self.assertNotEqual(retcode, 0, 'softhsm2-tool succeeded before initialization: ' +
510 stdout.decode() + stderr.decode()) 514 stdout.decode() + stderr.decode())
511 515
512 # Run cert_provider. 516 # Run aktualizr-cert-provider.
513 bb_vars = get_bb_vars(['SOTA_PACKED_CREDENTIALS'], 'aktualizr-native') 517 bb_vars = get_bb_vars(['SOTA_PACKED_CREDENTIALS'], 'aktualizr-native')
514 creds = bb_vars['SOTA_PACKED_CREDENTIALS'] 518 creds = bb_vars['SOTA_PACKED_CREDENTIALS']
515 bb_vars_prov = get_bb_vars(['STAGING_DIR_HOST', 'libdir'], 'aktualizr-hsm-prov') 519 bb_vars_prov = get_bb_vars(['STAGING_DIR_HOST', 'libdir'], 'aktualizr-hsm-prov')
516 config = bb_vars_prov['STAGING_DIR_HOST'] + bb_vars_prov['libdir'] + '/sota/sota_hsm_prov.toml' 520 config = bb_vars_prov['STAGING_DIR_HOST'] + bb_vars_prov['libdir'] + '/sota/sota_hsm_prov.toml'
517 521
518 akt_native_run(self, 'aktualizr_cert_provider -c {creds} -t root@localhost -p {port} -r -s -u -g {config}' 522 akt_native_run(self, 'aktualizr-cert-provider -c {creds} -t root@localhost -p {port} -r -s -u -g {config}'
519 .format(creds=creds, port=self.qemu.ssh_port, config=config)) 523 .format(creds=creds, port=self.qemu.ssh_port, config=config))
520 524
521 # Verify that HSM is able to initialize. 525 # Verify that HSM is able to initialize.
@@ -655,7 +659,13 @@ def qemu_launch(efi=False, machine=None, imagename=None):
655 args.dir = 'tmp/deploy/images' 659 args.dir = 'tmp/deploy/images'
656 args.efi = efi 660 args.efi = efi
657 args.machine = machine 661 args.machine = machine
658 args.kvm = None # Autodetect 662 qemu_use_kvm = get_bb_var("QEMU_USE_KVM")
663 if qemu_use_kvm and \
664 (qemu_use_kvm == 'True' and 'x86' in machine or \
665 get_bb_var('MACHINE') in qemu_use_kvm.split()):
666 args.kvm = True
667 else:
668 args.kvm = None # Autodetect
659 args.no_gui = True 669 args.no_gui = True
660 args.gdb = False 670 args.gdb = False
661 args.pcap = None 671 args.pcap = None