| 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. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 STATUS_CODE_MAP = { | 23 STATUS_CODE_MAP = { |
| 24 'START': ACTIVE, | 24 'START': ACTIVE, |
| 25 'GOOD': PASSED, | 25 'GOOD': PASSED, |
| 26 'FAIL': FAILED, | 26 'FAIL': FAILED, |
| 27 'ERROR': FAILED} | 27 'ERROR': FAILED} |
| 28 | 28 |
| 29 | 29 |
| 30 LOG_PATH = '/var/log/factory.log' | 30 LOG_PATH = '/var/log/factory.log' |
| 31 DATA_PREFIX = 'FACTORY_DATA:' | 31 DATA_PREFIX = 'FACTORY_DATA:' |
| 32 FINAL_VERIFICATION_TEST_UNIQUE_NAME = 'factory_Verify' |
| 32 | 33 |
| 33 def log(s): | 34 def log(s): |
| 34 print >> sys.stderr, 'FACTORY: ' + s | 35 print >> sys.stderr, 'FACTORY: ' + s |
| 35 | 36 |
| 36 def log_shared_data(key, value): | 37 def log_shared_data(key, value): |
| 37 print >> sys.stderr, '%s %s=%s' % (DATA_PREFIX, key, repr(value)) | 38 print >> sys.stderr, '%s %s=%s' % (DATA_PREFIX, key, repr(value)) |
| 38 | 39 |
| 40 def lookup_status_by_unique_name(unique_name, test_list, status_file_path): |
| 41 """ quick way to determine the status of given test """ |
| 42 status_map = StatusMap(test_list, status_file_path) |
| 43 testdb = status_map.test_db |
| 44 xtest = testdb.get_test_by_unique_name(unique_name) |
| 45 return status_map.lookup_status(xtest) |
| 39 | 46 |
| 40 class FactoryTest: | 47 class FactoryTest: |
| 41 def __repr__(self): | 48 def __repr__(self): |
| 42 d = ['%s=%s' % (l, repr(v)) | 49 d = ['%s=%s' % (l, repr(v)) |
| 43 for l, v in self.__dict__.items() | 50 for l, v in self.__dict__.items() |
| 44 if l != 'self'] | 51 if l != 'self'] |
| 45 c = ('%s' % self.__class__).rpartition('.')[2] | 52 c = ('%s' % self.__class__).rpartition('.')[2] |
| 46 return '%s(%s)' % (c, ','.join(d)) | 53 return '%s(%s)' % (c, ','.join(d)) |
| 47 | 54 |
| 48 class FactoryAutotestTest(FactoryTest): | 55 class FactoryAutotestTest(FactoryTest): |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 if test.drop_caches: | 362 if test.drop_caches: |
| 356 self._job.drop_caches_between_iterations = True | 363 self._job.drop_caches_between_iterations = True |
| 357 self._job.run_test(test.autotest_name, **dargs) | 364 self._job.run_test(test.autotest_name, **dargs) |
| 358 self._job.drop_caches_between_iterations = False | 365 self._job.drop_caches_between_iterations = False |
| 359 self._log_data.read_new_data() | 366 self._log_data.read_new_data() |
| 360 activated_ks = self._log_data.shared_dict.pop( | 367 activated_ks = self._log_data.shared_dict.pop( |
| 361 'activated_kbd_shortcut', None) | 368 'activated_kbd_shortcut', None) |
| 362 lookup = self._status_map.test_db.get_test_by_kbd_shortcut | 369 lookup = self._status_map.test_db.get_test_by_kbd_shortcut |
| 363 self.activated_kbd_shortcut_test = ( | 370 self.activated_kbd_shortcut_test = ( |
| 364 activated_ks and lookup(activated_ks) or None) | 371 activated_ks and lookup(activated_ks) or None) |
| OLD | NEW |