| OLD | NEW |
| 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 # DESCRIPTION : | 6 # DESCRIPTION : |
| 7 # | 7 # |
| 8 # This library provides common types and routines for the factory ui | 8 # This library provides common types and routines for the factory ui |
| 9 # infrastructure. This library explicitly does not import gtk, to | 9 # infrastructure. This library explicitly does not import gtk, to |
| 10 # allow its use by the autotest control process. | 10 # allow its use by the autotest control process. |
| 11 | 11 |
| 12 | 12 |
| 13 import gobject | |
| 14 import signal | 13 import signal |
| 15 import subprocess | 14 import subprocess |
| 16 import sys | 15 import sys |
| 17 import time | 16 import time |
| 18 | 17 |
| 19 | 18 |
| 20 ACTIVE = 'ACTIVE' | 19 ACTIVE = 'ACTIVE' |
| 21 PASSED = 'PASS' | 20 PASSED = 'PASS' |
| 22 FAILED = 'FAIL' | 21 FAILED = 'FAIL' |
| 23 UNTESTED = 'UNTESTED' | 22 UNTESTED = 'UNTESTED' |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 self._job = job | 317 self._job = job |
| 319 self._status_map = status_map | 318 self._status_map = status_map |
| 320 self._log_data = LogData() | 319 self._log_data = LogData() |
| 321 self._std_dargs = { | 320 self._std_dargs = { |
| 322 'status_file_path' : status_file_path, | 321 'status_file_path' : status_file_path, |
| 323 'test_list': test_list} | 322 'test_list': test_list} |
| 324 self._nuke_fn = nuke_fn | 323 self._nuke_fn = nuke_fn |
| 325 self.activated_kbd_shortcut_test = None | 324 self.activated_kbd_shortcut_test = None |
| 326 signal.signal(signal.SIGUSR1, self.kill_current_test_callback) | 325 signal.signal(signal.SIGUSR1, self.kill_current_test_callback) |
| 327 | 326 |
| 328 log('waiting for ui to come up...') | |
| 329 while self._log_data.get('test_widget_size') is None: | |
| 330 time.sleep(1) | |
| 331 self._log_data.read_new_data() | |
| 332 | |
| 333 def kill_current_test_callback(self, signum, frame): | 327 def kill_current_test_callback(self, signum, frame): |
| 334 self._log_data.read_new_data() | 328 self._log_data.read_new_data() |
| 335 active_test_data = self._log_data.get('active_test_data') | 329 active_test_data = self._log_data.get('active_test_data') |
| 336 log('KILLING active_test_data %s' % repr(active_test_data)) | 330 log('KILLING active_test_data %s' % repr(active_test_data)) |
| 337 if active_test_data is not None: | 331 if active_test_data is not None: |
| 338 self._nuke_fn(*active_test_data) | 332 self._nuke_fn(*active_test_data) |
| 339 | 333 |
| 340 def run_test(self, test): | 334 def run_test(self, test): |
| 335 log_shared_data('activated_kbd_shortcut', None) |
| 336 |
| 341 self._status_map.incr_count(test) | 337 self._status_map.incr_count(test) |
| 342 self._log_data.read_new_data() | 338 self._log_data.read_new_data() |
| 343 test_tag = self._status_map.lookup_tag(test) | 339 test_tag = self._status_map.lookup_tag(test) |
| 344 dargs = {} | 340 dargs = {} |
| 345 dargs.update(test.dargs) | 341 dargs.update(test.dargs) |
| 346 dargs.update(self._std_dargs) | 342 dargs.update(self._std_dargs) |
| 347 dargs.update({'tag': test_tag, | 343 dargs.update({'tag': test_tag, |
| 348 'subtest_tag': test_tag, | 344 'subtest_tag': test_tag, |
| 349 'shared_dict': self._log_data.shared_dict}) | 345 'shared_dict': self._log_data.shared_dict}) |
| 350 | 346 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 361 self._job.drop_caches_between_iterations = False | 357 self._job.drop_caches_between_iterations = False |
| 362 self._log_data.read_new_data() | 358 self._log_data.read_new_data() |
| 363 kbd_shortcut = self._log_data.shared_dict.pop( | 359 kbd_shortcut = self._log_data.shared_dict.pop( |
| 364 'activated_kbd_shortcut', None) | 360 'activated_kbd_shortcut', None) |
| 365 if kbd_shortcut is not None: | 361 if kbd_shortcut is not None: |
| 366 test_db = self._status_map.test_db | 362 test_db = self._status_map.test_db |
| 367 target_test = test_db.get_test_by_kbd_shortcut(kbd_shortcut) | 363 target_test = test_db.get_test_by_kbd_shortcut(kbd_shortcut) |
| 368 self.activated_kbd_shortcut_test = target_test | 364 self.activated_kbd_shortcut_test = target_test |
| 369 log('kbd_shortcut %s -> %s)' % ( | 365 log('kbd_shortcut %s -> %s)' % ( |
| 370 kbd_shortcut, test_db.get_unique_details(target_test))) | 366 kbd_shortcut, test_db.get_unique_details(target_test))) |
| OLD | NEW |