OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium 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 """Runs all the native unit tests. | 7 """Runs all the native unit tests. |
8 | 8 |
9 1. Copy over test binary to /data/local on device. | 9 1. Copy over test binary to /data/local on device. |
10 2. Resources: chrome/unit_tests requires resources (chrome.pak and en-US.pak) | 10 2. Resources: chrome/unit_tests requires resources (chrome.pak and en-US.pak) |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 qualified_test_suites = [os.path.join(test_suite_dir, t) | 106 qualified_test_suites = [os.path.join(test_suite_dir, t) |
107 for t in all_test_suites] | 107 for t in all_test_suites] |
108 else: | 108 else: |
109 # out/(Debug|Release)/$SUITE_apk/$SUITE-debug.apk | 109 # out/(Debug|Release)/$SUITE_apk/$SUITE-debug.apk |
110 qualified_test_suites = [os.path.join(test_suite_dir, | 110 qualified_test_suites = [os.path.join(test_suite_dir, |
111 t + '_apk', | 111 t + '_apk', |
112 t + '-debug.apk') | 112 t + '-debug.apk') |
113 for t in all_test_suites] | 113 for t in all_test_suites] |
114 for t, q in zip(all_test_suites, qualified_test_suites): | 114 for t, q in zip(all_test_suites, qualified_test_suites): |
115 if not os.path.exists(q): | 115 if not os.path.exists(q): |
116 logging.critical('Test suite %s not found in %s.\n' | 116 raise Exception('Test suite %s not found in %s.\n' |
117 'Supported test suites:\n %s\n' | 117 'Supported test suites:\n %s\n' |
118 'Ensure it has been built.\n', | 118 'Ensure it has been built.\n' % |
119 t, q, _TEST_SUITES) | 119 (t, q, _TEST_SUITES)) |
120 return [] | |
121 return qualified_test_suites | 120 return qualified_test_suites |
122 | 121 |
123 | 122 |
124 class TimeProfile(object): | 123 class TimeProfile(object): |
125 """Class for simple profiling of action, with logging of cost.""" | 124 """Class for simple profiling of action, with logging of cost.""" |
126 | 125 |
127 def __init__(self, description): | 126 def __init__(self, description): |
128 self._description = description | 127 self._description = description |
129 self.Start() | 128 self.Start() |
130 | 129 |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 # the batch (this happens because the exit status is a sum of all failures | 464 # the batch (this happens because the exit status is a sum of all failures |
466 # from all suites, but the buildbot associates the exit status only with the | 465 # from all suites, but the buildbot associates the exit status only with the |
467 # most recent step). | 466 # most recent step). |
468 if options.exit_code: | 467 if options.exit_code: |
469 return failed_tests_count | 468 return failed_tests_count |
470 return 0 | 469 return 0 |
471 | 470 |
472 | 471 |
473 if __name__ == '__main__': | 472 if __name__ == '__main__': |
474 sys.exit(main(sys.argv)) | 473 sys.exit(main(sys.argv)) |
OLD | NEW |