Example #1
0
def run_tests(chrome_binary,
              chrome_features,
              test_suite_path,
              test_suite,
              jobs,
              server,
              test_file=None):
    env = os.environ.copy()
    env['CHROME_BIN'] = chrome_binary
    if chrome_features:
        env['CHROME_FEATURES'] = chrome_features

    if test_file is not None:
        env['TEST_FILE'] = test_file

    if jobs:
        env['JOBS'] = jobs

    env['SERVER'] = server
    cwd = devtools_paths.devtools_root_path()
    exec_command = [
        devtools_paths.node_path(),
        devtools_paths.mocha_path(),
        '--config',
        os.path.join(test_suite_path, '.mocharc.js'),
    ]

    exit_code = test_helpers.popen(exec_command, cwd=cwd, env=env)
    if exit_code != 0:
        return True

    return False
def run_tests(chrome_binary, target, no_text_coverage, coverage):
    cwd = devtools_paths.devtools_root_path()
    karmaconfig_path = os.path.join(cwd, 'out', target, 'gen', 'test',
                                    'unittests', 'front_end', 'karma.conf.js')

    if not os.path.exists(karmaconfig_path):
        print('Unable to find Karma config at ' + karmaconfig_path)
        print(
            'Make sure to set the --ninja-build-name argument to the folder name of "out/target"'
        )
        sys.exit(1)

    print('Using karma config ' + karmaconfig_path)

    exec_command = [
        devtools_paths.node_path(),
        devtools_paths.karma_path(), 'start',
        test_helpers.to_platform_path_exact(karmaconfig_path)
    ]

    env = os.environ.copy()
    env['NODE_PATH'] = devtools_paths.node_path()
    if (no_text_coverage is not False):
        env['NO_TEXT_COVERAGE'] = '1'
    if (coverage is True):
        env['COVERAGE'] = '1'
    if (chrome_binary is not None):
        env['CHROME_BIN'] = chrome_binary

    exit_code = test_helpers.popen(exec_command, cwd=cwd, env=env)
    if exit_code == 1:
        return True

    return False
def run_tests(chrome_binary, chrome_features, test_suite, test_suite_list_path, test_file=None):
    env = os.environ.copy()
    env['CHROME_BIN'] = chrome_binary
    env['TEST_LIST'] = test_suite_list_path
    if chrome_features:
        env['CHROME_FEATURES'] = chrome_features

    if test_file is not None:
        env['TEST_FILE'] = test_file

    cwd = devtools_paths.devtools_root_path()
    if test_suite == 'e2e':
        exec_command = [
            devtools_paths.node_path(),
            devtools_paths.mocha_path(),
            '--config',
            E2E_MOCHA_CONFIGURATION_LOCATION,
        ]
    else:
        runner_path = os.path.join(cwd, 'test', 'shared', 'runner.js')
        exec_command = [devtools_paths.node_path(), runner_path]

    exit_code = test_helpers.popen(exec_command, cwd=cwd, env=env)
    if exit_code != 0:
        return True

    return False
def compile_typescript(typescript_targets):
    for target in typescript_targets:
        print("Compiling %s TypeScript" % (target['name']))
        exec_command = [devtools_paths.node_path(), devtools_paths.typescript_compiler_path(), '-p', target['path']]
        exit_code = test_helpers.popen(exec_command)
        if exit_code != 0:
            return True

    return False
Example #5
0
def run_tests(chrome_binary, test_suite_list_path):
    env = os.environ.copy()
    env['CHROME_BIN'] = chrome_binary
    env['TEST_LIST'] = test_suite_list_path

    cwd = devtools_paths.devtools_root_path()
    runner_path = os.path.join(cwd, 'test', 'shared', 'runner.js')
    exec_command = [devtools_paths.node_path(), runner_path]

    exit_code = test_helpers.popen(exec_command, cwd=cwd, env=env)
    if exit_code != 0:
        return True

    return False
def run_tests(chrome_binary,
              chrome_features,
              test_suite_path,
              test_suite,
              jobs,
              target,
              cwd=None,
              node_modules_path=None,
              test_patterns=None):
    env = os.environ.copy()
    env['CHROME_BIN'] = chrome_binary
    if chrome_features:
        env['CHROME_FEATURES'] = chrome_features

    if test_patterns:
        env['TEST_PATTERNS'] = ';'.join(test_patterns)

    if jobs:
        env['JOBS'] = jobs

    if target:
        env['TARGET'] = target

    if node_modules_path is not None:
        # Node requires the path to be absolute
        env['NODE_PATH'] = os.path.abspath(node_modules_path)

    if not cwd:
        cwd = devtools_paths.devtools_root_path()

    exec_command = [devtools_paths.node_path()]

    if 'DEBUG' in env:
        exec_command.append('--inspect')

    exec_command = exec_command + [
        devtools_paths.mocha_path(),
        '--config',
        os.path.join(test_suite_path, '.mocharc.js'),
    ]

    exit_code = test_helpers.popen(exec_command, cwd=cwd, env=env)
    if exit_code != 0:
        return True

    return False
Example #7
0
def run_tests(chrome_binary):
    cwd = devtools_paths.devtools_root_path()
    karmaconfig_path = os.path.join(cwd, 'karma.conf.js')

    exec_command = [
        devtools_paths.node_path(),
        devtools_paths.karma_path(), 'start',
        test_helpers.to_platform_path_exact(karmaconfig_path)
    ]

    env = os.environ.copy()
    env['NODE_PATH'] = devtools_paths.node_path()
    if (chrome_binary is not None):
        env['CHROME_BIN'] = chrome_binary

    exit_code = test_helpers.popen(exec_command, cwd=cwd, env=env)
    if exit_code == 1:
        return True

    return False
Example #8
0
def run_tests(chrome_binary, target, no_text_coverage, no_html_coverage,
              coverage, expanded_reporting, cwd, mocha_fgrep):
    karmaconfig_path = os.path.join(cwd, 'out', target, 'gen', 'test',
                                    'unittests', 'karma.conf.js')

    if not os.path.exists(karmaconfig_path):
        print('Unable to find Karma config at ' + karmaconfig_path)
        print(
            'Make sure to set the --ninja-build-name argument to the folder name of "out/target"'
        )
        sys.exit(1)

    print('Using karma config ' + karmaconfig_path)

    exec_command = [
        devtools_paths.node_path(),
        devtools_paths.karma_path(), 'start',
        test_helpers.to_platform_path_exact(karmaconfig_path)
    ]

    env = os.environ.copy()
    env['NODE_PATH'] = devtools_paths.node_path()
    if (no_text_coverage is not False):
        env['NO_TEXT_COVERAGE'] = '1'
    if (no_html_coverage is not False):
        env['NO_HTML_COVERAGE'] = '1'
    if (coverage is True):
        env['COVERAGE'] = '1'
    if (expanded_reporting is True):
        env['EXPANDED_REPORTING'] = '1'
    if (chrome_binary is not None):
        env['CHROME_BIN'] = chrome_binary
    if (mocha_fgrep is not None):
        print('Using Mocha --fgrep flag ' + mocha_fgrep)
        env['MOCHA_FGREP'] = mocha_fgrep
    exit_code = test_helpers.popen(exec_command, cwd=cwd, env=env)
    if exit_code == 1:
        return True

    return False