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
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
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.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: def repeat_gen(tests): for test in tests: for i in range(options.repeat): yield test test_gen = repeat_gen(test_gen) test_count *= options.repeat return test_count, test_gen