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