OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium 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 import re | 5 import re |
6 | 6 |
7 | 7 |
8 class Test(object): | 8 class Test(object): |
9 """ | 9 """ |
10 Base class for tests that can be retried after deapplying a previously | 10 Base class for tests that can be retried after deapplying a previously |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 91 |
92 This makes it possible to keep the logic src-side as opposed | 92 This makes it possible to keep the logic src-side as opposed |
93 to the build repo most Chromium developers are unfamiliar with. | 93 to the build repo most Chromium developers are unfamiliar with. |
94 | 94 |
95 Another advantage is being to test changes to these scripts | 95 Another advantage is being to test changes to these scripts |
96 on trybots. | 96 on trybots. |
97 | 97 |
98 All new tests are strongly encouraged to use this infrastructure. | 98 All new tests are strongly encouraged to use this infrastructure. |
99 """ | 99 """ |
100 | 100 |
101 def __init__(self, name, script): | 101 def __init__(self, name, script, all_compile_targets): |
102 super(ScriptTest, self).__init__() | 102 super(ScriptTest, self).__init__() |
103 self._name = name | 103 self._name = name |
104 self._script = script | 104 self._script = script |
| 105 self._all_compile_targets = all_compile_targets |
105 | 106 |
106 @property | 107 @property |
107 def name(self): | 108 def name(self): |
108 return self._name | 109 return self._name |
109 | 110 |
110 @staticmethod | 111 def compile_targets(self, api): |
111 def compile_targets(_): | 112 try: |
112 # TODO(phajdan.jr): Implement this (http://crbug.com/422235). | 113 return self._all_compile_targets[self._script] |
113 return [] | 114 except KeyError: |
| 115 # Not all scripts will have test data inside recipes, |
| 116 # so return a default value. |
| 117 # TODO(phajdan.jr): Revisit this when all script tests |
| 118 # lists move src-side. We should be able to provide |
| 119 # test data then. |
| 120 if api.chromium._test_data.enabled: |
| 121 return [] |
| 122 |
| 123 raise |
114 | 124 |
115 def run(self, api, suffix): | 125 def run(self, api, suffix): |
116 name = self.name | 126 name = self.name |
117 if suffix: | 127 if suffix: |
118 name += ' (%s)' % suffix | 128 name += ' (%s)' % suffix |
119 try: | 129 try: |
120 api.python( | 130 api.python( |
121 name, | 131 name, |
122 # Enforce that all scripts are in the specified directory | 132 # Enforce that all scripts are in the specified directory |
123 # for consistency. | 133 # for consistency. |
124 api.path['checkout'].join( | 134 api.path['checkout'].join( |
125 'testing', 'scripts', api.path.basename(self._script)), | 135 'testing', 'scripts', api.path.basename(self._script)), |
126 args=['run', '--output', api.json.output()], | 136 args=(api.chromium.get_common_args_for_scripts() + |
| 137 ['run', '--output', api.json.output()]), |
127 step_test_data=lambda: api.json.test_api.output( | 138 step_test_data=lambda: api.json.test_api.output( |
128 {'valid': True, 'failures': []})) | 139 {'valid': True, 'failures': []})) |
129 finally: | 140 finally: |
130 self._test_runs[suffix] = api.step.active_result | 141 self._test_runs[suffix] = api.step.active_result |
131 | 142 |
132 return self._test_runs[suffix] | 143 return self._test_runs[suffix] |
133 | 144 |
134 def has_valid_results(self, api, suffix): | 145 def has_valid_results(self, api, suffix): |
135 try: | 146 try: |
136 # Make sure the JSON includes all necessary data. | 147 # Make sure the JSON includes all necessary data. |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 GTestTest('crypto_unittests'), | 869 GTestTest('crypto_unittests'), |
859 GTestTest('gfx_unittests'), | 870 GTestTest('gfx_unittests'), |
860 GTestTest('url_unittests'), | 871 GTestTest('url_unittests'), |
861 GTestTest('content_unittests'), | 872 GTestTest('content_unittests'), |
862 GTestTest('net_unittests'), | 873 GTestTest('net_unittests'), |
863 GTestTest('ui_unittests'), | 874 GTestTest('ui_unittests'), |
864 GTestTest('ui_ios_unittests'), | 875 GTestTest('ui_ios_unittests'), |
865 GTestTest('sync_unit_tests'), | 876 GTestTest('sync_unit_tests'), |
866 GTestTest('sql_unittests'), | 877 GTestTest('sql_unittests'), |
867 ] | 878 ] |
OLD | NEW |