Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2017 The Chromium Authors. All rights reserved. | 1 # Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 import unittest | 4 import unittest |
| 5 | 5 |
| 6 from core import perf_data_generator | 6 from core import perf_data_generator |
| 7 from core.perf_data_generator import BenchmarkMetadata | 7 from core.perf_data_generator import BenchmarkMetadata |
| 8 | 8 |
| 9 | 9 |
| 10 class _MockBenchmark(object): | |
|
nednguyen
2017/04/14 20:45:59
why not just inherits this from the real benchmark
rnephew (Reviews Here)
2017/04/14 21:40:17
My intention was to not create unnecessary depende
| |
| 11 def __init__(self, name): | |
| 12 self.name = name | |
| 13 | |
| 14 def Name(self): | |
| 15 return self.name | |
| 16 | |
| 17 | |
| 10 class PerfDataGeneratorTest(unittest.TestCase): | 18 class PerfDataGeneratorTest(unittest.TestCase): |
| 11 def setUp(self): | 19 def setUp(self): |
| 12 # Test config can be big, so set maxDiff to None to see the full comparision | 20 # Test config can be big, so set maxDiff to None to see the full comparision |
| 13 # diff when assertEquals fails. | 21 # diff when assertEquals fails. |
| 14 self.maxDiff = None | 22 self.maxDiff = None |
| 15 | 23 |
| 16 def testVerifyAllTestsInBenchmarkCsvPassesWithCorrectInput(self): | 24 def testVerifyAllTestsInBenchmarkCsvPassesWithCorrectInput(self): |
| 17 tests = { | 25 tests = { |
| 18 'AAAAA1 AUTOGENERATED': {}, | 26 'AAAAA1 AUTOGENERATED': {}, |
| 19 'Android Nexus5 Perf (2)': { | 27 'Android Nexus5 Perf (2)': { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 'dimension_sets': [{'os': 'SkyNet', 'id': 'T-850', 'pool': 'T-RIP'}], | 112 'dimension_sets': [{'os': 'SkyNet', 'id': 'T-850', 'pool': 'T-RIP'}], |
| 105 'hard_timeout': 7200, | 113 'hard_timeout': 7200, |
| 106 'can_use_on_swarming_builders': True, | 114 'can_use_on_swarming_builders': True, |
| 107 'expiration': 36000, | 115 'expiration': 36000, |
| 108 'io_timeout': 3600, | 116 'io_timeout': 3600, |
| 109 }, | 117 }, |
| 110 'name': 'speedometer.reference', | 118 'name': 'speedometer.reference', |
| 111 'isolate_name': 'telemetry_perf_tests', | 119 'isolate_name': 'telemetry_perf_tests', |
| 112 } | 120 } |
| 113 self.assertEquals(test, expected_generated_test) | 121 self.assertEquals(test, expected_generated_test) |
| 122 | |
| 123 def testGenerateTelemetryTestsBlacklistedReferenceBuildTest(self): | |
| 124 swarming_dimensions = [ | |
| 125 {'os': 'SkyNet', 'id': 'T-850', 'pool': 'T-RIP', 'device_ids': ['a']} | |
| 126 ] | |
| 127 test_config = { | |
| 128 'platform': 'android', | |
| 129 'swarming_dimensions': swarming_dimensions, | |
| 130 } | |
| 131 benchmarks = [ | |
| 132 _MockBenchmark('blacklisted'), | |
| 133 _MockBenchmark('not_blacklisted') | |
| 134 ] | |
| 135 tests = perf_data_generator.generate_telemetry_tests( | |
| 136 test_config, benchmarks, None, False, ['blacklisted']) | |
| 137 expected_generated_tests = [ | |
|
nednguyen
2017/04/14 20:45:59
I think we only need a a few test methods that tes
rnephew (Reviews Here)
2017/04/14 21:40:17
Done.
| |
| 138 {'args': ['blacklisted', | |
| 139 '-v', | |
| 140 '--upload-results', | |
| 141 '--output-format=chartjson', | |
| 142 '--browser=android-chromium'], | |
| 143 'isolate_name': 'telemetry_perf_tests', | |
| 144 'name': 'blacklisted', | |
| 145 'override_compile_targets': ['telemetry_perf_tests'], | |
| 146 'swarming': {'can_use_on_swarming_builders': True, | |
| 147 'dimension_sets': [{'id': 'a', | |
| 148 'os': 'SkyNet', | |
| 149 'pool': 'Chrome-perf'}], | |
| 150 'expiration': 36000, | |
| 151 'hard_timeout': 7200, | |
| 152 'ignore_task_failure': False, | |
| 153 'io_timeout': 3600}}, | |
| 154 {'args': ['not_blacklisted', | |
| 155 '-v', | |
| 156 '--upload-results', | |
| 157 '--output-format=chartjson', | |
| 158 '--browser=android-chromium'], | |
| 159 'isolate_name': 'telemetry_perf_tests', | |
| 160 'name': 'not_blacklisted', | |
| 161 'override_compile_targets': ['telemetry_perf_tests'], | |
| 162 'swarming': {'can_use_on_swarming_builders': True, | |
| 163 'dimension_sets': [{'id': 'a', | |
| 164 'os': 'SkyNet', | |
| 165 'pool': 'Chrome-perf'}], | |
| 166 'expiration': 36000, | |
| 167 'hard_timeout': 7200, | |
| 168 'ignore_task_failure': False, | |
| 169 'io_timeout': 3600}}, | |
| 170 {'args': ['not_blacklisted', | |
| 171 '-v', | |
| 172 '--upload-results', | |
| 173 '--output-format=chartjson', | |
| 174 '--browser=reference', | |
| 175 '--output-trace-tag=_ref'], | |
| 176 'isolate_name': 'telemetry_perf_tests', | |
| 177 'name': 'not_blacklisted.reference', | |
| 178 'override_compile_targets': ['telemetry_perf_tests'], | |
| 179 'swarming': {'can_use_on_swarming_builders': True, | |
| 180 'dimension_sets': [{'id': 'a', | |
| 181 'os': 'SkyNet', | |
| 182 'pool': 'Chrome-perf'}], | |
| 183 'expiration': 36000, | |
| 184 'hard_timeout': 7200, | |
| 185 'ignore_task_failure': True, | |
| 186 'io_timeout': 3600} | |
| 187 } | |
| 188 ] | |
| 189 self.assertEquals(tests, expected_generated_tests) | |
| OLD | NEW |