| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 # This exec defines TEST_LIST in global scope. | 63 # This exec defines TEST_LIST in global scope. |
| 64 execfile(TEST_LIST_PATH) | 64 execfile(TEST_LIST_PATH) |
| 65 | 65 |
| 66 | 66 |
| 67 # Hack to work around autotest's obsession with GRUB. | 67 # Hack to work around autotest's obsession with GRUB. |
| 68 job.bootloader.set_default = lambda x: None | 68 job.bootloader.set_default = lambda x: None |
| 69 job.bootloader.boot_once = lambda x: None | 69 job.bootloader.boot_once = lambda x: None |
| 70 | 70 |
| 71 | 71 |
| 72 def start_ui(): |
| 73 ui_proc_args = [FACTORY_UI_PATH, TEST_LIST_PATH, |
| 74 STATUS_FILE_PATH, str(os.getpid())] |
| 75 factory.log('starting ui -- %s' % repr(ui_proc_args)) |
| 76 sp = subprocess.Popen(ui_proc_args, stdout=subprocess.PIPE) |
| 77 factory.log('waiting for ui to come up...') |
| 78 factory.log('got message from UI : %s' % repr(sp.stdout.readline().strip())) |
| 79 |
| 80 |
| 72 def step_reboot_seq(tag_prefix, total_iterations, i=0): | 81 def step_reboot_seq(tag_prefix, total_iterations, i=0): |
| 73 if i < total_iterations: | 82 if i < total_iterations: |
| 74 job.next_step_prepend([step_reboot_seq, tag_prefix, | 83 job.next_step_prepend([step_reboot_seq, tag_prefix, |
| 75 total_iterations, i + 1]) | 84 total_iterations, i + 1]) |
| 76 factory.log('rebooting (iteration %d of %d)' % (i, total_iterations)) | 85 factory.log('rebooting (iteration %d of %d)' % (i, total_iterations)) |
| 77 job.reboot() | 86 job.reboot() |
| 78 else: | 87 else: |
| 79 step_init(intentional_reboot_subtest_tag_prefix=tag_prefix) | 88 step_init(intentional_reboot_subtest_tag_prefix=tag_prefix) |
| 80 | 89 |
| 81 | 90 |
| 82 def step_init(intentional_reboot_subtest_tag_prefix=None): | 91 def step_init(intentional_reboot_subtest_tag_prefix=None): |
| 83 job.next_step([step_init]) | 92 job.next_step([step_init]) |
| 84 | 93 |
| 85 ui_proc_args = [FACTORY_UI_PATH, TEST_LIST_PATH, | 94 start_ui() |
| 86 STATUS_FILE_PATH, str(os.getpid())] | |
| 87 factory.log('starting ui -- %s' % repr(ui_proc_args)) | |
| 88 ui_proc = subprocess.Popen(ui_proc_args) | |
| 89 | 95 |
| 90 status_map = factory.StatusMap(TEST_LIST, STATUS_FILE_PATH) | 96 status_map = factory.StatusMap(TEST_LIST, STATUS_FILE_PATH) |
| 91 control_state = factory.ControlState( | 97 control_state = factory.ControlState( |
| 92 job, TEST_LIST, status_map, STATUS_FILE_PATH, | 98 job, TEST_LIST, status_map, STATUS_FILE_PATH, |
| 93 parallel.fork_nuke_subprocess) | 99 parallel.fork_nuke_subprocess) |
| 94 | 100 |
| 95 if intentional_reboot_subtest_tag_prefix: | 101 if intentional_reboot_subtest_tag_prefix: |
| 96 reboot_subtest = status_map.test_db.get_subtest_by_tag_prefix( | 102 reboot_subtest = status_map.test_db.get_subtest_by_tag_prefix( |
| 97 intentional_reboot_subtest_tag_prefix) | 103 intentional_reboot_subtest_tag_prefix) |
| 98 control_state.run_test(reboot_subtest) | 104 control_state.run_test(reboot_subtest) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 109 step_reboot_seq(tag_prefix, subtest.iterations) | 115 step_reboot_seq(tag_prefix, subtest.iterations) |
| 110 else: | 116 else: |
| 111 control_state.run_test(subtest) | 117 control_state.run_test(subtest) |
| 112 if control_state.activated_kbd_shortcut_test: | 118 if control_state.activated_kbd_shortcut_test: |
| 113 break | 119 break |
| 114 else: | 120 else: |
| 115 control_state.run_test(test) | 121 control_state.run_test(test) |
| 116 status_map.read_new_data() | 122 status_map.read_new_data() |
| 117 test = (control_state.activated_kbd_shortcut_test or | 123 test = (control_state.activated_kbd_shortcut_test or |
| 118 status_map.next_untested()) | 124 status_map.next_untested()) |
| OLD | NEW |