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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 | 246 |
247 Returns: | 247 Returns: |
248 A TestResults object. | 248 A TestResults object. |
249 """ | 249 """ |
250 try: | 250 try: |
251 self.test_package.CreateTestRunnerScript(self._gtest_filter, | 251 self.test_package.CreateTestRunnerScript(self._gtest_filter, |
252 self._test_arguments) | 252 self._test_arguments) |
253 self.test_results = self.test_package.RunTestsAndListResults() | 253 self.test_results = self.test_package.RunTestsAndListResults() |
254 except errors.DeviceUnresponsiveError as e: | 254 except errors.DeviceUnresponsiveError as e: |
255 # Make sure this device is not attached | 255 # Make sure this device is not attached |
| 256 logging.warning(e) |
256 if android_commands.IsDeviceAttached(self.device): | 257 if android_commands.IsDeviceAttached(self.device): |
257 raise e | 258 raise e |
258 | 259 self.test_results.device_exception = device_exception |
259 # TODO(frankf): We should report these as "skipped" not "failures". | 260 # Calculate unknown test results. |
260 # Wrap the results | 261 finally: |
261 logging.warning(e) | 262 # TODO(frankf): Do not break TestResults encapsulation. |
262 failed_tests = [] | 263 all_tests = set(self._gtest_filter.split(':')) |
263 for t in self._gtest_filter.split(':'): | 264 all_tests_ran = set([t.name for t in self.test_results.GetAll()]) |
264 failed_tests += [BaseTestResult(t, '')] | 265 unknown_tests = all_tests - all_tests_ran |
265 self.test_results = TestResults.FromRun( | 266 self.test_results.unknown = [BaseTestResult(t, '') for t in unknown_tests] |
266 failed=failed_tests, device_exception=self.device) | |
267 | 267 |
268 return self.test_results | 268 return self.test_results |
269 | 269 |
270 def SetUp(self): | 270 def SetUp(self): |
271 """Sets up necessary test enviroment for the test suite.""" | 271 """Sets up necessary test enviroment for the test suite.""" |
272 super(SingleTestRunner, self).SetUp() | 272 super(SingleTestRunner, self).SetUp() |
273 self.adb.ClearApplicationState(constants.CHROME_PACKAGE) | 273 self.adb.ClearApplicationState(constants.CHROME_PACKAGE) |
274 if self.dump_debug_info: | 274 if self.dump_debug_info: |
275 self.dump_debug_info.StartRecordingLog(True) | 275 self.dump_debug_info.StartRecordingLog(True) |
276 self.StripAndCopyFiles() | 276 self.StripAndCopyFiles() |
277 self.LaunchHelperToolsForTestSuite() | 277 self.LaunchHelperToolsForTestSuite() |
278 self.tool.SetupEnvironment() | 278 self.tool.SetupEnvironment() |
279 | 279 |
280 def TearDown(self): | 280 def TearDown(self): |
281 """Cleans up the test enviroment for the test suite.""" | 281 """Cleans up the test enviroment for the test suite.""" |
282 self.tool.CleanUpEnvironment() | 282 self.tool.CleanUpEnvironment() |
283 if self.test_package.cleanup_test_files: | 283 if self.test_package.cleanup_test_files: |
284 self.adb.RemovePushedFiles() | 284 self.adb.RemovePushedFiles() |
285 if self.dump_debug_info: | 285 if self.dump_debug_info: |
286 self.dump_debug_info.StopRecordingLog() | 286 self.dump_debug_info.StopRecordingLog() |
287 if self.dump_debug_info: | 287 if self.dump_debug_info: |
288 self.dump_debug_info.ArchiveNewCrashFiles() | 288 self.dump_debug_info.ArchiveNewCrashFiles() |
289 super(SingleTestRunner, self).TearDown() | 289 super(SingleTestRunner, self).TearDown() |
OLD | NEW |