OLD | NEW |
1 # -*- coding: utf-8 -*- | 1 # -*- coding: utf-8 -*- |
2 # | 2 # |
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 AUTHOR = "Chrome OS Team" | 7 AUTHOR = "Chrome OS Team" |
8 NAME = "Factory" | 8 NAME = "Factory" |
9 TIME = "LONG" | 9 TIME = "LONG" |
10 TEST_CATEGORY = "Functional" | 10 TEST_CATEGORY = "Functional" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 formal_name='step_runin', | 81 formal_name='step_runin', |
82 automated_seq=[ | 82 automated_seq=[ |
83 # Match HWQual ID by running hardware_Components with ignored cids. | 83 # Match HWQual ID by running hardware_Components with ignored cids. |
84 factory.TestData( | 84 factory.TestData( |
85 label_en='hwqual id matching', | 85 label_en='hwqual id matching', |
86 label_zw='型號匹配', | 86 label_zw='型號匹配', |
87 formal_name='hardware_Components', | 87 formal_name='hardware_Components', |
88 dargs={'approved_dbs':'qualified_components*', | 88 dargs={'approved_dbs':'qualified_components*', |
89 'ignored_cids':[ | 89 'ignored_cids':[ |
90 'hash_ro_firmware', | 90 'hash_ro_firmware', |
91 'part_id_bios', | |
92 'part_id_hwqual', | 91 'part_id_hwqual', |
| 92 'vendor_id_bios', |
93 'version_rw_firmware', | 93 'version_rw_firmware', |
94 ]}), | 94 ]}), |
95 factory.TestData( | 95 factory.TestData( |
96 label_en='gpio switch check', | 96 label_en='gpio switch check', |
97 label_zw='檢查 gpio 開關', | 97 label_zw='檢查 gpio 開關', |
98 formal_name='hardware_GPIOSwitches'), | 98 formal_name='hardware_GPIOSwitches'), |
99 factory.TestData( | 99 factory.TestData( |
100 label_en='system stress', | 100 label_en='system stress', |
101 label_zw='壓力測試', | 101 label_zw='壓力測試', |
102 formal_name='hardware_SAT', | 102 formal_name='hardware_SAT', |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 label_zw='還原模式', | 193 label_zw='還原模式', |
194 formal_name='factory_DeveloperRecovery', | 194 formal_name='factory_DeveloperRecovery', |
195 trigger='b', | 195 trigger='b', |
196 dargs={'layout':'devrec'}), | 196 dargs={'layout':'devrec'}), |
197 | 197 |
198 # THIS IS A GOOGLE REQUIRED TEST. | 198 # THIS IS A GOOGLE REQUIRED TEST. |
199 # PLEASE DO NOT REMOVE THIS TEST IN PRODUCTION RELEASES. | 199 # PLEASE DO NOT REMOVE THIS TEST IN PRODUCTION RELEASES. |
200 factory.TestData( | 200 factory.TestData( |
201 label_en='final', | 201 label_en='final', |
202 label_zw='最後測試', | 202 label_zw='最後測試', |
203 formal_name='step_final', | 203 formal_name='step_final_stage1', |
204 automated_seq=[ | 204 automated_seq=[ |
205 # THIS IS A GOOGLE REQUIRED TEST. | 205 # THIS IS A GOOGLE REQUIRED TEST. |
206 # PLEASE DO NOT REMOVE THIS TEST IN PRODUCTION RELEASES. | 206 # PLEASE DO NOT REMOVE THIS TEST IN PRODUCTION RELEASES. |
207 factory.TestData( | 207 factory.TestData( |
| 208 label_en='write GBB', |
| 209 label_zw='寫入GBB', |
| 210 formal_name='factory_WriteGBB'), |
| 211 factory.TestData( |
| 212 label_en='reboot', |
| 213 label_zw='重新開機', |
| 214 formal_name='factory_RebootStub'), |
| 215 factory.TestData( |
208 label_en='component validation', | 216 label_en='component validation', |
209 label_zw='元件驗證', | 217 label_zw='元件驗證', |
210 formal_name='hardware_Components', | 218 formal_name='hardware_Components')], |
211 dargs={'approved_dbs':'qualified_components*'})], | |
212 trigger='f'), | 219 trigger='f'), |
213 | 220 |
214 # THIS IS A GOOGLE REQUIRED TEST. | 221 # THIS IS A GOOGLE REQUIRED TEST. |
215 # PLEASE DO NOT REMOVE THIS TEST IN PRODUCTION DEVICES. | 222 # PLEASE DO NOT REMOVE THIS TEST IN PRODUCTION DEVICES. |
216 factory.TestData( | 223 factory.TestData( |
217 label_en='wipe', | 224 label_en='wipe', |
218 label_zw='清除', | 225 label_zw='清除', |
219 formal_name='factory_Wipe', | 226 formal_name='factory_Wipe', |
220 trigger='x', | 227 trigger='x', |
221 dargs={'secure_wipe':DO_FACTORY_SECURE_WIPE, | 228 dargs={'secure_wipe':DO_FACTORY_SECURE_WIPE, |
(...skipping 21 matching lines...) Expand all Loading... |
243 ] | 250 ] |
244 | 251 |
245 for test in test_list: | 252 for test in test_list: |
246 test.tag_prefix = test.trigger | 253 test.tag_prefix = test.trigger |
247 for subtest in test.automated_seq: | 254 for subtest in test.automated_seq: |
248 subtest.tag_prefix = test.formal_name | 255 subtest.tag_prefix = test.formal_name |
249 | 256 |
250 test_map = factory.make_test_map(test_list) | 257 test_map = factory.make_test_map(test_list) |
251 trigger_set = factory.make_trigger_set(test_list) | 258 trigger_set = factory.make_trigger_set(test_list) |
252 | 259 |
253 hwqual = None | |
254 | 260 |
255 def run_subtest(name, dargs_map): | 261 def run_subtest(name, dargs_map): |
256 job.run_test(name, **dargs_map[name]) | 262 job.run_test(name, **dargs_map[name]) |
257 | 263 |
258 | 264 |
259 def step_reboot_seq(dargs_map, i=0): | 265 def step_reboot_seq(dargs_map, i=0): |
260 if i < _REBOOT_SEQ_ITERATIONS: | 266 if i < _REBOOT_SEQ_ITERATIONS: |
261 job.next_step_prepend([step_reboot_seq, dargs_map, i + 1]) | 267 job.next_step_prepend([step_reboot_seq, dargs_map, i + 1]) |
262 factory.log('rebooting (iteration %d)' % i) | 268 factory.log('rebooting (iteration %d)' % i) |
263 time.sleep(5) | 269 time.sleep(5) |
264 job.reboot() | 270 job.reboot() |
265 else: | 271 else: |
266 run_subtest('factory_RebootStub', dargs_map) | 272 run_subtest('factory_RebootStub', dargs_map) |
267 step_init() | 273 step_init() |
268 | 274 |
269 | 275 |
| 276 hwqual_id = None |
| 277 |
| 278 def get_hwqual_id(): |
| 279 # TODO: Move HWQual ID to StatusMap. |
| 280 global hwqual_id |
| 281 if not hwqual_id: |
| 282 hwqual_id = find_hwqual_id() |
| 283 return hwqual_id |
| 284 |
| 285 def find_hwqual_id(): |
| 286 cmd = ('find %s -name keyval | xargs grep -h ^hwqual_id= | ' |
| 287 'sed s/hwqual_id=// | head -1' % |
| 288 (_RESULTS_PATH + '/hardware_Components.step_runin_*')) |
| 289 hwqual_id = utils.system_output(cmd).strip() |
| 290 hwqual_id = hwqual_id.rsplit(' ', 1)[0].replace(' ', '_') |
| 291 if not hwqual_id: |
| 292 factory.log('fail to get the HWQual ID') |
| 293 return hwqual_id |
| 294 |
| 295 |
| 296 def update_dargs(test, dargs_map, update_map): |
| 297 for (key, value) in update_map.iteritems(): |
| 298 dargs_map[test][key] = value |
| 299 |
| 300 |
270 def step_runin(ui, dargs_map): | 301 def step_runin(ui, dargs_map): |
271 run_subtest('hardware_Components', dargs_map) | 302 run_subtest('hardware_Components', dargs_map) |
272 # Find the HWQual ID by getting the result of above hardware component test. | |
273 # TODO: Move this functionality to StatusMap. | |
274 cmd = ('find %s -name keyval | xargs grep -h ^hwqual_id= | ' | |
275 'sed s/hwqual_id=// | head -1' % | |
276 (_RESULTS_PATH + '/hardware_Components.step_runin_*')) | |
277 hwqual = utils.system_output(cmd).strip() | |
278 if hwqual: | |
279 factory.log('HWQual ID = %s' % hwqual) | |
280 else: | |
281 factory.log('fail to get the HWQual ID') | |
282 | |
283 run_subtest('hardware_GPIOSwitches', dargs_map) | 303 run_subtest('hardware_GPIOSwitches', dargs_map) |
284 job.drop_caches_between_iterations = True | 304 job.drop_caches_between_iterations = True |
285 run_subtest('hardware_SAT', dargs_map) | 305 run_subtest('hardware_SAT', dargs_map) |
286 job.drop_caches_between_iterations = False | 306 job.drop_caches_between_iterations = False |
287 run_subtest('graphics_GLBench', dargs_map) | 307 run_subtest('graphics_GLBench', dargs_map) |
288 step_reboot_seq(dargs_map) | 308 step_reboot_seq(dargs_map) |
289 | 309 |
290 | 310 |
291 def step_final(ui, dargs_map): | 311 def step_final_stage1(ui, dargs_map): |
| 312 update_dargs('factory_WriteGBB', dargs_map, |
| 313 {'gbb_file': 'gbb_*%s' % get_hwqual_id()}) |
| 314 run_subtest('factory_WriteGBB', dargs_map) |
| 315 job.next_step_prepend([step_final_stage2, ui, dargs_map]) |
| 316 factory.log('rebooting') |
| 317 time.sleep(5) |
| 318 job.reboot() |
| 319 |
| 320 |
| 321 def step_final_stage2(ui, dargs_map): |
| 322 run_subtest('factory_RebootStub', dargs_map) |
| 323 update_dargs('hardware_Components', dargs_map, |
| 324 {'approved_dbs': 'qualified_components_*%s' % get_hwqual_id()}) |
292 run_subtest('hardware_Components', dargs_map) | 325 run_subtest('hardware_Components', dargs_map) |
| 326 step_init() |
293 | 327 |
294 | 328 |
295 def step_init(): | 329 def step_init(): |
296 '''Launch the factory UI, which will then make decisions on which | 330 '''Launch the factory UI, which will then make decisions on which |
297 tests to run in which order. This is to support user driven | 331 tests to run in which order. This is to support user driven |
298 out-of-order test execution based on keyboard shortcuts. | 332 out-of-order test execution based on keyboard shortcuts. |
299 | 333 |
300 For each test, a trigger (possibly None) is communicated to the | 334 For each test, a trigger (possibly None) is communicated to the |
301 UI, which then replies with the test name and a count number that | 335 UI, which then replies with the test name and a count number that |
302 becomes the autotest tag to allow repeated test execution while | 336 becomes the autotest tag to allow repeated test execution while |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 result = eval(file.readline()) | 381 result = eval(file.readline()) |
348 | 382 |
349 if result is not None: | 383 if result is not None: |
350 ui.send_cmd_switch_to(result) | 384 ui.send_cmd_switch_to(result) |
351 else: | 385 else: |
352 ui.send_cmd_next_test() | 386 ui.send_cmd_next_test() |
353 | 387 |
354 test, test_count = ui.recv_target_test_update(test_map) | 388 test, test_count = ui.recv_target_test_update(test_map) |
355 | 389 |
356 factory.log('factory testing completed') | 390 factory.log('factory testing completed') |
OLD | NEW |