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

Unified Diff: tools/telemetry/telemetry/test_runner.py

Issue 551883003: Update test_runner.py to use page_set names rather than paths. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/telemetry/telemetry/core/discover_unittest.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/test_runner.py
diff --git a/tools/telemetry/telemetry/test_runner.py b/tools/telemetry/telemetry/test_runner.py
index 6d43391da228724036379f6fb32cd4244a3e4b26..7fbbd8f90c1ac0bb4651e495228cb1bb10d7adfd 100644
--- a/tools/telemetry/telemetry/test_runner.py
+++ b/tools/telemetry/telemetry/test_runner.py
@@ -151,19 +151,19 @@ class Run(command_line.OptparseCommand):
parser.error('Need to specify a page set for "%s".' % test_class.Name())
if len(args.positional_args) > 2:
parser.error('Too many arguments.')
- page_set_path = args.positional_args[1]
- if not os.path.exists(page_set_path):
- parser.error('Page set not found.')
- if not (os.path.isfile(page_set_path) and
- discover.IsPageSetFile(page_set_path)):
- parser.error('Unsupported page set file format.')
+ page_set_name = args.positional_args[1]
+ page_set_class = _MatchPageSetName(page_set_name)
+ if page_set_class is None:
+ parser.error(
+ 'Page set not found. Please specify the name of a valid page set.')
+ #TODO(ariblue): Print available page sets.
class TestWrapper(benchmark.Benchmark):
test = test_class
@classmethod
def CreatePageSet(cls, options):
- return page_set.PageSet.FromFile(page_set_path)
+ return page_set_class()
test_class = TestWrapper
else:
@@ -213,6 +213,19 @@ def _Tests():
return tests
+# TODO(ariblue): Use discover.py's abstracted _MatchName class (in pending CL
+# 432543003) and eliminate _MatchPageSetName and _MatchTestName.
+def _MatchPageSetName(input_name):
+ page_sets = []
+ for base_dir in config.base_paths:
+ page_sets += discover.DiscoverClasses(base_dir, base_dir, page_set.PageSet,
+ index_by_class_name=True).values()
+ for p in page_sets:
+ if input_name == p.Name():
+ return p
+ return None
+
+
def _MatchTestName(input_test_name, exact_matches=True):
def _Matches(input_string, search_string):
if search_string.startswith(input_string):
« no previous file with comments | « tools/telemetry/telemetry/core/discover_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698