diff options
author | Zee314159 <252806294@qq.com> | 2019-07-31 16:01:01 +0200 |
---|---|---|
committer | Laurent Bonnans <laurent.bonnans@here.com> | 2019-08-15 17:49:10 +0200 |
commit | 0f4c7fcc735fd92d2568383ebbf31b1152067dc9 (patch) | |
tree | fb805f11f12a5024c560d8b1200839227f2fe439 /lib/oeqa/selftest/cases/testutils.py | |
parent | 78401be5bf0cdec7dec366747bf4d8b1c4fb665c (diff) | |
download | meta-updater-0f4c7fcc735fd92d2568383ebbf31b1152067dc9.tar.gz |
Test for setting hwid
Fixed bug taking device ID for hardware ID
Signed-off-by: Zee314159 <252806294@qq.com>
(cherry-picked from commit a2fc4db9ca899db957bb5feb8bc15b6526b1b23e)
Diffstat (limited to 'lib/oeqa/selftest/cases/testutils.py')
-rw-r--r-- | lib/oeqa/selftest/cases/testutils.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/oeqa/selftest/cases/testutils.py b/lib/oeqa/selftest/cases/testutils.py index 28087ca..802d665 100644 --- a/lib/oeqa/selftest/cases/testutils.py +++ b/lib/oeqa/selftest/cases/testutils.py | |||
@@ -119,7 +119,7 @@ def verifyNotProvisioned(testInst, machine): | |||
119 | 'Device already provisioned!? ' + stderr.decode() + stdout.decode()) | 119 | 'Device already provisioned!? ' + stderr.decode() + stdout.decode()) |
120 | 120 | ||
121 | 121 | ||
122 | def verifyProvisioned(testInst, machine): | 122 | def verifyProvisioned(testInst, machine, hwid=''): |
123 | # Verify that device HAS provisioned. | 123 | # Verify that device HAS provisioned. |
124 | # First loop while waiting for the device to boot. | 124 | # First loop while waiting for the device to boot. |
125 | ran_ok = False | 125 | ran_ok = False |
@@ -133,12 +133,15 @@ def verifyProvisioned(testInst, machine): | |||
133 | # Then wait for aktualizr to provision. | 133 | # Then wait for aktualizr to provision. |
134 | if stdout.decode().find('Fetched metadata: yes') < 0: | 134 | if stdout.decode().find('Fetched metadata: yes') < 0: |
135 | stdout, stderr, retcode = testInst.qemu_command('aktualizr-info --wait-until-provisioned') | 135 | stdout, stderr, retcode = testInst.qemu_command('aktualizr-info --wait-until-provisioned') |
136 | 136 | testInst.assertFalse(retcode, 'aktualizr-info failed: ' + stderr.decode() + stdout.decode()) | |
137 | testInst.assertFalse(retcode, 'aktualizr-info failed: ' + stderr.decode() + stdout.decode()) | 137 | testInst.assertEqual(stderr, b'', 'aktualizr-info failed: ' + stderr.decode() + stdout.decode()) |
138 | testInst.assertEqual(stderr, b'', 'aktualizr-info failed: ' + stderr.decode() + stdout.decode()) | ||
139 | testInst.assertIn(b'Device ID: ', stdout, 'Provisioning failed: ' + stderr.decode() + stdout.decode()) | 138 | testInst.assertIn(b'Device ID: ', stdout, 'Provisioning failed: ' + stderr.decode() + stdout.decode()) |
140 | testInst.assertIn(b'Primary ecu hardware ID: ' + machine.encode(), stdout, | 139 | if hwid == '': |
141 | 'Provisioning failed: ' + stderr.decode() + stdout.decode()) | 140 | testInst.assertIn(b'Primary ecu hardware ID: ' + machine.encode(), stdout, |
141 | 'Provisioning failed: ' + stderr.decode() + stdout.decode()) | ||
142 | else: | ||
143 | testInst.assertIn(b'Primary ecu hardware ID: ' + hwid.encode(), stdout, | ||
144 | 'Provisioning failed: ' + stderr.decode() + stdout.decode()) | ||
142 | testInst.assertIn(b'Fetched metadata: yes', stdout, 'Provisioning failed: ' + stderr.decode() + stdout.decode()) | 145 | testInst.assertIn(b'Fetched metadata: yes', stdout, 'Provisioning failed: ' + stderr.decode() + stdout.decode()) |
143 | p = re.compile(r'Device ID: ([a-z0-9-]*)\n') | 146 | p = re.compile(r'Device ID: ([a-z0-9-]*)\n') |
144 | m = p.search(stdout.decode()) | 147 | m = p.search(stdout.decode()) |