Ticket #87: shell.py.diff

File shell.py.diff, 2.4 KB (added by rochg, 3 years ago)

Example of the use of custom properties. Not intended for the BuildBot code base.

  • buildbot/steps/shell.py

    old new  
    271295    description = ["testing"] 
    272296    descriptionDone = ["test"] 
    273297    command = ["make", "test"] 
     298 
     299class BKBSelectiveTest(Test): 
     300  
     301    name = "Test" 
     302    description = ["testing"] 
     303    descriptionDone = ["test"] 
     304    warnOnFailure = 1 
     305 
     306    # Overridden method simple to include test filtering information in the 
     307    # command that we run and to support supressing code coverage information 
     308    # to aid testing speed 
     309    def start(self): 
     310        extraenv = {} 
     311 
     312        # 
     313        # See if the NV_TEST_FILTER property has been set. If it has, we want 
     314        # to pass it in the enviroment to the build slave and adjust the 
     315        # description of this step to indicate which tests we are running 
     316        # 
     317        try: 
     318            extraenv['NV_TEST_FILTER'] = self.getProperty('NV_TEST_FILTER') 
     319            description = ["testing (" + self.getProperty('NV_TEST_FILTER') + ")"] 
     320            descriptionDone = ["test (" + self.getProperty('NV_TEST_FILTER') + ")"] 
     321        except: 
     322            # todo - how do we do nothing here? 
     323            self.command = self.command 
     324 
     325        # Now see if we've been asked to suppress code coverage processing. 
     326        # If we have, this again needs to get passed in the environment to the 
     327        # slave. 
     328        try: 
     329            if "TRUE" == self.getProperty('NV_SUPPRESS_COVERAGE_PROCESSING'): 
     330                extraenv['NV_SUPPRESS_COVERAGE_PROCESSING'] = "TRUE" 
     331        except: 
     332            # todo - how do we do nothing here? 
     333            self.command = self.command 
     334 
     335        # Combine any enviroment we want to set with any that was already 
     336        # specified 
     337        if self.remote_kwargs.has_key('env') != True: 
     338            self.remote_kwargs['env'] = {} 
     339 
     340        self.remote_kwargs['env'].update(extraenv) 
     341 
     342        # Invoke the base class to actually carry out the shell command 
     343        ShellCommand.start(self) 
     344 
     345    def describe(self, done=False): 
     346        filter = None 
     347        try: 
     348            filter = self.getProperty('NV_TEST_FILTER') 
     349        except: 
     350            filter = None 
     351 
     352        if done is True: 
     353            word = "test" 
     354        else: 
     355            word = "testing" 
     356 
     357        if None != filter: 
     358            return [ word + " (" + filter + ")" ] 
     359        else: 
     360            return [ word ]