| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 'file', | 6 'file', |
| 7 'isolate', | 7 'isolate', |
| 8 'recipe_engine/path', | 8 'recipe_engine/path', |
| 9 'recipe_engine/properties', | 9 'recipe_engine/properties', |
| 10 'recipe_engine/python', | 10 'recipe_engine/python', |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 isolated_hash = step_result.stdout.split()[0].strip() | 84 isolated_hash = step_result.stdout.split()[0].strip() |
| 85 | 85 |
| 86 # Create a task to run the isolated file on swarming, set OS dimension. | 86 # Create a task to run the isolated file on swarming, set OS dimension. |
| 87 # Also generate code coverage for multi-shard case by triggering multiple | 87 # Also generate code coverage for multi-shard case by triggering multiple |
| 88 # shards on Linux. | 88 # shards on Linux. |
| 89 task = api.swarming.task('hello_world', isolated_hash, | 89 task = api.swarming.task('hello_world', isolated_hash, |
| 90 task_output_dir=temp_dir.join('task_output_dir')) | 90 task_output_dir=temp_dir.join('task_output_dir')) |
| 91 task.dimensions['os'] = api.swarming.prefered_os_dimension(platform) | 91 task.dimensions['os'] = api.swarming.prefered_os_dimension(platform) |
| 92 task.shards = 2 if platform == 'linux' else 1 | 92 task.shards = 2 if platform == 'linux' else 1 |
| 93 task.tags.add('os:' + platform) | 93 task.tags.add('os:' + platform) |
| 94 task.cipd_packages = [('bin', 'super/awesome/pkg', 'git_revision:deadbeef')] | |
| 95 tasks.append(task) | 94 tasks.append(task) |
| 96 | 95 |
| 97 # Launch all tasks. | 96 # Launch all tasks. |
| 98 for task in tasks: | 97 for task in tasks: |
| 99 step_result = api.swarming.trigger_task(task) | 98 step_result = api.swarming.trigger_task(task) |
| 100 assert step_result.swarming_task in tasks | 99 assert step_result.swarming_task in tasks |
| 101 | 100 |
| 102 # Recipe can do something useful here locally while tasks are | 101 # Recipe can do something useful here locally while tasks are |
| 103 # running on swarming. | 102 # running on swarming. |
| 104 api.step('local step', ['echo', 'running something locally']) | 103 api.step('local step', ['echo', 'running something locally']) |
| 105 | 104 |
| 106 # Wait for all tasks to complete. | 105 # Wait for all tasks to complete. |
| 107 for task in tasks: | 106 for task in tasks: |
| 108 step_result = api.swarming.collect_task(task) | 107 step_result = api.swarming.collect_task(task) |
| 109 state = step_result.json.output['shards'][0]['state'] | 108 state = step_result.json.output['shards'][0]['state'] |
| 110 assert api.swarming.State.COMPLETED == state, state | 109 assert api.swarming.State.COMPLETED == state, state |
| 111 state_name = api.swarming.State.to_string(state) | 110 state_name = api.swarming.State.to_string(state) |
| 112 assert 'Completed' == state_name, state_name | 111 assert 'Completed' == state_name, state_name |
| 113 assert step_result.swarming_task in tasks | 112 assert step_result.swarming_task in tasks |
| 114 | 113 |
| 115 # Cleanup. | 114 # Cleanup. |
| 116 api.file.rmtree('remove temp dir', temp_dir) | 115 api.file.rmtree('remove temp dir', temp_dir) |
| 117 | 116 |
| 118 | 117 |
| 119 def GenTests(api): | 118 def GenTests(api): |
| 120 yield ( | 119 yield ( |
| 121 api.test('basic_0.8') + | 120 api.test('basic_0.4') + |
| 122 api.step_data( | 121 api.step_data( |
| 123 'archive for win', | 122 'archive for win', |
| 124 stdout=api.raw_io.output('hash_for_win hello_world.isolated')) + | 123 stdout=api.raw_io.output('hash_for_win hello_world.isolated')) + |
| 125 api.step_data( | 124 api.step_data( |
| 126 'archive for linux', | 125 'archive for linux', |
| 127 stdout=api.raw_io.output('hash_for_linux hello_world.isolated')) + | 126 stdout=api.raw_io.output('hash_for_linux hello_world.isolated')) + |
| 128 api.step_data( | 127 api.step_data( |
| 129 'archive for mac', | 128 'archive for mac', |
| 130 stdout=api.raw_io.output('hash_for_mac hello_world.isolated')) + | 129 stdout=api.raw_io.output('hash_for_mac hello_world.isolated')) + |
| 131 api.properties(simulated_version=(0, 8, 6))) | 130 api.properties(simulated_version=(0, 4, 10))) |
| 132 | 131 |
| 133 yield ( | 132 yield ( |
| 134 api.test('basic_0.8_trybot') + | 133 api.test('basic_0.5') + |
| 135 api.step_data( | 134 api.step_data( |
| 136 'archive for win', | 135 'archive for win', |
| 137 stdout=api.raw_io.output('hash_for_win hello_world.isolated')) + | 136 stdout=api.raw_io.output('hash_for_win hello_world.isolated')) + |
| 138 api.step_data( | 137 api.step_data( |
| 139 'archive for linux', | 138 'archive for linux', |
| 140 stdout=api.raw_io.output('hash_for_linux hello_world.isolated')) + | 139 stdout=api.raw_io.output('hash_for_linux hello_world.isolated')) + |
| 141 api.step_data( | 140 api.step_data( |
| 142 'archive for mac', | 141 'archive for mac', |
| 143 stdout=api.raw_io.output('hash_for_mac hello_world.isolated')) + | 142 stdout=api.raw_io.output('hash_for_mac hello_world.isolated')) + |
| 144 api.properties( | 143 api.properties( |
| 145 rietveld="https://codereview.chromium.org", | 144 rietveld="https://codereview.chromium.org", |
| 146 issue="123", | 145 issue="123", |
| 147 patchset="1001", | 146 patchset="1001", |
| 148 simulated_version=(0, 8, 6))) | 147 simulated_version=(0, 5))) |
| 149 | 148 |
| 150 yield ( | 149 yield ( |
| 151 api.test('basic_0.8_show_shards_in_collect_step') + | 150 api.test('basic_0.5_show_shards_in_collect_step') + |
| 152 api.step_data( | 151 api.step_data( |
| 153 'archive for win', | 152 'archive for win', |
| 154 stdout=api.raw_io.output('hash_for_win hello_world.isolated')) + | 153 stdout=api.raw_io.output('hash_for_win hello_world.isolated')) + |
| 155 api.step_data( | 154 api.step_data( |
| 156 'archive for linux', | 155 'archive for linux', |
| 157 stdout=api.raw_io.output('hash_for_linux hello_world.isolated')) + | 156 stdout=api.raw_io.output('hash_for_linux hello_world.isolated')) + |
| 158 api.step_data( | 157 api.step_data( |
| 159 'archive for mac', | 158 'archive for mac', |
| 160 stdout=api.raw_io.output('hash_for_mac hello_world.isolated')) + | 159 stdout=api.raw_io.output('hash_for_mac hello_world.isolated')) + |
| 161 api.properties( | 160 api.properties( |
| 162 rietveld="https://codereview.chromium.org", | 161 rietveld="https://codereview.chromium.org", |
| 163 issue="123", | 162 issue="123", |
| 164 patchset="1001", | 163 patchset="1001", |
| 165 simulated_version=(0, 8, 6), | 164 simulated_version=(0, 5), |
| 166 show_shards_in_collect_step=True)) | 165 show_shards_in_collect_step=True)) |
| 167 | 166 |
| 168 yield ( | 167 yield ( |
| 169 api.test('basic_0.8_show_isolated_out_in_collect_step') + | 168 api.test('basic_0.5_show_isolated_out_in_collect_step') + |
| 170 api.step_data( | 169 api.step_data( |
| 171 'archive for win', | 170 'archive for win', |
| 172 stdout=api.raw_io.output('hash_for_win hello_world.isolated')) + | 171 stdout=api.raw_io.output('hash_for_win hello_world.isolated')) + |
| 173 api.step_data( | 172 api.step_data( |
| 174 'archive for linux', | 173 'archive for linux', |
| 175 stdout=api.raw_io.output('hash_for_linux hello_world.isolated')) + | 174 stdout=api.raw_io.output('hash_for_linux hello_world.isolated')) + |
| 176 api.step_data( | 175 api.step_data( |
| 177 'archive for mac', | 176 'archive for mac', |
| 178 stdout=api.raw_io.output('hash_for_mac hello_world.isolated')) + | 177 stdout=api.raw_io.output('hash_for_mac hello_world.isolated')) + |
| 179 api.properties( | 178 api.properties( |
| 180 rietveld="https://codereview.chromium.org", | 179 rietveld="https://codereview.chromium.org", |
| 181 issue="123", | 180 issue="123", |
| 182 patchset="1001", | 181 patchset="1001", |
| 183 simulated_version=(0, 8, 6), | 182 simulated_version=(0, 5), |
| 184 show_isolated_out_in_collect_step=False)) | 183 show_isolated_out_in_collect_step=False)) |
| OLD | NEW |