Commit a66c92ff authored by jbroman's avatar jbroman Committed by Commit bot

Revert of Telemetry: Use the leftmost argument to find the test to parse...

Revert of Telemetry: Use the leftmost argument to find the test to parse flags. (patchset #2 id:20001 of https://codereview.chromium.org/582793002/)

Reason for revert:
Broke Android debug gpu bot:
http://build.chromium.org/p/chromium.gpu/builders/Android%20Debug%20%28Nexus%207%29/builds/12692

This bot relies on being able to supply some flags before the test name; it runs:
content/test/gpu/run_gpu_test.py --browser=android-content-shell webgl_conformance --webgl-conformance-version=1.0.1

Original issue's description:
> Telemetry: Use the leftmost argument to find the test to parse flags.
>
> Previously it would check all of the arguments, and use the last test found.
> This is causes problems as different tests can be used to create the parser and
> accepts the parsed flags.
>
> SHERIFFS: If errors related to parsing flags for run_measurement, run_benchmark
> or run_gpu_test.py appear, this is likely the cause. It is safe to revert.
>
> BUG=413334
>
> Committed: https://crrev.com/5afe5a61f03743bd523dae66f662ad773f8befb9
> Cr-Commit-Position: refs/heads/master@{#295738}

TBR=nednguyen@google.com,kbr@chromium.org,tonyg@chromium.org,dtu@chromium.org,ariblue@google.com
NOTREECHECKS=true
NOTRY=true
BUG=413334

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

Cr-Commit-Position: refs/heads/master@{#295765}
parent 30798ed8
...@@ -111,23 +111,15 @@ class Run(command_line.OptparseCommand): ...@@ -111,23 +111,15 @@ class Run(command_line.OptparseCommand):
def AddCommandLineArgs(cls, parser): def AddCommandLineArgs(cls, parser):
benchmark.AddCommandLineArgs(parser) benchmark.AddCommandLineArgs(parser)
# TODO(jbroman): This compensates for the fact that the "run" command
# may or may not be given on the command line. It's inelegant.
if len(sys.argv) > 2 and 'run'.startswith(sys.argv[1]):
test_name = sys.argv[2]
elif len(sys.argv) > 1:
test_name = sys.argv[1]
else:
# No arguments, so no more flags needed.
return
# Allow tests to add their own command line options. # Allow tests to add their own command line options.
matching_tests = _MatchTestName(test_name) matching_tests = []
for arg in sys.argv[1:]:
matching_tests += _MatchTestName(arg)
if matching_tests: if matching_tests:
# TODO(dtu): After move to argparse, add command-line args for all tests # TODO(dtu): After move to argparse, add command-line args for all tests
# to subparser. Using subparsers will avoid duplicate arguments. # to subparser. Using subparsers will avoid duplicate arguments.
matching_test = matching_tests[0] matching_test = matching_tests.pop()
matching_test.AddCommandLineArgs(parser) matching_test.AddCommandLineArgs(parser)
# The test's options override the defaults! # The test's options override the defaults!
matching_test.SetArgumentDefaults(parser) matching_test.SetArgumentDefaults(parser)
...@@ -254,8 +246,6 @@ def _MatchTestName(input_test_name, exact_matches=True): ...@@ -254,8 +246,6 @@ def _MatchTestName(input_test_name, exact_matches=True):
for test_class in _Tests(): for test_class in _Tests():
if exact_match == test_class.Name(): if exact_match == test_class.Name():
return [test_class] return [test_class]
# TODO(jbroman): [] is the correct result when no exact match is found.
# However, some bots rely on this falling through right now.
# Fuzzy matching. # Fuzzy matching.
return [test_class for test_class in _Tests() return [test_class for test_class in _Tests()
......
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