Ejemplo n.º 1
0
def main_win(options, args, results_collector):
  """Print appropriate size information about built Windows targets.

  Returns the first non-zero exit status of any command it executes,
  or zero on success.
  """
  build_dir = build_directory.GetBuildOutputDirectory(SRC_DIR)
  target_dir = os.path.join(build_dir, options.target)
  chrome_dll = os.path.join(target_dir, 'chrome.dll')
  chrome_child_dll = os.path.join(target_dir, 'chrome_child.dll')
  chrome_exe = os.path.join(target_dir, 'chrome.exe')
  mini_installer_exe = os.path.join(target_dir, 'mini_installer.exe')
  setup_exe = os.path.join(target_dir, 'setup.exe')

  result = 0

  print 'RESULT chrome.dll: chrome.dll= %s bytes' % get_size(chrome_dll)

  if os.path.exists(chrome_child_dll):
    fmt = 'RESULT chrome_child.dll: chrome_child.dll= %s bytes'
    print fmt % get_size(chrome_child_dll)

  print 'RESULT chrome.exe: chrome.exe= %s bytes' % get_size(chrome_exe)

  if os.path.exists(mini_installer_exe):
    fmt = 'RESULT mini_installer.exe: mini_installer.exe= %s bytes'
    print fmt % get_size(mini_installer_exe)

  if os.path.exists(setup_exe):
    print 'RESULT setup.exe: setup.exe= %s bytes' % get_size(setup_exe)

  return result
Ejemplo n.º 2
0
def _ExpandArgs(args):
    """Expands the arguments in the provided list of arguments. Any occurrence of
  @{BUILD_DIR} is replaced with the actual build directory.
  """
    build_dir = build_directory.GetBuildOutputDirectory()
    eargs = [re.sub('@\{BUILD_DIR\}', build_dir, arg) for arg in args]
    return eargs
Ejemplo n.º 3
0
def main():
    option_parser = optparse.OptionParser()
    option_parser.add_option('',
                             '--revision',
                             default=None,
                             help='unique id for this run')
    option_parser.add_option('', '--build-dir', help='ignored')
    option_parser.add_option('',
                             '--builder-name',
                             default=None,
                             help='name of the build machine')
    option_parser.add_option('',
                             '--test-name',
                             default=None,
                             help='name of the test')
    options = option_parser.parse_args()[0]
    options.build_dir = build_directory.GetBuildOutputDirectory()

    if (options.revision is None or options.build_dir is None
            or options.builder_name is None or options.test_name is None):
        print 'All command options are required. Use --help.'
        return 1

    if Archive(options.revision, options.build_dir, options.builder_name,
               options.test_name):
        return 0
    return 2
Ejemplo n.º 4
0
def main():
    parser = optparse.OptionParser(usage='%prog [options]')
    parser.add_option('--target', help='Release or Debug')
    parser.add_option('--output-json',
                      help='File to dump JSON results into. '
                      'If unspecified, writes to stdout.')
    options, _ = parser.parse_args()

    assert options.target
    build_dir = build_directory.GetBuildOutputDirectory()
    outdir = os.path.join(build_dir, options.target)

    result = {}

    # Get the file hash values and output the pair.
    for filepath in sorted(glob.glob(os.path.join(outdir, '*.isolated'))):
        test_name = os.path.splitext(os.path.basename(filepath))[0]
        if re.match(r'^.+?\.\d$', test_name):
            # It's a split .isolated file, e.g. foo.0.isolated. Ignore these.
            continue

        sha1_hash = hash_file(filepath)
        os.remove(filepath)
        if not options.output_json:
            print('%s %s' % (test_name, sha1_hash))
            # TODO(csharp): Remove both the message and the deletion once the isolate
            # tracked dependencies are inputs for the isolated files.
            print('Deleted %s to ensure it is regenerated by the next build.' %
                  filepath)
        else:
            result[test_name] = sha1_hash

    if options.output_json:
        with open(options.output_json, 'wb') as f:
            json.dump(result, f)
def main():
    option_parser = optparse.OptionParser()

    option_parser.add_option('--target',
                             help='build target to archive (Debug or Release)')
    option_parser.add_option('--build-dir', help='ignored')
    option_parser.add_option('--build-url',
                             help='url where to find the build to extract')
    option_parser.add_option('--revision', help='Revision number to download.')
    option_parser.add_option('--halt-on-missing-build',
                             help='Halt on missing build.')
    chromium_utils.AddPropertiesOptions(option_parser)

    options, args = option_parser.parse_args()
    if args:
        print 'Unknown options: %s' % args
        return 1

    options.build_dir = build_directory.GetBuildOutputDirectory()
    options.build_dir = os.path.abspath(options.build_dir)

    options.build_url = (options.build_url
                         or options.factory_properties.get('build_url'))

    del options.factory_properties
    del options.build_properties

    return real_main(options)
def main():
  option_parser = optparse.OptionParser()
  option_parser.add_option('', '--build-dir', help='ignored')
  option_parser.add_option('', '--results-dir',
                           help='path to layout test results, relative to '
                                'the build_dir')
  option_parser.add_option('', '--builder-name',
                           default=None,
                           help='The name of the builder running this script.')
  option_parser.add_option('', '--build-number',
                           default=None,
                           help=('The build number of the builder running'
                                 'this script.'))
  option_parser.add_option('', '--gs-bucket',
                           default=None,
                           help=('The google storage bucket to upload to. '
                                 'If provided, this script will upload to gs '
                                 'instead of the master.'))
  option_parser.add_option('', '--gs-acl',
                           default=None,
                           help=('The ACL of the google storage files.'))
  chromium_utils.AddPropertiesOptions(option_parser)
  options, args = option_parser.parse_args()
  options.build_dir = build_directory.GetBuildOutputDirectory()

  # To continue supporting buildbot, initialize these from the
  # factory_properties if they were not supplied on the command line.
  if not options.gs_bucket:
    options.gs_bucket = options.factory_properties.get('gs_bucket')
  if not options.gs_acl:
    options.gs_acl = options.factory_properties.get('gs_acl')

  return archive_layout(options, args)
def Main():
  """Main routine."""
  option_parser = optparse.OptionParser()
  option_parser.add_option('--target',
                           default='Debug',
                           help='build target (Debug, Release) '
                                '[default: %default]')
  option_parser.add_option('--build-dir', help='ignored')
  option_parser.add_option('--perf-subdir',
                           metavar='DIR',
                           help='destination subdirectory under'
                                'coverage')
  option_parser.add_option('--build-number',
                           help='destination subdirectory under perf-subdir')
  options, args = option_parser.parse_args()
  options.build_dir = build_directory.GetBuildOutputDirectory()

  if args:
    option_parser.error('Args not supported: %s' % args)

  ac = ArchiveCoverage(options)
  ac.Upload('total_coverage')

  ac = ArchiveCoverage(options)
  ac.Upload('unittests_coverage')

  ac = ArchiveCoverage(options)
  ac.Upload('browsertests_coverage')

  return 0
Ejemplo n.º 8
0
def archive(options, args):
    build_dir = build_directory.GetBuildOutputDirectory()
    build_dir = os.path.join(build_dir, options.target)
    src_dir = os.path.abspath(os.path.dirname(options.build_dir))

    staging_dir = slave_utils.GetStagingDir(src_dir)
    build_revision = slave_utils.SubversionRevision(src_dir)
    chromium_utils.MakeParentDirectoriesWorldReadable(staging_dir)

    print 'Staging in %s' % build_dir

    # Build the list of files to archive.
    zip_file_list = [
        f for f in os.listdir(build_dir)
        if ShouldPackageFile(f, options.target)
    ]

    subdir = None

    # TODO(nsylvain): We need to move linux to a subdir as well, but aarya is not
    # ready with the server-side change.
    if chromium_utils.IsMac():
        subdir = '%s-%s' % (chromium_utils.PlatformName(),
                            options.target.lower())

    prefix = options.factory_properties.get('asan_archive_name', 'asan')
    zip_file_name = '%s-%s-%s-%d' % (prefix, chromium_utils.PlatformName(),
                                     options.target.lower(), build_revision)

    (zip_dir, zip_file) = chromium_utils.MakeZip(staging_dir,
                                                 zip_file_name,
                                                 zip_file_list,
                                                 build_dir,
                                                 raise_error=True)
    chromium_utils.RemoveDirectory(zip_dir)
    if not os.path.exists(zip_file):
        raise StagingError('Failed to make zip package %s' % zip_file)
    chromium_utils.MakeWorldReadable(zip_file)

    # Report the size of the zip file to help catch when it gets too big.
    zip_size = os.stat(zip_file)[stat.ST_SIZE]
    print 'Zip file is %ld bytes' % zip_size

    gs_bucket = options.factory_properties.get('gs_bucket', None)
    gs_acl = options.factory_properties.get('gs_acl', None)
    status = slave_utils.GSUtilCopyFile(zip_file,
                                        gs_bucket,
                                        subdir=subdir,
                                        gs_acl=gs_acl)
    if status:
        raise StagingError('Failed to upload %s to %s. Error %d' %
                           (zip_file, gs_bucket, status))
    else:
        # Delete the file, it is not needed anymore.
        os.remove(zip_file)

    return status
Ejemplo n.º 9
0
def main_android_webview(options, args, results_collector):
  """Print appropriate size information about Android WebViewChromium targets.

  Returns the first non-zero exit status of any command it executes,
  or zero on success.
  """
  target_dir = os.path.join(build_directory.GetBuildOutputDirectory(SRC_DIR),
                            options.target)

  binaries = ['lib/libwebviewchromium.so']

  return check_android_binaries(binaries, target_dir, options)
def main():
  parser = optparse.OptionParser()
  parser.add_option('--target', help='Release or Debug')
  options, args = parser.parse_args()
  assert not args

  build_dir = build_directory.GetBuildOutputDirectory()
  return chromium_utils.RunCommand([
      sys.executable,
      os.path.join('src', 'tools', 'checkbins', 'checkbins.py'),
      os.path.join(build_dir, options.target)
      ])
Ejemplo n.º 11
0
def main_linux(options, args):
    """Print appropriate size information about built Linux targets.

  Returns the first non-zero exit status of any command it executes,
  or zero on success.
  """
    build_dir = build_directory.GetBuildOutputDirectory()
    target_dir = os.path.join(build_dir, options.target)

    binaries = [
        'chrome',
        'nacl_helper',
        'nacl_helper_bootstrap',
        'libffmpegsumo.so',
        'libgcflashplayer.so',
        'lib/libpeerconnection.so',
        'libpdf.so',
        'libppGoogleNaClPluginChrome.so',
    ]

    result = 0

    totals = {}

    for binary in binaries:
        this_result, this_sizes = check_linux_binary(target_dir, binary,
                                                     options)
        if result == 0:
            result = this_result
        for name, identifier, totals_id, value, units in this_sizes:
            print 'RESULT %s: %s= %s %s' % (name, identifier, value, units)
            totals_id = totals_id or identifier, units
            totals[totals_id] = totals.get(totals_id, 0) + int(value)

    files = [
        'nacl_irt_x86_64.nexe',
        'resources.pak',
    ]

    for filename in files:
        path = os.path.join(target_dir, filename)
        try:
            size = get_size(path)
        except OSError, e:
            if e.errno == errno.ENOENT:
                continue  # Don't print anything for missing files.
            raise
        print 'RESULT %s: %s= %s bytes' % (filename, filename, size)
        totals['size', 'bytes'] += size
Ejemplo n.º 12
0
def main():
    option_parser = optparse.OptionParser()
    option_parser.add_option('--build-dir', help='ignored')

    # Note that --target isn't needed for --lint-test-files, but the
    # RunPythonCommandInBuildDir() will get upset if we don't say something.
    option_parser.add_option(
        '',
        '--target',
        default='release',
        help='DumpRenderTree build configuration (Release or Debug)')

    options, args = option_parser.parse_args()
    options.build_dir = build_directory.GetBuildOutputDirectory()
    return layout_test(options, args)
Ejemplo n.º 13
0
def main_android(options, args, results_collector):
  """Print appropriate size information about built Android targets.

  Returns the first non-zero exit status of any command it executes,
  or zero on success.
  """
  target_dir = os.path.join(build_directory.GetBuildOutputDirectory(SRC_DIR),
                            options.target)

  binaries = [
      'chrome_public_apk/libs/armeabi-v7a/libchrome.so',
      'lib/libchrome.so',
  ]

  return check_android_binaries(binaries, target_dir, options)
Ejemplo n.º 14
0
def main():
    client = swarming_utils.find_client(os.getcwd())
    if not client:
        print >> sys.stderr, 'Failed to find swarm(ing)_client'
        return 1
    # Replace the 'isolate_shim.py' wrapper with 'isolate.py'.
    args = [sys.executable, os.path.join(client, 'isolate.py')] + sys.argv[1:]
    build_dir, args = InterceptFlag('--build-dir', args)
    target, args = InterceptFlag('--target', args)

    if build_dir:
        assert target
        build_dir = build_directory.GetBuildOutputDirectory()
        AdjustIsolatedFlag(args, os.path.join(build_dir, target))

    return chromium_utils.RunCommand(args)
Ejemplo n.º 15
0
def main_android_cronet(options, args, results_collector):
  """Print appropriate size information about Android Cronet targets.

  Returns the first non-zero exit status of any command it executes,
  or zero on success.
  """
  target_dir = os.path.join(build_directory.GetBuildOutputDirectory(SRC_DIR),
                            options.target)

  binaries = ['cronet_sample_apk/libs/arm64-v8a/libcronet.so',
              'cronet_sample_apk/libs/armeabi-v7a/libcronet.so',
              'cronet_sample_apk/libs/armeabi/libcronet.so',
              'cronet_sample_apk/libs/mips/libcronet.so',
              'cronet_sample_apk/libs/x86_64/libcronet.so',
              'cronet_sample_apk/libs/x86/libcronet.so']

  return check_android_binaries(binaries, target_dir, options)
Ejemplo n.º 16
0
def main_android_cronet(options, args, results_collector):
  """Print appropriate size information about Android Cronet targets.

  Returns the first non-zero exit status of any command it executes,
  or zero on success.
  """
  target_dir = os.path.join(build_directory.GetBuildOutputDirectory(SRC_DIR),
                            options.target)
  # Use version in binary file name, but not in printed output.
  binaries_with_paths = glob.glob(os.path.join(target_dir,'libcronet.*.so'))
  num_binaries = len(binaries_with_paths)
  assert num_binaries == 1, "Got %d binaries" % (num_binaries,)
  binaries = [os.path.basename(binaries_with_paths[0])]
  binaries_to_print = ['libcronet.so']

  return check_android_binaries(binaries, target_dir, options,
                                results_collector, binaries_to_print)
def main():
    if sys.platform in ('win32', 'cygwin'):
        default_platform = 'win'
    elif sys.platform.startswith('darwin'):
        default_platform = 'mac'
    elif sys.platform == 'linux2':
        default_platform = 'linux'
    else:
        default_platform = None

    platforms = ['linux', 'mac', 'win']

    option_parser = optparse.OptionParser()
    option_parser.add_option('--target',
                             default='Debug',
                             help='build target (Debug, Release) '
                             '[default: %default]')
    option_parser.add_option('--build-dir', help='ignored')
    option_parser.add_option(
        '--platform',
        default=default_platform,
        help='specify platform (%s) [default: %%default]' %
        ', '.join(platforms))
    option_parser.add_option('--build-id',
                             help='The build number of the tested build.')
    option_parser.add_option('--upload-dir',
                             help='Path coverage file was uploaded to.')

    chromium_utils.AddPropertiesOptions(option_parser)
    options, args = option_parser.parse_args()
    options.build_dir = build_directory.GetBuildOutputDirectory()

    fp = options.factory_properties
    options.tests = fp.get('tests')
    options.sharded_tests = fp.get('sharded_tests')
    options.browser_total_shards = fp.get('browser_total_shards')
    del options.factory_properties
    del options.build_properties

    if options.platform not in platforms:
        sys.stderr.write('Unsupported sys.platform %s.\n' % repr(sys.platform))
        msg = 'Use the --platform= option to specify a supported platform:\n'
        sys.stderr.write(msg + '    ' + ' '.join(platforms) + '\n')
        return 2
    return ProcessCoverage(options, args)
Ejemplo n.º 18
0
def main():
  parser = optparse.OptionParser()
  parser.add_option('--target', help='Release or Debug')
  options, args = parser.parse_args()
  assert not args

  mini_installer_dir = os.path.join('src', 'chrome', 'test', 'mini_installer')
  mini_installer_tests_config = os.path.join(
      mini_installer_dir, 'config', 'config.config')
  return chromium_utils.RunCommand([
      sys.executable,
      os.path.join(mini_installer_dir, 'test_installer.py'),
      '-v',
      '--config', mini_installer_tests_config,
      '--build-dir', build_directory.GetBuildOutputDirectory(),
      '--target', options.target,
      '--force-clean',
      ])
Ejemplo n.º 19
0
def main():
    parser = optparse.OptionParser()
    parser.add_option('--build-dir', help='ignored')
    parser.add_option('--target', help='Release or Debug')
    parser.add_option('--profile-type-to-generate')
    options, args = parser.parse_args()

    output_dir = os.path.join(build_directory.GetBuildOutputDirectory(),
                              options.target, 'generated_profile')
    cmd = [
        sys.executable,
        os.path.join('src', 'tools', 'perf', 'generate_profile'),
        '-v',
        '--browser=' + options.target.lower(),
        '--profile-type-to-generate=' + options.profile_type_to_generate,
        '--output-dir=' + output_dir,
    ] + args

    return chromium_utils.RunCommand(cmd)
def main():
    option_parser = optparse.OptionParser()
    option_parser.add_option('--build-dir', help='ignored')

    # Note that --target isn't needed for --lint-test-files, but the
    # RunPythonCommandInBuildDir() will get upset if we don't say something.
    option_parser.add_option(
        '',
        '--target',
        default='release',
        help='DumpRenderTree build configuration (Release or Debug)')

    options, _ = option_parser.parse_args()
    options.build_dir = build_directory.GetBuildOutputDirectory()

    build_dir = os.path.abspath(options.build_dir)
    webkit_tests_dir = chromium_utils.FindUpward(build_dir, 'third_party',
                                                 'WebKit', 'Tools', 'Scripts')
    command = [os.path.join(webkit_tests_dir, 'test-webkitpy')]
    return slave_utils.RunPythonCommandInBuildDir(build_dir, options.target,
                                                  command)
def main():
  option_parser = optparse.OptionParser()

  # Required options:
  option_parser.add_option('--post-process', action='store_true',
                           help='Prepare dynamorio before running tests.')
  option_parser.add_option('--pre-process', action='store_true',
                           help='Process coverage after running tests.')
  option_parser.add_option('--build-dir', help='ignored')
  option_parser.add_option('--build-id',
                           help='The build number of the tested build.')
  option_parser.add_option('--target',
                           help='Target directory.')
  option_parser.add_option('--platform',
                           help='Coverage subdir.')
  option_parser.add_option('--dynamorio-dir',
                           help='Path to dynamorio binary.')
  option_parser.add_option('--test-to-upload',
                           help='Test name.')

  chromium_utils.AddPropertiesOptions(option_parser)
  options, _ = option_parser.parse_args()
  options.build_dir = build_directory.GetBuildOutputDirectory()

  fp = options.factory_properties
  options.browser_shard_index = fp.get('browser_shard_index')
  options.sharded_tests = fp.get('sharded_tests')
  options.host = fp.get('host')
  options.www_dir = fp.get('www-dir')
  del options.factory_properties
  del options.build_properties

  if options.pre_process:
    return PreProcess(options)
  elif options.post_process:
    return CreateCoverageFileAndUpload(options)
  else:
    print 'No valid options provided.'
    return 1
Ejemplo n.º 22
0
def main():
    """Using the target build configuration, run the crash_service.exe
  executable.
  """
    option_parser = optparse.OptionParser(usage=USAGE)

    option_parser.add_option('--target',
                             default='Release',
                             help='build target (Debug or Release)')
    option_parser.add_option('--build-dir', help='ignored')
    options, args = option_parser.parse_args()
    options.build_dir = build_directory.GetBuildOutputDirectory()

    if args:
        option_parser.error('No args are supported')

    build_dir = os.path.abspath(options.build_dir)
    exe_path = os.path.join(build_dir, options.target, 'crash_service.exe')
    if not os.path.exists(exe_path):
        raise chromium_utils.PathNotFound('Unable to find %s' % exe_path)

    # crash_service's window can interfere with interactive ui tests.
    cmd = exe_path + ' --no-window'

    print '\n' + cmd + '\n',

    # We cannot use Popen or os.spawn here because buildbot will wait until
    # the process terminates before going to the next step. Since we want to
    # keep the process alive, we need to explicitly say that we want the
    # process to be detached and that we don't want to inherit handles from
    # the parent process.
    si = win32process.STARTUPINFO()
    details = win32process.CreateProcess(None, cmd, None, None, 0,
                                         win32process.DETACHED_PROCESS, None,
                                         None, si)
    print '\nCreated with process id %d\n' % details[2]
    return 0
Ejemplo n.º 23
0
def main():
  parser = optparse.OptionParser(usage='%prog [options] slavename')

  parser.add_option('--build-dir', help='ignored')
  parser.add_option('--start', action='store_true', help='Start xvfb')
  parser.add_option('--stop', action='store_true', help='Stop xvfb')

  options, args = parser.parse_args()
  options.build_dir = build_directory.GetBuildOutputDirectory()

  if len(args) != 1:
    parser.error('Please specify the slave name')
  slave_name = args[0]

  if (not options.start) and (not options.stop):
    parser.error('Use one of --start OR --stop')

  if options.start:
    xvfb.StartVirtualX(slave_name, options.build_dir)

  if options.stop:
    xvfb.StopVirtualX(slave_name)

  return 0
Ejemplo n.º 24
0
def main_win(options, args, results_collector):
  """Print appropriate size information about built Windows targets.

  Returns the first non-zero exit status of any command it executes,
  or zero on success.
  """
  files = [
    'chrome.dll',
    'chrome.dll.pdb',
    'chrome.exe',
    'chrome_child.dll',
    'chrome_child.dll.pdb',
    'chrome_elf.dll',
    'chrome_watcher.dll',
    'libEGL.dll',
    'libGLESv2.dll',
    'mini_installer.exe',
    'resources.pak',
    'setup.exe',
    'swiftshader\\libEGL.dll',
    'swiftshader\\libGLESv2.dll',
    'WidevineCdm\\_platform_specific\\win_x64\\widevinecdm.dll',
    'WidevineCdm\\_platform_specific\\win_x64\\widevinecdmadapter.dll',
    'WidevineCdm\\_platform_specific\\win_x86\\widevinecdm.dll',
    'WidevineCdm\\_platform_specific\\win_x86\\widevinecdmadapter.dll',
  ]

  build_dir = build_directory.GetBuildOutputDirectory(SRC_DIR)
  target_dir = os.path.join(build_dir, options.target)

  for f in files:
    p = os.path.join(target_dir, f)
    if os.path.isfile(p):
      results_collector.add_result(f, f, get_size(p), 'bytes')

  return 0
Ejemplo n.º 25
0
def Archive(options):
    build_dir = build_directory.GetBuildOutputDirectory(
        options.src_dir, options.cros_board)
    build_dir = os.path.abspath(os.path.join(build_dir, options.target))

    staging_dir = slave_utils.GetStagingDir(options.src_dir)
    chromium_utils.MakeParentDirectoriesWorldReadable(staging_dir)

    if not options.build_revision:
        (build_revision, webkit_revision) = slave_utils.GetBuildRevisions(
            options.src_dir, options.webkit_dir, options.revision_dir)
    else:
        build_revision = options.build_revision
        webkit_revision = options.webkit_revision

    unversioned_base_name, version_suffix = slave_utils.GetZipFileNames(
        options.master_name,
        options.build_number,
        options.parent_build_number,
        build_revision,
        webkit_revision,
        use_try_buildnumber=(not options.append_deps_patch_sha))

    if options.append_deps_patch_sha:
        deps_sha = os.path.join('src', 'DEPS.sha')
        if os.path.exists(deps_sha):
            sha = open(deps_sha).read()
            version_suffix = '%s_%s' % (version_suffix, sha.strip())
            print 'Appending sha of the patch: %s' % sha
        else:
            print 'DEPS.sha file not found, not appending sha.'

    print 'Full Staging in %s' % staging_dir
    print 'Build Directory %s' % build_dir

    # Include the revision file in tarballs
    WriteRevisionFile(build_dir, build_revision)

    # Copy the crt files if necessary.
    if options.target == 'Debug' and chromium_utils.IsWindows():
        CopyDebugCRT(build_dir)

    # Build the list of files to archive.
    root_files = os.listdir(build_dir)

    # Remove initial\chrome.ilk. The filtering is only done on toplevel files,
    # and we can't exclude everything in initial since initial\chrome.dll.pdb is
    # needed in the archive. (And we can't delete it on disk because that would
    # slow down the next incremental build).
    if 'initial' in root_files:
        # Expand 'initial' directory by its contents, so that initial\chrome.ilk
        # will be filtered out by the blacklist.
        index = root_files.index('initial')
        root_files[index:index + 1] = [
            os.path.join('initial', f)
            for f in os.listdir(os.path.join(build_dir, 'initial'))
        ]

    path_filter = PathMatcher(options)
    print path_filter
    print('\nActually excluded: %s' %
          [f for f in root_files if not path_filter.Match(f)])

    zip_file_list = [f for f in root_files if path_filter.Match(f)]

    # TODO(yzshen): Once we have swarming support ready, we could use it to
    # archive run time dependencies of tests and remove this step.
    mojom_files = _MojomFiles(build_dir, ['.mojom.js', '_mojom.py'])
    print 'Include mojom files: %s' % mojom_files
    zip_file_list.extend(mojom_files)

    zip_file = MakeUnversionedArchive(build_dir, staging_dir, zip_file_list,
                                      unversioned_base_name)

    zip_base, zip_ext, versioned_file = MakeVersionedArchive(
        zip_file, version_suffix, options)

    prune_limit = 10
    if options.build_url.startswith('gs://'):
        # Don't keep builds lying around when uploading them to google storage.
        prune_limit = 3
    PruneOldArchives(staging_dir, zip_base, zip_ext, prune_limit=prune_limit)

    # Update the latest revision file in the staging directory
    # to allow testers to figure out the latest packaged revision
    # without downloading tarballs.
    revision_file = WriteRevisionFile(staging_dir, build_revision)

    urls = {}
    if options.build_url.startswith('gs://'):
        zip_url = UploadToGoogleStorage(versioned_file, revision_file,
                                        options.build_url, options.gs_acl)

        storage_url = ('https://storage.googleapis.com/%s/%s' %
                       (options.build_url[len('gs://'):],
                        os.path.basename(versioned_file)))
        urls['storage_url'] = storage_url
    else:
        staging_path = (os.path.splitdrive(versioned_file)[1].replace(
            os.path.sep, '/'))
        zip_url = 'http://' + options.slave_name + staging_path

    urls['zip_url'] = zip_url

    return urls
Ejemplo n.º 26
0
def main_mac(options, args, results_collector):
  """Print appropriate size information about built Mac targets.

  Returns the first non-zero exit status of any command it executes,
  or zero on success.
  """
  build_dir = build_directory.GetBuildOutputDirectory(SRC_DIR)
  target_dir = os.path.join(build_dir, options.target)

  """Set DEVELOPER_DIR to the hermetic Xcode.app so 'size' will work."""
  if not 'DEVELOPER_DIR' in os.environ:
    xcode_path = os.path.join(SRC_DIR, 'build', 'mac_files', 'Xcode.app');
    if os.path.exists(xcode_path):
      os.environ['DEVELOPER_DIR'] = xcode_path

  result = 0
  # Work with either build type.
  base_names = ('Chromium', 'Google Chrome')
  for base_name in base_names:
    app_bundle = base_name + '.app'
    framework_name = base_name + ' Framework'
    framework_bundle = framework_name + '.framework'
    framework_dsym_bundle = framework_name + '.dSYM'
    framework_unstripped_name = framework_name + '.unstripped'

    chromium_app_dir = os.path.join(target_dir, app_bundle)
    chromium_executable = os.path.join(chromium_app_dir,
                                       'Contents', 'MacOS', base_name)

    chromium_framework_dir = os.path.join(target_dir, framework_bundle)
    chromium_framework_executable = os.path.join(chromium_framework_dir,
                                                 framework_name)

    chromium_framework_dsym_dir = os.path.join(target_dir,
                                               framework_dsym_bundle)
    chromium_framework_dsym = os.path.join(chromium_framework_dsym_dir,
                                           'Contents', 'Resources', 'DWARF',
                                           framework_name)
    chromium_framework_unstripped = os.path.join(target_dir,
                                                 framework_unstripped_name)
    if os.path.exists(chromium_executable):
      print_dict = {
        # Remove spaces in the names so any downstream processing is less
        # likely to choke.
        'app_name'         : re.sub(r'\s', '', base_name),
        'app_bundle'       : re.sub(r'\s', '', app_bundle),
        'framework_name'   : re.sub(r'\s', '', framework_name),
        'framework_bundle' : re.sub(r'\s', '', framework_bundle),
        'app_size'         : get_size(chromium_executable),
        'framework_size'   : get_size(chromium_framework_executable),
        'framework_dsym_name' : re.sub(r'\s', '', framework_name) + 'Dsym',
        'framework_dsym_size' : get_size(chromium_framework_dsym),
      }

      # Collect the segment info out of the App
      result, stdout = run_process(result, ['size', chromium_executable])
      print_dict['app_text'], print_dict['app_data'], print_dict['app_objc'] = \
          re.search(r'(\d+)\s+(\d+)\s+(\d+)', stdout).groups()

      # Collect the segment info out of the Framework
      result, stdout = run_process(result, ['size',
                                            chromium_framework_executable])
      print_dict['framework_text'], print_dict['framework_data'], \
        print_dict['framework_objc'] = \
          re.search(r'(\d+)\s+(\d+)\s+(\d+)', stdout).groups()

      # Collect the whole size of the App bundle on disk (include the framework)
      result, stdout = run_process(result, ['du', '-s', '-k', chromium_app_dir])
      du_s = re.search(r'(\d+)', stdout).group(1)
      print_dict['app_bundle_size'] = (int(du_s) * 1024)

      results_collector.add_result(
          print_dict['app_name'], print_dict['app_name'],
          print_dict['app_size'], 'bytes')
      results_collector.add_result(
          '%s-__TEXT' % print_dict['app_name'], '__TEXT',
          print_dict['app_text'], 'bytes')
      results_collector.add_result(
          '%s-__DATA' % print_dict['app_name'], '__DATA',
          print_dict['app_data'], 'bytes')
      results_collector.add_result(
          '%s-__OBJC' % print_dict['app_name'], '__OBJC',
          print_dict['app_objc'], 'bytes')
      results_collector.add_result(
          print_dict['framework_name'], print_dict['framework_name'],
          print_dict['framework_size'], 'bytes')
      results_collector.add_result(
          '%s-__TEXT' % print_dict['framework_name'], '__TEXT',
          print_dict['framework_text'], 'bytes')
      results_collector.add_result(
          '%s-__DATA' % print_dict['framework_name'], '__DATA',
          print_dict['framework_data'], 'bytes')
      results_collector.add_result(
          '%s-__OBJC' % print_dict['framework_name'], '__OBJC',
          print_dict['framework_objc'], 'bytes')
      results_collector.add_result(
          print_dict['app_bundle'], print_dict['app_bundle'],
          print_dict['app_bundle_size'], 'bytes')
      results_collector.add_result(
          print_dict['framework_dsym_name'], print_dict['framework_dsym_name'],
          print_dict['framework_dsym_size'], 'bytes')

      # Found a match, don't check the other base_names.
      return result
  # If no base_names matched, fail script.
  return 66
Ejemplo n.º 27
0
def main():
    """Entry point for runtest.py.

  This function:
    (1) Sets up the command-line options.
    (2) Sets environment variables based on those options.
    (3) Delegates to the platform-specific main functions.

  Returns:
    Exit code for this script.
  """
    option_parser = optparse.OptionParser(usage=USAGE)

    # Since the trailing program to run may have has command-line args of its
    # own, we need to stop parsing when we reach the first positional argument.
    option_parser.disable_interspersed_args()

    option_parser.add_option('--target',
                             default='Release',
                             help='build target (Debug or Release)')
    option_parser.add_option('--pass-target',
                             action='store_true',
                             default=False,
                             help='pass --target to the spawned test script')
    option_parser.add_option('--build-dir', help='ignored')
    option_parser.add_option(
        '--pass-build-dir',
        action='store_true',
        default=False,
        help='pass --build-dir to the spawned test script')
    option_parser.add_option('--test-platform',
                             help='Platform to test on, e.g. ios-simulator')
    option_parser.add_option('--total-shards',
                             dest='total_shards',
                             default=None,
                             type='int',
                             help='Number of shards to split this test into.')
    option_parser.add_option('--shard-index',
                             dest='shard_index',
                             default=None,
                             type='int',
                             help='Shard to run. Must be between 1 and '
                             'total-shards.')
    option_parser.add_option('--run-shell-script',
                             action='store_true',
                             default=False,
                             help='treat first argument as the shell script'
                             'to run.')
    option_parser.add_option('--run-python-script',
                             action='store_true',
                             default=False,
                             help='treat first argument as a python script'
                             'to run.')
    option_parser.add_option('--generate-json-file',
                             action='store_true',
                             default=False,
                             help='output JSON results file if specified.')
    option_parser.add_option('--xvfb',
                             action='store_true',
                             dest='xvfb',
                             default=True,
                             help='Start virtual X server on Linux.')
    option_parser.add_option('--no-xvfb',
                             action='store_false',
                             dest='xvfb',
                             help='Do not start virtual X server on Linux.')
    option_parser.add_option('-o',
                             '--results-directory',
                             default='',
                             help='output results directory for JSON file.')
    option_parser.add_option('--chartjson-file',
                             default='',
                             help='File to dump chartjson results.')
    option_parser.add_option('--log-processor-output-file',
                             default='',
                             help='File to dump gtest log processor results.')
    option_parser.add_option(
        '--builder-name',
        default=None,
        help='The name of the builder running this script.')
    option_parser.add_option('--slave-name',
                             default=None,
                             help='The name of the slave running this script.')
    option_parser.add_option(
        '--master-class-name',
        default=None,
        help='The class name of the buildbot master running '
        'this script: examples include "Chromium", '
        '"ChromiumWebkit", and "ChromiumGPU". The '
        'flakiness dashboard uses this value to '
        'categorize results. See buildershandler.py '
        'in the flakiness dashboard code '
        '(use codesearch) for the known values. '
        'Defaults to fetching it from '
        'slaves.cfg/builders.pyl.')
    option_parser.add_option('--build-number',
                             default=None,
                             help=('The build number of the builder running'
                                   'this script.'))
    option_parser.add_option(
        '--step-name',
        default=None,
        help=('The name of the step running this script.'))
    option_parser.add_option('--test-type',
                             default='',
                             help='The test name that identifies the test, '
                             'e.g. \'unit-tests\'')
    option_parser.add_option('--test-results-server',
                             default='',
                             help='The test results server to upload the '
                             'results.')
    option_parser.add_option('--annotate',
                             default='',
                             help='Annotate output when run as a buildstep. '
                             'Specify which type of test to parse, available'
                             ' types listed with --annotate=list.')
    option_parser.add_option('--parse-input',
                             default='',
                             help='When combined with --annotate, reads test '
                             'from a file instead of executing a test '
                             'binary. Use - for stdin.')
    option_parser.add_option('--parse-result',
                             default=0,
                             help='Sets the return value of the simulated '
                             'executable under test. Only has meaning when '
                             '--parse-input is used.')
    option_parser.add_option('--results-url',
                             default='',
                             help='The URI of the perf dashboard to upload '
                             'results to.')
    option_parser.add_option(
        '--perf-dashboard-id',
        default='',
        help='The ID on the perf dashboard to add results '
        'to.')
    option_parser.add_option('--perf-id',
                             default='',
                             help='The perf builder id')
    option_parser.add_option(
        '--perf-config',
        default='',
        help='Perf configuration dictionary (as a string). '
        'This allows to specify custom revisions to be '
        'the main revision at the Perf dashboard. '
        'Example: --perf-config="{\'a_default_rev\': '
        '\'r_webrtc_rev\'}"')
    option_parser.add_option('--supplemental-columns-file',
                             default='supplemental_columns',
                             help='A file containing a JSON blob with a dict '
                             'that will be uploaded to the results '
                             'dashboard as supplemental columns.')
    option_parser.add_option(
        '--revision',
        help='The revision number which will be is used as '
        'primary key by the dashboard. If omitted it '
        'is automatically extracted from the checkout.')
    option_parser.add_option('--webkit-revision', help='See --revision.')
    option_parser.add_option('--enable-asan',
                             action='store_true',
                             default=False,
                             help='Enable fast memory error detection '
                             '(AddressSanitizer).')
    option_parser.add_option(
        '--enable-lsan',
        action='store_true',
        default=False,
        help='Enable memory leak detection (LeakSanitizer).')
    option_parser.add_option(
        '--enable-msan',
        action='store_true',
        default=False,
        help='Enable uninitialized memory reads detection '
        '(MemorySanitizer).')
    option_parser.add_option('--enable-tsan',
                             action='store_true',
                             default=False,
                             help='Enable data race detection '
                             '(ThreadSanitizer).')
    option_parser.add_option(
        '--strip-path-prefix',
        default='build/src/out/Release/../../',
        help='Source paths in stack traces will be stripped '
        'of prefixes ending with this substring. This '
        'option is used by sanitizer tools.')
    option_parser.add_option('--no-spawn-dbus',
                             action='store_true',
                             default=False,
                             help='Disable GLib DBus bug workaround: '
                             'manually spawning dbus-launch')
    option_parser.add_option(
        '--test-launcher-summary-output',
        help='Path to test results file with all the info '
        'from the test launcher')
    option_parser.add_option(
        '--flakiness-dashboard-server',
        help='The flakiness dashboard server to which the '
        'results should be uploaded.')
    option_parser.add_option('--verbose',
                             action='store_true',
                             default=False,
                             help='Prints more information.')

    chromium_utils.AddPropertiesOptions(option_parser)
    options, args = option_parser.parse_args()

    # Initialize logging.
    log_level = logging.INFO
    if options.verbose:
        log_level = logging.DEBUG
    logging.basicConfig(level=log_level,
                        format='%(asctime)s %(filename)s:%(lineno)-3d'
                        ' %(levelname)s %(message)s',
                        datefmt='%y%m%d %H:%M:%S')
    logging.basicConfig(level=logging.DEBUG)
    logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout))

    options.test_type = options.test_type or options.factory_properties.get(
        'step_name', '')

    if options.run_shell_script and options.run_python_script:
        sys.stderr.write(
            'Use either --run-shell-script OR --run-python-script, '
            'not both.')
        return 1

    print '[Running on builder: "%s"]' % options.builder_name

    did_launch_dbus = False
    if not options.no_spawn_dbus:
        did_launch_dbus = _LaunchDBus()

    try:
        options.build_dir = build_directory.GetBuildOutputDirectory()

        if options.pass_target and options.target:
            args.extend(['--target', options.target])
        if options.pass_build_dir:
            args.extend(['--build-dir', options.build_dir])

        # We will use this to accumulate overrides for the command under test,
        # That we may not need or want for other support commands.
        extra_env = {}

        # This option is used by sanitizer code. There is no corresponding command
        # line flag.
        options.use_symbolization_script = False
        # Set up extra environment and args for sanitizer tools.
        _ConfigureSanitizerTools(options, args, extra_env)

        # Set the number of shards environment variables.
        # NOTE: Chromium's test launcher will ignore these in favor of the command
        # line flags passed in _BuildTestBinaryCommand.
        if options.total_shards and options.shard_index:
            extra_env['GTEST_TOTAL_SHARDS'] = str(options.total_shards)
            extra_env['GTEST_SHARD_INDEX'] = str(options.shard_index - 1)

        return _Main(options, args, extra_env)
    finally:
        if did_launch_dbus:
            # It looks like the command line argument --exit-with-session
            # isn't working to clean up the spawned dbus-daemon. Kill it
            # manually.
            _ShutdownDBus()
Ejemplo n.º 28
0
    def __init__(self, options, build_revision):
        """Sets a number of file and directory paths for convenient use."""

        self.options = options
        self._src_dir = os.path.abspath(options.src_dir)
        self._chrome_dir = os.path.join(self._src_dir, 'chrome')
        # TODO: This scode should not be grabbing so deeply into WebKit.
        #       Worse, this code ends up looking at top-of-tree WebKit
        #       instead of the revision in DEPS.
        self._webkit_dir = os.path.join(self._src_dir, 'third_party', 'WebKit',
                                        'Source')
        self._v8_dir = os.path.join(self._src_dir, 'v8')

        build_dir = build_directory.GetBuildOutputDirectory()
        self._build_dir = os.path.join(build_dir, options.target)
        if chromium_utils.IsWindows():
            self._tool_dir = os.path.join(self._chrome_dir, 'tools', 'build',
                                          'win')
        elif chromium_utils.IsLinux():
            # On Linux, we might have built for chromeos.  Archive the same.
            if (options.factory_properties.get('chromeos', None)
                    or slave_utils.GypFlagIsOn(options, 'chromeos')):
                self._tool_dir = os.path.join(self._chrome_dir, 'tools',
                                              'build', 'chromeos')
            # Or, we might have built for Android.
            elif options.factory_properties.get('target_os') == 'android':
                self._tool_dir = os.path.join(self._chrome_dir, 'tools',
                                              'build', 'android')
            else:
                self._tool_dir = os.path.join(self._chrome_dir, 'tools',
                                              'build', 'linux')
        elif chromium_utils.IsMac():
            self._tool_dir = os.path.join(self._chrome_dir, 'tools', 'build',
                                          'mac')
        else:
            raise NotImplementedError(
                'Platform "%s" is not currently supported.' % sys.platform)
        self._staging_dir = slave_utils.GetStagingDir(self._src_dir)

        self._symbol_dir_base = options.dirs['symbol_dir_base']
        self._www_dir_base = options.dirs['www_dir_base']

        if options.build_name:
            self._build_name = options.build_name
        else:
            self._build_name = slave_utils.SlaveBuildName(self._src_dir)

        self._symbol_dir_base = os.path.join(self._symbol_dir_base,
                                             self._build_name)
        self._www_dir_base = os.path.join(self._www_dir_base, self._build_name)

        self._version_file = os.path.join(self._chrome_dir, 'VERSION')

        if options.default_chromium_revision:
            self._chromium_revision = options.default_chromium_revision
        else:
            self._chromium_revision = slave_utils.GetHashOrRevision(
                os.path.dirname(
                    self._chrome_dir))  # src/ instead of src/chrome
        if options.default_webkit_revision:
            self._webkit_revision = options.default_webkit_revision
        else:
            self._webkit_revision = slave_utils.GetHashOrRevision(
                os.path.dirname(
                    self._webkit_dir))  # WebKit/ instead of WebKit/Source
        if options.default_v8_revision:
            self._v8_revision = options.default_v8_revision
        else:
            self._v8_revision = slave_utils.GetHashOrRevision(self._v8_dir)
        self.last_change_file = os.path.join(self._staging_dir, 'LAST_CHANGE')
        # The REVISIONS file will record the revisions information of the main
        # components Chromium/WebKit/V8.
        self.revisions_path = os.path.join(self._staging_dir, 'REVISIONS')
        self._build_revision = build_revision
        # Will be initialized in GetLastBuildRevision.
        self.last_chromium_revision = None
        self.last_webkit_revision = None
        self.last_v8_revision = None

        self._files_file = os.path.join(self._tool_dir,
                                        archive_utils.FILES_FILENAME)
        self._test_files = self.BuildOldFilesList(TEST_FILE_NAME)

        self._dual_upload = options.factory_properties.get(
            'dual_upload', False)
        self._archive_files = None
    def __init__(self, options, build_revision):
        """Sets a number of file and directory paths for convenient use."""

        self.options = options
        self._src_dir = os.path.abspath(options.src_dir)
        self._chrome_dir = os.path.join(self._src_dir, 'chrome')

        build_dir = build_directory.GetBuildOutputDirectory()
        self._build_dir = os.path.join(build_dir, options.target)
        if chromium_utils.IsWindows():
            self._tool_dir = os.path.join(self._chrome_dir, 'tools', 'build',
                                          'win')
        elif chromium_utils.IsLinux():
            # On Linux, we might have built for chromeos.  Archive the same.
            if (options.factory_properties.get('chromeos', None)
                    or slave_utils.GypFlagIsOn(options, 'chromeos')):
                self._tool_dir = os.path.join(self._chrome_dir, 'tools',
                                              'build', 'chromeos')
            # Or, we might have built for Android.
            elif options.factory_properties.get('target_os') == 'android':
                self._tool_dir = os.path.join(self._chrome_dir, 'tools',
                                              'build', 'android')
            else:
                self._tool_dir = os.path.join(self._chrome_dir, 'tools',
                                              'build', 'linux')
        elif chromium_utils.IsMac():
            self._tool_dir = os.path.join(self._chrome_dir, 'tools', 'build',
                                          'mac')
        else:
            raise NotImplementedError(
                'Platform "%s" is not currently supported.' % sys.platform)
        self._staging_dir = (options.staging_dir
                             or slave_utils.GetStagingDir(self._src_dir))
        if not os.path.exists(self._staging_dir):
            os.makedirs(self._staging_dir)

        self._symbol_dir_base = options.dirs['symbol_dir_base']
        self._www_dir_base = options.dirs['www_dir_base']

        if options.build_name:
            self._build_name = options.build_name
        else:
            self._build_name = slave_utils.SlaveBuildName(self._src_dir)

        self._symbol_dir_base = os.path.join(self._symbol_dir_base,
                                             self._build_name)
        self._www_dir_base = os.path.join(self._www_dir_base, self._build_name)

        self._version_file = os.path.join(self._chrome_dir, 'VERSION')

        self._chromium_revision = chromium_utils.GetBuildSortKey(options)[1]

        self._v8_revision = chromium_utils.GetBuildSortKey(options,
                                                           project='v8')[1]
        self._v8_revision_git = chromium_utils.GetGitCommit(options,
                                                            project='v8')

        self.last_change_file = os.path.join(self._staging_dir, 'LAST_CHANGE')
        # The REVISIONS file will record the revisions information of the main
        # components Chromium/WebKit/V8.
        self.revisions_path = os.path.join(self._staging_dir, 'REVISIONS')
        self._build_revision = build_revision
        self._build_path_component = str(self._build_revision)

        # Will be initialized in GetLastBuildRevision.
        self.last_chromium_revision = None
        self.last_v8_revision = None

        self._files_file = os.path.join(self._tool_dir,
                                        archive_utils.FILES_FILENAME)
        self._test_files = self.BuildOldFilesList(TEST_FILE_NAME)

        self._dual_upload = options.factory_properties.get(
            'dual_upload', False)
        self._archive_files = None
Ejemplo n.º 30
0
def main_mac(options, args, results_collector):
  """Print appropriate size information about built Mac targets.

  Returns the first non-zero exit status of any command it executes,
  or zero on success.
  """
  build_dir = build_directory.GetBuildOutputDirectory(SRC_DIR)
  target_dir = os.path.join(build_dir, options.target)

  result = 0
  # Work with either build type.
  base_names = ('Chromium', 'Google Chrome')
  for base_name in base_names:
    app_bundle = base_name + '.app'
    framework_name = base_name + ' Framework'
    framework_bundle = framework_name + '.framework'
    framework_dsym_bundle = framework_bundle + '.dSYM'
    framework_unstripped_name = framework_name + '.unstripped'

    chromium_app_dir = os.path.join(target_dir, app_bundle)
    chromium_executable = os.path.join(chromium_app_dir,
                                       'Contents', 'MacOS', base_name)

    chromium_framework_dir = os.path.join(target_dir, framework_bundle)
    chromium_framework_executable = os.path.join(chromium_framework_dir,
                                                 framework_name)

    chromium_framework_dsym_dir = os.path.join(target_dir,
                                               framework_dsym_bundle)
    chromium_framework_dsym = os.path.join(chromium_framework_dsym_dir,
                                           'Contents', 'Resources', 'DWARF',
                                           framework_name)
    chromium_framework_unstripped = os.path.join(target_dir,
                                                 framework_unstripped_name)
    if os.path.exists(chromium_executable):
      print_dict = {
        # Remove spaces in the names so any downstream processing is less
        # likely to choke.
        'app_name'         : re.sub(r'\s', '', base_name),
        'app_bundle'       : re.sub(r'\s', '', app_bundle),
        'framework_name'   : re.sub(r'\s', '', framework_name),
        'framework_bundle' : re.sub(r'\s', '', framework_bundle),
        'app_size'         : get_size(chromium_executable),
        'framework_size'   : get_size(chromium_framework_executable)
      }

      # Collect the segment info out of the App
      result, stdout = run_process(result, ['size', chromium_executable])
      print_dict['app_text'], print_dict['app_data'], print_dict['app_objc'] = \
          re.search(r'(\d+)\s+(\d+)\s+(\d+)', stdout).groups()

      # Collect the segment info out of the Framework
      result, stdout = run_process(result, ['size',
                                            chromium_framework_executable])
      print_dict['framework_text'], print_dict['framework_data'], \
        print_dict['framework_objc'] = \
          re.search(r'(\d+)\s+(\d+)\s+(\d+)', stdout).groups()

      # Collect the whole size of the App bundle on disk (include the framework)
      result, stdout = run_process(result, ['du', '-s', '-k', chromium_app_dir])
      du_s = re.search(r'(\d+)', stdout).group(1)
      print_dict['app_bundle_size'] = (int(du_s) * 1024)

      # Count the number of files with at least one static initializer.
      pipes = [['otool', '-l', chromium_framework_executable],
               ['grep', '__mod_init_func', '-C', '5'],
               ['grep', 'size']]
      last_stdout = None
      for pipe in pipes:
        p = subprocess.Popen(pipe, stdin=last_stdout, stdout=subprocess.PIPE)
        last_stdout = p.stdout
      stdout = p.communicate()[0]
      initializers = re.search('0x([0-9a-f]+)', stdout)
      if initializers:
        initializers_s = initializers.group(1)
        if result == 0:
          result = p.returncode
      else:
        initializers_s = '0'
      word_size = 4  # Assume 32 bit
      si_count = int(initializers_s, 16) / word_size
      print_dict['initializers'] = si_count

      # For Release builds only, use dump-static-initializers.py to print the
      # list of static initializers.
      if si_count > 0 and options.target == 'Release':
        print '\n# Static initializers in %s:' % chromium_framework_executable

        # First look for a dSYM to get information about the initializers. If
        # one is not present, check if there is an unstripped copy of the build
        # output.
        mac_tools_path = os.path.join(os.path.dirname(build_dir),
                                      'tools', 'mac')
        if os.path.exists(chromium_framework_dsym):
          dump_static_initializers = os.path.join(
              mac_tools_path, 'dump-static-initializers.py')
          result, stdout = run_process(result, [dump_static_initializers,
                                                chromium_framework_dsym])
          print_si_fail_hint('tools/mac/dump-static-initializers.py')
          print stdout
        else:
          show_mod_init_func = os.path.join(
              mac_tools_path, 'show_mod_init_func.py')
          args = [show_mod_init_func]
          if os.path.exists(chromium_framework_unstripped):
            args.append(chromium_framework_unstripped)
          else:
            print '# Warning: Falling back to potentially stripped output.'
            args.append(chromium_framework_executable)
          result, stdout = run_process(result, args)
          print_si_fail_hint('tools/mac/show_mod_init_func.py')
          print stdout


      results_collector.add_result(
          print_dict['app_name'], print_dict['app_name'],
          print_dict['app_size'], 'bytes')
      results_collector.add_result(
          '%s-__TEXT' % print_dict['app_name'], '__TEXT',
          print_dict['app_text'], 'bytes')
      results_collector.add_result(
          '%s-__DATA' % print_dict['app_name'], '__DATA',
          print_dict['app_data'], 'bytes')
      results_collector.add_result(
          '%s-__OBJC' % print_dict['app_name'], '__OBJC',
          print_dict['app_objc'], 'bytes')
      results_collector.add_result(
          print_dict['framework_name'], print_dict['framework_name'],
          print_dict['framework_size'], 'bytes')
      results_collector.add_result(
          '%s-__TEXT' % print_dict['framework_name'], '__TEXT',
          print_dict['framework_text'], 'bytes')
      results_collector.add_result(
          '%s-__DATA' % print_dict['framework_name'], '__DATA',
          print_dict['framework_data'], 'bytes')
      results_collector.add_result(
          '%s-__OBJC' % print_dict['framework_name'], '__OBJC',
          print_dict['framework_objc'], 'bytes')
      results_collector.add_result(
          print_dict['app_bundle'], print_dict['app_bundle'],
          print_dict['app_bundle_size'], 'bytes')
      results_collector.add_result(
          'chrome-si', 'initializers',
          print_dict['initializers'], 'files')

      # Found a match, don't check the other base_names.
      return result
  # If no base_names matched, fail script.
  return 66