diff options
author | Zhizhou Yang <zhizhouy@google.com> | 2018-12-05 10:13:05 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-12-06 05:54:39 -0800 |
commit | 6535cc843c4860246fb455d147b1b282e2b72c87 (patch) | |
tree | 1c193fb0d283eb0fe71f1d1a8157ba69b3f27387 /crosperf | |
parent | 5cc59a85d1557f9fb420f6a718c201e6c62c2a53 (diff) | |
download | toolchain-utils-6535cc843c4860246fb455d147b1b282e2b72c87.tar.gz |
crosperf: make cwp_dso only work for run_local=False
We do not want to run cwp_dso experiment with run_local to be True.
Note that run_local is set to True by default.
BUG=chromium:902785
TEST=Passed all unit tests
Change-Id: I11688f34b3c96ac91d3a75ec645bdb5430bef69e
Reviewed-on: https://chromium-review.googlesource.com/1363472
Commit-Ready: Zhizhou Yang <zhizhouy@google.com>
Tested-by: Zhizhou Yang <zhizhouy@google.com>
Reviewed-by: Caroline Tice <cmtice@chromium.org>
Diffstat (limited to 'crosperf')
-rw-r--r-- | crosperf/experiment_factory.py | 3 | ||||
-rwxr-xr-x | crosperf/experiment_factory_unittest.py | 20 |
2 files changed, 21 insertions, 2 deletions
diff --git a/crosperf/experiment_factory.py b/crosperf/experiment_factory.py index aa0e4cf0..20e0fdba 100644 --- a/crosperf/experiment_factory.py +++ b/crosperf/experiment_factory.py @@ -202,6 +202,9 @@ class ExperimentFactory(object): if suite != 'telemetry_Crosperf': raise RuntimeError('CWP approximation weight only works with ' 'telemetry_Crosperf suite') + if run_local: + raise RuntimeError('run_local must be set to False to use CWP ' + 'approximation') if weight > 1 or weight < 0: raise RuntimeError('Weight should be a float between 0 and 1') elif cwp_dso: diff --git a/crosperf/experiment_factory_unittest.py b/crosperf/experiment_factory_unittest.py index d7805c72..92fb3116 100755 --- a/crosperf/experiment_factory_unittest.py +++ b/crosperf/experiment_factory_unittest.py @@ -52,12 +52,14 @@ EXPERIMENT_FILE_2 = """ benchmark: Octane { iterations: 1 suite: telemetry_Crosperf + run_local: False weight: 0.8 } benchmark: Kraken { iterations: 1 suite: telemetry_Crosperf + run_local: False weight: 0.2 } @@ -169,10 +171,24 @@ class ExperimentFactoryTest(unittest.TestCase): 'telemetry_Crosperf suite', str(msg.exception)) - # Test 5: weight should be float between 0 and 1 + # Test 5: cwp_dso does not work for local run + benchmark_settings = settings_factory.BenchmarkSettings('name') + benchmark_settings.SetField('weight', '0.8') + benchmark_settings.SetField('suite', 'telemetry_Crosperf') + benchmark_settings.SetField('run_local', 'True') + mock_experiment_file.all_settings = [] + mock_experiment_file.all_settings.append(benchmark_settings) + with self.assertRaises(RuntimeError) as msg: + ef = ExperimentFactory() + ef.GetExperiment(mock_experiment_file, '', '') + self.assertEqual('run_local must be set to False to use CWP approximation', + str(msg.exception)) + + # Test 6: weight should be float between 0 and 1 benchmark_settings = settings_factory.BenchmarkSettings('name') benchmark_settings.SetField('weight', '1.2') benchmark_settings.SetField('suite', 'telemetry_Crosperf') + benchmark_settings.SetField('run_local', 'False') mock_experiment_file.all_settings = [] mock_experiment_file.all_settings.append(benchmark_settings) with self.assertRaises(RuntimeError) as msg: @@ -181,7 +197,7 @@ class ExperimentFactoryTest(unittest.TestCase): self.assertEqual('Weight should be a float between 0 and 1', str(msg.exception)) - # Test 6: more than one story tag in test_args + # Test 7: more than one story tag in test_args benchmark_settings = settings_factory.BenchmarkSettings('name') benchmark_settings.SetField('test_args', '--story-filter=a --story-tag-filter=b') |