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 import glob | 5 import glob |
6 import logging | 6 import logging |
7 import os | 7 import os |
8 import sys | 8 import sys |
9 | 9 |
10 from base_test_runner import BaseTestRunner | 10 from base_test_runner import BaseTestRunner |
(...skipping 17 matching lines...) Expand all Loading... | |
28 gtest_filter: A gtest_filter flag. | 28 gtest_filter: A gtest_filter flag. |
29 test_arguments: Additional arguments to pass to the test binary. | 29 test_arguments: Additional arguments to pass to the test binary. |
30 timeout: Timeout for each test. | 30 timeout: Timeout for each test. |
31 rebaseline: Whether or not to run tests in isolation and update the filter. | 31 rebaseline: Whether or not to run tests in isolation and update the filter. |
32 performance_test: Whether or not performance test(s). | 32 performance_test: Whether or not performance test(s). |
33 cleanup_test_files: Whether or not to cleanup test files on device. | 33 cleanup_test_files: Whether or not to cleanup test files on device. |
34 tool: Name of the Valgrind tool. | 34 tool: Name of the Valgrind tool. |
35 shard_index: index number of the shard on which the test suite will run. | 35 shard_index: index number of the shard on which the test suite will run. |
36 dump_debug_info: Whether or not to dump debug information. | 36 dump_debug_info: Whether or not to dump debug information. |
37 build_type: 'Release' or 'Debug'. | 37 build_type: 'Release' or 'Debug'. |
38 in_webkit_checkout: Whether the suite is being run from a WebKit checkout. | |
38 """ | 39 """ |
39 | 40 |
40 def __init__(self, device, test_suite, gtest_filter, test_arguments, timeout, | 41 def __init__(self, device, test_suite, gtest_filter, test_arguments, timeout, |
41 rebaseline, performance_test, cleanup_test_files, tool_name, | 42 rebaseline, performance_test, cleanup_test_files, tool_name, |
42 shard_index, dump_debug_info, fast_and_loose, build_type): | 43 shard_index, dump_debug_info, fast_and_loose, build_type, |
44 in_webkit_checkout): | |
43 BaseTestRunner.__init__(self, device, tool_name, shard_index, build_type) | 45 BaseTestRunner.__init__(self, device, tool_name, shard_index, build_type) |
44 self._running_on_emulator = self.device.startswith('emulator') | 46 self._running_on_emulator = self.device.startswith('emulator') |
45 self._gtest_filter = gtest_filter | 47 self._gtest_filter = gtest_filter |
46 self._test_arguments = test_arguments | 48 self._test_arguments = test_arguments |
47 self.test_results = TestResults() | 49 self.test_results = TestResults() |
48 if dump_debug_info: | 50 if dump_debug_info: |
49 self.dump_debug_info = debug_info.GTestDebugInfo(self.adb, device, | 51 self.dump_debug_info = debug_info.GTestDebugInfo(self.adb, device, |
50 os.path.basename(test_suite), gtest_filter) | 52 os.path.basename(test_suite), gtest_filter) |
51 else: | 53 else: |
52 self.dump_debug_info = None | 54 self.dump_debug_info = None |
53 self.fast_and_loose = fast_and_loose | 55 self.fast_and_loose = fast_and_loose |
56 self.in_webkit_checkout = in_webkit_checkout | |
54 | 57 |
55 logging.warning('Test suite: ' + test_suite) | 58 logging.warning('Test suite: ' + test_suite) |
56 if os.path.splitext(test_suite)[1] == '.apk': | 59 if os.path.splitext(test_suite)[1] == '.apk': |
57 self.test_package = TestPackageApk(self.adb, device, | 60 self.test_package = TestPackageApk(self.adb, device, |
58 test_suite, timeout, rebaseline, performance_test, cleanup_test_files, | 61 test_suite, timeout, rebaseline, performance_test, cleanup_test_files, |
59 self.tool, self.dump_debug_info) | 62 self.tool, self.dump_debug_info) |
60 else: | 63 else: |
61 # Put a copy into the android out/target directory, to allow stack trace | 64 # Put a copy into the android out/target directory, to allow stack trace |
62 # generation. | 65 # generation. |
63 symbols_dir = os.path.join(constants.CHROME_DIR, 'out', build_type, | 66 symbols_dir = os.path.join(constants.CHROME_DIR, 'out', build_type, |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
219 ] | 222 ] |
220 elif self.test_package.test_suite_basename == 'ui_tests': | 223 elif self.test_package.test_suite_basename == 'ui_tests': |
221 return [ | 224 return [ |
222 'chrome/test/data/dromaeo', | 225 'chrome/test/data/dromaeo', |
223 'chrome/test/data/json2.js', | 226 'chrome/test/data/json2.js', |
224 'chrome/test/data/sunspider', | 227 'chrome/test/data/sunspider', |
225 'chrome/test/data/v8_benchmark', | 228 'chrome/test/data/v8_benchmark', |
226 'chrome/test/perf/sunspider_uitest.js', | 229 'chrome/test/perf/sunspider_uitest.js', |
227 'chrome/test/perf/v8_benchmark_uitest.js', | 230 'chrome/test/perf/v8_benchmark_uitest.js', |
228 ] | 231 ] |
229 elif self.test_package.test_suite_basename == 'webkit_unit_tests': | |
230 return [ | |
231 'third_party/WebKit/Source/WebKit/chromium/tests/data', | |
232 ] | |
233 elif self.test_package.test_suite_basename == 'content_unittests': | 232 elif self.test_package.test_suite_basename == 'content_unittests': |
234 return [ | 233 return [ |
235 'content/test/data/gpu/webgl_conformance_test_expectations.txt', | 234 'content/test/data/gpu/webgl_conformance_test_expectations.txt', |
236 'net/data/ssl/certificates/', | 235 'net/data/ssl/certificates/', |
237 'webkit/data/dom_storage/webcore_test_database.localstorage', | 236 'webkit/data/dom_storage/webcore_test_database.localstorage', |
238 'third_party/hyphen/hyph_en_US.dic', | 237 'third_party/hyphen/hyph_en_US.dic', |
239 ] | 238 ] |
240 elif self.test_package.test_suite_basename == 'media_unittests': | 239 elif self.test_package.test_suite_basename == 'media_unittests': |
241 return [ | 240 return [ |
242 'media/test/data', | 241 'media/test/data', |
(...skipping 13 matching lines...) Expand all Loading... | |
256 """Strips and copies the required data files for the test suite.""" | 255 """Strips and copies the required data files for the test suite.""" |
257 self.test_package.StripAndCopyExecutable() | 256 self.test_package.StripAndCopyExecutable() |
258 self.test_package.PushDataAndPakFiles() | 257 self.test_package.PushDataAndPakFiles() |
259 self.tool.CopyFiles() | 258 self.tool.CopyFiles() |
260 test_data = self.GetDataFilesForTestSuite() | 259 test_data = self.GetDataFilesForTestSuite() |
261 if test_data and not self.fast_and_loose: | 260 if test_data and not self.fast_and_loose: |
262 # Make sure SD card is ready. | 261 # Make sure SD card is ready. |
263 self.adb.WaitForSdCardReady(20) | 262 self.adb.WaitForSdCardReady(20) |
264 for data in test_data: | 263 for data in test_data: |
265 self.CopyTestData([data], self.adb.GetExternalStorage()) | 264 self.CopyTestData([data], self.adb.GetExternalStorage()) |
265 if self.test_package.test_suite_basename == 'webkit_unit_tests': | |
266 self.PushWebKitUnitTestsData() | |
267 | |
268 def PushWebKitUnitTestsData(self): | |
269 """Pushes the webkit_unit_tests data files to the device. | |
270 | |
271 The path of this directory is different when the suite is being run as | |
272 part of a WebKit check-out. | |
273 """ | |
274 webkit_src = os.path.join(constants.CHROME_DIR, 'third_party', 'WebKit') | |
275 if self.in_webkit_checkout: | |
276 webkit_src = os.path.join(constants.CHROME_DIR, '..', '..', '..') | |
277 | |
278 self.adb.PushIfNeeded( | |
279 '%s/Source/WebKit/chromium/tests/data' % webkit_src, | |
Peter Beverloo
2012/11/15 12:11:29
q: would having a chain of os.path.join() argument
bulach
2012/11/15 17:46:26
given 280, I think it's more readable.. just to be
Peter Beverloo
2012/11/15 18:02:54
Done.
| |
280 os.path.join(self.adb.GetExternalStorage(), | |
281 'third_party/WebKit/Source/WebKit/chromium/tests/data')) | |
266 | 282 |
267 def RunTestsWithFilter(self): | 283 def RunTestsWithFilter(self): |
268 """Runs a tests via a small, temporary shell script.""" | 284 """Runs a tests via a small, temporary shell script.""" |
269 self.test_package.CreateTestRunnerScript(self._gtest_filter, | 285 self.test_package.CreateTestRunnerScript(self._gtest_filter, |
270 self._test_arguments) | 286 self._test_arguments) |
271 self.test_results = self.test_package.RunTestsAndListResults() | 287 self.test_results = self.test_package.RunTestsAndListResults() |
272 | 288 |
273 def RebaselineTests(self): | 289 def RebaselineTests(self): |
274 """Runs all available tests, restarting in case of failures.""" | 290 """Runs all available tests, restarting in case of failures.""" |
275 if self._gtest_filter: | 291 if self._gtest_filter: |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
350 self.tool.CleanUpEnvironment() | 366 self.tool.CleanUpEnvironment() |
351 if self.test_package.cleanup_test_files: | 367 if self.test_package.cleanup_test_files: |
352 self.adb.RemovePushedFiles() | 368 self.adb.RemovePushedFiles() |
353 if self.dump_debug_info: | 369 if self.dump_debug_info: |
354 self.dump_debug_info.StopRecordingLog() | 370 self.dump_debug_info.StopRecordingLog() |
355 if self._performance_test_setup: | 371 if self._performance_test_setup: |
356 self._performance_test_setup.TearDown() | 372 self._performance_test_setup.TearDown() |
357 if self.dump_debug_info: | 373 if self.dump_debug_info: |
358 self.dump_debug_info.ArchiveNewCrashFiles() | 374 self.dump_debug_info.ArchiveNewCrashFiles() |
359 super(SingleTestRunner, self).TearDown() | 375 super(SingleTestRunner, self).TearDown() |
OLD | NEW |