Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: scripts/slave/recipe_modules/filter/example.py

Issue 427073003: Adds ability to filter the set of tests that are run by a bot (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: fix Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 'filter', 6 'filter',
7 'json',
7 'path', 8 'path',
8 'properties', 9 'properties',
9 'raw_io', 10 'raw_io',
10 ] 11 ]
11 12
12 def GenSteps(api): 13 def GenSteps(api):
13 api.path['checkout'] = api.path['slave_build'] 14 api.path['checkout'] = api.path['slave_build']
14 api.filter.does_patch_require_compile() 15 api.filter.does_patch_require_compile()
15 assert (api.filter.result and api.properties['example_result']) or \ 16 assert (api.filter.result and api.properties['example_result']) or \
16 (not api.filter.result and not api.properties['example_result']) 17 (not api.filter.result and not api.properties['example_result'])
18 assert (not api.properties['example_matching_exes'] or
19 list(api.properties['example_matching_exes']) ==
20 api.filter.matching_exes)
17 21
18 def GenTests(api): 22 def GenTests(api):
19 # Trivial test with no exclusions and nothing matching. 23 # Trivial test with no exclusions and nothing matching.
20 yield (api.test('basic') + 24 yield (api.test('basic') +
21 api.properties(filter_exclusions=[]) + 25 api.properties(filter_exclusions=[]) +
22 api.properties(example_result=None) + 26 api.properties(example_result=None) +
27 api.properties(example_matching_exes=None) +
23 api.override_step_data( 28 api.override_step_data(
24 'analyze', 29 'analyze',
25 api.raw_io.stream_output('xx')) + 30 stdout=api.json.output({'status': 'No dependency'})) +
26 api.override_step_data( 31 api.override_step_data(
27 'git diff to analyze patch', 32 'git diff to analyze patch',
28 api.raw_io.stream_output('yy'))) 33 api.raw_io.stream_output('yy')))
29 34
30 # Matches exclusions 35 # Matches exclusions
31 yield (api.test('match_exclusion') + 36 yield (api.test('match_exclusion') +
32 api.properties(filter_exclusions=['fo.*']) + 37 api.properties(filter_exclusions=['fo.*']) +
33 api.properties(example_result=1) + 38 api.properties(example_result=1) +
39 api.properties(example_matching_exes=None) +
34 api.override_step_data( 40 api.override_step_data(
35 'git diff to analyze patch', 41 'git diff to analyze patch',
36 api.raw_io.stream_output('foo.cc'))) 42 api.raw_io.stream_output('foo.cc')))
37 43
38 # Doesnt match exclusion. 44 # Doesnt match exclusion.
39 yield (api.test('doesnt_match_exclusion') + 45 yield (api.test('doesnt_match_exclusion') +
40 api.properties(filter_exclusions=['fo.*']) + 46 api.properties(filter_exclusions=['fo.*']) +
41 api.properties(example_result=None) + 47 api.properties(example_result=None) +
48 api.properties(example_matching_exes=None) +
42 api.override_step_data( 49 api.override_step_data(
43 'analyze', 50 'analyze',
44 api.raw_io.stream_output('xx')) + 51 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
45 api.override_step_data( 52 api.override_step_data(
46 'git diff to analyze patch', 53 'git diff to analyze patch',
47 api.raw_io.stream_output('bar.cc'))) 54 api.raw_io.stream_output('bar.cc')))
48 55
49 # Analyze returns matching result. 56 # Analyze returns matching result.
50 yield (api.test('analyzes_returns_true') + 57 yield (api.test('analyzes_returns_true') +
51 api.properties(example_result=1) + 58 api.properties(example_result=1) +
59 api.properties(example_matching_exes=None) +
52 api.override_step_data( 60 api.override_step_data(
53 'analyze', 61 'analyze',
54 api.raw_io.stream_output('Found dependency'))) 62 stdout=api.json.output({'status': 'Found dependency',
63 'targets': []})))
64
65 # Analyze returns matching tests.
66 yield (api.test('analyzes_matches_exes') +
67 api.properties(matching_exes=['foo', 'bar']) +
68 api.properties(example_matching_exes=['foo']) +
69 api.properties(example_result=1) +
70 api.override_step_data(
71 'analyze',
72 stdout=api.json.output({'status': 'Found dependency',
73 'targets': ['foo']})))
74
75 # Analyze with error condition.
76 yield (api.test('analyzes_error') +
77 api.properties(matching_exes=None) +
78 api.properties(example_matching_exes=None) +
79 api.properties(example_result=1) +
80 api.override_step_data(
81 'analyze',
82 stdout=api.json.output({'error': 'ERROR'})))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698