summaryrefslogtreecommitdiffstats
path: root/lib/oeqa/selftest
diff options
context:
space:
mode:
authorLaurent Bonnans <laurent.bonnans@here.com>2019-07-11 11:28:15 +0200
committerLaurent Bonnans <laurent.bonnans@here.com>2019-07-15 15:28:26 +0200
commitbdbc87e0ac6316d86a066ae7eecf27267a204e12 (patch)
tree475d8babec501fcca4ffc0c59539a803509e1915 /lib/oeqa/selftest
parent91dde6ff5c3f04f2ff2b3d87a2b443aae8872934 (diff)
downloadmeta-updater-bdbc87e0ac6316d86a066ae7eecf27267a204e12.tar.gz
Fix race condition in oe-selftest HSM test
Signed-off-by: Laurent Bonnans <laurent.bonnans@here.com>
Diffstat (limited to 'lib/oeqa/selftest')
-rw-r--r--lib/oeqa/selftest/cases/updater_qemux86_64.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/oeqa/selftest/cases/updater_qemux86_64.py b/lib/oeqa/selftest/cases/updater_qemux86_64.py
index c16b669..2b4726c 100644
--- a/lib/oeqa/selftest/cases/updater_qemux86_64.py
+++ b/lib/oeqa/selftest/cases/updater_qemux86_64.py
@@ -263,18 +263,17 @@ class DeviceCredProvHsmTests(OESelftestTestCase):
263 .format(creds=creds, port=self.qemu.ssh_port, config=config)) 263 .format(creds=creds, port=self.qemu.ssh_port, config=config))
264 264
265 # Verify that HSM is able to initialize. 265 # Verify that HSM is able to initialize.
266 ran_ok = False
267 for delay in [5, 5, 5, 5, 10]: 266 for delay in [5, 5, 5, 5, 10]:
268 sleep(delay) 267 sleep(delay)
269 p11_out, p11_err, p11_ret = self.qemu_command(pkcs11_command) 268 p11_out, p11_err, p11_ret = self.qemu_command(pkcs11_command)
270 hsm_out, hsm_err, hsm_ret = self.qemu_command(softhsm2_command) 269 hsm_out, hsm_err, hsm_ret = self.qemu_command(softhsm2_command)
271 if p11_ret == 0 and hsm_ret == 0 and hsm_err == b'': 270 if (p11_ret == 0 and hsm_ret == 0 and hsm_err == b'' and
272 ran_ok = True 271 b'X.509 cert' in p11_out and b'present token' in p11_err):
273 break 272 break
274 self.assertTrue(ran_ok, 'pkcs11-tool or softhsm2-tool failed: ' + p11_err.decode() + 273 else:
275 p11_out.decode() + hsm_err.decode() + hsm_out.decode()) 274 self.fail('pkcs11-tool or softhsm2-tool failed: ' + p11_err.decode() +
276 self.assertIn(b'present token', p11_err, 'pkcs11-tool failed: ' + p11_err.decode() + p11_out.decode()) 275 p11_out.decode() + hsm_err.decode() + hsm_out.decode())
277 self.assertIn(b'X.509 cert', p11_out, 'pkcs11-tool failed: ' + p11_err.decode() + p11_out.decode()) 276
278 self.assertIn(b'Initialized: yes', hsm_out, 'softhsm2-tool failed: ' + 277 self.assertIn(b'Initialized: yes', hsm_out, 'softhsm2-tool failed: ' +
279 hsm_err.decode() + hsm_out.decode()) 278 hsm_err.decode() + hsm_out.decode())
280 self.assertIn(b'User PIN init.: yes', hsm_out, 'softhsm2-tool failed: ' + 279 self.assertIn(b'User PIN init.: yes', hsm_out, 'softhsm2-tool failed: ' +