Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 | 4 |
| 5 """Example of using the PGO recipe module.""" | 5 """Example of using the PGO recipe module.""" |
| 6 | 6 |
| 7 # Recipe module dependencies. | 7 # Recipe module dependencies. |
| 8 DEPS = [ | 8 DEPS = [ |
| 9 'chromium', | |
| 10 'pgo', | |
| 9 'recipe_engine/platform', | 11 'recipe_engine/platform', |
| 10 'recipe_engine/properties', | 12 'recipe_engine/properties', |
| 11 'pgo', | |
| 12 ] | 13 ] |
| 13 | 14 |
| 14 from recipe_engine import recipe_test_api | |
| 15 from recipe_engine.recipe_api import Property | 15 from recipe_engine.recipe_api import Property |
| 16 from recipe_engine.types import freeze | 16 from recipe_engine.types import freeze |
| 17 | 17 |
| 18 | 18 |
| 19 PROPERTIES = { | 19 PROPERTIES = { |
| 20 'buildername': Property(), | 20 'buildername': Property(), |
| 21 } | 21 } |
| 22 | 22 |
| 23 | 23 |
| 24 TEST_BUILDERS = freeze({ | 24 TEST_BUILDERS = freeze({ |
| 25 'chromium_pgo.test' : { | 25 'chromium_pgo.test' : { |
| 26 'Test builder': { | 26 'builders': { |
| 27 'recipe_config': 'chromium', | 27 'Test builder': { |
| 28 'chromium_config_instrument': 'chromium_pgo_instrument', | 28 'recipe_config': 'chromium', |
| 29 'chromium_config_optimize': 'chromium_pgo_optimize', | 29 'chromium_config_instrument': 'chromium_pgo_instrument', |
| 30 'gclient_config': 'chromium', | 30 'chromium_config_optimize': 'chromium_pgo_optimize', |
| 31 'clobber': True, | 31 'gclient_config': 'chromium', |
| 32 'patch_root': 'src', | 32 'chromium_config_kwargs': { |
| 33 'chromium_config_kwargs': { | 33 'BUILD_CONFIG': 'Release', |
| 34 'BUILD_CONFIG': 'Release', | 34 'TARGET_BITS': 32, |
| 35 'TARGET_BITS': 32, | 35 }, |
| 36 }, | 36 'patch_root': 'src', |
| 37 'testing': { | 37 'testing': { 'platform': 'win' }, |
| 38 'platform': 'win', | |
| 39 }, | 38 }, |
| 40 }, | 39 }, |
| 41 } | 40 } |
| 42 }) | 41 }) |
| 43 | 42 |
| 44 | 43 |
| 45 def RunSteps(api, buildername): | 44 def RunSteps(api, buildername): |
| 46 buildername = api.properties['buildername'] | |
| 47 mastername = api.properties['mastername'] | 45 mastername = api.properties['mastername'] |
| 48 bot_config = TEST_BUILDERS.get(mastername, {}).get(buildername) | 46 buildername, bot_config = api.chromium.configure_bot(TEST_BUILDERS, []) |
|
Nico
2016/06/01 23:36:55
This makes the file more similar to most other fil
| |
| 49 | 47 |
| 50 api.pgo.compile_pgo(bot_config) | 48 api.pgo.compile_pgo(bot_config) |
| 51 | 49 |
| 52 | 50 |
| 53 def GenTests(api): | 51 def GenTests(api): |
| 54 def _sanitize_nonalpha(text): | 52 def _sanitize_nonalpha(text): |
| 55 return ''.join(c if c.isalnum() else '_' for c in text) | 53 return ''.join(c if c.isalnum() else '_' for c in text) |
| 56 | 54 |
| 57 for mastername, builders in TEST_BUILDERS.iteritems(): | 55 # Don't use api.chromium.gen_tests_for_builders because that looks at a |
| 58 for buildername in builders: | 56 # builder's name to set the platform, but we want to set 'win'. |
| 57 for mastername in TEST_BUILDERS: | |
| 58 for buildername in TEST_BUILDERS[mastername]['builders']: | |
| 59 yield ( | 59 yield ( |
| 60 api.test('full_%s_%s' % (_sanitize_nonalpha(mastername), | 60 api.test('full_%s_%s' % (_sanitize_nonalpha(mastername), |
| 61 _sanitize_nonalpha(buildername))) + | 61 _sanitize_nonalpha(buildername))) + |
| 62 api.properties.generic(mastername=mastername, buildername=buildername) + | 62 api.properties.generic(mastername=mastername, buildername=buildername) + |
| 63 api.platform('win', 64) | 63 api.platform('win', 64) |
| 64 ) | 64 ) |
| 65 | 65 |
| 66 | |
| 66 yield ( | 67 yield ( |
| 67 api.test('full_%s_%s_benchmark_failure' % | 68 api.test('full_%s_%s_benchmark_failure' % |
| 68 (_sanitize_nonalpha('chromium_pgo.test'), | 69 (_sanitize_nonalpha('chromium_pgo.test'), |
| 69 _sanitize_nonalpha('Test builder'))) + | 70 _sanitize_nonalpha('Test builder'))) + |
| 70 api.properties.generic(mastername='chromium_pgo.test', | 71 api.properties.generic(mastername='chromium_pgo.test', |
| 71 buildername='Test builder') + | 72 buildername='Test builder') + |
| 72 api.platform('win', 32) + | 73 api.platform('win', 32) + |
| 73 api.step_data('Telemetry benchmark: sunspider', retcode=1) | 74 api.step_data('Telemetry benchmark: sunspider', retcode=1) |
| 74 ) | 75 ) |
| OLD | NEW |