From cecce420755c308753ac362f16e062f7da7aefc1 Mon Sep 17 00:00:00 2001 From: zhangyouyou Date: Fri, 10 Jun 2022 10:23:08 +0800 Subject: [PATCH] https://gitee.com/openharmony/ark_js_runtime/issues/I5BKUG Signed-off-by: zhangyouyou --- test262/README.md | 1 + test262/config.py | 2 + test262/es2021_tests.txt | 92 ++++++++++++++++++++++++++++++++++++++++ test262/run_test262.py | 53 +++++++++++++++++------ 4 files changed, 136 insertions(+), 12 deletions(-) create mode 100644 test262/es2021_tests.txt diff --git a/test262/README.md b/test262/README.md index 758d7f7f9a..51c3e85b41 100644 --- a/test262/README.md +++ b/test262/README.md @@ -2,6 +2,7 @@ ``` es5_tests.txt: This file contains a list of ES5 test cases. If useful cases are found missing, you can add them as needed. es2015_tests.txt: This file contains a full list of use cases of ES2015 except those filtered out with'es6id'. If useful cases are found missing, you can add them as needed. +es2021_tests.txt: This file contains a full list of use cases of ES2021 except those filtered out with'es6id'. If useful cases are found missing, you can add them as needed. intl_tests.txt: This file contains a list of internationalization test cases. If you find useful cases missing, you can add them as needed. skip_tests.json: This file contains a list of use cases that do not meet the requirements. If useful cases are found missing, you can add them according to the specified format. intl_skip_tests.json: This file contains a list of non-compliant internationalization use cases. If useful cases are found to be missing, they can be added in the specified format. diff --git a/test262/config.py b/test262/config.py index 2f09754edb..bd87d40b4b 100755 --- a/test262/config.py +++ b/test262/config.py @@ -39,6 +39,7 @@ DEFAULT_MODE = 2 TEST_ES5_DIR = os.path.join(DATA_DIR, "test_es51") TEST_ES2015_DIR = os.path.join(DATA_DIR, "test_es2015") +TEST_ES2021_DIR = os.path.join(DATA_DIR, "test_es2021") TEST_INTL_DIR = os.path.join(DATA_DIR, "test_intl") TEST_CI_DIR = os.path.join(DATA_DIR, "test_CI") @@ -57,6 +58,7 @@ DEFAULT_TIMEOUT = 60000 ES5_LIST_FILE = os.path.join("test262", "es5_tests.txt") ES2015_LIST_FILE = os.path.join("test262", "es2015_tests.txt") INTL_LIST_FILE = os.path.join("test262", "intl_tests.txt") +ES2021_LIST_FILE = os.path.join("test262", "es2021_tests.txt") CI_LIST_FILE = os.path.join("test262", "CI_tests.txt") MODULE_FILES_LIST = os.path.join("test262", "module_tests.txt") diff --git a/test262/es2021_tests.txt b/test262/es2021_tests.txt new file mode 100644 index 0000000000..ad67188b12 --- /dev/null +++ b/test262/es2021_tests.txt @@ -0,0 +1,92 @@ +built-ins/String/prototype/matchAll/regexp-get-matchAll-throws.js +built-ins/String/prototype/matchAll/not-a-constructor.js +built-ins/String/prototype/matchAll/flags-undefined-throws.js +built-ins/String/prototype/matchAll/flags-nonglobal-throws.js +built-ins/String/prototype/matchAll/length.js +built-ins/String/prototype/matchAll/name.js +built-ins/String/prototype/matchAll/prop-desc.js +built-ins/String/prototype/matchAll/regexp-is-null.js +built-ins/String/prototype/matchAll/regexp-is-undefined-or-null-invokes-matchAll.js +built-ins/String/prototype/matchAll/regexp-matchAll-invocation.js +built-ins/String/prototype/matchAll/regexp-is-undefined.js +built-ins/String/prototype/matchAll/regexp-matchAll-throws.js +built-ins/String/prototype/matchAll/regexp-matchAll-is-undefined-or-null.js +built-ins/String/prototype/matchAll/regexp-prototype-get-matchAll-throws.js +built-ins/String/prototype/matchAll/regexp-prototype-has-no-matchAll.js +built-ins/String/prototype/matchAll/regexp-matchAll-not-callable.js +built-ins/String/prototype/matchAll/regexp-prototype-matchAll-invocation.js +built-ins/String/prototype/matchAll/regexp-prototype-matchAll-throws.js +built-ins/String/prototype/matchAll/this-val-non-obj-coercible.js +built-ins/String/prototype/matchAll/toString-this-val.js +built-ins/String/prototype/padStart/exception-fill-string-symbol.js +built-ins/String/prototype/padStart/exception-not-object-coercible.js +built-ins/String/prototype/padStart/fill-string-empty.js +built-ins/String/prototype/padStart/exception-symbol.js +built-ins/String/prototype/padStart/fill-string-omitted.js +built-ins/String/prototype/padStart/fill-string-non-strings.js +built-ins/String/prototype/padStart/function-name.js +built-ins/String/prototype/padStart/function-length.js +built-ins/String/prototype/padStart/max-length-not-greater-than-string.js +built-ins/String/prototype/padStart/normal-operation.js +built-ins/String/prototype/padStart/not-a-constructor.js +built-ins/String/prototype/padStart/function-property-descriptor.js +built-ins/String/prototype/padStart/observable-operations.js +built-ins/String/prototype/padEnd/exception-fill-string-symbol.js +built-ins/String/prototype/padEnd/fill-string-non-strings.js +built-ins/String/prototype/padEnd/fill-string-empty.js +built-ins/String/prototype/padEnd/exception-symbol.js +built-ins/String/prototype/padEnd/fill-string-omitted.js +built-ins/String/prototype/padEnd/exception-not-object-coercible.js +built-ins/String/prototype/padEnd/function-length.js +built-ins/String/prototype/padEnd/function-name.js +built-ins/String/prototype/padEnd/max-length-not-greater-than-string.js +built-ins/String/prototype/padEnd/observable-operations.js +built-ins/String/prototype/padEnd/not-a-constructor.js +built-ins/String/prototype/padEnd/normal-operation.js +built-ins/String/prototype/padEnd/function-property-descriptor.js +built-ins/String/prototype/trimStart/this-value-line-terminator.js +built-ins/String/prototype/trimStart/not-a-constructor.js +built-ins/String/prototype/trimStart/this-value-not-obj-coercible.js +built-ins/String/prototype/trimStart/this-value-boolean.js +built-ins/String/prototype/trimStart/this-value-number.js +built-ins/String/prototype/trimStart/prop-desc.js +built-ins/String/prototype/trimStart/length.js +built-ins/String/prototype/trimStart/name.js +built-ins/String/prototype/trimStart/this-value-object-toprimitive-call-err.js +built-ins/String/prototype/trimStart/this-value-object-toprimitive-meth-err.js +built-ins/String/prototype/trimStart/this-value-object-cannot-convert-to-primitive-err.js +built-ins/String/prototype/trimStart/this-value-object-toprimitive-meth-priority.js +built-ins/String/prototype/trimStart/this-value-object-toprimitive-returns-object-err.js +built-ins/String/prototype/trimStart/this-value-object-tostring-meth-err.js +built-ins/String/prototype/trimStart/this-value-object-tostring-call-err.js +built-ins/String/prototype/trimStart/this-value-object-tostring-meth-priority.js +built-ins/String/prototype/trimStart/this-value-object-tostring-returns-object-err.js +built-ins/String/prototype/trimStart/this-value-object-valueof-meth-err.js +built-ins/String/prototype/trimStart/this-value-symbol-typeerror.js +built-ins/String/prototype/trimStart/this-value-object-valueof-call-err.js +built-ins/String/prototype/trimStart/this-value-object-valueof-returns-object-err.js +built-ins/String/prototype/trimStart/this-value-object-valueof-meth-priority.js +built-ins/String/prototype/trimStart/this-value-whitespace.js +built-ins/String/prototype/trimEnd/this-value-boolean.js +built-ins/String/prototype/trimEnd/not-a-constructor.js +built-ins/String/prototype/trimEnd/this-value-line-terminator.js +built-ins/String/prototype/trimEnd/this-value-number.js +built-ins/String/prototype/trimEnd/this-value-not-obj-coercible.js +built-ins/String/prototype/trimEnd/length.js +built-ins/String/prototype/trimEnd/name.js +built-ins/String/prototype/trimEnd/prop-desc.js +built-ins/String/prototype/trimEnd/this-value-object-toprimitive-call-err.js +built-ins/String/prototype/trimEnd/this-value-object-cannot-convert-to-primitive-err.js +built-ins/String/prototype/trimEnd/this-value-object-toprimitive-returns-object-err.js +built-ins/String/prototype/trimEnd/this-value-object-toprimitive-meth-err.js +built-ins/String/prototype/trimEnd/this-value-object-toprimitive-meth-priority.js +built-ins/String/prototype/trimEnd/this-value-object-tostring-call-err.js +built-ins/String/prototype/trimEnd/this-value-object-tostring-meth-err.js +built-ins/String/prototype/trimEnd/this-value-object-tostring-meth-priority.js +built-ins/String/prototype/trimEnd/this-value-object-valueof-call-err.js +built-ins/String/prototype/trimEnd/this-value-object-tostring-returns-object-err.js +built-ins/String/prototype/trimEnd/this-value-object-valueof-meth-err.js +built-ins/String/prototype/trimEnd/this-value-symbol-typeerror.js +built-ins/String/prototype/trimEnd/this-value-object-valueof-meth-priority.js +built-ins/String/prototype/trimEnd/this-value-object-valueof-returns-object-err.js +built-ins/String/prototype/trimEnd/this-value-whitespace.js \ No newline at end of file diff --git a/test262/run_test262.py b/test262/run_test262.py index c7c54692e0..5896a57c86 100755 --- a/test262/run_test262.py +++ b/test262/run_test262.py @@ -44,15 +44,19 @@ def parse_args(): '3: both default and strict mode\n') parser.add_argument('--es51', action='store_true', help='Run test262 ES5.1 version') - parser.add_argument('--es2015', default=False, const='all', + parser.add_argument('--es2021', default=False, const='all', nargs='?', choices=['all', 'only'], - help='Run test262 - ES2015. ' + - 'all: Contains all use cases for ES5 and ES2015' + - 'only: Only include use cases for ES2015') + help='Run test262 - ES2021. ' + + 'all: Contains all use cases for es5_tests and es2015_tests and es2021_tests and intl_tests' + + 'only: Only include use cases for ES2021') parser.add_argument('--intl', default=False, const='intl', nargs='?', choices=['intl'], help='Run test262 - Intltest. ' + 'intl: Only include use cases for intlcsae') + parser.add_argument('--es2015', default=False, const='es2015', + nargs='?', choices=['es2015'], + help='Run test262 - es2015. ' + + 'es2015: Only include use cases for es2015') parser.add_argument('--ci-build', action='store_true', help='Run test262 ES2015 filter cases for build version') parser.add_argument('--esnext', action='store_true', @@ -125,6 +129,7 @@ def init(args): remove_dir(TEST_ES5_DIR) remove_dir(TEST_ES2015_DIR) remove_dir(TEST_INTL_DIR) + remove_dir(TEST_ES2021_DIR) remove_dir(TEST_CI_DIR) get_all_skip_tests(SKIP_LIST_FILE) get_intl_skip_tests(INTL_SKIP_LIST_FILE) @@ -209,22 +214,26 @@ class TestPrepare(): git_clean(HARNESS_DIR) git_apply("../harness.patch", HARNESS_DIR) - def prepare_args_es51_es2015(self): + def prepare_args_es51_es2021(self): if self.args.dir: if TEST_ES5_DIR in self.args.dir: self.args.es51 = True elif TEST_ES2015_DIR in self.args.dir: - self.args.es2015 = "all" + self.args.es2015 = "es2015" elif TEST_INTL_DIR in self.args.dir: self.args.intl = "intl" + elif TEST_ES2021_DIR in self.args.dir: + self.args.es2021 = "all" if self.args.file: if TEST_ES5_DIR in self.args.file: self.args.es51 = True elif TEST_ES2015_DIR in self.args.file: - self.args.es2015 = "all" + self.args.es2015 = "es2015" elif TEST_INTL_DIR in self.args.file: self.args.intl = "intl" + elif TEST_ES2021_DIR in self.args.file: + self.args.es2021 = "all" def prepare_out_dir(self): if self.args.es51: @@ -233,6 +242,8 @@ class TestPrepare(): self.out_dir = os.path.join(BASE_OUT_DIR, "test_es2015") elif self.args.intl: self.out_dir = os.path.join(BASE_OUT_DIR, "test_intl") + elif self.args.es2021: + self.out_dir = os.path.join(BASE_OUT_DIR, "test_es2021") elif self.args.ci_build: self.out_dir = os.path.join(BASE_OUT_DIR, "test_CI") else: @@ -248,6 +259,8 @@ class TestPrepare(): self.args.dir = TEST_ES2015_DIR elif self.args.intl: self.args.dir = TEST_INTL_DIR + elif self.args.es2021: + self.args.dir = TEST_ES2021_DIR elif self.args.ci_build: self.args.dir = TEST_CI_DIR else: @@ -268,6 +281,8 @@ class TestPrepare(): dstdir = os.path.join(TEST_ES2015_DIR, file) elif self.args.intl: dstdir = os.path.join(TEST_INTL_DIR, file) + elif self.args.es2021: + dstdir = os.path.join(TEST_ES2021_DIR, file) elif self.args.ci_build: dstdir = os.path.join(TEST_CI_DIR, file) subprocess.getstatusoutput("cp %s %s" % (srcdir, dstdir)) @@ -279,7 +294,7 @@ class TestPrepare(): esid = "" if self.args.es51: esid = "es5id" - elif self.args.es2015: + elif self.args.es2021: esid = "es6id" for file_name in file_names: @@ -294,13 +309,14 @@ class TestPrepare(): files = fopen.readlines() return files - def prepare_es2015_tests(self): + def prepare_es2021_tests(self): files = [] files = self.collect_tests() - files.extend(self.get_tests_from_file(ES2015_LIST_FILE)) - if self.args.es2015 == "all": + files.extend(self.get_tests_from_file(ES2021_LIST_FILE)) + if self.args.es2021 == "all": files.extend(self.get_tests_from_file(ES5_LIST_FILE)) files.extend(self.get_tests_from_file(INTL_LIST_FILE)) + files.extend(self.get_tests_from_file(ES2015_LIST_FILE)) return files def prepare_intl_tests(self): @@ -309,6 +325,13 @@ class TestPrepare(): if self.args.intl: files = self.get_tests_from_file(INTL_LIST_FILE) return files + + def prepare_es2015_tests(self): + files = [] + files = self.collect_tests() + if self.args.es2015: + files = self.get_tests_from_file(ES2015_LIST_FILE) + return files def prepare_test_suit(self): files = [] @@ -322,6 +345,9 @@ class TestPrepare(): elif self.args.intl: test_dir = TEST_INTL_DIR files = self.prepare_intl_tests() + elif self.args.es2021: + test_dir = TEST_ES2021_DIR + files = self.prepare_es2021_tests() elif self.args.ci_build: test_dir = TEST_CI_DIR files = self.get_tests_from_file(CI_LIST_FILE) @@ -347,6 +373,9 @@ class TestPrepare(): elif self.args.intl: self.prepare_test_suit() src_dir = TEST_INTL_DIR + elif self.args.es2021: + self.prepare_test_suit() + src_dir = TEST_ES2021_DIR elif self.args.ci_build: self.prepare_test_suit() src_dir = TEST_CI_DIR @@ -367,7 +396,7 @@ class TestPrepare(): self.prepare_test262_code() self.prepare_clean_data() self.patching_the_plugin() - self.prepare_args_es51_es2015() + self.prepare_args_es51_es2021() self.prepare_out_dir() self.prepare_args_testdir() self.prepare_test262_test() -- Gitee