def main(): OPTIONS = parse_options(sys.argv[1:]) is_cygwin = sys.platform == 'cygwin' chrome_binary = None # Default to the downloaded / pinned Chromium binary downloaded_chrome_binary = devtools_paths.downloaded_chrome_binary_path() if check_chrome_binary(downloaded_chrome_binary): chrome_binary = downloaded_chrome_binary # Override with the arg value if provided. if OPTIONS.chrome_binary: chrome_binary = OPTIONS.chrome_binary if not check_chrome_binary(chrome_binary): print('Unable to find a Chrome binary at \'%s\'' % chrome_binary) sys.exit(1) if (chrome_binary is None): print('Unable to run, no Chrome binary provided') sys.exit(1) print('Using Chromium binary (%s)\n' % chrome_binary) errors_found = False try: errors_found = compile_typescript_test_files() if (errors_found): raise Exception('Typescript failed to compile') errors_found = run_e2e_test(chrome_binary) except Exception as err: print(err) if errors_found: print('ERRORS DETECTED') sys.exit(1)
def run_unit_tests_on_ninja_build_target(target, no_text_coverage=True, coverage=False, chrome_binary=None): if chrome_binary and not test_helpers.check_chrome_binary(chrome_binary): print( 'Chrome binary argument path does not exist or is not executable, reverting to downloaded binary' ) chrome_binary = None if not chrome_binary: # Default to the downloaded / pinned Chromium binary downloaded_chrome_binary = devtools_paths.downloaded_chrome_binary_path( ) if test_helpers.check_chrome_binary(downloaded_chrome_binary): chrome_binary = downloaded_chrome_binary if (chrome_binary is None): print('Unable to run, no Chrome binary provided') sys.exit(1) print('Using Chromium binary (%s)\n' % chrome_binary) errors_found = run_tests(chrome_binary, target, no_text_coverage, coverage) if errors_found: print('ERRORS DETECTED') sys.exit(1)
def run_test(): OPTIONS = parse_options(sys.argv[1:]) is_cygwin = sys.platform == 'cygwin' chrome_binary = None test_suite = None chrome_features = None # Default to the downloaded / pinned Chromium binary downloaded_chrome_binary = devtools_paths.downloaded_chrome_binary_path() if test_helpers.check_chrome_binary(downloaded_chrome_binary): chrome_binary = downloaded_chrome_binary # Override with the arg value if provided. if OPTIONS.chrome_binary: chrome_binary = OPTIONS.chrome_binary if not test_helpers.check_chrome_binary(chrome_binary): print('Unable to find a Chrome binary at \'%s\'' % chrome_binary) sys.exit(1) if OPTIONS.chrome_features: chrome_features = '--enable-features=%s' % OPTIONS.chrome_features if (chrome_binary is None): print('Unable to run, no Chrome binary provided') sys.exit(1) if (OPTIONS.test_suite is None): print('Unable to run, no test suite provided') sys.exit(1) test_suite = OPTIONS.test_suite test_file = OPTIONS.test_file print('Using Chromium binary ({}{})\n'.format(chrome_binary, ' ' + chrome_features if chrome_features else '')) print('Using Test Suite (%s)\n' % test_suite) print('Using target (%s)\n' % OPTIONS.target) if test_file is not None: print('Testing file (%s)' % test_file) cwd = devtools_paths.devtools_root_path() test_suite_path = os.path.join(cwd, 'out', OPTIONS.target, 'gen', 'test', test_suite) errors_found = False try: errors_found = run_tests(chrome_binary, chrome_features, test_suite_path, test_suite, test_file=test_file) except Exception as err: print(err) if errors_found: print('ERRORS DETECTED') sys.exit(1)
def run_dark_mode_generator(file_path): chrome_binary = devtools_paths.downloaded_chrome_binary_path() exec_command = [ devtools_paths.node_path(), 'scripts/dark_mode/generate_dark_theme_sheet.js', chrome_binary, file_path ] process = subprocess.Popen(exec_command) process.communicate()
def run_test(): OPTIONS = parse_options(sys.argv[1:]) is_cygwin = sys.platform == 'cygwin' chrome_binary = None test_suite = None # Default to the downloaded / pinned Chromium binary downloaded_chrome_binary = devtools_paths.downloaded_chrome_binary_path() if test_helpers.check_chrome_binary(downloaded_chrome_binary): chrome_binary = downloaded_chrome_binary # Override with the arg value if provided. if OPTIONS.chrome_binary: chrome_binary = OPTIONS.chrome_binary if not test_helpers.check_chrome_binary(chrome_binary): print('Unable to find a Chrome binary at \'%s\'' % chrome_binary) sys.exit(1) if (chrome_binary is None): print('Unable to run, no Chrome binary provided') sys.exit(1) if (OPTIONS.test_suite is None): print('Unable to run, no test suite provided') sys.exit(1) test_suite = OPTIONS.test_suite print('Using Chromium binary (%s)\n' % chrome_binary) print('Using Test Suite (%s)\n' % test_suite) cwd = devtools_paths.devtools_root_path() shared_path = os.path.join(cwd, 'test', 'shared') test_suite_path = os.path.join(cwd, 'test', test_suite) typescript_paths = [{ 'name': 'shared', 'path': shared_path }, { 'name': 'suite', 'path': test_suite_path }] errors_found = False try: errors_found = compile_typescript(typescript_paths) if (errors_found): raise Exception('Typescript failed to compile') test_suite_list_path = os.path.join(test_suite_path, 'test-list.js') errors_found = run_tests(chrome_binary, test_suite_list_path) except Exception as err: print(err) if errors_found: print('ERRORS DETECTED') sys.exit(1)
def run_unit_tests_on_ninja_build_target(target, no_text_coverage=True, no_html_coverage=True, coverage=False, expanded_reporting=False, chrome_binary=None, cwd=None, mocha_fgrep=None): if chrome_binary and not test_helpers.check_chrome_binary(chrome_binary): print( 'Chrome binary argument path does not exist or is not executable, reverting to downloaded binary' ) chrome_binary = None if not chrome_binary: # Default to the downloaded / pinned Chromium binary downloaded_chrome_binary = devtools_paths.downloaded_chrome_binary_path( ) if test_helpers.check_chrome_binary(downloaded_chrome_binary): chrome_binary = downloaded_chrome_binary if (chrome_binary is None): print('Unable to run, no Chrome binary provided') sys.exit(1) print('Using Chromium binary (%s)' % chrome_binary) if not cwd: cwd = devtools_paths.devtools_root_path() print('Running tests from %s\n' % cwd) errors_found = run_tests(chrome_binary, target, no_text_coverage, no_html_coverage, coverage, expanded_reporting, cwd, mocha_fgrep) if coverage and not no_html_coverage: print('') print( ' You can see the coverage results by opening \033[1mkarma-coverage/index.html\033[0m in a browser' ) print('') if errors_found: print('ERRORS DETECTED') if not expanded_reporting: print('') print( ' Run with \033[1m--expanded-reporting\033[0m to get better information about why the tests failed.' ) print('') sys.exit(1)
def main(): chrome_binary = None # Default to the downloaded / pinned Chromium binary downloaded_chrome_binary = devtools_paths.downloaded_chrome_binary_path() if test_helpers.check_chrome_binary(downloaded_chrome_binary): chrome_binary = downloaded_chrome_binary if (chrome_binary is None): print('Unable to run, no Chrome binary provided') sys.exit(1) print('Using Chromium binary (%s)\n' % chrome_binary) errors_found = run_tests(chrome_binary) if errors_found: print('ERRORS DETECTED') sys.exit(1)
def run_unit_tests_on_ninja_build_target(target, no_text_coverage=True): chrome_binary = None # Default to the downloaded / pinned Chromium binary downloaded_chrome_binary = devtools_paths.downloaded_chrome_binary_path() if test_helpers.check_chrome_binary(downloaded_chrome_binary): chrome_binary = downloaded_chrome_binary if (chrome_binary is None): print('Unable to run, no Chrome binary provided') sys.exit(1) print('Using Chromium binary (%s)\n' % chrome_binary) errors_found = run_tests(chrome_binary, target, no_text_coverage) if errors_found: print('ERRORS DETECTED') sys.exit(1)
def main(): OPTIONS = parse_options(sys.argv[1:]) is_cygwin = sys.platform == 'cygwin' chrome_binary = None # Default to the downloaded / pinned Chromium binary downloaded_chrome_binary = devtools_paths.downloaded_chrome_binary_path() if check_chrome_binary(downloaded_chrome_binary): chrome_binary = downloaded_chrome_binary # Override with the arg value if provided. if OPTIONS.chrome_binary: chrome_binary = OPTIONS.chrome_binary if not check_chrome_binary(chrome_binary): print('Unable to find a Chrome binary at \'%s\'' % chrome_binary) sys.exit(1) if (chrome_binary is None): print('Unable to run, no Chrome binary provided') sys.exit(1) runs = 37 if OPTIONS.runs: runs = int(OPTIONS.runs) print('Running boot perf test with %s iteration(s). This may take some time...' % runs) print('Using Chromium binary (%s)\n' % chrome_binary) errors_found = False hosted_mode_pid = None try: hosted_mode_pid = start_hosted_mode_server() errors_found = run_boot_perf_test(chrome_binary, runs) except Exception as err: print(err) finally: stop_hosted_mode_server(hosted_mode_pid) if errors_found: print('ERRORS DETECTED') sys.exit(1)
def run_test(): OPTIONS = parse_options(sys.argv[1:]) is_cygwin = sys.platform == 'cygwin' chrome_binary = None test_suite = None chrome_features = None # Default to the downloaded / pinned Chromium binary downloaded_chrome_binary = devtools_paths.downloaded_chrome_binary_path() if test_helpers.check_chrome_binary(downloaded_chrome_binary): chrome_binary = downloaded_chrome_binary # Override with the arg value if provided. if OPTIONS.chrome_binary: chrome_binary = OPTIONS.chrome_binary if not test_helpers.check_chrome_binary(chrome_binary): print('Unable to find a Chrome binary at \'%s\'' % chrome_binary) sys.exit(1) if OPTIONS.chrome_features: chrome_features = OPTIONS.chrome_features if (chrome_binary is None): print('Unable to run, no Chrome binary provided') sys.exit(1) if OPTIONS.jobs: jobs = OPTIONS.jobs test_file = OPTIONS.test_file test_patterns = OPTIONS.test_patterns if test_file: test_patterns.append(test_file) print('Using Chromium binary ({}{})\n'.format( chrome_binary, ' ' + chrome_features if chrome_features else '')) print('Using target (%s)\n' % OPTIONS.target) if test_file is not None: print( 'The test_file argument is obsolete, just pass the filename as positional argument' ) if test_patterns: print('Testing file(s) (%s)' % ', '.join(test_patterns)) cwd = OPTIONS.cwd target = OPTIONS.target node_modules_path = OPTIONS.node_modules_path print('Running tests from %s\n' % cwd) test_suite_path_input = OPTIONS.test_suite_path test_suite = OPTIONS.test_suite test_suite_parts = None if test_suite: # test-suite is deprecated and will be removed, but we support it for now to not break the bots until their recipes are updated. test_suite_parts = ['gen', 'test', test_suite] elif test_suite_path_input: # We take the input with Linux path separators, but need to split and join to make sure this works on Windows. test_suite_parts = test_suite_path_input.split('/') else: print( 'Unable to run, require one of --test-suite or --test-suite-path to be provided.' ) sys.exit(1) print('Using Test Suite (%s)\n' % os.path.join(*test_suite_parts)) test_suite_path = os.path.join(os.path.abspath(cwd), 'out', OPTIONS.target, *test_suite_parts) errors_found = False try: errors_found = run_tests(chrome_binary, chrome_features, test_suite_path, test_suite, jobs, target, cwd, node_modules_path, test_patterns=test_patterns) except Exception as err: print(err) if errors_found: print('ERRORS DETECTED') sys.exit(1)