parameters: (self, binaries)
docstring: Set up the platform specific environment and instrument the binaries for
      coverage.
  
      This method sets up the environment, instruments all the compiled binaries
      and sets up the code coverage counters.
  
      Args:
        binaries: List of binaries that need to be instrumented.
  
      Returns:
        True on success.
        False on error.
docstring_summary: Set up the platform specific environment and instrument the binaries for
      coverage.
docstring_tokens: Set up the platform specific environment and instrument the binaries for coverage .
function: def SetUp(self, binaries):
      """Set up the platform specific environment and instrument the binaries for
      coverage.
  
      This method sets up the environment, instruments all the compiled binaries
      and sets up the code coverage counters.
  
      Args:
        binaries: List of binaries that need to be instrumented.
  
      Returns:
        True on success.
        False on error.
      """
      if self.instrumented:
        logging.error('Binaries already instrumented')
        return False
      if IsWindows():
        # Stop all previous instance of VSPerfMon counters
        counters_command = ('%s -shutdown' %
                            (os.path.join(self.tools_path, 'vsperfcmd.exe')))
        (retcode, output) = proc.RunCommandFull(counters_command,
                                                collect_output=True)
        # TODO(niranjan): Add a check that to verify that the binaries were built
        # using the /PROFILE linker flag.
        if self.tools_path == None:
          logging.error('Could not locate Visual Studio Team Server tools')
          return False
        # Remove trailing slashes
        self.tools_path = self.tools_path.rstrip('\\')
        # Add this to the env PATH.
        os.environ['PATH'] = os.environ['PATH'] + ';' + self.tools_path
        instrument_command = '%s /COVERAGE ' % (os.path.join(self.tools_path,
                                                             'vsinstr.exe'))
        for binary in binaries:
          logging.info('binary = %s' % (binary))
          logging.info('instrument_command = %s' % (instrument_command))
          # Instrument each binary in the list
          binary = os.path.join(self.src_path, 'chrome', 'Release', binary)
          (retcode, output) = proc.RunCommandFull(instrument_command + binary,
                                                  collect_output=True)
          # Check if the file has been instrumented correctly.
          if output.pop().rfind('Successfully instrumented') == -1:
            logging.error('Error instrumenting %s' % (binary))
            return False
        # We are now ready to run tests and measure code coverage.
        self.instrumented = True
        return True
function_tokens: def SetUp ( self , binaries ) : if self . instrumented : logging . error ( 'Binaries already instrumented' ) return False if IsWindows ( ) : # Stop all previous instance of VSPerfMon counters counters_command = ( '%s -shutdown' % ( os . path . join ( self . tools_path , 'vsperfcmd.exe' ) ) ) ( retcode , output ) = proc . RunCommandFull ( counters_command , collect_output = True ) # TODO(niranjan): Add a check that to verify that the binaries were built # using the /PROFILE linker flag. if self . tools_path == None : logging . error ( 'Could not locate Visual Studio Team Server tools' ) return False # Remove trailing slashes self . tools_path = self . tools_path . rstrip ( '\\' ) # Add this to the env PATH. os . environ [ 'PATH' ] = os . environ [ 'PATH' ] + ';' + self . tools_path instrument_command = '%s /COVERAGE ' % ( os . path . join ( self . tools_path , 'vsinstr.exe' ) ) for binary in binaries : logging . info ( 'binary = %s' % ( binary ) ) logging . info ( 'instrument_command = %s' % ( instrument_command ) ) # Instrument each binary in the list binary = os . path . join ( self . src_path , 'chrome' , 'Release' , binary ) ( retcode , output ) = proc . RunCommandFull ( instrument_command + binary , collect_output = True ) # Check if the file has been instrumented correctly. if output . pop ( ) . rfind ( 'Successfully instrumented' ) == - 1 : logging . error ( 'Error instrumenting %s' % ( binary ) ) return False # We are now ready to run tests and measure code coverage. self . instrumented = True return True