diff options
| author | Zee314159 <252806294@qq.com> | 2019-07-24 09:32:24 +0200 |
|---|---|---|
| committer | Laurent Bonnans <laurent.bonnans@here.com> | 2019-08-15 17:49:09 +0200 |
| commit | 7679da3a7ada003c112e68d4c6e317466f0ccc7e (patch) | |
| tree | b01318fac54f1733e506846235f32bc9086d5e2a /lib/oeqa | |
| parent | a6e445b011e4e51f2e1fc740bdd342b60b3f512a (diff) | |
| download | meta-updater-7679da3a7ada003c112e68d4c6e317466f0ccc7e.tar.gz | |
oe-selftests: wait until provisioned
* fixed bugs
* Removed unnecessary code and added comments
* Checked stderr and stdout
Signed-off-by: Zee314159 <252806294@qq.com>
(cherry-picked and squashed from PR #562)
Diffstat (limited to 'lib/oeqa')
| -rw-r--r-- | lib/oeqa/selftest/cases/testutils.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/oeqa/selftest/cases/testutils.py b/lib/oeqa/selftest/cases/testutils.py index 8d618a6..28087ca 100644 --- a/lib/oeqa/selftest/cases/testutils.py +++ b/lib/oeqa/selftest/cases/testutils.py | |||
| @@ -121,15 +121,21 @@ def verifyNotProvisioned(testInst, machine): | |||
| 121 | 121 | ||
| 122 | def verifyProvisioned(testInst, machine): | 122 | def verifyProvisioned(testInst, machine): |
| 123 | # Verify that device HAS provisioned. | 123 | # Verify that device HAS provisioned. |
| 124 | # First loop while waiting for the device to boot. | ||
| 124 | ran_ok = False | 125 | ran_ok = False |
| 125 | for delay in [5, 5, 5, 5, 10, 10, 10, 10]: | 126 | for delay in [5, 5, 5, 5, 10, 10, 10, 10]: |
| 126 | stdout, stderr, retcode = testInst.qemu_command('aktualizr-info') | 127 | stdout, stderr, retcode = testInst.qemu_command('aktualizr-info') |
| 127 | if retcode == 0 and stderr == b'' and stdout.decode().find('Fetched metadata: yes') >= 0: | 128 | if retcode == 0 and stderr == b'': |
| 128 | ran_ok = True | 129 | ran_ok = True |
| 129 | break | 130 | break |
| 130 | sleep(delay) | 131 | sleep(delay) |
| 131 | testInst.assertTrue(ran_ok, 'aktualizr-info failed: ' + stderr.decode() + stdout.decode()) | 132 | testInst.assertTrue(ran_ok, 'aktualizr-info failed: ' + stderr.decode() + stdout.decode()) |
| 133 | # Then wait for aktualizr to provision. | ||
| 134 | if stdout.decode().find('Fetched metadata: yes') < 0: | ||
| 135 | stdout, stderr, retcode = testInst.qemu_command('aktualizr-info --wait-until-provisioned') | ||
| 132 | 136 | ||
| 137 | testInst.assertFalse(retcode, 'aktualizr-info failed: ' + stderr.decode() + stdout.decode()) | ||
| 138 | testInst.assertEqual(stderr, b'', 'aktualizr-info failed: ' + stderr.decode() + stdout.decode()) | ||
| 133 | testInst.assertIn(b'Device ID: ', stdout, 'Provisioning failed: ' + stderr.decode() + stdout.decode()) | 139 | testInst.assertIn(b'Device ID: ', stdout, 'Provisioning failed: ' + stderr.decode() + stdout.decode()) |
| 134 | testInst.assertIn(b'Primary ecu hardware ID: ' + machine.encode(), stdout, | 140 | testInst.assertIn(b'Primary ecu hardware ID: ' + machine.encode(), stdout, |
| 135 | 'Provisioning failed: ' + stderr.decode() + stdout.decode()) | 141 | 'Provisioning failed: ' + stderr.decode() + stdout.decode()) |
