Commit 181a5c9c authored by frankf@chromium.org's avatar frankf@chromium.org

[Android] Add --no-timeout to perf sharder.

This delegates timeout logic to the step command.

BUG=
R=bulach@chromium.org, craigdh@chromium.org

Review URL: https://codereview.chromium.org/23784006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221721 0039d316-1c4b-4281-b951-d872f2087c98
parent 3acff903
...@@ -10,4 +10,5 @@ PerfOptions = collections.namedtuple('PerfOptions', [ ...@@ -10,4 +10,5 @@ PerfOptions = collections.namedtuple('PerfOptions', [
'steps', 'steps',
'flaky_steps', 'flaky_steps',
'print_step', 'print_step',
'no_timeout',
]) ])
...@@ -114,9 +114,14 @@ class TestRunner(base_test_runner.BaseTestRunner): ...@@ -114,9 +114,14 @@ class TestRunner(base_test_runner.BaseTestRunner):
(self._tests[test_name], self.device)) (self._tests[test_name], self.device))
logging.info('%s : %s', test_name, cmd) logging.info('%s : %s', test_name, cmd)
start_time = datetime.datetime.now() start_time = datetime.datetime.now()
timeout = 1800
if self._options.no_timeout:
timeout = None
output, exit_code = pexpect.run( output, exit_code = pexpect.run(
cmd, cwd=os.path.abspath(constants.DIR_SOURCE_ROOT), cmd, cwd=os.path.abspath(constants.DIR_SOURCE_ROOT),
withexitstatus=True, logfile=sys.stdout, timeout=1800, withexitstatus=True, logfile=sys.stdout, timeout=timeout,
env=os.environ) env=os.environ)
end_time = datetime.datetime.now() end_time = datetime.datetime.now()
if exit_code is None: if exit_code is None:
......
...@@ -4,11 +4,7 @@ ...@@ -4,11 +4,7 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
"""Runs all types of tests from one unified interface. """Runs all types of tests from one unified interface."""
TODO(gkanwar):
* Add options to run Monkey tests.
"""
import collections import collections
import logging import logging
...@@ -433,14 +429,20 @@ def AddPerfTestOptions(option_parser): ...@@ -433,14 +429,20 @@ def AddPerfTestOptions(option_parser):
option_parser.command_list = [] option_parser.command_list = []
option_parser.example = ('%prog perf --steps perf_steps.json') option_parser.example = ('%prog perf --steps perf_steps.json')
option_parser.add_option('--steps', help='JSON file containing the list ' option_parser.add_option(
'of perf steps to run.') '--steps',
option_parser.add_option('--flaky-steps', help='JSON file containing the list of perf steps to run.')
help='A JSON file containing steps that are flaky ' option_parser.add_option(
'and will have its exit code ignored.') '--flaky-steps',
option_parser.add_option('--print-step', help='The name of a previously ' help=('A JSON file containing steps that are flaky '
'executed perf step to print.') 'and will have its exit code ignored.'))
option_parser.add_option(
'--print-step',
help='The name of a previously executed perf step to print.')
option_parser.add_option(
'--no-timeout', action='store_true',
help=('Do not impose a timeout. Each perf step is responsible for '
'implementing the timeout logic.'))
AddCommonOptions(option_parser) AddCommonOptions(option_parser)
...@@ -458,7 +460,8 @@ def ProcessPerfTestOptions(options, error_func): ...@@ -458,7 +460,8 @@ def ProcessPerfTestOptions(options, error_func):
if not options.steps and not options.print_step: if not options.steps and not options.print_step:
error_func('Please specify --steps or --print-step') error_func('Please specify --steps or --print-step')
return perf_test_options.PerfOptions( return perf_test_options.PerfOptions(
options.steps, options.flaky_steps, options.print_step) options.steps, options.flaky_steps, options.print_step,
options.no_timeout)
def _RunGTests(options, error_func, devices): def _RunGTests(options, error_func, devices):
...@@ -571,7 +574,8 @@ def _RunMonkeyTests(options, error_func, devices): ...@@ -571,7 +574,8 @@ def _RunMonkeyTests(options, error_func, devices):
runner_factory, tests = monkey_setup.Setup(monkey_options) runner_factory, tests = monkey_setup.Setup(monkey_options)
results, exit_code = test_dispatcher.RunTests( results, exit_code = test_dispatcher.RunTests(
tests, runner_factory, devices, shard=False, test_timeout=None) tests, runner_factory, devices, shard=False, test_timeout=None,
num_retries=options.num_retries)
report_results.LogFull( report_results.LogFull(
results=results, results=results,
...@@ -591,7 +595,8 @@ def _RunPerfTests(options, error_func, devices): ...@@ -591,7 +595,8 @@ def _RunPerfTests(options, error_func, devices):
runner_factory, tests = perf_setup.Setup(perf_options) runner_factory, tests = perf_setup.Setup(perf_options)
results, _ = test_dispatcher.RunTests( results, _ = test_dispatcher.RunTests(
tests, runner_factory, devices, shard=True, test_timeout=None) tests, runner_factory, devices, shard=True, test_timeout=None,
num_retries=options.num_retries)
report_results.LogFull( report_results.LogFull(
results=results, results=results,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment