| 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 | 11 |
| 12 from master.factory import commands | 12 from master.factory import commands |
| 13 from master.log_parser import gtest_command | 13 from master.log_parser import gtest_command |
| 14 | 14 |
| 15 class SwarmCommands(commands.FactoryCommands): | 15 class SwarmCommands(commands.FactoryCommands): |
| 16 """Encapsulates methods to add swarm commands to a buildbot factory""" | 16 """Encapsulates methods to add swarm commands to a buildbot factory""" |
| 17 | 17 |
| 18 def AddTriggerSwarmTestStep(self, target_platform, swarm_server, | 18 def AddTriggerSwarmTestStep(self, target_platform, swarm_server, data_server, |
| 19 hashtable_dir, data_dest_dir, |
| 19 min_shards, max_shards, | 20 min_shards, max_shards, |
| 20 manifest_files): | 21 manifest_files): |
| 21 script_path = self.PathJoin(self._script_dir, 'run_slavelastic.py') | 22 script_path = self.PathJoin(self._script_dir, 'run_slavelastic.py') |
| 22 | 23 |
| 23 swarm_request_name_prefix = WithProperties('%s-%s-', | 24 swarm_request_name_prefix = WithProperties('%s-%s-', |
| 24 'buildername:-None', | 25 'buildername:-None', |
| 25 'buildnumber:-None') | 26 'buildnumber:-None') |
| 26 | 27 |
| 27 command = [self._python, script_path, '-m', min_shards, '-s', max_shards, | 28 command = [self._python, script_path, '-m', min_shards, '-s', max_shards, |
| 28 '-o', target_platform, '-u', swarm_server, | 29 '-o', target_platform, '-u', swarm_server, '-d', data_server, |
| 30 '--hashtable_dir', hashtable_dir, |
| 31 '--data-dest-dir', data_dest_dir, |
| 29 '-t', swarm_request_name_prefix] | 32 '-t', swarm_request_name_prefix] |
| 30 command.extend(manifest_files) | 33 command.extend(manifest_files) |
| 31 | 34 |
| 32 self.AddTestStep(shell.ShellCommand, 'trigger_swarm_tests', command) | 35 self.AddTestStep(shell.ShellCommand, 'trigger_swarm_tests', command) |
| 33 | 36 |
| 34 def AddGetSwarmTestStep(self, swarm_server, test_name): | 37 def AddGetSwarmTestStep(self, swarm_server, test_name): |
| 35 script_path = self.PathJoin(self._script_dir, 'get_swarm_results.py') | 38 script_path = self.PathJoin(self._script_dir, 'get_swarm_results.py') |
| 36 | 39 |
| 37 swarm_request_name = WithProperties('%s-%s-' + test_name, | 40 swarm_request_name = WithProperties('%s-%s-' + test_name, |
| 38 'buildername:-None', | 41 'buildername:-None', |
| 39 'buildnumber:-None') | 42 'buildnumber:-None') |
| 40 | 43 |
| 41 command = [self._python, script_path, '-u', swarm_server, | 44 command = [self._python, script_path, '-u', swarm_server, |
| 42 swarm_request_name] | 45 swarm_request_name] |
| 43 | 46 |
| 44 self.AddTestStep(gtest_command.GTestCommand, | 47 self.AddTestStep(gtest_command.GTestCommand, |
| 45 '%s_swarm' % test_name, | 48 '%s_swarm' % test_name, |
| 46 command) | 49 command) |
| OLD | NEW |