Esempio n. 1
0
def MaybeRelease(revision):
  # Version is embedded as: const char kChromeDriverVersion[] = "0.1";
  with open(os.path.join(_THIS_DIR, 'chrome', 'version.cc'), 'r') as f:
    version_line = filter(lambda x: 'kChromeDriverVersion' in x, f.readlines())
  version = version_line[0].split('"')[1]

  bitness = '32'
  if util.IsLinux():
    bitness = '64'
  zip_name = 'chromedriver2_%s%s_%s.zip' % (
      util.GetPlatformName(), bitness, version)

  site = 'https://code.google.com/p/chromedriver/downloads/list'
  s = urllib2.urlopen(site)
  downloads = s.read()
  s.close()

  if zip_name in downloads:
    return 0

  print '@@@BUILD_STEP releasing %s@@@' % zip_name
  if util.IsWindows():
    server_orig_name = 'chromedriver2_server.exe'
    server_name = 'chromedriver.exe'
  else:
    server_orig_name = 'chromedriver2_server'
    server_name = 'chromedriver'
  server = os.path.join(chrome_paths.GetBuildDir([server_orig_name]),
                        server_orig_name)

  print 'Zipping ChromeDriver server', server
  temp_dir = util.MakeTempDir()
  zip_path = os.path.join(temp_dir, zip_name)
  f = zipfile.ZipFile(zip_path, 'w', zipfile.ZIP_DEFLATED)
  f.write(server, server_name)
  if util.IsLinux() or util.IsMac():
    adb_commands = os.path.join(_THIS_DIR, 'chrome', 'adb_commands.py')
    f.write(adb_commands, 'adb_commands.py')
  f.close()

  cmd = [
    sys.executable,
    os.path.join(_THIS_DIR, 'third_party', 'googlecode',
                 'googlecode_upload.py'),
    '--summary', 'version of ChromeDriver2 r%s' % revision,
    '--project', 'chromedriver',
    '--user', '*****@*****.**',
    '--label', 'Release',
    zip_path
  ]
  with open(os.devnull, 'wb') as no_output:
    if subprocess.Popen(cmd, stdout=no_output, stderr=no_output).wait():
      print '@@@STEP_FAILURE@@@'
Esempio n. 2
0
def Main():
    chromedriver_map = {
        'win': 'chromedriver2.dll',
        'mac': 'chromedriver2.so',
        'linux': 'libchromedriver2.so',
    }
    chromedriver = chromedriver_map[util.GetPlatformName()]
    build_dir = chrome_paths.GetBuildDir([chromedriver])
    chrome_binary = _FindChromeBinary(build_dir)
    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()

    # Run python test for chromedriver.
    print '@@@BUILD_STEP chromedriver2_python_tests@@@'
    cmd = [
        sys.executable,
        os.path.join(_THIS_DIR, 'test.py'),
        os.path.join(build_dir, chromedriver),
    ]
    # Set the built chrome binary.
    if chrome_binary is not None:
        cmd.append(chrome_binary)
    if util.IsMac():
        # In Mac, chromedriver2.so is a 32-bit build, so run with the 32-bit python.
        os.environ['VERSIONER_PYTHON_PREFER_32_BIT'] = 'yes'
    code1 = util.RunCommand(cmd)
    if code1 != 0:
        print '@@@STEP_FAILURE@@@'

    # Run java tests for chromedriver.
    print '@@@BUILD_STEP chromedriver2_java_tests@@@'
    cmd = [
        sys.executable,
        os.path.join(_THIS_DIR, 'run_java_tests.py'),
        '--chromedriver_path=' + os.path.join(build_dir, chromedriver),
    ]
    # Set the built chrome binary.
    if chrome_binary is not None:
        cmd.append('--chrome_path=' + chrome_binary)
    code2 = util.RunCommand(cmd)
    if code2 != 0:
        print '@@@STEP_FAILURE@@@'

    return code1 or code2
Esempio n. 3
0
def MaybeRelease(revision):
  # Version is embedded as: const char kChromeDriverVersion[] = "0.1";
  with open(os.path.join(_THIS_DIR, 'version.cc'), 'r') as f:
    version_line = filter(lambda x: 'kChromeDriverVersion' in x, f.readlines())
  version = version_line[0].split('"')[1]

  # This assumes the bitness of python is the same as the built ChromeDriver.
  bitness = '32'
  if sys.maxint > 2**32:
    bitness = '64'
  zip_name = 'experimental_chromedriver2_%s%s_%s.zip' % (
      util.GetPlatformName(), bitness, version)

  site = 'https://code.google.com/p/chromedriver/downloads/list'
  s = urllib2.urlopen(site)
  downloads = s.read()
  s.close()

  if zip_name in downloads:
    return 0

  print '@@@BUILD_STEP releasing %s@@@' % zip_name
  if util.IsWindows():
    server_orig_name = 'chromedriver2_server.exe'
    server_name = 'chromedriver.exe'
  else:
    server_orig_name = 'chromedriver2_server'
    server_name = 'chromedriver'
  server = os.path.join(chrome_paths.GetBuildDir([server_orig_name]),
                        server_orig_name)

  print 'Zipping ChromeDriver server', server
  temp_dir = util.MakeTempDir()
  zip_path = os.path.join(temp_dir, zip_name)
  f = zipfile.ZipFile(zip_path, 'w', zipfile.ZIP_DEFLATED)
  f.write(server, server_name)
  f.close()

  cmd = [
    sys.executable,
    os.path.join(_THIS_DIR, 'third_party', 'googlecode',
                 'googlecode_upload.py'),
    '--summary', 'alpha version of ChromeDriver2 r%s' % revision,
    '--project', 'chromedriver',
    '--user', '*****@*****.**',
    '--label', 'Release-Alpha',
    zip_path
  ]
  if util.RunCommand(cmd):
    print '@@@STEP_FAILURE@@@'
Esempio n. 4
0
def Main():
  print '@@@BUILD_STEP chromedriver2_tests@@@'
  chromedriver_map = {
    'win': 'chromedriver2.dll',
    'mac': 'chromedriver2.so',
    'linux': 'libchromedriver2.so',
  }
  chromedriver = chromedriver_map[util.GetPlatformName()]
  build_dir = chrome_paths.GetBuildDir([chromedriver])
  cmd = [
    sys.executable,
    os.path.join(_THIS_DIR, 'test.py'),
    os.path.join(build_dir, chromedriver),
  ]
  code = util.RunCommand(cmd)
  if code != 0:
    print '@@@STEP_FAILURE@@@'
  return code
def Download():
    print '@@@BUILD_STEP Download chromedriver prebuilts@@@'

    temp_dir = util.MakeTempDir()
    zip_path = os.path.join(temp_dir, 'chromedriver2_prebuilts.zip')
    cmd = [
        sys.executable, DOWNLOAD_SCRIPT,
        '--url=%s' % GS_BUCKET,
        '--partial-name=%s' % GS_ZIP_PREFIX,
        '--dst=%s' % zip_path
    ]
    if util.RunCommand(cmd):
        print '@@@STEP_FAILURE@@@'

    build_dir = chrome_paths.GetBuildDir(['host_forwarder'])
    print 'Unzipping prebuilts %s to %s' % (zip_path, build_dir)
    f = zipfile.ZipFile(zip_path, 'r')
    f.extractall(build_dir)
    f.close()
    # Workaround for Python bug: http://bugs.python.org/issue15795
    os.chmod(os.path.join(build_dir, 'chromedriver2_server'), 0700)
Esempio n. 6
0
def main():
  chromedriver_map = {
    'win': 'chromedriver2.dll',
    'mac': 'chromedriver2.so',
    'linux': 'libchromedriver2.so',
  }
  chromedriver_name = chromedriver_map[util.GetPlatformName()]

  chrome_map = {
    'win': 'chrome.exe',
    'mac': 'Chromium.app/Contents/MacOS/Chromium',
    'linux': 'chrome',
  }
  chrome_name = chrome_map[util.GetPlatformName()]

  if util.IsWindows():
    cpp_tests_name = 'chromedriver2_tests.exe'
  else:
    cpp_tests_name = 'chromedriver2_tests'

  required_build_outputs = [chromedriver_name, chrome_name, cpp_tests_name]
  build_dir = chrome_paths.GetBuildDir(required_build_outputs)
  print 'Using build outputs from', build_dir

  chromedriver = os.path.join(build_dir, chromedriver_name)
  chrome = os.path.join(build_dir, chrome_name)
  cpp_tests = os.path.join(build_dir, cpp_tests_name)

  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()

  code1 = RunPythonTests(chromedriver, chrome)
  code2 = RunJavaTests(chromedriver, chrome)
  code3 = RunCppTests(cpp_tests)
  return code1 or code2 or code3
Esempio n. 7
0
def Archive(revision):
  print '@@@BUILD_STEP archive@@@'
  prebuilts = ['libchromedriver2.so', 'chromedriver2_server',
               'chromedriver2_unittests', 'chromedriver2_tests']
  build_dir = chrome_paths.GetBuildDir(prebuilts[0:1])
  zip_name = '%s_r%s.zip' % (GS_ZIP_PREFIX, revision)
  temp_dir = util.MakeTempDir()
  zip_path = os.path.join(temp_dir, zip_name)
  print 'Zipping prebuilts %s' % zip_path
  f = zipfile.ZipFile(zip_path, 'w', zipfile.ZIP_DEFLATED)
  for prebuilt in prebuilts:
    f.write(os.path.join(build_dir, prebuilt), prebuilt)
  f.close()

  cmd = [
    sys.executable,
    UPLOAD_SCRIPT,
    '--source_filepath=%s' % zip_path,
    '--dest_gsbase=%s' % GS_BUCKET
  ]
  if util.RunCommand(cmd):
    print '@@@STEP_FAILURE@@@'
Esempio n. 8
0
def Archive(revision):
  print '@@@BUILD_STEP archive@@@'
  prebuilts = ['libchromedriver2.so', 'chromedriver2_server',
               'chromedriver2_unittests', 'chromedriver2_tests']
  build_dir = chrome_paths.GetBuildDir(prebuilts[0:1])
  zip_name = 'chromedriver2_prebuilts_r%s.zip' % revision
  temp_dir = util.MakeTempDir()
  zip_path = os.path.join(temp_dir, zip_name)
  print 'Zipping prebuilts %s' % zip_path
  f = zipfile.ZipFile(zip_path, 'w', zipfile.ZIP_DEFLATED)
  for prebuilt in prebuilts:
    f.write(os.path.join(build_dir, prebuilt), prebuilt)
  f.close()

  gs_bucket = 'gs://chromedriver-prebuilts'
  cmd = [
    sys.executable,
    '../../../scripts/slave/skia/upload_to_bucket.py',
    '--source_filepath=%s' % zip_path,
    '--dest_gsbase=%s' % gs_bucket
  ]
  if util.RunCommand(cmd):
    print '@@@STEP_FAILURE@@@'
Esempio n. 9
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()

    chromedriver_map = {
        'win': 'chromedriver2.dll',
        'mac': 'chromedriver2.so',
        'linux': 'libchromedriver2.so',
    }
    chromedriver_name = chromedriver_map[util.GetPlatformName()]

    chrome_map = {
        'win': 'chrome.exe',
        'mac': 'Chromium.app/Contents/MacOS/Chromium',
        'linux': 'chrome',
    }
    chrome_name = chrome_map[util.GetPlatformName()]

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

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

    chromedriver = os.path.join(build_dir, chromedriver_name)
    chromedriver_server = os.path.join(build_dir, server_name)

    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,
                               android_package=options.android_package)
        code2 = RunJavaTests(chromedriver_server,
                             android_package=options.android_package)
        return code1 or code2
    else:
        chrome_tip_of_tree = os.path.join(build_dir, chrome_name)
        cpp_tests = os.path.join(build_dir, cpp_tests_name)

        chrome_26 = continuous_archive.DownloadChrome(
            continuous_archive.CHROME_26_REVISION, util.MakeTempDir())
        chrome_27 = continuous_archive.DownloadChrome(
            continuous_archive.CHROME_27_REVISION, util.MakeTempDir())
        chrome_path_versions = [
            {
                'path': chrome_tip_of_tree,
                'version': 'HEAD'
            },
            {
                'path': chrome_27,
                'version': '27'
            },
            {
                'path': chrome_26,
                'version': '26'
            },
        ]
        code = 0
        for chrome in chrome_path_versions:
            if options.chrome_version and chrome[
                    'version'] != options.chrome_version:
                continue

            code1 = RunPythonTests(chromedriver,
                                   chrome=chrome['path'],
                                   chrome_version=chrome['version'])
            code2 = RunJavaTests(chromedriver_server,
                                 chrome=chrome['path'],
                                 chrome_version=chrome['version'])
            code = code or code1 or code2
        return RunCppTests(cpp_tests) or code