def DownloadChrome(version_name, revision, download_site): util.MarkBuildStepStart('download %s' % version_name) try: temp_dir = util.MakeTempDir() return (temp_dir, archive.DownloadChrome(revision, temp_dir, download_site)) except Exception: traceback.print_exc() util.AddBuildStepText('Skip Java and Python tests') util.MarkBuildStepError() return (None, None)
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], ['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 = archive.DownloadChrome(version[1], util.MakeTempDir(), 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
def DownloadChrome(version_name, revision, download_site): util.MarkBuildStepStart('download %s' % version_name) return archive.DownloadChrome(revision, util.MakeTempDir(), download_site)