Beispiel #1
0
def main():
    parser = optparse.OptionParser()
    parser.add_option(
        '',
        '--android-package',
        help='Application package name, if running tests on Android.')
    # Option 'chrome-version' is for desktop only.
    parser.add_option(
        '',
        '--chrome-version',
        help='Version of chrome, e.g., \'HEAD\', \'27\', or \'26\'.'
        'Default is to run tests against all of these versions.'
        'Notice: this option only applies to desktop.')
    options, _ = parser.parse_args()

    exe_postfix = ''
    if util.IsWindows():
        exe_postfix = '.exe'
    cpp_tests_name = 'chromedriver2_tests' + exe_postfix
    server_name = 'chromedriver2_server' + exe_postfix

    required_build_outputs = [server_name]
    if not options.android_package:
        required_build_outputs += [cpp_tests_name]
    build_dir = chrome_paths.GetBuildDir(required_build_outputs)
    print 'Using build outputs from', build_dir

    chromedriver = os.path.join(build_dir, server_name)
    platform_name = util.GetPlatformName()
    if util.IsLinux() and platform.architecture()[0] == '64bit':
        platform_name += '64'
    ref_chromedriver = os.path.join(
        chrome_paths.GetSrc(), 'chrome', 'test', 'chromedriver', 'third_party',
        'java_tests', 'reference_builds',
        'chromedriver_%s%s' % (platform_name, exe_postfix))

    if util.IsLinux():
        # Set LD_LIBRARY_PATH to enable successful loading of shared object files,
        # when chromedriver2.so is not a static build.
        _AppendEnvironmentPath('LD_LIBRARY_PATH',
                               os.path.join(build_dir, 'lib'))
    elif util.IsWindows():
        # For Windows bots: add ant, java(jre) and the like to system path.
        _AddToolsToSystemPathForWindows()

    if options.android_package:
        os.environ['PATH'] += os.pathsep + os.path.join(_THIS_DIR, 'chrome')
        code1 = RunPythonTests(chromedriver,
                               ref_chromedriver,
                               android_package=options.android_package)
        code2 = RunJavaTests(chromedriver,
                             android_package=options.android_package)
        return code1 or code2
    else:
        latest_snapshot_revision = archive.GetLatestRevision(
            archive.Site.SNAPSHOT)
        versions = [['HEAD', latest_snapshot_revision],
                    ['29', archive.CHROME_29_REVISION],
                    ['28', archive.CHROME_28_REVISION],
                    ['27', archive.CHROME_27_REVISION]]
        code = 0
        for version in versions:
            if options.chrome_version and version[0] != options.chrome_version:
                continue
            download_site = archive.Site.CONTINUOUS
            version_name = version[0]
            if version_name == 'HEAD':
                version_name = version[1]
                download_site = archive.Site.SNAPSHOT
            chrome_path = DownloadChrome(version_name, version[1],
                                         download_site)
            code1 = RunPythonTests(chromedriver,
                                   ref_chromedriver,
                                   chrome=chrome_path,
                                   chrome_version=version[0],
                                   chrome_version_name=version_name)
            code2 = RunJavaTests(chromedriver,
                                 chrome=chrome_path,
                                 chrome_version=version[0],
                                 chrome_version_name=version_name)
            code = code or code1 or code2
        cpp_tests = os.path.join(build_dir, cpp_tests_name)
        return RunCppTests(cpp_tests) or code
Beispiel #2
0
def main():
    parser = optparse.OptionParser()
    parser.add_option(
        '',
        '--android-packages',
        help='Comma separated list of application package names, '
        'if running tests on Android.')
    # Option 'chrome-version' is for desktop only.
    parser.add_option(
        '',
        '--chrome-version',
        help='Version of chrome, e.g., \'HEAD\', \'27\', or \'26\'.'
        'Default is to run tests against all of these versions.'
        'Notice: this option only applies to desktop.')
    options, _ = parser.parse_args()

    exe_postfix = ''
    if util.IsWindows():
        exe_postfix = '.exe'
    cpp_tests_name = 'chromedriver_tests' + exe_postfix
    server_name = 'chromedriver' + exe_postfix

    required_build_outputs = [server_name]
    if not options.android_packages:
        required_build_outputs += [cpp_tests_name]
    try:
        build_dir = chrome_paths.GetBuildDir(required_build_outputs)
    except RuntimeError:
        util.MarkBuildStepStart('check required binaries')
        traceback.print_exc()
        util.MarkBuildStepError()
    constants.SetBuildType(os.path.basename(build_dir))
    print 'Using build outputs from', build_dir

    chromedriver = os.path.join(build_dir, server_name)
    platform_name = util.GetPlatformName()
    if util.IsLinux() and util.Is64Bit():
        platform_name += '64'
    ref_chromedriver = os.path.join(
        chrome_paths.GetSrc(), 'chrome', 'test', 'chromedriver', 'third_party',
        'java_tests', 'reference_builds',
        'chromedriver_%s%s' % (platform_name, exe_postfix))

    if options.android_packages:
        os.environ['PATH'] += os.pathsep + os.path.join(
            _THIS_DIR, os.pardir, 'chrome')
        code = 0
        for package in options.android_packages.split(','):
            code1 = RunPythonTests(chromedriver,
                                   ref_chromedriver,
                                   chrome_version_name=package,
                                   android_package=package)
            code2 = RunJavaTests(chromedriver,
                                 chrome_version_name=package,
                                 android_package=package,
                                 verbose=True)
            code = code or code1 or code2
        return code
    else:
        versions = {'HEAD': archive.GetLatestRevision()}
        if util.IsLinux() and not util.Is64Bit():
            # Linux32 builds need to be special-cased, because 1) they are keyed by
            # git hash rather than commit position, and 2) come from a different
            # download site (so we can't just convert the commit position to a hash).
            versions['58'] = '7613176285d46fbc5b4712e42bd135aae99cbba5'
            versions['57'] = '7da9cd89d4d18e171323ff7d0d2a93ede0c1d721'
            versions['56'] = '67002b0fdaa3123f10f96fa2f7965677d531db74'
            # TODO(samuong): speculative fix for crbug.com/611886
            os.environ['CHROME_DEVEL_SANDBOX'] = '/opt/chromium/chrome_sandbox'
        else:
            versions['58'] = '454475'
            versions['57'] = '444890'
            versions['56'] = '433020'
        code = 0
        for version, revision in versions.iteritems():
            if options.chrome_version and version != options.chrome_version:
                continue
            download_site = archive.GetDownloadSite()
            version_name = version
            if version_name == 'HEAD':
                version_name = revision
            temp_dir, chrome_path = DownloadChrome(version_name, revision,
                                                   download_site)
            if not chrome_path:
                code = 1
                continue
            code1 = RunPythonTests(chromedriver,
                                   ref_chromedriver,
                                   chrome=chrome_path,
                                   chrome_version=version,
                                   chrome_version_name='v%s' % version_name)
            code2 = RunJavaTests(chromedriver,
                                 chrome=chrome_path,
                                 chrome_version=version,
                                 chrome_version_name='v%s' % version_name)
            code = code or code1 or code2
            _KillChromes()
            shutil.rmtree(temp_dir)
        cpp_tests = os.path.join(build_dir, cpp_tests_name)
        return RunCppTests(cpp_tests) or code
Beispiel #3
0
def main():
  parser = optparse.OptionParser()
  parser.add_option(
      '', '--android-packages',
      help='Comma separated list of application package names, '
           'if running tests on Android.')
  # Option 'chrome-version' is for desktop only.
  parser.add_option(
      '', '--chrome-version',
      help='Version of chrome, e.g., \'HEAD\', \'27\', or \'26\'.'
           'Default is to run tests against all of these versions.'
           'Notice: this option only applies to desktop.')
  options, _ = parser.parse_args()

  exe_postfix = ''
  if util.IsWindows():
    exe_postfix = '.exe'
  cpp_tests_name = 'chromedriver_tests' + exe_postfix
  server_name = 'chromedriver' + exe_postfix

  required_build_outputs = [server_name]
  if not options.android_packages:
    required_build_outputs += [cpp_tests_name]
  try:
    build_dir = chrome_paths.GetBuildDir(required_build_outputs)
  except RuntimeError:
    util.MarkBuildStepStart('check required binaries')
    traceback.print_exc()
    util.MarkBuildStepError()
  constants.SetBuildType(os.path.basename(build_dir))
  print 'Using build outputs from', build_dir

  chromedriver = os.path.join(build_dir, server_name)
  platform_name = util.GetPlatformName()
  if util.IsLinux() and platform.architecture()[0] == '64bit':
    platform_name += '64'
  ref_chromedriver = os.path.join(
      chrome_paths.GetSrc(),
      'chrome', 'test', 'chromedriver', 'third_party', 'java_tests',
      'reference_builds',
      'chromedriver_%s%s' % (platform_name, exe_postfix))

  if options.android_packages:
    os.environ['PATH'] += os.pathsep + os.path.join(
        _THIS_DIR, os.pardir, 'chrome')
    code = 0
    for package in options.android_packages.split(','):
      code1 = RunPythonTests(chromedriver,
                             ref_chromedriver,
                             chrome_version_name=package,
                             android_package=package)
      code2 = RunJavaTests(chromedriver,
                           chrome_version_name=package,
                           android_package=package,
                           verbose=True)
      code = code or code1 or code2
    return code
  else:
    latest_snapshot_revision = archive.GetLatestSnapshotVersion()
    versions = [
        ['HEAD', latest_snapshot_revision],
        ['50', archive.CHROME_50_REVISION],
        ['49', archive.CHROME_49_REVISION],
        ['48', archive.CHROME_48_REVISION],
    ]
    code = 0
    for version in versions:
      if options.chrome_version and version[0] != options.chrome_version:
        continue
      download_site = archive.Site.CONTINUOUS
      version_name = version[0]
      if version_name == 'HEAD':
        version_name = version[1]
        download_site = archive.GetSnapshotDownloadSite()
      temp_dir, chrome_path = DownloadChrome(version_name, version[1],
                                             download_site)
      if not chrome_path:
        code = 1
        continue
      code1 = RunPythonTests(chromedriver,
                             ref_chromedriver,
                             chrome=chrome_path,
                             chrome_version=version[0],
                             chrome_version_name='v%s' % version_name)
      code2 = RunJavaTests(chromedriver, chrome=chrome_path,
                           chrome_version=version[0],
                           chrome_version_name='v%s' % version_name)
      code = code or code1 or code2
      _KillChromes()
      shutil.rmtree(temp_dir)
    cpp_tests = os.path.join(build_dir, cpp_tests_name)
    return RunCppTests(cpp_tests) or code
Beispiel #4
0
def main():
  parser = optparse.OptionParser()
  parser.add_option(
      '', '--android-packages',
      help='Comma separated list of application package names, '
           'if running tests on Android.')
  # Option 'chrome-version' is for desktop only.
  parser.add_option(
      '', '--chrome-version',
      help='Version of chrome, e.g., \'HEAD\', \'27\', or \'26\'.'
           'Default is to run tests against all of these versions.'
           'Notice: this option only applies to desktop.')
  options, _ = parser.parse_args()

  exe_postfix = ''
  if util.IsWindows():
    exe_postfix = '.exe'
  cpp_tests_name = 'chromedriver_tests' + exe_postfix
  server_name = 'chromedriver' + exe_postfix

  required_build_outputs = [server_name]
  if not options.android_packages:
    required_build_outputs += [cpp_tests_name]
  try:
    build_dir = chrome_paths.GetBuildDir(required_build_outputs)
  except RuntimeError:
    util.MarkBuildStepStart('check required binaries')
    traceback.print_exc()
    util.MarkBuildStepError()
  constants.SetBuildType(os.path.basename(build_dir))
  print 'Using build outputs from', build_dir

  chromedriver = os.path.join(build_dir, server_name)
  platform_name = util.GetPlatformName()
  if util.IsLinux() and util.Is64Bit():
    platform_name += '64'
  ref_chromedriver = os.path.join(
      chrome_paths.GetSrc(),
      'chrome', 'test', 'chromedriver', 'third_party', 'java_tests',
      'reference_builds',
      'chromedriver_%s%s' % (platform_name, exe_postfix))

  if options.android_packages:
    os.environ['PATH'] += os.pathsep + os.path.join(
        _THIS_DIR, os.pardir, 'chrome')
    code = 0
    for package in options.android_packages.split(','):
      code1 = RunPythonTests(chromedriver,
                             ref_chromedriver,
                             chrome_version_name=package,
                             android_package=package)
      code2 = RunJavaTests(chromedriver,
                           chrome_version_name=package,
                           android_package=package,
                           verbose=True)
      code = code or code1 or code2
    return code
  else:
    versions = {'HEAD': archive.GetLatestRevision()}
    # Linux64 build numbers
    if util.IsLinux():
      versions['70'] = '587811'
      versions['69'] = '576753'
      versions['68'] = '561732'

    # Mac build numbers
    elif util.IsMac():
      versions['70'] = '587811'
      versions['69'] = '576753'
      versions['68'] = '561733'

    # Windows build numbers
    elif util.IsWindows():
      versions['70'] = '587814'
      versions['69'] = '576753'
      versions['68'] = '561732'

    code = 0
    for version, revision in versions.iteritems():
      if options.chrome_version and version != options.chrome_version:
        continue
      download_site = archive.GetDownloadSite()
      version_name = version
      if version_name == 'HEAD':
        version_name = revision
      temp_dir, chrome_path = DownloadChrome(version_name, revision,
                                             download_site)
      if not chrome_path:
        code = 1
        continue
      code1 = RunPythonTests(chromedriver,
                             ref_chromedriver,
                             chrome=chrome_path,
                             chrome_version=version,
                             chrome_version_name='v%s' % version_name)
      code2 = RunJavaTests(chromedriver, chrome=chrome_path,
                           chrome_version=version,
                           chrome_version_name='v%s' % version_name,
                           verbose=True)
      code3 = RunReplayTests(chromedriver,
                             chrome=chrome_path,
                             chrome_version=version,
                             chrome_version_name='v%s' % version_name)
      code = code or code1 or code2 or code3
      _KillChromes()
      shutil.rmtree(temp_dir)
    cpp_tests = os.path.join(build_dir, cpp_tests_name)
    return RunCppTests(cpp_tests) or code