summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorZee314159 <252806294@qq.com>2019-07-31 16:01:01 +0200
committerZee314159 <252806294@qq.com>2019-08-08 03:18:46 +0200
commita2fc4db9ca899db957bb5feb8bc15b6526b1b23e (patch)
tree124e1e2415c4c59509aec0e51f59e3336e8dd149 /lib
parent558c25c0f0da4ca9456162844d05b7b00b3629da (diff)
downloadmeta-updater-a2fc4db9ca899db957bb5feb8bc15b6526b1b23e.tar.gz
Fixed bug taking device ID for hardware ID Signed-off-by: Zee314159 <252806294@qq.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/oeqa/selftest/cases/testutils.py15
-rw-r--r--lib/oeqa/selftest/cases/updater_qemux86_64.py4
2 files changed, 12 insertions, 7 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
122def verifyProvisioned(testInst, machine): 122def 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())
diff --git a/lib/oeqa/selftest/cases/updater_qemux86_64.py b/lib/oeqa/selftest/cases/updater_qemux86_64.py
index c65d6e9..24abcff 100644
--- a/lib/oeqa/selftest/cases/updater_qemux86_64.py
+++ b/lib/oeqa/selftest/cases/updater_qemux86_64.py
@@ -85,6 +85,7 @@ class SharedCredProvTests(OESelftestTestCase):
85 self.append_config('MACHINE = "qemux86-64"') 85 self.append_config('MACHINE = "qemux86-64"')
86 self.append_config('SOTA_CLIENT_PROV = " aktualizr-shared-prov "') 86 self.append_config('SOTA_CLIENT_PROV = " aktualizr-shared-prov "')
87 self.append_config('IMAGE_FSTYPES_remove = "ostreepush garagesign garagecheck"') 87 self.append_config('IMAGE_FSTYPES_remove = "ostreepush garagesign garagecheck"')
88 self.append_config('SOTA_HARDWARE_ID = "plain_reibekuchen_314"')
88 self.qemu, self.s = qemu_launch(machine='qemux86-64') 89 self.qemu, self.s = qemu_launch(machine='qemux86-64')
89 90
90 def tearDownLocal(self): 91 def tearDownLocal(self):
@@ -107,7 +108,8 @@ class SharedCredProvTests(OESelftestTestCase):
107 self.assertEqual(value, machine, 108 self.assertEqual(value, machine,
108 'MACHINE does not match hostname: ' + machine + ', ' + value) 109 'MACHINE does not match hostname: ' + machine + ', ' + value)
109 110
110 verifyProvisioned(self, machine) 111 hwid = get_bb_var('SOTA_HARDWARE_ID')
112 verifyProvisioned(self, machine, hwid)
111 113
112 114
113class ManualControlTests(OESelftestTestCase): 115class ManualControlTests(OESelftestTestCase):