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 'filter', | 7 'filter', |
8 'json', | 8 'json', |
9 'path', | 9 'path', |
10 'properties', | 10 'properties', |
11 'raw_io', | 11 'raw_io', |
12 'step', | 12 'step', |
13 ] | 13 ] |
14 | 14 |
15 def GenSteps(api): | 15 def GenSteps(api): |
16 api.path['checkout'] = api.path['slave_build'] | 16 api.path['checkout'] = api.path['slave_build'] |
17 api.chromium.set_config('chromium') | 17 api.chromium.set_config('chromium') |
18 api.filter.does_patch_require_compile() | 18 api.filter.does_patch_require_compile() |
19 assert (api.filter.result and api.properties['example_result']) or \ | 19 assert (api.filter.result and api.properties['example_result']) or \ |
20 (not api.filter.result and not api.properties['example_result']) | 20 (not api.filter.result and not api.properties['example_result']) |
21 assert (not api.properties['example_matching_exes'] or | 21 assert (not api.properties['example_matching_exes'] or |
22 list(api.properties['example_matching_exes']) == | 22 list(api.properties['example_matching_exes']) == |
23 api.filter.matching_exes) | 23 api.filter.matching_exes) |
24 assert (not api.properties['example_matching_compile_targets'] or | |
25 list(api.properties['example_matching_compile_targets']) == | |
26 api.filter.compile_targets) | |
iannucci
2014/08/20 17:54:39
nit: these asserts seem overly verbose... couldn't
sky
2014/08/20 20:26:33
I only wanted to do the interesting part of the as
| |
24 api.step('hello', ['echo', 'Why hello, there.']) | 27 api.step('hello', ['echo', 'Why hello, there.']) |
25 | 28 |
26 def GenTests(api): | 29 def GenTests(api): |
27 # Trivial test with no exclusions and nothing matching. | 30 # Trivial test with no exclusions and nothing matching. |
28 yield (api.test('basic') + | 31 yield (api.test('basic') + |
29 api.properties(filter_exclusions=[]) + | 32 api.properties(filter_exclusions=[]) + |
30 api.properties(example_result=None) + | 33 api.properties(example_result=None) + |
31 api.properties(example_matching_exes=None) + | 34 api.properties(example_matching_exes=None) + |
35 api.properties(example_matching_compile_targets=None) + | |
iannucci
2014/08/20 17:54:39
fyi: you can do multiple properties per call here:
sky
2014/08/20 20:26:32
Done.
| |
32 api.override_step_data( | 36 api.override_step_data( |
33 'git diff to analyze patch', | 37 'git diff to analyze patch', |
34 api.raw_io.stream_output('yy'))) | 38 api.raw_io.stream_output('yy'))) |
35 | 39 |
36 # Matches exclusions | 40 # Matches exclusions |
37 yield (api.test('match_exclusion') + | 41 yield (api.test('match_exclusion') + |
38 api.properties(filter_exclusions=['fo.*']) + | 42 api.properties(filter_exclusions=['fo.*']) + |
39 api.properties(example_result=1) + | 43 api.properties(example_result=1) + |
40 api.properties(example_matching_exes=None) + | 44 api.properties(example_matching_exes=None) + |
45 api.properties(example_matching_compile_targets=None) + | |
41 api.override_step_data( | 46 api.override_step_data( |
42 'git diff to analyze patch', | 47 'git diff to analyze patch', |
43 api.raw_io.stream_output('foo.cc'))) | 48 api.raw_io.stream_output('foo.cc'))) |
44 | 49 |
45 # Doesnt match exclusion. | 50 # Doesnt match exclusion. |
46 yield (api.test('doesnt_match_exclusion') + | 51 yield (api.test('doesnt_match_exclusion') + |
47 api.properties(filter_exclusions=['fo.*']) + | 52 api.properties(filter_exclusions=['fo.*']) + |
48 api.properties(example_result=None) + | 53 api.properties(example_result=None) + |
49 api.properties(example_matching_exes=None) + | 54 api.properties(example_matching_exes=None) + |
55 api.properties(example_matching_compile_targets=None) + | |
50 api.override_step_data( | 56 api.override_step_data( |
51 'git diff to analyze patch', | 57 'git diff to analyze patch', |
52 api.raw_io.stream_output('bar.cc'))) | 58 api.raw_io.stream_output('bar.cc'))) |
53 | 59 |
54 # Analyze returns matching result. | 60 # Analyze returns matching result. |
55 yield (api.test('analyzes_returns_true') + | 61 yield (api.test('analyzes_returns_true') + |
56 api.properties(example_result=1) + | 62 api.properties(example_result=1) + |
57 api.properties(example_matching_exes=None) + | 63 api.properties(example_matching_exes=None) + |
64 api.properties(example_matching_compile_targets=None) + | |
58 api.override_step_data( | 65 api.override_step_data( |
59 'analyze', | 66 'analyze', |
60 api.json.output({'status': 'Found dependency', | 67 api.json.output({'status': 'Found dependency', |
61 'targets': []}))) | 68 'targets': [], |
69 'build_targets': []}))) | |
62 | 70 |
63 # Analyze returns matching tests while matching all. | 71 # Analyze returns matching tests while matching all. |
64 yield (api.test('analyzes_matches_all_exes') + | 72 yield (api.test('analyzes_matches_all_exes') + |
65 api.properties(matching_exes=['foo', 'bar']) + | |
66 api.properties(example_matching_exes=['foo']) + | |
67 api.properties(example_result=1) + | 73 api.properties(example_result=1) + |
74 api.properties(example_matching_exes=None) + | |
75 api.properties(example_matching_compile_targets=None) + | |
68 api.override_step_data( | 76 api.override_step_data( |
69 'analyze', | 77 'analyze', |
70 api.json.output({'status': 'Found dependency (all)', | 78 api.json.output({'status': 'Found dependency (all)'}))) |
71 'targets': ['foo']}))) | |
72 | 79 |
73 # Analyze matches all and returns matching tests. | 80 # Analyze matches all and returns matching tests. |
74 yield (api.test('analyzes_matches_exes') + | 81 yield (api.test('analyzes_matches_exes') + |
75 api.properties(matching_exes=['foo', 'bar']) + | 82 api.properties(matching_exes=['foo', 'bar']) + |
76 api.properties(example_matching_exes=['foo']) + | 83 api.properties(example_matching_exes=['foo']) + |
84 api.properties(example_matching_compile_targets=None) + | |
77 api.properties(example_result=1) + | 85 api.properties(example_result=1) + |
78 api.override_step_data( | 86 api.override_step_data( |
79 'analyze', | 87 'analyze', |
80 api.json.output({'status': 'Found dependency', | 88 api.json.output({'status': 'Found dependency', |
81 'targets': ['foo']}))) | 89 'targets': ['foo'], |
90 'build_targets': []}))) | |
91 | |
92 # Analyze matches all and returns matching tests. | |
93 yield (api.test('analyzes_matches_compile_targets') + | |
94 api.properties(example_matching_exes=None) + | |
95 api.properties(example_matching_compile_targets=['bar']) + | |
96 api.properties(example_result=1) + | |
97 api.override_step_data( | |
98 'analyze', | |
99 api.json.output({'status': 'Found dependency', | |
100 'targets': ['foo'], | |
101 'build_targets': ['bar']}))) | |
82 | 102 |
83 # Analyze with error condition. | 103 # Analyze with error condition. |
84 yield (api.test('analyzes_error') + | 104 yield (api.test('analyzes_error') + |
85 api.properties(matching_exes=None) + | 105 api.properties(matching_exes=None) + |
86 api.properties(example_matching_exes=None) + | 106 api.properties(example_matching_exes=None) + |
107 api.properties(example_matching_compile_targets=None) + | |
87 api.properties(example_result=1) + | 108 api.properties(example_result=1) + |
88 api.override_step_data( | 109 api.override_step_data( |
89 'analyze', | 110 'analyze', |
90 api.json.output({'error': 'ERROR'}))) | 111 api.json.output({'error': 'ERROR'}))) |
91 | 112 |
92 # Analyze with python returning bad status. | 113 # Analyze with python returning bad status. |
93 yield (api.test('bad_retcode_doesnt_fail') + | 114 yield (api.test('bad_retcode_doesnt_fail') + |
94 api.properties(matching_exes=None) + | 115 api.properties(matching_exes=None) + |
95 api.properties(example_matching_exes=None) + | 116 api.properties(example_matching_exes=None) + |
117 api.properties(example_matching_compile_targets=None) + | |
96 api.properties(example_result=1) + | 118 api.properties(example_result=1) + |
97 api.step_data( | 119 api.step_data( |
98 'analyze', | 120 'analyze', |
99 retcode=-1)) | 121 retcode=-1)) |
OLD | NEW |