tools/bisect-builds.py
def RunRevision(context, revision, zip_file, profile, num_runs, command, args):
  """Given a zipped revision, unzip it and run the test."""
  print('Trying revision %s...' % str(revision))

  # Create a temp directory and unzip the revision into it.
  cwd = os.getcwd()
  tempdir = tempfile.mkdtemp(prefix='bisect_tmp')
  UnzipFilenameToDir(zip_file, tempdir)

  # Hack: Some Chrome OS archives are missing some files; try to copy them
  # from the local directory.
  if context.platform == 'chromeos' and revision < 591483:
    CopyMissingFileFromCurrentSource('third_party/icu/common/icudtl.dat',
                                     '%s/chrome-linux/icudtl.dat' % tempdir)
    CopyMissingFileFromCurrentSource('*out*/*/libminigbm.so',
                                     '%s/chrome-linux/libminigbm.so' % tempdir)

  os.chdir(tempdir)

  # Run the build as many times as specified.
  testargs = ['--user-data-dir=%s' % profile] + args
  # The sandbox must be run as root on Official Chrome, so bypass it.
  if (context.flash_path and context.platform.startswith('linux')):
    testargs.append('--no-sandbox')
  if context.flash_path:
    testargs.append('--ppapi-flash-path=%s' % context.flash_path)
    # We have to pass a large enough Flash version, which currently needs not
    # be correct. Instead of requiring the user of the script to figure out and
    # pass the correct version we just spoof it.
    testargs.append('--ppapi-flash-version=99.9.999.999')

  runcommand = []
  for token in shlex.split(command):
    if token == '%a':
      runcommand.extend(testargs)
    else:
      runcommand.append(
          token.replace('%p', os.path.abspath(context.GetLaunchPath(revision))).
          replace('%s', ' '.join(testargs)))
  result = None
  try:
    for _ in range(num_runs):
      subproc = subprocess.Popen(
          runcommand,
          bufsize=-1,
          stdout=subprocess.PIPE,
          stderr=subprocess.PIPE)
      (stdout, stderr) = subproc.communicate()
      result = (subproc.returncode, stdout, stderr)
      if subproc.returncode:
        break
    return result
  finally:
    os.chdir(cwd)
    try:
      shutil.rmtree(tempdir, True)
    except Exception:
      pass
Given a zipped revision, unzip it and run the test.
Given a zipped revision, unzip it and run the test.
Given a zipped revision unzip it and run the test .
def RunRevision(context, revision, zip_file, profile, num_runs, command, args):
  print('Trying revision %s...' % str(revision))
  cwd = os.getcwd()
  tempdir = tempfile.mkdtemp(prefix='bisect_tmp')
  UnzipFilenameToDir(zip_file, tempdir)
  if context.platform == 'chromeos' and revision < 591483:
    CopyMissingFileFromCurrentSource('third_party/icu/common/icudtl.dat',
                                     '%s/chrome-linux/icudtl.dat' % tempdir)
    CopyMissingFileFromCurrentSource('*out*/*/libminigbm.so',
                                     '%s/chrome-linux/libminigbm.so' % tempdir)
  os.chdir(tempdir)
  testargs = ['--user-data-dir=%s' % profile] + args
  if (context.flash_path and context.platform.startswith('linux')):
    testargs.append('--no-sandbox')
  if context.flash_path:
    testargs.append('--ppapi-flash-path=%s' % context.flash_path)
    testargs.append('--ppapi-flash-version=99.9.999.999')
  runcommand = []
  for token in shlex.split(command):
    if token == '%a':
      runcommand.extend(testargs)
    else:
      runcommand.append(
          token.replace('%p', os.path.abspath(context.GetLaunchPath(revision))).
          replace('%s', ' '.join(testargs)))
  result = None
  try:
    for _ in range(num_runs):
      subproc = subprocess.Popen(
          runcommand,
          bufsize=-1,
          stdout=subprocess.PIPE,
          stderr=subprocess.PIPE)
      (stdout, stderr) = subproc.communicate()
      result = (subproc.returncode, stdout, stderr)
      if subproc.returncode:
        break
    return result
  finally:
    os.chdir(cwd)
    try:
      shutil.rmtree(tempdir, True)
    except Exception:
      pass
def RunRevision ( context , revision , zip_file , profile , num_runs , command , args ) : print ( 'Trying revision %s...' % str ( revision ) ) cwd = os . getcwd ( ) tempdir = tempfile . mkdtemp ( prefix = 'bisect_tmp' ) UnzipFilenameToDir ( zip_file , tempdir ) if context . platform == 'chromeos' and revision < 591483 : CopyMissingFileFromCurrentSource ( 'third_party/icu/common/icudtl.dat' , '%s/chrome-linux/icudtl.dat' % tempdir ) CopyMissingFileFromCurrentSource ( '*out*/*/libminigbm.so' , '%s/chrome-linux/libminigbm.so' % tempdir ) os . chdir ( tempdir ) testargs = [ '--user-data-dir=%s' % profile ] + args if ( context . flash_path and context . platform . startswith ( 'linux' ) ) : testargs . append ( '--no-sandbox' ) if context . flash_path : testargs . append ( '--ppapi-flash-path=%s' % context . flash_path ) testargs . append ( '--ppapi-flash-version=99.9.999.999' ) runcommand = [ ] for token in shlex . split ( command ) : if token == '%a' : runcommand . extend ( testargs ) else : runcommand . append ( token . replace ( '%p' , os . path . abspath ( context . GetLaunchPath ( revision ) ) ) . replace ( '%s' , ' ' . join ( testargs ) ) ) result = None try : for _ in range ( num_runs ) : subproc = subprocess . Popen ( runcommand , bufsize = - 1 , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) ( stdout , stderr ) = subproc . communicate ( ) result = ( subproc . returncode , stdout , stderr ) if subproc . returncode : break return result finally : os . chdir ( cwd ) try : shutil . rmtree ( tempdir , True ) except Exception : pass
Given a zipped revision, unzip it and run the test.
Given a zipped revision unzip it and run the test .
"""Given a zipped revision, unzip it and run the test.""" # Create a temp directory and unzip the revision into it. # Hack: Some Chrome OS archives are missing some files; try to copy them # from the local directory. # Run the build as many times as specified. # The sandbox must be run as root on Official Chrome, so bypass it. # We have to pass a large enough Flash version, which currently needs not # be correct. Instead of requiring the user of the script to figure out and # pass the correct version we just spoof it.
context
revision
zip_file
profile
num_runs
command
args