Chromium Code Reviews| Index: scripts/slave/recipe_modules/filter/example.py |
| diff --git a/scripts/slave/recipe_modules/filter/example.py b/scripts/slave/recipe_modules/filter/example.py |
| index b2709f0f5d46c9445c76725a41c403fa7d8a9db0..d44d66e5e0e2b4acf9f7c2af1963a2ed743adf4d 100644 |
| --- a/scripts/slave/recipe_modules/filter/example.py |
| +++ b/scripts/slave/recipe_modules/filter/example.py |
| @@ -4,6 +4,7 @@ |
| DEPS = [ |
| 'filter', |
| + 'json', |
| 'path', |
| 'properties', |
| 'raw_io', |
| @@ -14,15 +15,19 @@ def GenSteps(api): |
| api.filter.does_patch_require_compile() |
| assert (api.filter.result and api.properties['example_result']) or \ |
| (not api.filter.result and not api.properties['example_result']) |
| + assert (not api.properties['example_matching_exes'] or |
| + list(api.properties['example_matching_exes']) == |
| + api.filter.matching_exes) |
| def GenTests(api): |
| # Trivial test with no exclusions and nothing matching. |
| yield (api.test('basic') + |
| api.properties(filter_exclusions=[]) + |
| api.properties(example_result=None) + |
| + api.properties(example_matching_exes=None) + |
| api.override_step_data( |
| 'analyze', |
| - api.raw_io.stream_output('xx')) + |
| + stdout=api.json.output({'status': 'No dependency'})) + |
| api.override_step_data( |
| 'git diff to analyze patch', |
| api.raw_io.stream_output('yy'))) |
| @@ -31,6 +36,7 @@ def GenTests(api): |
| yield (api.test('match_exclusion') + |
| api.properties(filter_exclusions=['fo.*']) + |
| api.properties(example_result=1) + |
| + api.properties(example_matching_exes=None) + |
| api.override_step_data( |
| 'git diff to analyze patch', |
| api.raw_io.stream_output('foo.cc'))) |
| @@ -39,9 +45,10 @@ def GenTests(api): |
| yield (api.test('doesnt_match_exclusion') + |
| api.properties(filter_exclusions=['fo.*']) + |
| api.properties(example_result=None) + |
| + api.properties(example_matching_exes=None) + |
| api.override_step_data( |
| 'analyze', |
| - api.raw_io.stream_output('xx')) + |
| + stdout=api.json.output({'status': 'No dependency'})) + |
|
iannucci
2014/07/30 01:20:37
just wondering... there's not a way to actually ha
sky
2014/07/30 21:14:16
I changed the analyze code to do that. It simplifi
|
| api.override_step_data( |
| 'git diff to analyze patch', |
| api.raw_io.stream_output('bar.cc'))) |
| @@ -49,6 +56,27 @@ def GenTests(api): |
| # Analyze returns matching result. |
| yield (api.test('analyzes_returns_true') + |
| api.properties(example_result=1) + |
| + api.properties(example_matching_exes=None) + |
| api.override_step_data( |
| 'analyze', |
| - api.raw_io.stream_output('Found dependency'))) |
| + stdout=api.json.output({'status': 'Found dependency', |
| + 'targets': []}))) |
| + |
| + # Analyze returns matching tests. |
| + yield (api.test('analyzes_matches_exes') + |
| + api.properties(matching_exes=['foo', 'bar']) + |
| + api.properties(example_matching_exes=['foo']) + |
| + api.properties(example_result=1) + |
| + api.override_step_data( |
| + 'analyze', |
| + stdout=api.json.output({'status': 'Found dependency', |
| + 'targets': ['foo']}))) |
| + |
| + # Analyze with error condition. |
| + yield (api.test('analyzes_error') + |
| + api.properties(matching_exes=None) + |
| + api.properties(example_matching_exes=None) + |
| + api.properties(example_result=1) + |
| + api.override_step_data( |
| + 'analyze', |
| + stdout=api.json.output({'error': 'ERROR'}))) |