OLD | NEW |
---|---|
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """Class for running instrumentation tests on a single device.""" | 5 """Class for running instrumentation tests on a single device.""" |
6 | 6 |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 import re | 9 import re |
10 import sys | 10 import sys |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 self.device.PushChangedFiles( | 109 self.device.PushChangedFiles( |
110 os.path.join(constants.DIR_SOURCE_ROOT, p), | 110 os.path.join(constants.DIR_SOURCE_ROOT, p), |
111 os.path.join(self.device.GetExternalStoragePath(), p)) | 111 os.path.join(self.device.GetExternalStoragePath(), p)) |
112 | 112 |
113 # TODO(frankf): Specify test data in this file as opposed to passing | 113 # TODO(frankf): Specify test data in this file as opposed to passing |
114 # as command-line. | 114 # as command-line. |
115 for dest_host_pair in self.options.test_data: | 115 for dest_host_pair in self.options.test_data: |
116 dst_src = dest_host_pair.split(':', 1) | 116 dst_src = dest_host_pair.split(':', 1) |
117 dst_layer = dst_src[0] | 117 dst_layer = dst_src[0] |
118 host_src = dst_src[1] | 118 host_src = dst_src[1] |
119 host_test_files_path = '%s/%s' % (constants.DIR_SOURCE_ROOT, host_src) | 119 host_test_files_path = os.path.join(constants.DIR_SOURCE_ROOT, |
120 host_src) | |
120 if os.path.exists(host_test_files_path): | 121 if os.path.exists(host_test_files_path): |
121 self.device.PushChangedFiles( | 122 self.device.PushChangedFiles( |
122 host_test_files_path, | 123 host_test_files_path, |
123 '%s/%s/%s' % ( | 124 '%s/%s/%s' % ( |
124 self.device.GetExternalStoragePath(), | 125 self.device.GetExternalStoragePath(), |
125 TestRunner._DEVICE_DATA_DIR, | 126 TestRunner._DEVICE_DATA_DIR, |
126 dst_layer)) | 127 dst_layer)) |
127 self.tool.CopyFiles() | 128 self.tool.CopyFiles() |
128 TestRunner._DEVICE_HAS_TEST_FILES[str(self.device)] = True | 129 TestRunner._DEVICE_HAS_TEST_FILES[str(self.device)] = True |
129 | 130 |
(...skipping 26 matching lines...) Expand all Loading... | |
156 self.device.RunShellCommand('stop') | 157 self.device.RunShellCommand('stop') |
157 self.device.RunShellCommand('start') | 158 self.device.RunShellCommand('start') |
158 | 159 |
159 # We give different default value to launch HTTP server based on shard index | 160 # We give different default value to launch HTTP server based on shard index |
160 # because it may have race condition when multiple processes are trying to | 161 # because it may have race condition when multiple processes are trying to |
161 # launch lighttpd with same port at same time. | 162 # launch lighttpd with same port at same time. |
162 self.LaunchTestHttpServer( | 163 self.LaunchTestHttpServer( |
163 os.path.join(constants.DIR_SOURCE_ROOT), self._lighttp_port) | 164 os.path.join(constants.DIR_SOURCE_ROOT), self._lighttp_port) |
164 if self.flags: | 165 if self.flags: |
165 self.flags.AddFlags(['--disable-fre', '--enable-test-intents']) | 166 self.flags.AddFlags(['--disable-fre', '--enable-test-intents']) |
167 if self.options.device_flags: | |
168 with open(self.options.device_flags) as device_flags_file: | |
169 self.flags.AddFlags([flag for flag in device_flags_file]) | |
jbudorick
2014/08/07 18:42:15
nit: can this just be list(device_flags_file)?
| |
166 | 170 |
167 def TearDown(self): | 171 def TearDown(self): |
168 """Cleans up the test harness and saves outstanding data from test run.""" | 172 """Cleans up the test harness and saves outstanding data from test run.""" |
169 if self.flags: | 173 if self.flags: |
170 self.flags.Restore() | 174 self.flags.Restore() |
171 super(TestRunner, self).TearDown() | 175 super(TestRunner, self).TearDown() |
172 | 176 |
173 def TestSetup(self, test): | 177 def TestSetup(self, test): |
174 """Sets up the test harness for running a particular test. | 178 """Sets up the test harness for running a particular test. |
175 | 179 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
312 timeout_scale = int(scale_match.group(1)) | 316 timeout_scale = int(scale_match.group(1)) |
313 if self.options.wait_for_debugger: | 317 if self.options.wait_for_debugger: |
314 timeout_scale *= 100 | 318 timeout_scale *= 100 |
315 return timeout_scale | 319 return timeout_scale |
316 | 320 |
317 def _GetIndividualTestTimeoutSecs(self, test): | 321 def _GetIndividualTestTimeoutSecs(self, test): |
318 """Returns the timeout in seconds for the given |test|.""" | 322 """Returns the timeout in seconds for the given |test|.""" |
319 annotations = self.test_pkg.GetTestAnnotations(test) | 323 annotations = self.test_pkg.GetTestAnnotations(test) |
320 if 'Manual' in annotations: | 324 if 'Manual' in annotations: |
321 return 10 * 60 * 60 | 325 return 10 * 60 * 60 |
326 if 'IntegrationTest' in annotations: | |
327 return 30 * 60 | |
322 if 'External' in annotations: | 328 if 'External' in annotations: |
323 return 10 * 60 | 329 return 10 * 60 |
324 if 'EnormousTest' in annotations: | 330 if 'EnormousTest' in annotations: |
325 return 10 * 60 | 331 return 10 * 60 |
326 if 'LargeTest' in annotations or _PERF_TEST_ANNOTATION in annotations: | 332 if 'LargeTest' in annotations or _PERF_TEST_ANNOTATION in annotations: |
327 return 5 * 60 | 333 return 5 * 60 |
328 if 'MediumTest' in annotations: | 334 if 'MediumTest' in annotations: |
329 return 3 * 60 | 335 return 3 * 60 |
330 if 'SmallTest' in annotations: | 336 if 'SmallTest' in annotations: |
331 return 1 * 60 | 337 return 1 * 60 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
424 duration_ms = 0 | 430 duration_ms = 0 |
425 message = str(e) | 431 message = str(e) |
426 if not message: | 432 if not message: |
427 message = 'No information.' | 433 message = 'No information.' |
428 results.AddResult(test_result.InstrumentationTestResult( | 434 results.AddResult(test_result.InstrumentationTestResult( |
429 test, base_test_result.ResultType.CRASH, start_date_ms, duration_ms, | 435 test, base_test_result.ResultType.CRASH, start_date_ms, duration_ms, |
430 log=message)) | 436 log=message)) |
431 raw_result = None | 437 raw_result = None |
432 self.TestTeardown(test, raw_result) | 438 self.TestTeardown(test, raw_result) |
433 return (results, None if results.DidRunPass() else test) | 439 return (results, None if results.DidRunPass() else test) |
OLD | NEW |