From 69c558b42977054d6168ad13829ebdd80ad77a7c Mon Sep 17 00:00:00 2001 From: Zhizhou Yang Date: Tue, 13 Nov 2018 09:51:13 -0800 Subject: crosperf: do not allow more than one story tags in test_args This patch added a check at stage of parsing benchmark, to ensure that story tag only appear once in test_args. This is because more than one story tags will cause an implicit failure when running benchmark on DUT and crosperf cannot catch it. BUG=chromium:902466 TEST=Passed unit tests and a simple test Change-Id: Ic8e4aa19928911fb4ed03529ab89471856cec05c Reviewed-on: https://chromium-review.googlesource.com/1330010 Commit-Ready: Zhizhou Yang Tested-by: Zhizhou Yang Reviewed-by: Caroline Tice --- crosperf/experiment_factory.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'crosperf/experiment_factory.py') diff --git a/crosperf/experiment_factory.py b/crosperf/experiment_factory.py index c9c3e68a..60785fa3 100644 --- a/crosperf/experiment_factory.py +++ b/crosperf/experiment_factory.py @@ -174,12 +174,16 @@ class ExperimentFactory(object): test_args = benchmark_settings.GetField('test_args') # Rename benchmark name if 'story-filter' or 'story-tag-filter' specified - # in test_args. + # in test_args. Make sure these two tags only appear once. + story_count = 0 for arg in test_args.split(): - if '--story-filter' in arg or '--story-tag-filter' in arg: + if '--story-filter=' in arg or '--story-tag-filter=' in arg: + story_count += 1 + if story_count > 1: + raise RuntimeError("Only one story or story-tag filter allowed in " + "a single benchmark run") # Rename benchmark name with an extension of 'story'-option benchmark_name = '%s@@%s' % (benchmark_name, arg.split('=')[-1]) - break # Check for duplicated benchmark name after renaming if not benchmark_name in benchmark_names: -- cgit v1.2.3