diff options
Diffstat (limited to 'chromium/third_party/catapult/catapult_build/run_dev_server_tests.py')
-rw-r--r-- | chromium/third_party/catapult/catapult_build/run_dev_server_tests.py | 55 |
1 files changed, 31 insertions, 24 deletions
diff --git a/chromium/third_party/catapult/catapult_build/run_dev_server_tests.py b/chromium/third_party/catapult/catapult_build/run_dev_server_tests.py index 44f51a30994..025a50cd2b1 100644 --- a/chromium/third_party/catapult/catapult_build/run_dev_server_tests.py +++ b/chromium/third_party/catapult/catapult_build/run_dev_server_tests.py @@ -133,20 +133,23 @@ def GetChromeInfo(args): raise ChromeNotFound('Could not find chrome locally. You can supply it ' 'manually using --chrome_path') return ChromeInfo(path=chrome_path, version=None) + channel = args.channel + if sys.version_info.major == 3: + target = 'linux' else: - channel = args.channel - if sys.platform == 'linux2' and channel == 'canary': - channel = 'dev' - assert channel in ['stable', 'beta', 'dev', 'canary'] + target = 'linux2' + if sys.platform == target and channel == 'canary': + channel = 'dev' + assert channel in ['stable', 'beta', 'dev', 'canary'] - binary = 'chrome' - print('Fetching the', channel, binary, 'binary via the binary_manager.') - chrome_manager = binary_manager.BinaryManager([CHROME_BINARIES_CONFIG]) - os_name, arch = dependency_util.GetOSAndArchForCurrentDesktopPlatform() - chrome_path, version = chrome_manager.FetchPathWithVersion( - '%s_%s' % (binary, channel), os_name, arch) - print('Finished fetching the', binary, 'binary to', chrome_path) - return ChromeInfo(path=chrome_path, version=version) + binary = 'chrome' + print('Fetching the', channel, binary, 'binary via the binary_manager.') + chrome_manager = binary_manager.BinaryManager([CHROME_BINARIES_CONFIG]) + os_name, arch = dependency_util.GetOSAndArchForCurrentDesktopPlatform() + chrome_path, version = chrome_manager.FetchPathWithVersion( + '%s_%s' % (binary, channel), os_name, arch) + print('Finished fetching the', binary, 'binary to', chrome_path) + return ChromeInfo(path=chrome_path, version=version) def KillProcess(process): @@ -190,7 +193,8 @@ def RunTests(args, chrome_path): if sys.platform != 'win32': output = server_process.stderr.readline() port = re.search( - r'Now running on http://127.0.0.1:([\d]+)', output).group(1) + r'Now running on http://127.0.0.1:([\d]+)', + output.decode('utf-8')).group(1) if xvfb.ShouldStartXvfb(): print('Starting xvfb...') xvfb_process = xvfb.StartXvfb() @@ -204,12 +208,15 @@ def RunTests(args, chrome_path): '--window-size=1280,1024', '--enable-logging', '--v=1', '--enable-features=ForceWebRequestProxyForTest', - '--enable-blink-features=CustomElementsV0,' - 'HTMLImports,ShadowDOMV0', '--force-device-scale-factor=1', - ('http://localhost:%s/%s/tests.html?' % (port, args.tests)) + - 'headless=true&testTypeToRun=all', + '--use-mock-keychain', ] + if args.extra_chrome_args: + chrome_command.extend(args.extra_chrome_args.strip('"').split(' ')) + chrome_command.append( + ('http://localhost:%s/%s/tests.html?' % (port, args.tests)) + + 'headless=true&testTypeToRun=all') + print('Starting Chrome at path %s...' % chrome_path) chrome_process = subprocess.Popen( chrome_command, stdout=sys.stdout, stderr=sys.stderr) @@ -239,12 +246,11 @@ def RunTests(args, chrome_path): if timed_out: print('Tests did not finish before', args.timeout_sec, 'seconds') return _TIMEOUT_RETURNCODE + if server_process.returncode == 0: + print("Tests passed in %.2f seconds." % (time.time() - test_start_time)) else: - if server_process.returncode == 0: - print("Tests passed in %.2f seconds." % (time.time() - test_start_time)) - else: - logging.error('Tests failed!') - return server_process.returncode + logging.error('Tests failed!') + return server_process.returncode finally: if timer: @@ -298,6 +304,8 @@ def Main(argv): parser.add_argument('--timeout-retries', type=int, default=0, help='Number of times to retry if tests time out.' 'Default 0 (no retries)') + parser.add_argument('--extra-chrome-args', type=str, + help='Extra args to pass to chrome.') parser.set_defaults(install_hooks=True) parser.set_defaults(use_local_chrome=True) args = parser.parse_args(argv[1:]) @@ -322,8 +330,7 @@ def Main(argv): if return_code == _TIMEOUT_RETURNCODE: attempts_left -= 1 continue - else: - break + break else: logging.error('Tests timed out every time. Retried %d times.', args.timeout_retries) |