Пример #1
0
    def list_tests(self, options):
        import 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_dirs = [
            "ecma_5", "js1_1", "js1_2", "js1_3", "js1_4", "js1_5", "js1_6",
            "js1_7", "js1_8", "js1_8_1", "js1_8_5"
        ]
        tc_list = []
        ESCARGOT_SKIP = "// escargot-skip:"
        ESCARGOT_TIMEOUT = "// escargot-timeout:"
        ESCARGOT_ENV = "// escargot-env:"
        for test_dir in test_dirs:
            for (path, dir,
                 files) in os.walk(os.path.join(self.base_dir, test_dir)):
                dir.sort()
                files.sort()
                for filename in files:
                    ext = os.path.splitext(filename)[-1]
                    if ext == self._suffix():
                        if filename.find("shell") == -1:
                            filepath = os.path.join(path, filename)
                            with open(filepath, "r") as f:
                                first_line = f.readline()
                                ignore = first_line.startswith(ESCARGOT_SKIP)
                                ignore_reason = None
                                if ignore:
                                    ignore_reason = first_line[
                                        len(ESCARGOT_SKIP):].strip()
                                filewise_timeout = first_line.startswith(
                                    ESCARGOT_TIMEOUT)
                                timeout = options.timeout
                                if filewise_timeout:
                                    timeout = int(
                                        first_line[len(ESCARGOT_TIMEOUT
                                                       ):].strip())
                                filewise_env = first_line.startswith(
                                    ESCARGOT_ENV)
                                env = None
                                if filewise_env:
                                    env = json.loads(
                                        first_line[len(ESCARGOT_ENV):].strip())
                            test = Test(filepath, ignore, ignore_reason,
                                        timeout, env)
                            manifest._parse_test_header(
                                filepath, test, xul_tester)
                            tc_list.append(test)
        return tc_list
Пример #2
0
            OPTIONS.manifest = filename
        else:
            print >> sys.stderr, 'no manifest file given and defaults not found'
            sys.exit(2)

    import manifest
    if JS is None:
        xul_tester = manifest.NullXULInfoTester()
    else:
        if OPTIONS.xul_info_src is None:
            xul_info = manifest.XULInfo.create(JS)
        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, JS)
    test_list = manifest.parse(OPTIONS.manifest, xul_tester)
    skipped_list = []

    if OPTIONS.check_manifest:
        manifest.check_manifest(test_list)
        if JS is None:
            sys.exit()

    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]