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 | 8 |
9 from pylib import android_commands | 9 from pylib import android_commands |
10 from pylib import constants | 10 from pylib import constants |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 256 |
257 try: | 257 try: |
258 self.test_package.ClearApplicationState() | 258 self.test_package.ClearApplicationState() |
259 self.test_package.CreateTestRunnerScript(test, self._test_arguments) | 259 self.test_package.CreateTestRunnerScript(test, self._test_arguments) |
260 test_results = self.test_package.RunTestsAndListResults() | 260 test_results = self.test_package.RunTestsAndListResults() |
261 except errors.DeviceUnresponsiveError as e: | 261 except errors.DeviceUnresponsiveError as e: |
262 # Make sure this device is not attached | 262 # Make sure this device is not attached |
263 logging.warning(e) | 263 logging.warning(e) |
264 if android_commands.IsDeviceAttached(self.device): | 264 if android_commands.IsDeviceAttached(self.device): |
265 raise | 265 raise |
| 266 finally: |
| 267 self.CleanupSpawningServerState() |
266 # Calculate unknown test results. | 268 # Calculate unknown test results. |
267 # TODO(frankf): Do not break TestResults encapsulation. | 269 # TODO(frankf): Do not break TestResults encapsulation. |
268 all_tests = set(test.split(':')) | 270 all_tests = set(test.split(':')) |
269 all_tests_ran = set([t.name for t in test_results.GetAll()]) | 271 all_tests_ran = set([t.name for t in test_results.GetAll()]) |
270 unknown_tests = all_tests - all_tests_ran | 272 unknown_tests = all_tests - all_tests_ran |
271 test_results.unknown = [test_result.BaseTestResult(t, '') for t in | 273 test_results.unknown = [test_result.BaseTestResult(t, '') for t in |
272 unknown_tests] | 274 unknown_tests] |
273 retry = ':'.join([t.name for t in test_results.GetAllBroken()]) | 275 retry = ':'.join([t.name for t in test_results.GetAllBroken()]) |
274 return test_results, retry | 276 return test_results, retry |
275 | 277 |
276 #override | 278 #override |
277 def SetUp(self): | 279 def SetUp(self): |
278 """Sets up necessary test enviroment for the test suite.""" | 280 """Sets up necessary test enviroment for the test suite.""" |
279 super(TestRunner, self).SetUp() | 281 super(TestRunner, self).SetUp() |
280 self.StripAndCopyFiles() | 282 self.StripAndCopyFiles() |
281 if _TestSuiteRequiresMockTestServer(self.test_package.test_suite_basename): | 283 if _TestSuiteRequiresMockTestServer(self.test_package.test_suite_basename): |
282 self.LaunchChromeTestServerSpawner() | 284 self.LaunchChromeTestServerSpawner() |
283 self.tool.SetupEnvironment() | 285 self.tool.SetupEnvironment() |
284 | 286 |
285 #override | 287 #override |
286 def TearDown(self): | 288 def TearDown(self): |
287 """Cleans up the test enviroment for the test suite.""" | 289 """Cleans up the test enviroment for the test suite.""" |
288 self.tool.CleanUpEnvironment() | 290 self.tool.CleanUpEnvironment() |
289 if self._cleanup_test_files: | 291 if self._cleanup_test_files: |
290 self.adb.RemovePushedFiles() | 292 self.adb.RemovePushedFiles() |
291 super(TestRunner, self).TearDown() | 293 super(TestRunner, self).TearDown() |
OLD | NEW |