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

Unified Diff: dashboard/dashboard/pinpoint/handlers/quest_generator.py

Issue 2998283002: [pinpoint] Add GTest support to quest_generator. (Closed)
Patch Set: Rebase Created 3 years, 4 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 | « no previous file | dashboard/dashboard/pinpoint/handlers/quest_generator_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dashboard/dashboard/pinpoint/handlers/quest_generator.py
diff --git a/dashboard/dashboard/pinpoint/handlers/quest_generator.py b/dashboard/dashboard/pinpoint/handlers/quest_generator.py
index 423b392cc6277087793789ad0c380d54c7afdd56..04676cd79bb6177760c834955d9181f586127bf5 100644
--- a/dashboard/dashboard/pinpoint/handlers/quest_generator.py
+++ b/dashboard/dashboard/pinpoint/handlers/quest_generator.py
@@ -29,38 +29,25 @@ def GenerateQuests(request):
A tuple of (arguments, quests), where arguments is a dict containing the
request arguments that were used, and quests is a list of Quests.
"""
+ target = request.get('target')
+ if target in ('telemetry_perf_tests', 'telemetry_perf_webview_tests'):
+ quest_functions = (_FindIsolate, _TelemetryRunTest, _ReadChartJsonValue)
+ else:
+ quest_functions = (_FindIsolate, _GTestRunTest, _ReadGraphJsonValue)
+
arguments = {}
quests = []
-
- quest_arguments, quest = _FindIsolateQuest(request)
- arguments.update(quest_arguments)
- quests.append(quest)
-
- dimensions = request.get('dimensions')
- if not dimensions:
- return arguments, quests
- dimensions = json.loads(dimensions)
- arguments['dimensions'] = json.dumps(dimensions)
-
- if arguments['target'] in ('telemetry_perf_tests',
- 'telemetry_perf_webview_tests'):
- quest_arguments, quest = _TelemetryRunTestQuest(request, dimensions)
+ for quest_function in quest_functions:
+ quest_arguments, quest = quest_function(request)
+ if not quest:
+ return arguments, quests
arguments.update(quest_arguments)
quests.append(quest)
- metric = request.get('metric')
- if not metric:
- return arguments, quests
- arguments['metric'] = metric
-
- quests.append(quest_module.ReadChartJsonValue(metric, request.get('story')))
- else:
- raise NotImplementedError()
-
return arguments, quests
-def _FindIsolateQuest(request):
+def _FindIsolate(request):
arguments = {}
configuration = request.get('configuration')
@@ -76,10 +63,16 @@ def _FindIsolateQuest(request):
return arguments, quest_module.FindIsolate(configuration, target)
-def _TelemetryRunTestQuest(request, dimensions):
+def _TelemetryRunTest(request):
arguments = {}
swarming_extra_args = []
+ dimensions = request.get('dimensions')
+ if not dimensions:
+ return {}, None
+ dimensions = json.loads(dimensions)
+ arguments['dimensions'] = json.dumps(dimensions)
+
benchmark = request.get('benchmark')
if not benchmark:
raise TypeError('Missing "benchmark" argument.')
@@ -95,7 +88,7 @@ def _TelemetryRunTestQuest(request, dimensions):
if repeat_count:
arguments['repeat_count'] = repeat_count
else:
- repeat_count = '20'
+ repeat_count = str(_DEFAULT_REPEAT_COUNT)
swarming_extra_args += ('--pageset-repeat', repeat_count)
browser = request.get('browser')
@@ -109,3 +102,62 @@ def _TelemetryRunTestQuest(request, dimensions):
swarming_extra_args += _SWARMING_EXTRA_ARGS
return arguments, quest_module.RunTest(dimensions, swarming_extra_args)
+
+
+def _GTestRunTest(request):
+ arguments = {}
+ swarming_extra_args = []
+
+ dimensions = request.get('dimensions')
+ if not dimensions:
+ return {}, None
+ dimensions = json.loads(dimensions)
+ arguments['dimensions'] = json.dumps(dimensions)
+
+ test = request.get('test')
+ if test:
+ arguments['test'] = test
+ swarming_extra_args += ('--gtest_filter', test)
+
+ repeat_count = request.get('repeat_count')
+ if repeat_count:
+ arguments['repeat_count'] = repeat_count
+ else:
+ repeat_count = str(_DEFAULT_REPEAT_COUNT)
+ swarming_extra_args += ('--gtest_repeat', repeat_count)
+
+ swarming_extra_args += _SWARMING_EXTRA_ARGS
+
+ return arguments, quest_module.RunTest(dimensions, swarming_extra_args)
+
+
+def _ReadChartJsonValue(request):
+ arguments = {}
+
+ metric = request.get('metric')
+ if not metric:
+ return {}, None
+ arguments['metric'] = metric
+
+ story = request.get('story')
+ if story:
+ arguments['story'] = story
+
+ return arguments, quest_module.ReadChartJsonValue(metric, story)
+
+
+def _ReadGraphJsonValue(request):
+ arguments = {}
+
+ chart = request.get('chart')
+ trace = request.get('trace')
+ if not (chart or trace):
+ return {}, None
+ if chart and not trace:
+ raise TypeError('"chart" specified but no "trace" given.')
+ if trace and not chart:
+ raise TypeError('"trace" specified but no "chart" given.')
+ arguments['chart'] = chart
+ arguments['trace'] = trace
+
+ return arguments, quest_module.ReadGraphJsonValue(chart, trace)
« no previous file with comments | « no previous file | dashboard/dashboard/pinpoint/handlers/quest_generator_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698