| 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 pylib import android_commands | 10 from pylib import android_commands |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 cleanup_test_files: Whether or not to cleanup test files on device. | 32 cleanup_test_files: Whether or not to cleanup test files on device. |
| 33 tool: Name of the Valgrind tool. | 33 tool: Name of the Valgrind tool. |
| 34 shard_index: index number of the shard on which the test suite will run. | 34 shard_index: index number of the shard on which the test suite will run. |
| 35 dump_debug_info: Whether or not to dump debug information. | 35 dump_debug_info: Whether or not to dump debug information. |
| 36 build_type: 'Release' or 'Debug'. | 36 build_type: 'Release' or 'Debug'. |
| 37 in_webkit_checkout: Whether the suite is being run from a WebKit checkout. | 37 in_webkit_checkout: Whether the suite is being run from a WebKit checkout. |
| 38 """ | 38 """ |
| 39 | 39 |
| 40 def __init__(self, device, test_suite, gtest_filter, test_arguments, timeout, | 40 def __init__(self, device, test_suite, gtest_filter, test_arguments, timeout, |
| 41 cleanup_test_files, tool_name, shard_index, dump_debug_info, | 41 cleanup_test_files, tool_name, shard_index, dump_debug_info, |
| 42 fast_and_loose, build_type, in_webkit_checkout): | 42 build_type, in_webkit_checkout): |
| 43 BaseTestRunner.__init__(self, device, tool_name, shard_index, build_type) | 43 BaseTestRunner.__init__(self, device, tool_name, shard_index, build_type) |
| 44 self._running_on_emulator = self.device.startswith('emulator') | 44 self._running_on_emulator = self.device.startswith('emulator') |
| 45 self._gtest_filter = gtest_filter | 45 self._gtest_filter = gtest_filter |
| 46 self._test_arguments = test_arguments | 46 self._test_arguments = test_arguments |
| 47 self.test_results = TestResults() | 47 self.test_results = TestResults() |
| 48 if dump_debug_info: | 48 if dump_debug_info: |
| 49 self.dump_debug_info = debug_info.GTestDebugInfo( | 49 self.dump_debug_info = debug_info.GTestDebugInfo( |
| 50 self.adb, device, | 50 self.adb, device, |
| 51 os.path.basename(test_suite), gtest_filter) | 51 os.path.basename(test_suite), gtest_filter) |
| 52 else: | 52 else: |
| 53 self.dump_debug_info = None | 53 self.dump_debug_info = None |
| 54 self.fast_and_loose = fast_and_loose | |
| 55 self.in_webkit_checkout = in_webkit_checkout | 54 self.in_webkit_checkout = in_webkit_checkout |
| 56 | 55 |
| 57 logging.warning('Test suite: ' + test_suite) | 56 logging.warning('Test suite: ' + test_suite) |
| 58 if os.path.splitext(test_suite)[1] == '.apk': | 57 if os.path.splitext(test_suite)[1] == '.apk': |
| 59 self.test_package = TestPackageApk( | 58 self.test_package = TestPackageApk( |
| 60 self.adb, | 59 self.adb, |
| 61 device, | 60 device, |
| 62 test_suite, | 61 test_suite, |
| 63 timeout, | 62 timeout, |
| 64 cleanup_test_files, | 63 cleanup_test_files, |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 """ | 214 """ |
| 216 if self._TestSuiteRequiresMockTestServer(): | 215 if self._TestSuiteRequiresMockTestServer(): |
| 217 self.LaunchChromeTestServerSpawner() | 216 self.LaunchChromeTestServerSpawner() |
| 218 | 217 |
| 219 def StripAndCopyFiles(self): | 218 def StripAndCopyFiles(self): |
| 220 """Strips and copies the required data files for the test suite.""" | 219 """Strips and copies the required data files for the test suite.""" |
| 221 self.test_package.StripAndCopyExecutable() | 220 self.test_package.StripAndCopyExecutable() |
| 222 self.test_package.PushDataAndPakFiles() | 221 self.test_package.PushDataAndPakFiles() |
| 223 self.tool.CopyFiles() | 222 self.tool.CopyFiles() |
| 224 test_data = self.GetDataFilesForTestSuite() | 223 test_data = self.GetDataFilesForTestSuite() |
| 225 if test_data and not self.fast_and_loose: | 224 if test_data: |
| 226 # Make sure SD card is ready. | 225 # Make sure SD card is ready. |
| 227 self.adb.WaitForSdCardReady(20) | 226 self.adb.WaitForSdCardReady(20) |
| 228 for data in test_data: | 227 for data in test_data: |
| 229 self.CopyTestData([data], self.adb.GetExternalStorage()) | 228 self.CopyTestData([data], self.adb.GetExternalStorage()) |
| 230 if self.test_package.test_suite_basename == 'webkit_unit_tests': | 229 if self.test_package.test_suite_basename == 'webkit_unit_tests': |
| 231 self.PushWebKitUnitTestsData() | 230 self.PushWebKitUnitTestsData() |
| 232 | 231 |
| 233 def PushWebKitUnitTestsData(self): | 232 def PushWebKitUnitTestsData(self): |
| 234 """Pushes the webkit_unit_tests data files to the device. | 233 """Pushes the webkit_unit_tests data files to the device. |
| 235 | 234 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 def TearDown(self): | 284 def TearDown(self): |
| 286 """Cleans up the test enviroment for the test suite.""" | 285 """Cleans up the test enviroment for the test suite.""" |
| 287 self.tool.CleanUpEnvironment() | 286 self.tool.CleanUpEnvironment() |
| 288 if self.test_package.cleanup_test_files: | 287 if self.test_package.cleanup_test_files: |
| 289 self.adb.RemovePushedFiles() | 288 self.adb.RemovePushedFiles() |
| 290 if self.dump_debug_info: | 289 if self.dump_debug_info: |
| 291 self.dump_debug_info.StopRecordingLog() | 290 self.dump_debug_info.StopRecordingLog() |
| 292 if self.dump_debug_info: | 291 if self.dump_debug_info: |
| 293 self.dump_debug_info.ArchiveNewCrashFiles() | 292 self.dump_debug_info.ArchiveNewCrashFiles() |
| 294 super(SingleTestRunner, self).TearDown() | 293 super(SingleTestRunner, self).TearDown() |
| OLD | NEW |