| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 DEPS = [ | 5 DEPS = [ |
| 6 'chromite', | 6 'chromite', |
| 7 'gitiles', |
| 7 ] | 8 ] |
| 8 | 9 |
| 9 | 10 |
| 11 _TEST_CONFIG = { |
| 12 '_default': { |
| 13 'foo': 'bar', |
| 14 'baz': 'qux', |
| 15 }, |
| 16 '_templates': { |
| 17 'woot': { |
| 18 'baz': 'templated', |
| 19 } |
| 20 }, |
| 21 'myconfig': { |
| 22 '_template': 'woot', |
| 23 'local': 'variable', |
| 24 }, |
| 25 } |
| 26 |
| 10 def RunSteps(api): | 27 def RunSteps(api): |
| 11 api.chromite.set_config('base') | 28 api.chromite.set_config('base') |
| 12 | 29 |
| 13 # Basic checkout exercise. | 30 # Basic checkout exercise. |
| 14 api.chromite.checkout() | 31 api.chromite.checkout() |
| 15 api.chromite.setup_board('amd64-generic', args=['--cache-dir', '.cache']) | 32 api.chromite.setup_board('amd64-generic', args=['--cache-dir', '.cache']) |
| 16 api.chromite.build_packages('amd64-generic') | 33 api.chromite.build_packages('amd64-generic') |
| 17 api.chromite.cros_sdk('cros_sdk', ['echo', 'hello'], | 34 api.chromite.cros_sdk('cros_sdk', ['echo', 'hello'], |
| 18 environ={ 'var1': 'value' }) | 35 environ={ 'var1': 'value' }) |
| 19 api.chromite.cbuildbot('cbuildbot', 'amd64-generic-full', | 36 api.chromite.cbuildbot('cbuildbot', 'amd64-generic-full', |
| 20 args=['--clobber', '--build-dir', '/here/there']) | 37 args=['--clobber', '--build-dir', '/here/there']) |
| 21 | 38 |
| 39 # Exercise valid configuraiton. |
| 40 config = api.chromite.load_config('myconfig') |
| 41 assert config is not None |
| 42 assert config['foo'] == 'bar' |
| 43 assert config['baz'] == 'templated' |
| 44 assert config['local'] == 'variable' |
| 45 assert config.get('invalid') is None |
| 46 |
| 47 raised = False |
| 48 try: |
| 49 config['invalid'] |
| 50 except KeyError: |
| 51 raised = True |
| 52 assert raised, 'Did not raise KeyError!' |
| 53 |
| 54 # Exercise invalid configuration. |
| 55 assert api.chromite.load_config('nonexistent') is None |
| 56 |
| 22 | 57 |
| 23 def GenTests(api): | 58 def GenTests(api): |
| 24 yield api.test('basic') | 59 yield (api.test('basic') + |
| 60 api.chromite.seed_chromite_config(_TEST_CONFIG) |
| 61 ) |
| 62 |
| OLD | NEW |