Beispiel #1
0
def load_tests(options, requested_paths, excluded_paths):
    """
    Returns a tuple: (skipped_tests, test_list)
        skip_list: [iterable<Test>] Tests found but skipped.
        test_list: [iterable<Test>] Tests found that should be run.
    """
    import lib.manifest as manifest

    if options.js_shell is None:
        xul_tester = manifest.NullXULInfoTester()
    else:
        if options.xul_info_src is None:
            xul_info = manifest.XULInfo.create(options.js_shell)
        else:
            xul_abi, xul_os, xul_debug = options.xul_info_src.split(r":")
            xul_debug = xul_debug.lower() is "true"
            xul_info = manifest.XULInfo(xul_abi, xul_os, xul_debug)
        xul_tester = manifest.XULInfoTester(xul_info, options.js_shell)

    test_dir = dirname(abspath(__file__))
    test_list = manifest.load(test_dir, requested_paths, excluded_paths, xul_tester)
    skip_list = []

    if options.make_manifests:
        manifest.make_manifests(options.make_manifests, test_list)
        sys.exit()

    # Create a new test list. Apply each TBPL configuration to every test.
    flags_list = None
    if options.tbpl:
        flags_list = get_jitflags("all")
    elif options.tbpl_debug:
        flags_list = get_jitflags("debug")
    else:
        flags_list = get_jitflags(options.jitflags, none=None)

    if flags_list:
        new_test_list = []
        for test in test_list:
            for jitflags in flags_list:
                tmp_test = copy(test)
                tmp_test.jitflags = copy(test.jitflags)
                tmp_test.jitflags.extend(jitflags)
                new_test_list.append(tmp_test)
        test_list = new_test_list

    if options.test_file:
        paths = set()
        for test_file in options.test_file:
            paths |= set([line.strip() for line in open(test_file).readlines()])
        test_list = [_ for _ in test_list if _.path in paths]

    if options.no_extensions:
        pattern = os.sep + "extensions" + os.sep
        test_list = [_ for _ in test_list if pattern not in _.path]

    if not options.random:
        test_list = [_ for _ in test_list if not _.random]

    if options.run_only_skipped:
        options.run_skipped = True
        test_list = [_ for _ in test_list if not _.enable]

    if not options.run_slow_tests:
        test_list = [_ for _ in test_list if not _.slow]

    if not options.run_skipped:
        skip_list = [_ for _ in test_list if not _.enable]
        test_list = [_ for _ in test_list if _.enable]

    return skip_list, test_list
Beispiel #2
0
def load_tests(options, requested_paths, excluded_paths):
    """
    Returns a tuple: (test_count, test_gen)
        test_count: [int] Number of tests that will be in test_gen
        test_gen: [iterable<Test>] Tests found that should be run.
    """
    import lib.manifest as manifest

    if options.js_shell is None:
        xul_tester = manifest.NullXULInfoTester()
    else:
        if options.xul_info_src is None:
            xul_info = manifest.XULInfo.create(options.js_shell)
        else:
            xul_abi, xul_os, xul_debug = options.xul_info_src.split(r':')
            xul_debug = xul_debug.lower() == 'true'
            xul_info = manifest.XULInfo(xul_abi, xul_os, xul_debug)
        feature_args = shlex.split(options.feature_args)
        xul_tester = manifest.XULInfoTester(xul_info, options.js_shell, feature_args)

    test_dir = dirname(abspath(__file__))
    path_options = PathOptions(test_dir, requested_paths, excluded_paths)
    test_count = manifest.count_tests(test_dir, path_options)
    test_gen = manifest.load_reftests(test_dir, path_options, xul_tester)

    # WPT tests are already run in the browser in their own harness.
    wpt_enabled = (options.wpt == 'enabled' or
                   (options.wpt == 'if-running-everything' and
                    len(requested_paths) == 0 and
                    not options.make_manifests))
    if wpt_enabled:
        wpt_tests = load_wpt_tests(xul_tester,
                                   requested_paths,
                                   excluded_paths)
        test_count += len(wpt_tests)
        test_gen = chain(test_gen, wpt_tests)

    if options.test_reflect_stringify is not None:
        def trs_gen(tests):
            for test in tests:
                test.test_reflect_stringify = options.test_reflect_stringify
                # Even if the test is not normally expected to pass, we still
                # expect reflect-stringify to be able to handle it.
                test.expect = True
                test.random = False
                test.slow = False
                yield test
        test_gen = trs_gen(test_gen)

    if options.make_manifests:
        manifest.make_manifests(options.make_manifests, test_gen)
        sys.exit()

    # Create a new test list. Apply each TBPL configuration to every test.
    flags_list = None
    if options.tbpl:
        flags_list = get_jitflags('all')
    elif options.tbpl_debug:
        flags_list = get_jitflags('debug')
    else:
        flags_list = get_jitflags(options.jitflags, none=None)

    if flags_list:
        def flag_gen(tests):
            for test in tests:
                for jitflags in flags_list:
                    tmp_test = copy(test)
                    tmp_test.jitflags = copy(test.jitflags)
                    tmp_test.jitflags.extend(jitflags)
                    yield tmp_test
        test_count = test_count * len(flags_list)
        test_gen = flag_gen(test_gen)

    if options.test_file:
        paths = set()
        for test_file in options.test_file:
            paths |= set(
                [line.strip() for line in open(test_file).readlines()])
        test_gen = (_ for _ in test_gen if _.path in paths)

    if options.no_extensions:
        pattern = os.sep + 'extensions' + os.sep
        test_gen = (_ for _ in test_gen if pattern not in _.path)

    if not options.random:
        test_gen = (_ for _ in test_gen if not _.random)

    if options.run_only_skipped:
        options.run_skipped = True
        test_gen = (_ for _ in test_gen if not _.enable)

    if not options.run_slow_tests:
        test_gen = (_ for _ in test_gen if not _.slow)

    if options.repeat:
        test_gen = (test for test in test_gen for i in range(options.repeat))
        test_count *= options.repeat

    return test_count, test_gen
Beispiel #3
0
def load_tests(options, requested_paths, excluded_paths):
    """
    Returns a tuple: (skipped_tests, test_list)
        test_count: [int] Number of tests that will be in test_gen
        test_gen: [iterable<Test>] Tests found that should be run.
    """
    import lib.manifest as manifest

    if options.js_shell is None:
        xul_tester = manifest.NullXULInfoTester()
    else:
        if options.xul_info_src is None:
            xul_info = manifest.XULInfo.create(options.js_shell)
        else:
            xul_abi, xul_os, xul_debug = options.xul_info_src.split(r':')
            xul_debug = xul_debug.lower() is 'true'
            xul_info = manifest.XULInfo(xul_abi, xul_os, xul_debug)
        xul_tester = manifest.XULInfoTester(xul_info, options.js_shell)

    test_dir = dirname(abspath(__file__))
    test_count = manifest.count_tests(test_dir, requested_paths, excluded_paths)
    test_gen = manifest.load_reftests(test_dir, requested_paths, excluded_paths,
                                      xul_tester)

    if options.test_reflect_stringify is not None:
        def trs_gen(tests):
            for test in tests:
                test.test_reflect_stringify = options.test_reflect_stringify
                # Even if the test is not normally expected to pass, we still
                # expect reflect-stringify to be able to handle it.
                test.expect = True
                test.random = False
                test.slow = False
                yield test
        test_gen = trs_gen(test_gen)

    if options.make_manifests:
        manifest.make_manifests(options.make_manifests, test_gen)
        sys.exit()

    # Create a new test list. Apply each TBPL configuration to every test.
    flags_list = None
    if options.tbpl:
        flags_list = get_jitflags('all')
    elif options.tbpl_debug:
        flags_list = get_jitflags('debug')
    else:
        flags_list = get_jitflags(options.jitflags, none=None)

    if flags_list:
        def flag_gen(tests):
            for test in tests:
                for jitflags in flags_list:
                    tmp_test = copy(test)
                    tmp_test.jitflags = copy(test.jitflags)
                    tmp_test.jitflags.extend(jitflags)
                    yield tmp_test
        test_count = test_count * len(flags_list)
        test_gen = flag_gen(test_gen)

    if options.test_file:
        paths = set()
        for test_file in options.test_file:
            paths |= set(
                [line.strip() for line in open(test_file).readlines()])
        test_gen = (_ for _ in test_gen if _.path in paths)

    if options.no_extensions:
        pattern = os.sep + 'extensions' + os.sep
        test_gen = (_ for _ in test_gen if pattern not in _.path)

    if not options.random:
        test_gen = (_ for _ in test_gen if not _.random)

    if options.run_only_skipped:
        options.run_skipped = True
        test_gen = (_ for _ in test_gen if not _.enable)

    if not options.run_slow_tests:
        test_gen = (_ for _ in test_gen if not _.slow)

    if options.repeat:
        test_gen = (test for test in test_gen for i in range(options.repeat))
        test_count *= options.repeat

    return test_count, test_gen
Beispiel #4
0
def load_tests(options, requested_paths, excluded_paths):
    """
    Returns a tuple: (skipped_tests, test_list)
        test_count: [int] Number of tests that will be in test_gen
        test_gen: [iterable<Test>] Tests found that should be run.
    """
    import lib.manifest as manifest

    if options.js_shell is None:
        xul_tester = manifest.NullXULInfoTester()
    else:
        if options.xul_info_src is None:
            xul_info = manifest.XULInfo.create(options.js_shell)
        else:
            xul_abi, xul_os, xul_debug = options.xul_info_src.split(r':')
            xul_debug = xul_debug.lower() is 'true'
            xul_info = manifest.XULInfo(xul_abi, xul_os, xul_debug)
        xul_tester = manifest.XULInfoTester(xul_info, options.js_shell)

    test_dir = dirname(abspath(__file__))
    test_count = manifest.count_tests(test_dir, requested_paths,
                                      excluded_paths)
    test_gen = manifest.load(test_dir, requested_paths, excluded_paths,
                             xul_tester)

    if options.make_manifests:
        manifest.make_manifests(options.make_manifests, test_gen)
        sys.exit()

    # Create a new test list. Apply each TBPL configuration to every test.
    flags_list = None
    if options.tbpl:
        flags_list = get_jitflags('all')
    elif options.tbpl_debug:
        flags_list = get_jitflags('debug')
    else:
        flags_list = get_jitflags(options.jitflags, none=None)

    if flags_list:

        def flag_gen(tests):
            for test in tests:
                for jitflags in flags_list:
                    tmp_test = copy(test)
                    tmp_test.jitflags = copy(test.jitflags)
                    tmp_test.jitflags.extend(jitflags)
                    yield tmp_test

        test_count = test_count * len(flags_list)
        test_gen = flag_gen(test_gen)

    if options.test_file:
        paths = set()
        for test_file in options.test_file:
            paths |= set(
                [line.strip() for line in open(test_file).readlines()])
        test_gen = (_ for _ in test_gen if _.path in paths)

    if options.no_extensions:
        pattern = os.sep + 'extensions' + os.sep
        test_gen = (_ for _ in test_gen if pattern not in _.path)

    if not options.random:
        test_gen = (_ for _ in test_gen if not _.random)

    if options.run_only_skipped:
        options.run_skipped = True
        test_gen = (_ for _ in test_gen if not _.enable)

    if not options.run_slow_tests:
        test_gen = (_ for _ in test_gen if not _.slow)

    return test_count, test_gen
Beispiel #5
0
def load_tests(options, requested_paths, excluded_paths):
    """
    Returns a tuple: (skipped_tests, test_list)
        skip_list: [iterable<Test>] Tests found but skipped.
        test_list: [iterable<Test>] Tests found that should be run.
    """
    import lib.manifest as manifest

    if options.js_shell is None:
        xul_tester = manifest.NullXULInfoTester()
    else:
        if options.xul_info_src is None:
            xul_info = manifest.XULInfo.create(options.js_shell)
        else:
            xul_abi, xul_os, xul_debug = options.xul_info_src.split(r':')
            xul_debug = xul_debug.lower() is 'true'
            xul_info = manifest.XULInfo(xul_abi, xul_os, xul_debug)
        xul_tester = manifest.XULInfoTester(xul_info, options.js_shell)

    test_dir = os.path.dirname(os.path.abspath(__file__))
    test_list = manifest.load(test_dir, xul_tester)
    skip_list = []

    if options.make_manifests:
        manifest.make_manifests(options.make_manifests, test_list)
        sys.exit()

    # Create a new test list. Apply each JIT configuration to every test.
    if options.jitflags:
        new_test_list = []
        jitflags_list = parse_jitflags(options.jitflags)
        for test in test_list:
            for jitflags in jitflags_list:
                tmp_test = copy(test)
                tmp_test.options = copy(test.options)
                tmp_test.options.extend(jitflags)
                new_test_list.append(tmp_test)
        test_list = new_test_list

    if options.test_file:
        paths = set()
        for test_file in options.test_file:
            paths |= set(
                [line.strip() for line in open(test_file).readlines()])
        test_list = [_ for _ in test_list if _.path in paths]

    if requested_paths:

        def p(path):
            for arg in requested_paths:
                if path.find(arg) != -1:
                    return True
            return False

        test_list = [_ for _ in test_list if p(_.path)]

    if options.exclude_file:
        test_list = [_ for _ in test_list if _.path not in excluded_paths]

    if options.no_extensions:
        pattern = os.sep + 'extensions' + os.sep
        test_list = [_ for _ in test_list if pattern not in _.path]

    if not options.random:
        test_list = [_ for _ in test_list if not _.random]

    if options.run_only_skipped:
        options.run_skipped = True
        test_list = [_ for _ in test_list if not _.enable]

    if not options.run_slow_tests:
        test_list = [_ for _ in test_list if not _.slow]

    if not options.run_skipped:
        skip_list = [_ for _ in test_list if not _.enable]
        test_list = [_ for _ in test_list if _.enable]

    return skip_list, test_list
Beispiel #6
0
def load_tests(options, requested_paths, excluded_paths):
    """
    Returns a tuple: (skipped_tests, test_list)
        skip_list: [iterable<Test>] Tests found but skipped.
        test_list: [iterable<Test>] Tests found that should be run.
    """
    import lib.manifest as manifest

    if options.js_shell is None:
        xul_tester = manifest.NullXULInfoTester()
    else:
        if options.xul_info_src is None:
            xul_info = manifest.XULInfo.create(options.js_shell)
        else:
            xul_abi, xul_os, xul_debug = options.xul_info_src.split(r':')
            xul_debug = xul_debug.lower() is 'true'
            xul_info = manifest.XULInfo(xul_abi, xul_os, xul_debug)
        xul_tester = manifest.XULInfoTester(xul_info, options.js_shell)

    test_dir = dirname(abspath(__file__))
    test_list = manifest.load(test_dir, requested_paths, excluded_paths,
                              xul_tester)
    skip_list = []

    if options.make_manifests:
        manifest.make_manifests(options.make_manifests, test_list)
        sys.exit()

    # Create a new test list. Apply each TBPL configuration to every test.
    if options.tbpl:
        new_test_list = []
        flags_list = TBPL_FLAGS
        for test in test_list:
            for jitflags in flags_list:
                tmp_test = copy(test)
                tmp_test.options = copy(test.options)
                tmp_test.options.extend(jitflags)
                new_test_list.append(tmp_test)
        test_list = new_test_list

    if options.jitflags:
        print(
            "Warning: the --jitflags option is obsolete and does nothing now.")

    if options.test_file:
        paths = set()
        for test_file in options.test_file:
            paths |= set(
                [line.strip() for line in open(test_file).readlines()])
        test_list = [_ for _ in test_list if _.path in paths]

    if options.no_extensions:
        pattern = os.sep + 'extensions' + os.sep
        test_list = [_ for _ in test_list if pattern not in _.path]

    if not options.random:
        test_list = [_ for _ in test_list if not _.random]

    if options.run_only_skipped:
        options.run_skipped = True
        test_list = [_ for _ in test_list if not _.enable]

    if not options.run_slow_tests:
        test_list = [_ for _ in test_list if not _.slow]

    if not options.run_skipped:
        skip_list = [_ for _ in test_list if not _.enable]
        test_list = [_ for _ in test_list if _.enable]

    return skip_list, test_list
Beispiel #7
0
def load_tests(options, requested_paths, excluded_paths):
    """
    Returns a tuple: (skipped_tests, test_list)
        skip_list: [iterable<Test>] Tests found but skipped.
        test_list: [iterable<Test>] Tests found that should be run.
    """
    import lib.manifest as manifest

    if options.js_shell is None:
        xul_tester = manifest.NullXULInfoTester()
    else:
        if options.xul_info_src is None:
            xul_info = manifest.XULInfo.create(options.js_shell)
        else:
            xul_abi, xul_os, xul_debug = options.xul_info_src.split(r':')
            xul_debug = xul_debug.lower() is 'true'
            xul_info = manifest.XULInfo(xul_abi, xul_os, xul_debug)
        xul_tester = manifest.XULInfoTester(xul_info, options.js_shell)

    test_dir = dirname(abspath(__file__))
    test_list = manifest.load(test_dir, xul_tester)
    skip_list = []

    if options.make_manifests:
        manifest.make_manifests(options.make_manifests, test_list)
        sys.exit()

    # Create a new test list. Apply each JIT configuration to every test.
    if options.jitflags:
        new_test_list = []
        jitflags_list = parse_jitflags(options.jitflags)
        for test in test_list:
            for jitflags in jitflags_list:
                tmp_test = copy(test)
                tmp_test.options = copy(test.options)
                tmp_test.options.extend(jitflags)
                new_test_list.append(tmp_test)
        test_list = new_test_list

    if options.test_file:
        paths = set()
        for test_file in options.test_file:
            paths |= set([ line.strip() for line in open(test_file).readlines()])
        test_list = [ _ for _ in test_list if _.path in paths ]

    if requested_paths:
        def p(path):
            for arg in requested_paths:
                if path.find(arg) != -1:
                    return True
            return False
        test_list = [ _ for _ in test_list if p(_.path) ]

    if options.exclude_file:
        test_list = [_ for _ in test_list if _.path not in excluded_paths]

    if options.no_extensions:
        pattern = os.sep + 'extensions' + os.sep
        test_list = [_ for _ in test_list if pattern not in _.path]

    if not options.random:
        test_list = [ _ for _ in test_list if not _.random ]

    if options.run_only_skipped:
        options.run_skipped = True
        test_list = [ _ for _ in test_list if not _.enable ]

    if not options.run_slow_tests:
        test_list = [ _ for _ in test_list if not _.slow ]

    if not options.run_skipped:
        skip_list = [ _ for _ in test_list if not _.enable ]
        test_list = [ _ for _ in test_list if _.enable ]

    return skip_list, test_list