OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """Set of utilities to add commands to a buildbot factory. | 5 """Set of utilities to add commands to a buildbot factory. |
6 | 6 |
7 This is based on commands.py and adds swarm-specific commands.""" | 7 This is based on commands.py and adds swarm-specific commands.""" |
8 | 8 |
9 from buildbot.process.properties import WithProperties | 9 from buildbot.process.properties import WithProperties |
10 from buildbot.steps import shell | 10 from buildbot.steps import shell |
11 from twisted.python import log | 11 from twisted.python import log |
12 | 12 |
13 import config | 13 import config |
14 from master.factory import commands | 14 from master.factory import commands |
15 from master.log_parser import gtest_command | 15 from master.log_parser import gtest_command |
16 | 16 |
17 | 17 |
18 def TestStepFilterSwarm(bStep): | 18 def TestStepFilterSwarm(bStep): |
19 """Examines the 'testfilter' property of a build and determines if this | 19 """Examines the 'testfilter' property of a build and determines if this |
20 build has swarm steps and thus if the test should run. | 20 build has swarm steps and thus if the test should run. |
21 It also adds a property, swarm_tests, which contains all the tests which will | 21 It also adds a property, swarm_tests, which contains all the tests which will |
22 run under swarm.""" | 22 run under swarm.""" |
23 bStep.setProperty('swarm_tests', '') | |
24 test_filters = bStep.build.getProperties().getProperty('testfilter') | 23 test_filters = bStep.build.getProperties().getProperty('testfilter') |
25 test_filters = test_filters or commands.DEFAULT_TESTS | 24 test_filters = test_filters or commands.DEFAULT_TESTS |
26 | 25 |
27 swarm_tests = '' | 26 swarm_tests = commands.GetSwarmTestsFromTestFilter(test_filters) |
28 for test_filter in test_filters: | 27 # TODO(csharp): Keep swarm_tests as a list. |
29 if '_swarm:' in test_filter: | 28 bStep.setProperty('swarm_tests', ' '.join(swarm_tests)) |
30 swarm_tests += test_filter.split('_swarm:')[0] + ' ' | |
31 elif test_filter.endswith('_swarm'): | |
32 swarm_tests += test_filter[:-len('_swarm')] + ' ' | |
33 | |
34 bStep.setProperty('swarm_tests', swarm_tests.strip()) | |
35 | 29 |
36 return bool(swarm_tests) | 30 return bool(swarm_tests) |
37 | 31 |
38 | 32 |
39 def TestStepHasSwarmProperties(bStep): | 33 def TestStepHasSwarmProperties(bStep): |
40 """Returns true if the step has the required swarm properties set.""" | 34 """Returns true if the step has the required swarm properties set.""" |
41 properties = bStep.build.getProperties() | 35 properties = bStep.build.getProperties() |
42 | 36 |
43 try: | 37 try: |
44 properties.getProperty('testfilter') | 38 properties.getProperty('testfilter') |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 141 |
148 command = [self._python, script_path, '--drive', drive, | 142 command = [self._python, script_path, '--drive', drive, |
149 '--network_path', network_path] | 143 '--network_path', network_path] |
150 | 144 |
151 self._factory.addStep( | 145 self._factory.addStep( |
152 shell.ShellCommand, | 146 shell.ShellCommand, |
153 name='setup_windows_network_storage', | 147 name='setup_windows_network_storage', |
154 description='setup_windows_network_storage', | 148 description='setup_windows_network_storage', |
155 descriptionDone='setup_windows_network_storage', | 149 descriptionDone='setup_windows_network_storage', |
156 command=command) | 150 command=command) |
OLD | NEW |