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 (BuildFactory). | 5 """Set of utilities to add commands to a buildbot factory (BuildFactory). |
6 | 6 |
7 All the utility functions to add steps to a build factory here are not | 7 All the utility functions to add steps to a build factory here are not |
8 project-specific. See the other *_commands.py for project-specific commands. | 8 project-specific. See the other *_commands.py for project-specific commands. |
9 """ | 9 """ |
10 | 10 |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 if total_shards and shard_index: | 556 if total_shards and shard_index: |
557 cmd.extend(['--total-shards', str(total_shards), | 557 cmd.extend(['--total-shards', str(total_shards), |
558 '--shard-index', str(shard_index)]) | 558 '--shard-index', str(shard_index)]) |
559 | 559 |
560 if test_name in factory_properties.get('sharded_tests', []): | 560 if test_name in factory_properties.get('sharded_tests', []): |
561 cmd.append('--parallel') | 561 cmd.append('--parallel') |
562 sharding_args = factory_properties.get('sharding_args') | 562 sharding_args = factory_properties.get('sharding_args') |
563 if sharding_args: | 563 if sharding_args: |
564 cmd.extend(['--sharding-args', sharding_args]) | 564 cmd.extend(['--sharding-args', sharding_args]) |
565 | 565 |
| 566 env = factory_properties.get('testing_env') |
| 567 |
566 cmd.append(self.GetExecutableName(test_name)) | 568 cmd.append(self.GetExecutableName(test_name)) |
567 | 569 |
568 arg_list.append('--gtest_print_time') | 570 arg_list.append('--gtest_print_time') |
569 arg_list.append(WithProperties('%(gtest_filter)s')) | 571 arg_list.append(WithProperties('%(gtest_filter)s')) |
570 cmd.extend(arg_list) | 572 cmd.extend(arg_list) |
571 | 573 |
572 self.AddTestStep(chromium_step.AnnotatedCommand, test_name, | 574 self.AddTestStep(chromium_step.AnnotatedCommand, test_name, |
573 ListProperties(cmd), description, do_step_if=doStep, | 575 ListProperties(cmd), description, do_step_if=doStep, |
574 br_do_step_if=brDoStep, hide_step_if=hideStep, | 576 env=env, br_do_step_if=brDoStep, hide_step_if=hideStep, |
575 target=self._target, factory_properties=factory_properties) | 577 target=self._target, factory_properties=factory_properties) |
576 | 578 |
577 def AddBuildStep(self, factory_properties, name='build', env=None, | 579 def AddBuildStep(self, factory_properties, name='build', env=None, |
578 timeout=6000): | 580 timeout=6000): |
579 """Add annotated step to use the buildrunner to run steps on the slave.""" | 581 """Add annotated step to use the buildrunner to run steps on the slave.""" |
580 | 582 |
581 factory_properties['target'] = self._target | 583 factory_properties['target'] = self._target |
582 | 584 |
583 cmd = [self._python, self._runbuild, '--annotate'] | 585 cmd = [self._python, self._runbuild, '--annotate'] |
584 cmd = self.AddBuildProperties(cmd) | 586 cmd = self.AddBuildProperties(cmd) |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 | 1108 |
1107 def commandComplete(self, cmd): | 1109 def commandComplete(self, cmd): |
1108 out = cmd.logs['stdio'].getText() | 1110 out = cmd.logs['stdio'].getText() |
1109 build_properties = re.findall('BUILD_PROPERTY ([^=]*)=(.*)', out) | 1111 build_properties = re.findall('BUILD_PROPERTY ([^=]*)=(.*)', out) |
1110 for propname, value in build_properties: | 1112 for propname, value in build_properties: |
1111 # findall can return strings containing CR characters, remove with strip. | 1113 # findall can return strings containing CR characters, remove with strip. |
1112 self.build.setProperty(propname, value.strip(), 'Step') | 1114 self.build.setProperty(propname, value.strip(), 'Step') |
1113 | 1115 |
1114 def getText(self, cmd, results): | 1116 def getText(self, cmd, results): |
1115 return self.describe(True) + self.messages | 1117 return self.describe(True) + self.messages |
OLD | NEW |