| 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 'chromium', | 6 'chromium', |
| 7 'depot_tools/infra_paths', | |
| 8 'isolate', | 7 'isolate', |
| 9 'recipe_engine/json', | 8 'recipe_engine/json', |
| 10 'recipe_engine/path', | 9 'recipe_engine/path', |
| 11 'recipe_engine/properties', | 10 'recipe_engine/properties', |
| 12 'recipe_engine/step', | 11 'recipe_engine/step', |
| 13 'swarming_client', | 12 'swarming_client', |
| 14 ] | 13 ] |
| 15 | 14 |
| 16 | 15 |
| 17 def RunSteps(api): | 16 def RunSteps(api): |
| 18 # 'isolate_tests' step needs swarming checkout. | 17 # 'isolate_tests' step needs swarming checkout. |
| 19 api.swarming_client.checkout('master') | 18 api.swarming_client.checkout('master') |
| 20 | 19 |
| 21 # Code coverage for isolate_server property. | 20 # Code coverage for isolate_server property. |
| 22 api.isolate.isolate_server = 'https://isolateserver-dev.appspot.com' | 21 api.isolate.isolate_server = 'https://isolateserver-dev.appspot.com' |
| 23 assert api.isolate.isolate_server == 'https://isolateserver-dev.appspot.com' | 22 assert api.isolate.isolate_server == 'https://isolateserver-dev.appspot.com' |
| 24 | 23 |
| 25 # Code coverage for set_isolate_environment. | 24 # Code coverage for set_isolate_environment. |
| 26 api.chromium.set_config('chromium') | 25 api.chromium.set_config('chromium') |
| 27 api.isolate.set_isolate_environment(api.chromium.c) | 26 api.isolate.set_isolate_environment(api.chromium.c) |
| 28 | 27 |
| 29 # That would read a list of files to search for, generated in GenTests. | 28 # That would read a list of files to search for, generated in GenTests. |
| 30 step_result = api.step('read test spec', ['cat'], stdout=api.json.output()) | 29 step_result = api.step('read test spec', ['cat'], stdout=api.json.output()) |
| 31 expected_targets = step_result.stdout | 30 expected_targets = step_result.stdout |
| 32 | 31 |
| 33 # Generates code coverage for find_isolated_tests corner cases. | 32 # Generates code coverage for find_isolated_tests corner cases. |
| 34 # TODO(vadimsh): This step doesn't actually make any sense when the recipe | 33 # TODO(vadimsh): This step doesn't actually make any sense when the recipe |
| 35 # is running for real via run_recipe.py. | 34 # is running for real via run_recipe.py. |
| 36 api.isolate.find_isolated_tests(api.infra_paths['build'], expected_targets) | 35 api.isolate.find_isolated_tests(api.path['build'], expected_targets) |
| 37 | 36 |
| 38 # Code coverage for 'isolate_tests'. 'isolated_test' doesn't support discovery | 37 # Code coverage for 'isolate_tests'. 'isolated_test' doesn't support discovery |
| 39 # of isolated targets in build directory, so skip if 'expected_targets' is | 38 # of isolated targets in build directory, so skip if 'expected_targets' is |
| 40 # None. | 39 # None. |
| 41 if expected_targets is not None: | 40 if expected_targets is not None: |
| 42 api.isolate.isolate_tests(api.infra_paths['build'], expected_targets) | 41 api.isolate.isolate_tests(api.path['build'], expected_targets) |
| 43 | 42 |
| 44 | 43 |
| 45 def GenTests(api): | 44 def GenTests(api): |
| 46 def make_test(name, expected_targets, discovered_targets): | 45 def make_test(name, expected_targets, discovered_targets): |
| 47 missing = set(expected_targets or []) - set(discovered_targets or []) | 46 missing = set(expected_targets or []) - set(discovered_targets or []) |
| 48 output = ( | 47 output = ( |
| 49 api.test(name) + | 48 api.test(name) + |
| 50 api.step_data( | 49 api.step_data( |
| 51 'read test spec', stdout=api.json.output(expected_targets)) + | 50 'read test spec', stdout=api.json.output(expected_targets)) + |
| 52 api.override_step_data( | 51 api.override_step_data( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 64 # No expectations, just discovering what's there returned by default mock. | 63 # No expectations, just discovering what's there returned by default mock. |
| 65 yield make_test('discover', None, None) | 64 yield make_test('discover', None, None) |
| 66 # Found more than expected. | 65 # Found more than expected. |
| 67 yield make_test('extra', ['test1', 'test2'], ['test1', 'test2', 'extra_test']) | 66 yield make_test('extra', ['test1', 'test2'], ['test1', 'test2', 'extra_test']) |
| 68 # Didn't find something. | 67 # Didn't find something. |
| 69 yield ( | 68 yield ( |
| 70 make_test('missing', ['test1', 'test2'], ['test1']) + | 69 make_test('missing', ['test1', 'test2'], ['test1']) + |
| 71 api.properties.generic(buildername='Windows Swarm Test')) | 70 api.properties.generic(buildername='Windows Swarm Test')) |
| 72 # No expectations, and nothing has been found, produces warning. | 71 # No expectations, and nothing has been found, produces warning. |
| 73 yield make_test('none', None, []) | 72 yield make_test('none', None, []) |
| OLD | NEW |