| 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 from telemetry import benchmark |
| 10 |
| 9 | 11 |
| 10 class PerfDataGeneratorTest(unittest.TestCase): | 12 class PerfDataGeneratorTest(unittest.TestCase): |
| 11 def setUp(self): | 13 def setUp(self): |
| 12 # Test config can be big, so set maxDiff to None to see the full comparision | 14 # Test config can be big, so set maxDiff to None to see the full comparision |
| 13 # diff when assertEquals fails. | 15 # diff when assertEquals fails. |
| 14 self.maxDiff = None | 16 self.maxDiff = None |
| 15 | 17 |
| 16 def testVerifyAllTestsInBenchmarkCsvPassesWithCorrectInput(self): | 18 def testVerifyAllTestsInBenchmarkCsvPassesWithCorrectInput(self): |
| 17 tests = { | 19 tests = { |
| 18 'AAAAA1 AUTOGENERATED': {}, | 20 'AAAAA1 AUTOGENERATED': {}, |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 'dimension_sets': [{'os': 'SkyNet', 'id': 'T-850', 'pool': 'T-RIP'}], | 106 'dimension_sets': [{'os': 'SkyNet', 'id': 'T-850', 'pool': 'T-RIP'}], |
| 105 'hard_timeout': 7200, | 107 'hard_timeout': 7200, |
| 106 'can_use_on_swarming_builders': True, | 108 'can_use_on_swarming_builders': True, |
| 107 'expiration': 36000, | 109 'expiration': 36000, |
| 108 'io_timeout': 3600, | 110 'io_timeout': 3600, |
| 109 }, | 111 }, |
| 110 'name': 'speedometer.reference', | 112 'name': 'speedometer.reference', |
| 111 'isolate_name': 'telemetry_perf_tests', | 113 'isolate_name': 'telemetry_perf_tests', |
| 112 } | 114 } |
| 113 self.assertEquals(test, expected_generated_test) | 115 self.assertEquals(test, expected_generated_test) |
| 116 |
| 117 def testGenerateTelemetryTestsBlacklistedReferenceBuildTest(self): |
| 118 class BlacklistedBenchmark(benchmark.Benchmark): |
| 119 @classmethod |
| 120 def Name(cls): |
| 121 return 'blacklisted' |
| 122 |
| 123 class NotBlacklistedBenchmark(benchmark.Benchmark): |
| 124 @classmethod |
| 125 def Name(cls): |
| 126 return 'not_blacklisted' |
| 127 |
| 128 swarming_dimensions = [ |
| 129 {'os': 'SkyNet', 'id': 'T-850', 'pool': 'T-RIP', 'device_ids': ['a']} |
| 130 ] |
| 131 test_config = { |
| 132 'platform': 'android', |
| 133 'swarming_dimensions': swarming_dimensions, |
| 134 } |
| 135 benchmarks = [BlacklistedBenchmark, NotBlacklistedBenchmark] |
| 136 tests = perf_data_generator.generate_telemetry_tests( |
| 137 test_config, benchmarks, None, False, ['blacklisted']) |
| 138 |
| 139 generated_test_names = set(t['name'] for t in tests) |
| 140 self.assertEquals( |
| 141 generated_test_names, |
| 142 {'blacklisted', 'not_blacklisted', 'not_blacklisted.reference'}) |
| OLD | NEW |