summaryrefslogtreecommitdiffstats
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-17 14:59:01 +0200
commit40202560bba5ea3cffac799cd68c268e53a89439 (patch)
treeff80020406a01def7c1b478069f8bfaba918ab54
parent3f75b1a1d702942285ad102107f1c6dd24706aee (diff)
downloadmeta-updater-40202560bba5ea3cffac799cd68c268e53a89439.tar.gz
Fix race condition in oe-selftest HSM test
Signed-off-by: Laurent Bonnans <laurent.bonnans@here.com>
-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 81c2e5e..80d135f 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: ' +