Esempio n. 1
0
def main():
    options, js_shell, requested_paths, excluded_paths = parse_args()
    skip_list, test_list = load_tests(options, js_shell, requested_paths, excluded_paths)

    if not test_list:
        print 'no tests selected'
        return 1

    test_dir = os.path.dirname(os.path.abspath(__file__))

    if options.debug:
        if len(test_list) > 1:
            print('Multiple tests match command line arguments, debugger can only run one')
            for tc in test_list:
                print('    %s'%tc.path)
            return 2

        cmd = test_list[0].get_command(TestCase.js_cmd_prefix)
        if options.show_cmd:
            print list2cmdline(cmd)
        if test_dir not in ('', '.'):
            os.chdir(test_dir)
        call(cmd)
        return 0

    curdir = os.getcwd()
    if test_dir not in ('', '.'):
        os.chdir(test_dir)

    results = None
    try:
        results = ResultsSink(ResultsSink.output_file, options)
        for t in skip_list:
            results.push(NullTestOutput(t))
        run_tests(options, test_list, results)
    finally:
        os.chdir(curdir)

    if ResultsSink.output_file != sys.stdout:
        ResultsSink.output_file.close()

    if results is None or not results.all_passed():
        return 1

    return 0
Esempio n. 2
0
        cmd = test_list[0].get_command(TestCase.js_cmd_prefix)
        if OPTIONS.show_cmd:
            print list2cmdline(cmd)
        manifest_dir = os.path.dirname(OPTIONS.manifest)
        if manifest_dir not in ('', '.'):
            os.chdir(manifest_dir)
        call(cmd)
        sys.exit()

    curdir = os.getcwd()
    manifest_dir = os.path.dirname(OPTIONS.manifest)
    if manifest_dir not in ('', '.'):
        os.chdir(manifest_dir)

    results = None
    try:
        results = ResultsSink(output_file, OPTIONS)
        run_tests(test_list, results)
    finally:
        os.chdir(curdir)

    for t in skipped_list:
        results.push(NullTestOutput(t))

    if output_file != sys.stdout:
        output_file.close()

    if results is None or not results.all_passed():
        sys.exit(1)
Esempio n. 3
0
        cmd = test_list[0].get_command(TestCase.js_cmd_prefix)
        if OPTIONS.show_cmd:
            print list2cmdline(cmd)
        manifest_dir = os.path.dirname(OPTIONS.manifest)
        if manifest_dir not in ('', '.'):
            os.chdir(manifest_dir)
        call(cmd)
        sys.exit()

    curdir = os.getcwd()
    manifest_dir = os.path.dirname(OPTIONS.manifest)
    if manifest_dir not in ('', '.'):
        os.chdir(manifest_dir)

    results = None
    try:
        results = ResultsSink(output_file, OPTIONS)
        run_tests(test_list, results)
    finally:
        os.chdir(curdir)

    for t in skipped_list:
        results.push(NullTestOutput(t))

    if output_file != sys.stdout:
        output_file.close()

    if results is None or not results.all_passed():
        sys.exit(1)