Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: build/android/pylib/gtest/test_runner.py

Issue 1108173002: Roll //build, //native_client, and a few more targets of opportunity. Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Test fix Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/android/pylib/gtest/test_package_exe.py ('k') | build/android/pylib/host_driven/setup.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 logging 5 import logging
6 import os 6 import os
7 import re 7 import re
8 8
9 from pylib import pexpect 9 from pylib import pexpect
10 from pylib import ports 10 from pylib import ports
11 from pylib.base import base_test_result 11 from pylib.base import base_test_result
12 from pylib.base import base_test_runner 12 from pylib.base import base_test_runner
13 from pylib.device import device_errors 13 from pylib.device import device_errors
14 from pylib.local import local_test_server_spawner 14 from pylib.local import local_test_server_spawner
15 from pylib.perf import perf_control 15 from pylib.perf import perf_control
16 16
17 # Test case statuses. 17 # Test case statuses.
18 RE_RUN = re.compile('\\[ RUN \\] ?(.*)\r\n') 18 RE_RUN = re.compile('\\[ RUN \\] ?(.*)\r\n')
19 RE_FAIL = re.compile('\\[ FAILED \\] ?(.*?)( \\((\\d+) ms\\))?\r\r\n') 19 RE_FAIL = re.compile('\\[ FAILED \\] ?(.*?)( \\((\\d+) ms\\))?\r\r\n')
20 RE_OK = re.compile('\\[ OK \\] ?(.*?)( \\((\\d+) ms\\))?\r\r\n') 20 RE_OK = re.compile('\\[ OK \\] ?(.*?)( \\((\\d+) ms\\))?\r\r\n')
21 21
22 # Test run statuses. 22 # Test run statuses.
23 RE_PASSED = re.compile('\\[ PASSED \\] ?(.*)\r\n') 23 RE_PASSED = re.compile('\\[ PASSED \\] ?(.*)\r\n')
24 RE_RUNNER_FAIL = re.compile('\\[ RUNNER_FAILED \\] ?(.*)\r\n') 24 RE_RUNNER_FAIL = re.compile('\\[ RUNNER_FAILED \\] ?(.*)\r\n')
25 # Signal handlers are installed before starting tests 25 # Signal handlers are installed before starting tests
26 # to output the CRASHED marker when a crash happens. 26 # to output the CRASHED marker when a crash happens.
27 RE_CRASH = re.compile('\\[ CRASHED \\](.*)\r\n') 27 RE_CRASH = re.compile('\\[ CRASHED \\](.*)\r\n')
28 28
29 # Bots that don't output anything for 20 minutes get timed out, so that's our
30 # hard cap.
31 _INFRA_STDOUT_TIMEOUT = 20 * 60
32
29 33
30 def _TestSuiteRequiresMockTestServer(suite_name): 34 def _TestSuiteRequiresMockTestServer(suite_name):
31 """Returns True if the test suite requires mock test server.""" 35 """Returns True if the test suite requires mock test server."""
32 tests_require_net_test_server = ['unit_tests', 'net_unittests', 36 tests_require_net_test_server = ['unit_tests', 'net_unittests',
37 'components_browsertests',
33 'content_unittests', 38 'content_unittests',
34 'content_browsertests'] 39 'content_browsertests']
35 return (suite_name in 40 return (suite_name in
36 tests_require_net_test_server) 41 tests_require_net_test_server)
37 42
38 def _TestSuiteRequiresHighPerfMode(suite_name): 43 def _TestSuiteRequiresHighPerfMode(suite_name):
39 """Returns True if the test suite requires high performance mode.""" 44 """Returns True if the test suite requires high performance mode."""
40 return 'perftests' in suite_name 45 return 'perftests' in suite_name
41 46
42 class TestRunner(base_test_runner.BaseTestRunner): 47 class TestRunner(base_test_runner.BaseTestRunner):
43 def __init__(self, test_options, device, test_package): 48 def __init__(self, test_options, device, test_package):
44 """Single test suite attached to a single device. 49 """Single test suite attached to a single device.
45 50
46 Args: 51 Args:
47 test_options: A GTestOptions object. 52 test_options: A GTestOptions object.
48 device: Device to run the tests. 53 device: Device to run the tests.
49 test_package: An instance of TestPackage class. 54 test_package: An instance of TestPackage class.
50 """ 55 """
51 56
52 super(TestRunner, self).__init__(device, test_options.tool, 57 super(TestRunner, self).__init__(device, test_options.tool)
53 test_options.cleanup_test_files)
54 58
55 self.test_package = test_package 59 self.test_package = test_package
56 self.test_package.tool = self.tool 60 self.test_package.tool = self.tool
57 self._test_arguments = test_options.test_arguments 61 self._test_arguments = test_options.test_arguments
58 62
59 timeout = test_options.timeout 63 timeout = test_options.timeout
60 if timeout == 0: 64 if timeout == 0:
61 timeout = 60 65 timeout = 60
62 # On a VM (e.g. chromium buildbots), this timeout is way too small. 66 # On a VM (e.g. chromium buildbots), this timeout is way too small.
63 if os.environ.get('BUILDBOT_SLAVENAME'): 67 if os.environ.get('BUILDBOT_SLAVENAME'):
64 timeout = timeout * 2 68 timeout = timeout * 2
65 69
66 self._timeout = timeout * self.tool.GetTimeoutScale() 70 self._timeout = min(timeout * self.tool.GetTimeoutScale(),
71 _INFRA_STDOUT_TIMEOUT)
67 if _TestSuiteRequiresHighPerfMode(self.test_package.suite_name): 72 if _TestSuiteRequiresHighPerfMode(self.test_package.suite_name):
68 self._perf_controller = perf_control.PerfControl(self.device) 73 self._perf_controller = perf_control.PerfControl(self.device)
69 74
70 if _TestSuiteRequiresMockTestServer(self.test_package.suite_name): 75 if _TestSuiteRequiresMockTestServer(self.test_package.suite_name):
71 self._servers = [ 76 self._servers = [
72 local_test_server_spawner.LocalTestServerSpawner( 77 local_test_server_spawner.LocalTestServerSpawner(
73 ports.AllocateTestServerPort(), self.device, self.tool)] 78 ports.AllocateTestServerPort(), self.device, self.tool)]
74 else: 79 else:
75 self._servers = [] 80 self._servers = []
76 81
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 #override 192 #override
188 def TearDown(self): 193 def TearDown(self):
189 """Cleans up the test enviroment for the test suite.""" 194 """Cleans up the test enviroment for the test suite."""
190 for s in self._servers: 195 for s in self._servers:
191 s.TearDown() 196 s.TearDown()
192 if _TestSuiteRequiresHighPerfMode(self.test_package.suite_name): 197 if _TestSuiteRequiresHighPerfMode(self.test_package.suite_name):
193 self._perf_controller.SetDefaultPerfMode() 198 self._perf_controller.SetDefaultPerfMode()
194 self.test_package.ClearApplicationState(self.device) 199 self.test_package.ClearApplicationState(self.device)
195 self.tool.CleanUpEnvironment() 200 self.tool.CleanUpEnvironment()
196 super(TestRunner, self).TearDown() 201 super(TestRunner, self).TearDown()
OLDNEW
« no previous file with comments | « build/android/pylib/gtest/test_package_exe.py ('k') | build/android/pylib/host_driven/setup.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698