Ejemplo n.º 1
0
def run_benchmark(options, use_refbuild, benchmark_results):
    result = 0

    build_dir = os.path.abspath(options.build_dir)
    if not use_refbuild:
        if chromium_utils.IsMac():
            build_dir = os.path.join(os.path.dirname(build_dir), 'xcodebuild')
        elif chromium_utils.IsLinux():
            build_dir = os.path.join(os.path.dirname(build_dir), 'sconsbuild')
        build_dir = os.path.join(build_dir, options.target)
    else:
        build_dir = os.path.join(os.path.dirname(build_dir), 'chrome', 'tools',
                                 'test', 'reference_build')
        if chromium_utils.IsMac():
            build_dir = os.path.join(build_dir, 'chrome_mac')
        elif chromium_utils.IsLinux():
            build_dir = os.path.join(build_dir, 'chrome_linux')
        else:
            build_dir = os.path.join(build_dir, 'chrome_win')

    if chromium_utils.IsWindows():
        chrome_exe_name = 'chrome.exe'
    elif chromium_utils.IsLinux():
        chrome_exe_name = 'chrome'
    else:
        chrome_exe_name = 'Chromium'
    chrome_exe_path = os.path.join(build_dir, chrome_exe_name)
    if not os.path.exists(chrome_exe_path):
        raise chromium_utils.PathNotFound('Unable to find %s' %
                                          chrome_exe_path)

    temp_dir = tempfile.mkdtemp()
    command = [
        chrome_exe_path,
        '--user-data-dir=%s' % temp_dir, '--no-first-run',
        '--no-default-browser-check', START_URL
    ]

    print "Executing: "
    print command
    browser_process = subprocess.Popen(command)

    benchmark_results['ready'].wait()
    if benchmark_results['ready'].isSet():
        results = json.loads(benchmark_results['results'])[0]
        print_result(True, 'Total', results['score'], use_refbuild)
        for child in results['children']:
            print_result(False, child['name'], child['score'], use_refbuild)
    benchmark_results['ready'].clear()

    if chromium_utils.IsWindows():
        subprocess.call('taskkill /f /pid %i /t' % browser_process.pid)
    else:
        os.system('kill -15 %i' % browser_process.pid)
    browser_process.wait()
    shutil.rmtree(temp_dir)
    return result
Ejemplo n.º 2
0
def RemoveChromeTemporaryFiles():
  """A large hammer to nuke what could be leaked files from unittests or
  files left from a unittest that crashed, was killed, etc."""
  # NOTE: print out what is cleaned up so the bots don't timeout if
  # there is a lot to cleanup and also se we see the leaks in the
  # build logs.
  # At some point a leading dot got added, support with and without it.
  kLogRegex = '^\.?(com\.google\.Chrome|org\.chromium)\.'
  if chromium_utils.IsWindows():
    kLogRegex = r'^(base_dir|scoped_dir|nps|chrome_test|SafeBrowseringTest)'
    LogAndRemoveFiles(tempfile.gettempdir(), kLogRegex)
    # Dump and temporary files.
    LogAndRemoveFiles(tempfile.gettempdir(), r'^.+\.(dmp|tmp)$')
    LogAndRemoveFiles(tempfile.gettempdir(), r'^_CL_.*$')
    RemoveChromeDesktopFiles()
    RemoveJumpListFiles()
  elif chromium_utils.IsLinux():
    kLogRegexHeapcheck = '\.(sym|heap)$'
    LogAndRemoveFiles(tempfile.gettempdir(), kLogRegex)
    LogAndRemoveFiles(tempfile.gettempdir(), kLogRegexHeapcheck)
    LogAndRemoveFiles('/dev/shm', kLogRegex)
  elif chromium_utils.IsMac():
    nstempdir_path = '/usr/local/libexec/nstempdir'
    if os.path.exists(nstempdir_path):
      ns_temp_dir = chromium_utils.GetCommandOutput([nstempdir_path]).strip()
      if ns_temp_dir:
        LogAndRemoveFiles(ns_temp_dir, kLogRegex)
    for i in ('Chromium', 'Google Chrome'):
      # Remove dumps.
      crash_path = '%s/Library/Application Support/%s/Crash Reports' % (
          os.environ['HOME'], i)
      LogAndRemoveFiles(crash_path, r'^.+\.dmp$')
  else:
    raise NotImplementedError(
        'Platform "%s" is not currently supported.' % sys.platform)
Ejemplo n.º 3
0
def BuildChangeResolution(sourcedir):
    """Build ChangeResolution tool used by tests.

  Note: This function will change the current directory.
  Exits program with return code 1 on failure.

  Args:
    sourcedir: path to source code for O3D.
  """
    build_dir = os.path.join(sourcedir, 'o3d', 'tests', 'lab',
                             'ChangeResolution')
    print 'Build dir:"%s"' % build_dir
    os.chdir(build_dir)

    if utils.IsWindows():
        env = dict(os.environ)
        our_process = subprocess.Popen(['build.bat'],
                                       stdout=subprocess.PIPE,
                                       stderr=subprocess.STDOUT,
                                       env=env,
                                       universal_newlines=True)

        # Read output so that process isn't blocked with a filled buffer.
        output = our_process.stdout.readlines()
        for line in output:
            print line

        our_process.wait()
        return_code = our_process.returncode

        if return_code != 0:
            print 'ChangeResolution failed to build.'
            print 'Exiting...'
            sys.exit(1)
Ejemplo n.º 4
0
    def _doApplyIssue(self, _):
        """Run the apply_issue.py script in the source checkout directory."""
        log.msg('ApplyIssue._doApplyIssue')
        cmd = [
            'apply_issue.bat' if chromium_utils.IsWindows() else 'apply_issue',
            '-r',
            self.root,
            '-i',
            self.issue,
            '-p',
            self.patchset,
            '-e',
            self.email,
            '-w',
            '-',
        ]

        if self.server:
            cmd.extend(['-s', self.server])

        command = runprocesscmd(self.builder,
                                cmd,
                                os.path.join(self.builder.basedir,
                                             self.workdir),
                                timeout=self.timeout,
                                initialStdin=self.password)
        return command.start()
Ejemplo n.º 5
0
def GSUtilSetup():
    # Get the path to the gsutil script.
    if _ARGS_GSUTIL_PY_PATH:
        # The `gsutil.py` path was supplied on the command-line. Run this through
        # our local Python interpreter.
        gsutil = [sys.executable, _ARGS_GSUTIL_PY_PATH, '--']
    else:
        # Fall back to local repository 'gsutil' invocation. NOTE that this requires
        # the standard infra checkout layout, namely that 'depot_tools' is checked
        # out one directory above 'build'.
        gsutil = os.path.join(os.path.dirname(__file__), 'gsutil')
        gsutil = os.path.normpath(gsutil)
        if chromium_utils.IsWindows():
            gsutil += '.bat'
        gsutil = [gsutil]

    # Get the path to the boto file containing the password.
    boto_file = os.path.join(os.path.dirname(__file__), '..', '..',
                             'site_config', '.boto')

    # Make sure gsutil uses this boto file if it exists.
    if os.path.exists(boto_file):
        os.environ['AWS_CREDENTIAL_FILE'] = boto_file
        os.environ['BOTO_CONFIG'] = boto_file
    return gsutil
Ejemplo n.º 6
0
def FileRegexBlacklist(options):
    extensions = None
    if chromium_utils.IsWindows():
        extensions = [
            'res', 'lib', 'exp', 'ilk', '7z', r'([pP]recompile\.h\.pch.*)'
        ]
    elif chromium_utils.IsMac():
        # The static libs are just built as intermediate targets, and we don't
        # need to pull the dSYMs over to the testers most of the time (except for
        # the memory tools).
        if options.package_dsym_files:
            extensions = ['a']
        else:
            extensions = ['a', 'dSYM']
    elif chromium_utils.IsLinux():
        # object files, archives, and gcc (make build) dependency info.
        extensions = ['o', 'a', 'd']
    else:
        return '$NO_FILTER^'

    # No need for the .ninja files generated by "gn gen".
    extensions.append('ninja')
    extensions_pattern = r'.+\.({})'.format('|'.join(extensions))
    # Primary toolchain is excluded by "exclusions" rather than regex.
    secondary_toolchain_pattern = r'\w+{}(obj|gen)'.format(
        re.escape(os.path.sep))
    return '^({}|{})$'.format(extensions_pattern, secondary_toolchain_pattern)
Ejemplo n.º 7
0
      def determine_goma_jobs():
        # We would like to speed up build on Windows a bit, since it is slowest.
        number_of_processors = 0
        try:
          number_of_processors = multiprocessing.cpu_count()
        except NotImplementedError:
          print 'cpu_count() is not implemented, using default value 50.'
          return 50

        assert number_of_processors > 0

        # When goma is used, 10 * number_of_processors is basically good in
        # various situations according to our measurement. Build speed won't
        # be improved if -j is larger than that.
        #
        # Since Mac had process number limitation before, we had to set
        # the upper limit to 50. Now that the process number limitation is 2000,
        # so we would be able to use 10 * number_of_processors.
        # For the safety, we'd like to set the upper limit to 200.
        #
        # Note that currently most try-bot build slaves have 8 processors.
        if chromium_utils.IsMac() or chromium_utils.IsWindows():
          return min(10 * number_of_processors, 200)

        # For Linux, we also would like to use 10 * cpu. However, not sure
        # backend resource is enough, so let me set Linux and Linux x64 builder
        # only for now.
        # Also increasing cpus for v8/blink trybots.
        hostname = goma_utils.GetShortHostname()
        if hostname in (
            ['build14-m1', 'build48-m1'] +
            ['build%d-m4' % x for x in xrange(45, 48)]):
          return min(10 * number_of_processors, 200)

        return 50
Ejemplo n.º 8
0
def FileRegexBlacklist(options):
    if chromium_utils.IsWindows():
        # Remove all .ilk/.7z and maybe PDB files
        # TODO(phajdan.jr): Remove package_pdb_files when nobody uses it.
        include_pdbs = options.factory_properties.get('package_pdb_files',
                                                      True)
        if include_pdbs:
            return r'^.+\.(rc|res|lib|exp|ilk|7z|([pP]recompile\.h\.pch.*))$'
        else:
            return r'^.+\.(rc|res|lib|exp|ilk|pdb|7z|([pP]recompile\.h\.pch.*))$'
    if chromium_utils.IsMac():
        # The static libs are just built as intermediate targets, and we don't
        # need to pull the dSYMs over to the testers most of the time (except for
        # the memory tools).
        include_dsyms = options.factory_properties.get('package_dsym_files',
                                                       False)
        if include_dsyms:
            return r'^.+\.(a)$'
        else:
            return r'^.+\.(a|dSYM)$'
    if chromium_utils.IsLinux():
        # object files, archives, and gcc (make build) dependency info.
        return r'^.+\.(o|a|d)$'

    return '$NO_FILTER^'
Ejemplo n.º 9
0
def MakeVersionedArchive(zip_file, file_suffix, options):
    """Takes a file name, e.g. /foo/bar.zip and an extra suffix, e.g. _baz,
  and copies (or hardlinks) the file to /foo/bar_baz.zip.

  Returns: A tuple containing three elements: the base filename, the extension
     and the full versioned filename."""
    zip_template = os.path.basename(zip_file)
    zip_base, zip_ext = os.path.splitext(zip_template)
    # Create a versioned copy of the file.
    versioned_file = zip_file.replace(zip_ext, file_suffix + zip_ext)
    # Allow for overriding the name of the file based on the given upload url.
    if options.use_build_url_name:
        new_build_url, new_archive_name = options.build_url.rsplit('/', 1)
        if new_archive_name and new_archive_name.endswith('.zip'):
            options.build_url = new_build_url
            versioned_file = zip_file.replace(zip_template, new_archive_name)
    if os.path.exists(versioned_file):
        # This file already exists. Maybe we are doing a clobber build at the same
        # revision. We can move this file away.
        old_file = versioned_file.replace(zip_ext, '_old' + zip_ext)
        chromium_utils.MoveFile(versioned_file, old_file)
    if chromium_utils.IsWindows():
        shutil.copyfile(zip_file, versioned_file)
    else:
        os.link(zip_file, versioned_file)
    chromium_utils.MakeWorldReadable(versioned_file)
    print 'Created versioned archive', versioned_file
    return (zip_base, zip_ext, versioned_file)
Ejemplo n.º 10
0
def GetGomaLogDirectory():
    """Get goma's log directory.

  Returns:
    a string of a directory name where goma's log may exist.

  Raises:
    chromium_utils.PathNotFound if it cannot find an available log directory.
  """
    candidates = ['GLOG_log_dir', 'GOOGLE_LOG_DIR', 'TEST_TMPDIR']
    default_dir = None
    if chromium_utils.IsWindows():
        candidates.extend(['TMP', 'TEMP', 'USERPROFILE'])
        # Note: I believe one of environment variables is set for usual Windows
        # environment, let me avoid to check the Windows directory, which we
        # need to use win32api on Python.
    else:
        candidates.extend(['TMPDIR', 'TMP'])
        default_dir = '/tmp'

    for candidate in candidates:
        value = os.environ.get(candidate)
        if value and os.path.isdir(value):
            return value
    if default_dir:
        return default_dir
    raise chromium_utils.PathNotFound('Cannot find Goma log directory.')
Ejemplo n.º 11
0
def main():
    usage = 'usage: %prog [--nuke]'
    parser = OptionParser(usage)
    parser.add_option('-n',
                      '--nuke',
                      action='store_true',
                      dest='nuke',
                      default=False,
                      help='Nuke whole repository (not just build output)')
    options, unused_args = parser.parse_args()

    if options.nuke:
        chromium_utils.RemoveDirectory('trunk')
    else:
        # Remove platform specific build output directories.
        if chromium_utils.IsWindows():
            chromium_utils.RemoveDirectory('trunk\\build\\Debug')
            chromium_utils.RemoveDirectory('trunk\\build\\Release')
        elif chromium_utils.IsMac():
            chromium_utils.RemoveDirectory('trunk/out')
            chromium_utils.RemoveDirectory('trunk/xcodebuild')
        elif chromium_utils.IsLinux():
            chromium_utils.RemoveDirectory('trunk/out')
        else:
            print 'Unknown platform: ' + sys.platform
            return 1
    return 0
Ejemplo n.º 12
0
def BuildArch(target_arch=None):
    """Determine the architecture of the build being processed."""
    if target_arch == 'x64':
        # Just use the architecture specified by the build if it's 64 bit.
        return '64bit'
    elif target_arch:
        raise StagingError('Unknown target_arch "%s"', target_arch)

    if chromium_utils.IsWindows() or chromium_utils.IsMac():
        # Architecture is not relevant for Mac (combines multiple archs in one
        # release) and Win (32-bit only), so just call it 32bit.
        # TODO(mmoss): This might change for Win if we add 64-bit builds.
        return '32bit'
    elif chromium_utils.IsLinux():
        # This assumes we either build natively or build (and run staging) in a
        # chroot, where the architecture of the python executable is the same as
        # the build target.
        # TODO(mmoss): This appears to be true for the current builders. If that
        # changes, we might have to modify the bots to pass in the build
        # architecture when running this script.
        arch = platform.architecture(bits='unknown')[0]
        if arch == 'unknown':
            raise StagingError('Could not determine build architecture')
        return arch
    else:
        raise NotImplementedError('Platform "%s" is not currently supported.' %
                                  sys.platform)
Ejemplo n.º 13
0
      def determine_goma_jobs():
        # We would like to speed up build on Windows a bit, since it is slowest.
        number_of_processors = 0
        try:
          number_of_processors = multiprocessing.cpu_count()
        except NotImplementedError:
          print 'cpu_count() is not implemented, using default value 50.'
          return 50

        assert number_of_processors > 0

        # When goma is used, 10 * number_of_processors is basically good in
        # various situations according to our measurement. Build speed won't
        # be improved if -j is larger than that.
        #
        # Since Mac had process number limitation before, we had to set
        # the upper limit to 50. Now that the process number limitation is 2000,
        # so we would be able to use 10 * number_of_processors.
        # For the safety, we'd like to set the upper limit to 200.
        #
        # For linux, let me keep the current value 50. It's fast enough
        # compared to the other platforms.
        #
        # Note that currently most try-bot build slaves have 8 processors.
        if chromium_utils.IsMac() or chromium_utils.IsWindows():
          return min(10 * number_of_processors, 200)
        return 50
Ejemplo n.º 14
0
def RemoveChromeDesktopFiles():
  """Removes Chrome files (i.e. shortcuts) from the desktop of the current user.
  This does nothing if called on a non-Windows platform."""
  if chromium_utils.IsWindows():
    desktop_path = os.environ['USERPROFILE']
    desktop_path = os.path.join(desktop_path, 'Desktop')
    LogAndRemoveFiles(desktop_path, '^(Chromium|chrome) \(.+\)?\.lnk$')
    RemoveOldSnapshots(desktop_path)
def DynamorioLogDir():
  profile = os.getenv("USERPROFILE")
  if not profile:
    raise Exception('USERPROFILE envir var not found')
  if chromium_utils.IsWindows():
    return profile + '\\AppData\\LocalLow\\coverage'
  else:
    return profile + '\\coverage'
Ejemplo n.º 16
0
def RemoveJumpListFiles():
    """Removes the files storing jump list history.
  This does nothing if called on a non-Windows platform."""
    if chromium_utils.IsWindows():
        custom_destination_path = os.path.join(os.environ['USERPROFILE'],
                                               'AppData', 'Roaming',
                                               'Microsoft', 'Windows',
                                               'Recent', 'CustomDestinations')
        LogAndRemoveFiles(custom_destination_path, '.+')
Ejemplo n.º 17
0
def SubversionExe():
  # TODO(pamg): move this into platform_utils to support Mac and Linux.
  if chromium_utils.IsWindows():
    return 'svn.bat'  # Find it in the user's path.
  elif chromium_utils.IsLinux() or chromium_utils.IsMac():
    return 'svn'  # Find it in the user's path.
  else:
    raise NotImplementedError(
        'Platform "%s" is not currently supported.' % sys.platform)
Ejemplo n.º 18
0
def CreateCoverageFileAndUpload(options):
    """Create coverage file with bbcov2lcov binary and upload to www dir."""
    # Assert log files exist
    log_files = glob.glob(os.path.join(options.dynamorio_log_dir, '*.log'))
    if not log_files:
        print 'No coverage log files found.'
        return 1

    if (options.browser_shard_index
            and options.test_to_upload in options.sharded_tests):
        coverage_info = os.path.join(
            options.build_dir,
            'coverage_%s.info' % options.browser_shard_index)
    else:
        coverage_info = os.path.join(options.build_dir, COVERAGE_INFO)
    coverage_info = os.path.normpath(coverage_info)
    if os.path.isfile(coverage_info):
        os.remove(coverage_info)

    bbcov2lcov_binary = GetExecutableName(
        os.path.join(options.dynamorio_dir, 'tools', 'bin32', 'bbcov2lcov'))
    cmd = [
        bbcov2lcov_binary, '--dir', options.dynamorio_log_dir, '--output',
        coverage_info
    ]
    RunCmd(cmd)

    # Delete log files.
    log_files = glob.glob(os.path.join(options.dynamorio_log_dir, '*.log'))
    for log_file in log_files:
        os.remove(log_file)

    # Assert coverage.info file exist
    if not os.path.isfile(coverage_info):
        print 'Failed to create coverage.info file.'
        return 1

    # Upload coverage file.
    cov_dir = options.test_to_upload.replace('_', '') + COVERAGE_DIR_POSTFIX
    dest = os.path.join(options.www_dir, options.platform, options.build_id,
                        cov_dir)
    dest = os.path.normpath(dest)
    if chromium_utils.IsWindows():
        print('chromium_utils.CopyFileToDir(%s, %s)' % (coverage_info, dest))
        chromium_utils.MaybeMakeDirectory(dest)
        chromium_utils.CopyFileToDir(coverage_info, dest)
    elif chromium_utils.IsLinux() or chromium_utils.IsMac():
        print 'SshCopyFiles(%s, %s, %s)' % (coverage_info, options.host, dest)
        chromium_utils.SshMakeDirectory(options.host, dest)
        chromium_utils.MakeWorldReadable(coverage_info)
        chromium_utils.SshCopyFiles(coverage_info, options.host, dest)
        os.unlink(coverage_info)
    else:
        raise NotImplementedError('Platform "%s" is not currently supported.' %
                                  sys.platform)
    return 0
Ejemplo n.º 19
0
def FileRegexWhitelist(options):
    if chromium_utils.IsWindows() and options.target is 'Release':
        # Special case for chrome. Add back all the chrome*.pdb files to the list.
        # Also add browser_test*.pdb, ui_tests.pdb and ui_tests.pdb.
        # TODO(nsylvain): This should really be defined somewhere else.
        return (r'^(chrome[_.]dll|chrome[_.]exe'
                # r'|browser_test.+|unit_tests'
                r')\.pdb$')

    return '$NO_FILTER^'
Ejemplo n.º 20
0
def goma_teardown(options, env):
  """Tears down goma if necessary. """
  if (options.compiler in ('goma', 'goma-clang', 'jsonclang') and
      options.goma_dir):
    if not chromium_utils.IsWindows():
      goma_ctl_cmd = [os.path.join(options.goma_dir, 'goma_ctl.sh')]
    else:
      goma_ctl_cmd = [sys.executable,
                      os.path.join(options.goma_dir, 'goma_ctl.py')]
    # Always stop the proxy for now to allow in-place update.
    chromium_utils.RunCommand(goma_ctl_cmd + ['stop'], env=env)
    def _UploadBuild(self, www_dir, revisions_path, archive_files, gs_base,
                     gs_acl):
        if chromium_utils.IsWindows():
            print 'os.makedirs(%s)' % www_dir

            for archive in archive_files:
                print 'chromium_utils.CopyFileToDir(%s, %s)' % (archive,
                                                                www_dir)
            print 'chromium_utils.CopyFileToDir(%s, %s)' % (revisions_path,
                                                            www_dir)

            if not self.options.dry_run:
                self.MyMaybeMakeDirectory(www_dir, gs_base)
                for archive in archive_files:
                    self.MyCopyFileToDir(archive,
                                         www_dir,
                                         gs_base,
                                         gs_acl=gs_acl)
                self.MyCopyFileToDir(revisions_path,
                                     www_dir,
                                     gs_base,
                                     gs_acl=gs_acl)
        elif chromium_utils.IsLinux() or chromium_utils.IsMac():
            for archive in archive_files:
                print 'SshCopyFiles(%s, %s, %s)' % (
                    archive, self.options.archive_host, www_dir)
            print 'SshCopyFiles(%s, %s, %s)' % (
                revisions_path, self.options.archive_host, www_dir)
            if not self.options.dry_run:
                print 'SshMakeDirectory(%s, %s)' % (self.options.archive_host,
                                                    www_dir)
                self.MySshMakeDirectory(self.options.archive_host, www_dir,
                                        gs_base)
                for archive in archive_files:
                    self.MyMakeWorldReadable(archive, gs_base)
                    self.MySshCopyFiles(archive,
                                        self.options.archive_host,
                                        www_dir,
                                        gs_base,
                                        gs_acl=gs_acl)
                    os.unlink(archive)
                # Files are created umask 077 by default, so make it world-readable
                # before pushing to web server.
                self.MyMakeWorldReadable(revisions_path, gs_base)
                self.MySshCopyFiles(revisions_path,
                                    self.options.archive_host,
                                    www_dir,
                                    gs_base,
                                    gs_acl=gs_acl)
        else:
            raise NotImplementedError(
                'Platform "%s" is not currently supported.' % sys.platform)
Ejemplo n.º 22
0
    def testUploadTestsNoDeepPaths(self):
        # This test is currently only applicable on Windows.
        if not chromium_utils.IsWindows():
            return

        self.createTestFiles(TEST_FILES_NO_DEEP_DIRS)
        self.initializeStager()
        self.stager.UploadTests(self.archive_dir)

        expected_archived_tests = TEST_FILES_NO_DEEP_DIRS
        archived_tests = os.listdir(
            os.path.join(self.archive_dir, 'chrome-win32.test'))
        self.assertEquals(len(expected_archived_tests), len(archived_tests))
Ejemplo n.º 23
0
 def prepareToolDir(self):
     # Build up a directory for Zip file testing
     if chromium_utils.IsWindows():
         self.tool_dir = 'chrome/tools/build/win'
     elif chromium_utils.IsLinux():
         self.tool_dir = 'chrome/tools/build/linux'
     elif chromium_utils.IsMac():
         self.tool_dir = 'chrome/tools/build/mac'
     else:
         raise PlatformError('Platform "%s" is not currently supported.' %
                             sys.platform)
     self.tool_dir = os.path.join(self.src_dir, self.tool_dir)
     os.makedirs(self.tool_dir)
Ejemplo n.º 24
0
def FileExclusions():
    # Skip files that the testers don't care about. Mostly directories.
    if chromium_utils.IsWindows():
        # Remove obj or lib dir entries
        return ['obj', 'lib', 'cfinstaller_archive', 'installer_archive']
    if chromium_utils.IsMac():
        return [
            # We don't need the arm bits v8 builds.
            'd8_arm',
            'v8_shell_arm',
            # pdfsqueeze is a build helper, no need to copy it to testers.
            'pdfsqueeze',
            # The inspector copies its resources into a resources folder in the build
            # output, but we only need the copy that ends up within the Chrome bundle.
            'resources',
            # We copy the framework into the app bundle, we don't need the second
            # copy outside the app.
            # TODO(mark): Since r28431, the copy in the build directory is actually
            # used by tests.  Putting two copies in the .zip isn't great, so maybe
            # we can find another workaround.
            # 'Chromium Framework.framework',
            # 'Google Chrome Framework.framework',
            # We copy the Helper into the app bundle, we don't need the second
            # copy outside the app.
            'Chromium Helper.app',
            'Google Chrome Helper.app',
            '.deps',
            'obj',
            'obj.host',
            'obj.target',
        ]
    if chromium_utils.IsLinux():
        return [
            # intermediate build directories (full of .o, .d, etc.).
            'appcache',
            'glue',
            'googleurl',
            'lib',
            'lib.host',
            'obj',
            'obj.host',
            'obj.target',
            'src',
            '.deps',
            # scons build cruft
            '.sconsign.dblite',
            # build helper, not needed on testers
            'mksnapshot',
        ]

    return []
Ejemplo n.º 25
0
def goma_setup(options, env):
  """Sets up goma if necessary.

  If using the Goma compiler, first call goma_ctl with ensure_start
  (or restart in clobber mode) to ensure the proxy is available, and returns
  True.
  If it failed to start up compiler_proxy, modify options.compiler and
  options.goma_dir and returns False

  """
  if options.compiler not in ('goma', 'goma-clang', 'jsonclang'):
    # Unset goma_dir to make sure we'll not use goma.
    options.goma_dir = None
    return False

  # HACK(agable,goma): This prevents native-client's build_nexe.py from using
  # Goma, as doing so is currently overloading machines and hurting the
  # waterfall. Remove this as soon as that is fixed. (12 June, 2013).
  env['NO_NACL_GOMA'] = 'true'

  # goma is requested.
  goma_key = os.path.join(options.goma_dir, 'goma.key')
  if os.path.exists(goma_key):
    env['GOMA_API_KEY_FILE'] = goma_key
  result = -1
  if not chromium_utils.IsWindows():
    goma_ctl_cmd = [os.path.join(options.goma_dir, 'goma_ctl.sh')]
    goma_start_command = ['ensure_start']
    if options.clobber:
      goma_start_command = ['restart']
    result = chromium_utils.RunCommand(goma_ctl_cmd + goma_start_command,
                                       env=env)
  else:
    env['GOMA_RPC_EXTRA_PARAMS'] = '?win'
    goma_ctl_cmd = [sys.executable,
                    os.path.join(options.goma_dir, 'goma_ctl.py')]
    result = chromium_utils.RunCommand(goma_ctl_cmd + ['start'], env=env)
  if not result:
    # goma started sucessfully.
    return True

  print 'warning: failed to start goma. falling back to non-goma'
  # Drop goma from options.compiler
  options.compiler = options.compiler.replace('goma-', '')
  if options.compiler == 'goma':
    options.compiler = None
  # Reset options.goma_dir.
  # options.goma_dir will be used to check if goma is ready
  # when options.compiler=jsonclang.
  options.goma_dir = None
  return False
Ejemplo n.º 26
0
def GSUtilSetup():
    # Get the path to the gsutil script.
    gsutil = os.path.join(os.path.dirname(__file__), 'gsutil')
    gsutil = os.path.normpath(gsutil)
    if chromium_utils.IsWindows():
        gsutil = gsutil + '.bat'

    # Get the path to the boto file containing the password.
    boto_file = os.path.join(os.path.dirname(__file__), '..', '..',
                             'site_config', '.boto')

    # Make sure gsutil uses this boto file.
    os.environ['AWS_CREDENTIAL_FILE'] = boto_file
    return gsutil
Ejemplo n.º 27
0
def main():
    builder_name = os.getenv('BUILDBOT_BUILDERNAME', default='')

    script = 'src/dartium_tools/buildbot_annotated_steps.py'

    chromium_utils.RunCommand([sys.executable, script])

    # BIG HACK
    # Normal ninja clobbering does not work due to symlinks/python on windows
    # Full clobbering before building does not work since it will destroy
    # the ninja build files
    # So we basically clobber at the end here
    if chromium_utils.IsWindows() and 'full' in builder_name:
        chromium_utils.RemoveDirectory('src/out')
    return 0
Ejemplo n.º 28
0
def main():
    try:
        if chromium_utils.IsWindows():
            return main_win()
        elif chromium_utils.IsMac():
            return main_mac()
        elif chromium_utils.IsLinux():
            return main_linux()
        else:
            print 'Unknown platform: ' + sys.platform
            return 1
    except FullDriveException, e:
        print >> sys.stderr, 'Not enough free space on %s: %d bytes left' % (
            e.args[0], e.args[1])
        send_alert(e.args[0], e.args[1])
Ejemplo n.º 29
0
def UploadFile(src, dst, force_ssh=False):
    www_base = config.Archive.www_dir_base
    full_dst = os.path.join(www_base, dst)
    dst_dir = os.path.dirname(full_dst)
    if chromium_utils.IsWindows() and not force_ssh:
        print 'copying (%s) to (%s)' % (src, full_dst)
        chromium_utils.MaybeMakeDirectory(dst_dir)
        shutil.copyfile(src, full_dst)
        print 'done.'
    else:
        host = config.Archive.archive_host
        print 'copying (%s) to (%s) on (%s)' % (src, full_dst, host)
        chromium_utils.SshMakeDirectory(host, dst_dir)
        chromium_utils.SshCopyFiles(src, host, full_dst)
        print 'done.'
Ejemplo n.º 30
0
def FileRegexBlacklist(options):
    if chromium_utils.IsWindows():
        return r'^.+\.(rc|res|lib|exp|ilk|7z|([pP]recompile\.h\.pch.*))$'
    if chromium_utils.IsMac():
        # The static libs are just built as intermediate targets, and we don't
        # need to pull the dSYMs over to the testers most of the time (except for
        # the memory tools).
        if options.package_dsym_files:
            return r'^.+\.(a)$'
        else:
            return r'^.+\.(a|dSYM)$'
    if chromium_utils.IsLinux():
        # object files, archives, and gcc (make build) dependency info.
        return r'^.+\.(o|a|d)$'

    return '$NO_FILTER^'