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 = { | |
| 20 'buildername': Property(), | |
| 21 } | |
| 22 | |
| 23 | |
| 24 TEST_BUILDERS = freeze({ | 19 TEST_BUILDERS = freeze({ |
| 25 'chromium_pgo.test' : { | 20 'chromium_pgo.test' : { |
| 26 'Test builder': { | 21 'builders': { |
| 27 'recipe_config': 'chromium', | 22 'Test builder': { |
| 28 'chromium_config_instrument': 'chromium_pgo_instrument', | 23 'recipe_config': 'chromium', |
| 29 'chromium_config_optimize': 'chromium_pgo_optimize', | 24 'chromium_config_instrument': 'chromium_pgo_instrument', |
| 30 'gclient_config': 'chromium', | 25 'chromium_config_optimize': 'chromium_pgo_optimize', |
| 31 'clobber': True, | 26 'gclient_config': 'chromium', |
| 32 'patch_root': 'src', | 27 'chromium_config_kwargs': { |
| 33 'chromium_config_kwargs': { | 28 'BUILD_CONFIG': 'Release', |
| 34 'BUILD_CONFIG': 'Release', | 29 'TARGET_BITS': 32, |
| 35 'TARGET_BITS': 32, | 30 }, |
| 36 }, | 31 'patch_root': 'src', |
| 37 'testing': { | 32 'testing': { 'platform': 'win' }, |
| 38 'platform': 'win', | |
| 39 }, | 33 }, |
| 40 }, | 34 }, |
| 41 } | 35 } |
| 42 }) | 36 }) |
| 43 | 37 |
| 44 | 38 |
| 45 def RunSteps(api, buildername): | 39 def RunSteps(api): |
| 46 buildername = api.properties['buildername'] | 40 _, bot_config = api.chromium.configure_bot(TEST_BUILDERS, []) |
| 47 mastername = api.properties['mastername'] | |
| 48 bot_config = TEST_BUILDERS.get(mastername, {}).get(buildername) | |
| 49 | |
| 50 api.pgo.compile_pgo(bot_config) | 41 api.pgo.compile_pgo(bot_config) |
| 51 | 42 |
| 52 | 43 |
| 53 def GenTests(api): | 44 def GenTests(api): |
| 54 def _sanitize_nonalpha(text): | 45 def _sanitize_nonalpha(text): |
| 55 return ''.join(c if c.isalnum() else '_' for c in text) | 46 return ''.join(c if c.isalnum() else '_' for c in text) |
| 56 | 47 |
| 57 for mastername, builders in TEST_BUILDERS.iteritems(): | 48 # Don't use api.chromium.gen_tests_for_builders because that looks at a |
| 58 for buildername in builders: | 49 # builder's name to set the platform, but we want to set 'win'. |
| 50 for mastername in TEST_BUILDERS: | |
| 51 for buildername in TEST_BUILDERS[mastername]['builders']: | |
|
Dirk Pranke
2016/06/02 01:49:13
given that there's only one builder here, these ne
| |
| 59 yield ( | 52 yield ( |
| 60 api.test('full_%s_%s' % (_sanitize_nonalpha(mastername), | 53 api.test('full_%s_%s' % (_sanitize_nonalpha(mastername), |
| 61 _sanitize_nonalpha(buildername))) + | 54 _sanitize_nonalpha(buildername))) + |
| 62 api.properties.generic(mastername=mastername, buildername=buildername) + | 55 api.properties.generic(mastername=mastername, buildername=buildername) + |
| 63 api.platform('win', 64) | 56 api.platform('win', 64) |
| 64 ) | 57 ) |
| 65 | 58 |
| 66 yield ( | 59 yield ( |
| 67 api.test('full_%s_%s_benchmark_failure' % | 60 api.test('full_%s_%s_benchmark_failure' % |
| 68 (_sanitize_nonalpha('chromium_pgo.test'), | 61 (_sanitize_nonalpha('chromium_pgo.test'), |
| 69 _sanitize_nonalpha('Test builder'))) + | 62 _sanitize_nonalpha('Test builder'))) + |
| 70 api.properties.generic(mastername='chromium_pgo.test', | 63 api.properties.generic(mastername='chromium_pgo.test', |
| 71 buildername='Test builder') + | 64 buildername='Test builder') + |
| 72 api.platform('win', 32) + | 65 api.platform('win', 32) + |
| 73 api.step_data('Telemetry benchmark: sunspider', retcode=1) | 66 api.step_data('Telemetry benchmark: sunspider', retcode=1) |
| 74 ) | 67 ) |
| OLD | NEW |