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

Unified Diff: tools/telemetry/telemetry/user_story/user_story_runner.py

Issue 790673005: Move max_failures option from PageTest to benchmark. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments. Created 6 years 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
Index: tools/telemetry/telemetry/user_story/user_story_runner.py
diff --git a/tools/telemetry/telemetry/user_story/user_story_runner.py b/tools/telemetry/telemetry/user_story/user_story_runner.py
index 0358c929b032dd06aaa3c82d91a0231f23de4549..57b217ea49870cbb4404b3feb5457db962514ae9 100644
--- a/tools/telemetry/telemetry/user_story/user_story_runner.py
+++ b/tools/telemetry/telemetry/user_story/user_story_runner.py
@@ -192,7 +192,8 @@ def GetUserStoryGroupsWithSameSharedUserStoryClass(user_story_set):
return user_story_groups
-def Run(test, user_story_set, expectations, finder_options, results):
+def Run(test, user_story_set, expectations, finder_options, results,
+ max_failures=None):
"""Runs a given test against a given page_set with the given options.
Stop execution for unexpected exceptions such as KeyboardInterrupt.
@@ -224,12 +225,14 @@ def Run(test, user_story_set, expectations, finder_options, results):
if not user_stories:
return
- user_story_with_discarded_first_results = set()
- max_failures = finder_options.max_failures # command-line gets priority
- if max_failures is None:
- max_failures = test.max_failures # may be None
+ # Effective max failures gives priority to command-line flag value.
+ effective_max_failures = finder_options.max_failures
+ if effective_max_failures is None:
+ effective_max_failures = max_failures
+
user_story_groups = GetUserStoryGroupsWithSameSharedUserStoryClass(
user_stories)
+ user_story_with_discarded_first_results = set()
test.WillRunTest(finder_options)
for group in user_story_groups:
@@ -277,7 +280,8 @@ def Run(test, user_story_set, expectations, finder_options, results):
# Print current exception and propagate existing exception.
exception_formatter.PrintFormattedException(
msg='Exception from result processing:')
- if max_failures is not None and len(results.failures) > max_failures:
+ if (effective_max_failures is not None and
+ len(results.failures) > effective_max_failures):
logging.error('Too many failures. Aborting.')
test.RequestExit()
finally:
« no previous file with comments | « tools/telemetry/telemetry/page/page_test.py ('k') | tools/telemetry/telemetry/user_story/user_story_runner_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698