| 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 from recipe_engine import recipe_api, config | 5 from recipe_engine import recipe_api, config |
| 6 | 6 |
| 7 DEPS = [ | 7 DEPS = [ |
| 8 'path', | 8 'path', |
| 9 'properties', | 9 'properties', |
| 10 'step', | 10 'step', |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 # Also, abusing bash -c in this way is a TERRIBLE IDEA DON'T DO IT. | 37 # Also, abusing bash -c in this way is a TERRIBLE IDEA DON'T DO IT. |
| 38 api.step('goodbye', ['bash', '-c', 'echo Good bye, $friend.'], | 38 api.step('goodbye', ['bash', '-c', 'echo Good bye, $friend.'], |
| 39 env={'friend': 'Darth Vader'}) | 39 env={'friend': 'Darth Vader'}) |
| 40 | 40 |
| 41 # You can modify environment in terms of old environment. Environment | 41 # You can modify environment in terms of old environment. Environment |
| 42 # variables are substituted in for expressions of the form %(VARNAME)s. | 42 # variables are substituted in for expressions of the form %(VARNAME)s. |
| 43 api.step('recipes help', | 43 api.step('recipes help', |
| 44 ['recipes.py', '--help'], | 44 ['recipes.py', '--help'], |
| 45 env={ | 45 env={ |
| 46 'PATH': api.path.pathsep.join( | 46 'PATH': api.path.pathsep.join( |
| 47 [str(api.step.package_resource()), '%(PATH)s']), | 47 [str(api.step.package_repo_resource()), '%(PATH)s']), |
| 48 }) | 48 }) |
| 49 | 49 |
| 50 # Finally, you can make your step accept any return code | 50 # Finally, you can make your step accept any return code |
| 51 api.step('anything is cool', ['bash', '-c', 'exit 3'], | 51 api.step('anything is cool', ['bash', '-c', 'exit 3'], |
| 52 ok_ret='any') | 52 ok_ret='any') |
| 53 | 53 |
| 54 # We can manipulate the step presentation arbitrarily until we run | 54 # We can manipulate the step presentation arbitrarily until we run |
| 55 # the next step. | 55 # the next step. |
| 56 step_result = api.step('hello', ['echo', 'hello']) | 56 step_result = api.step('hello', ['echo', 'hello']) |
| 57 step_result.presentation.status = api.step.EXCEPTION | 57 step_result.presentation.status = api.step.EXCEPTION |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 api.test('infra_failure') + | 149 api.test('infra_failure') + |
| 150 api.properties(raise_infra_failure=True) + | 150 api.properties(raise_infra_failure=True) + |
| 151 api.step_data('cleanup', retcode=1) | 151 api.step_data('cleanup', retcode=1) |
| 152 ) | 152 ) |
| 153 | 153 |
| 154 yield ( | 154 yield ( |
| 155 api.test('bad_return') + | 155 api.test('bad_return') + |
| 156 api.properties(bad_return=True) + | 156 api.properties(bad_return=True) + |
| 157 api.expect_exception('TypeError') | 157 api.expect_exception('TypeError') |
| 158 ) | 158 ) |
| OLD | NEW |