| Index: buildbot/scripts/master/factory/commands.py
|
| ===================================================================
|
| --- buildbot/scripts/master/factory/commands.py (revision 46397)
|
| +++ buildbot/scripts/master/factory/commands.py (working copy)
|
| @@ -151,28 +151,9 @@
|
| cmd.extend(arg_list)
|
| return cmd
|
|
|
| - @staticmethod
|
| - def DoStepFilterTest(bStep):
|
| - """Examines the 'testfilters' property of the build and determines if
|
| - the step should run; True for yes."""
|
| - try:
|
| - filters = bStep.getProperty('testfilters')
|
| - except:
|
| - return True
|
| -
|
| - for filter in filters:
|
| - if filter == bStep.name:
|
| - return True
|
| - if filter.startswith(("%s:" % bStep.name)):
|
| - # TODO(vandebo): We cannot modiby bStep after is it generated from the
|
| - # factory unless a copy is made.
|
| - #bStep.command.append("--gtest_filter=%s" % filter.split(':',1)[1])
|
| - return True
|
| - return False
|
| -
|
| def AddTestStep(self, command_class, test_name, test_command,
|
| test_description='', timeout=600, workdir=None, env=None,
|
| - locks=None, halt_on_failure=False):
|
| + locks=None, halt_on_failure=False, do_step_if=True):
|
| """Adds a step to the factory to run a test.
|
|
|
| Args:
|
| @@ -194,15 +175,11 @@
|
| locks: any locks to acquire for this test
|
| halt_on_failure: whether the current build should halt if this step fails
|
| """
|
| - doStepCondition = True
|
| - if command_class == gtest_command.GTestCommand:
|
| - doStepCondition = self.DoStepFilterTest
|
| -
|
| self._factory.addStep(
|
| command_class,
|
| name=test_name,
|
| timeout=timeout,
|
| - doStepIf=doStepCondition,
|
| + doStepIf=do_step_if,
|
| workdir=workdir,
|
| env=env,
|
| # TODO(bradnelson): FIXME
|
| @@ -212,6 +189,24 @@
|
| haltOnFailure=halt_on_failure,
|
| command=test_command)
|
|
|
| + @staticmethod
|
| + def GTestStepFilter(bStep):
|
| + """Examines the 'testfilters' property of the build and determines if
|
| + the step should run; True for yes."""
|
| + bStep.setProperty('gtest_filter', None, "Factory")
|
| + filters = bStep.build.getProperties().getProperty('testfilters')
|
| + if not filters:
|
| + return True
|
| +
|
| + for filter in filters:
|
| + if filter == bStep.name:
|
| + return True
|
| + if filter.startswith("%s:" % bStep.name):
|
| + bStep.setProperty('gtest_filter', "--gtest_filter=%s" %
|
| + filter.split(':',1)[1], "Scheduler")
|
| + return True
|
| + return False
|
| +
|
| def AddBasicGTestTestStep(self, test_name, factory_properties=None,
|
| description='', arg_list=None, total_shards=None,
|
| shard_index=None):
|
| @@ -250,9 +245,11 @@
|
| cmd.append(self.GetExecutableName(test_name))
|
|
|
| arg_list.append('--gtest_print_time')
|
| + arg_list.append(WithProperties("%(gtest_filter)s"))
|
| cmd.extend(arg_list)
|
|
|
| - self.AddTestStep(gtest_command.GTestCommand, test_name, cmd, description)
|
| + self.AddTestStep(gtest_command.GTestCommand, test_name, ListProperties(cmd),
|
| + description, do_step_if=self.GTestStepFilter)
|
|
|
| def AddBasicShellStep(self, test_name, timeout=600, arg_list=None):
|
| """Adds a step to the factory to run a simple shell test with standard
|
|
|