• Home
Name Date Size #Lines LOC

..--

CI_tests.txtD07-Sep-2024215.1 KiB3,9733,972

README.mdD07-Sep-20248.1 KiB185149

babel-preprocessor.jsD07-Sep-2024966 3316

config.pyD07-Sep-20245 KiB133104

dynamicImport_tests.txtD07-Sep-202425.5 KiB534534

es2015_tests.txtD07-Sep-2024416.2 KiB6,9156,915

es2021_tests.txtD07-Sep-2024270.7 KiB3,4583,458

es2022_tests.txtD07-Sep-2024252.1 KiB2,8562,855

es2023_tests.txtD07-Sep-202419.2 KiB299286

es2abc_skip_tests.jsonD07-Sep-202411.3 KiB172171

es5_tests.txtD07-Sep-2024411.6 KiB8,4588,458

eshost.patchD07-Sep-20249.2 KiB313296

force_gc_skip_tests.jsonD07-Sep-20245 KiB6564

harness.patchD07-Sep-20247.2 KiB243227

intl_skip_tests.jsonD07-Sep-20242 KiB4039

intl_tests.txtD07-Sep-202451.2 KiB895895

module_tests.txtD07-Sep-202423.6 KiB685684

run_sunspider.pyD07-Sep-202428.6 KiB720609

run_test262.pyD07-Sep-202424.8 KiB708583

skip_tests.jsonD07-Sep-2024111.3 KiB1,6251,624

ts2abc_skip_tests.jsonD07-Sep-202489.3 KiB987986

utils.pyD07-Sep-20245.1 KiB190135

README.md

1## File overview:
2```
3es5_tests.txt:  This file contains a list of ES5 test cases. If useful cases are found missing, you can add them as needed.
4es2015_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.
5es2021_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.
6intl_tests.txt:  This file contains a list of internationalization test cases. If you find useful cases missing, you can add them as needed.
7skip_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.
8intl_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.
9```
10
11## 1. Compile ts2abc and ark_js_vm project
12```
13./build.sh --product-name hispark_taurus_standard --build-target ark_js_vm --build-target ark_ts2abc_build
14```
15
16## 2 Run test cases
17
18### 2.1 Options
19```
20usage: run_test262.py [-h] [--dir DIR] [--file FILE] [--mode [{1,2,3}]]
21                      [--es51] [--es2015 [{all,only}]] [--esnext]
22                      [--engine FILE] [--babel] [--timeout TIMEOUT]
23                      [--threads THREADS] [--hostArgs HOSTARGS]
24                      [--ark-aot]
25                      [--ark-aot-tool ARK_AOT_TOOL]
26                      [--ark-tool ARK_TOOL]
27                      [--ark-frontend-tool ARK_FRONTEND_TOOL]
28                      [--libs-dir LIBS_DIR]
29                      [--ark-frontend [{ts2panda,es2panda}]]
30
31optional arguments:
32  -h, --help            Show this help message and exit
33  --dir DIR             Directory to test
34  --file FILE           File to test
35  --mode [{1,2,3}]      selection information as: 1: only default 2:
36                        only strict mode 3: both default and strict mode
37  --es51                Run test262 ES5.1 version
38  --es2015 [{all,only}]
39                        Run test262 - ES2015. all: Contains all use cases for
40                        ES5 and ES2015, only: Only include use cases for
41                        ES2015
42  --esnext              Run test262 - ES.next.
43  --engine FILE         Other engine binarys to run tests with
44                        (as:d8,hermes,jsc,qjs...)
45  --babel               Whether to use Babel conversion
46  --timeout TIMEOUT     Set a custom test timeout in milliseconds !!!
47  --threads THREADS     Run this many tests in parallel. Note that the browser
48                        runners don't work great with t > 1.
49  --hostArgs HOSTARGS   command-line arguments to pass to eshost host
50  --ark-aot             Run test262 with aot
51  --ark-aot-tool ARK_AOT_TOOL
52                        ark's aot tool
53  --ark-tool ARK_TOOL   ark's binary tool
54  --ark-frontend-tool ARK_FRONTEND_TOOL
55                        ark frontend conversion tool
56  --libs-dir LIBS_DIR   The path collection of dependent so, divided by':'
57  --ark-frontend [{ts2panda,es2panda}]
58                        Choose one of them
59```
60
61### 2.2 Run all the test cases
62
63```
64python3 test262/run_test262.py
65```
66
67### 2.3 Run `es51` related test cases
68
69```python
70python3 test262/run_test262.py --es51
71```
72
73After the execution finished, a directory named `test_es51` is created under directory `test262/data` , which is used to store all `es51` cases.
74
75### 2.4 Run `es2015` related test cases
76#### 2.4.1 only include use cases for ES2015
77```python
78python3 test262/run_test262.py --es2015 only
79```
80#### 2.4.2  Contains all use cases for ES5 and ES2015
81```python
82python3 test262/run_test262.py --es2015 all
83```
84
85### 2.5 Run single test case
86
87```python
88python3 test262/run_test262.py --file test262/data/test_es5/language/statements/break/12.8-1.js
89```
90
91### 2.6 Run all the test cases under specified directory
92
93```python
94python3 test262/run_test262.py --dir test262/data/test_es5/language/statements
95```
96
97### 2.7 Run single test case with other engines. Take d8 as an example
98
99```python
100 python3 test262/run_test262.py --engine="/home/share/v8-code/v8/out.gn/x64.release/d8" --file test262/data/test_es5/language/statements/break/12.8-1.js
101```
102### 2.8 Run single test case with `babel` conversion
103```
104python3 test262/run_test262.py  --babel --file test262/data/test_es5/language/statements/break/12.8-1.js
105```
106
107### 2.9 Get test result
108
109take the following code as an example:
110
111```shell
112zgy@lfgphicprd23154:/home/share/OpenHarmony2.0_20210604/ark/ts2abc$ python3 -B test262/run_test262.py --file test262/data/test_es51/language/statements/break/12.8-1.js
113
114Wait a moment..........
115
11607-30 16:56:03.857383 D:>>>       command: npm install | dir: /home/share/OpenHarmony2.0_20210604/out/ohos-arm-release/clang_x64/arkcompiler/ets_frontend/build/src/..
117npm WARN ts2panda@1.0.0 No description
118npm WARN ts2panda@1.0.0 No repository field.
119npm WARN ts2panda@1.0.0 No license field.
120npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
121npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
122
123up to date in 2.225s
124
12528 packages are looking for funding
126  run `npm fund` for details
127
12807-30 16:56:06.746184 D:>>>       command: npm install | dir: test262/eshost
129up to date in 1.446s
130
1311 package is looking for funding
132  run `npm fund` for details
133
13407-30 16:56:08.767037 D:>>>       command: npm install | dir: test262/harness
135up to date in 2.412s
13607-30 16:56:11.836409 D:>>>       command: git checkout -- . | dir: test262/data
13707-30 16:56:12.012115 D:>>>       command: git checkout 9ca13b12728b7e0089c7eb03fa2bd17f8abe297f | dir: test262/data
138HEAD is now at 9ca13b1272 Fix typo in BigIntArray property descriptor test
13907-30 16:56:12.275768 D:>>>       command: git checkout -- . | dir: test262/eshost
14007-30 16:56:12.280134 D:>>>       command: git apply ../eshost.patch | dir: test262/eshost
14107-30 16:56:12.283263 D:>>>       command: git checkout -- . | dir: test262/harness
14207-30 16:56:12.288134 D:>>>       command: git apply ../harness.patch | dir: test262/harness
143Test command:
144        node
145        test262/harness/bin/run.js
146        --hostType=panda
147        --hostPath=python3
148        --hostArgs='-B test262/run_sunspider.py --ark-tool=/home/share/OpenHarmony2.0_20210604/out/ohos-arm-release/clang_x64/arkcompiler/ets_runtime/ark_js_vm --ark-frontend-tool=/home/share/OpenHarmony2.0_20210604/out/ohos-arm-release/clang_x64/arkcompiler/ets_frontend/build/src/index.js --libs-dir=/home/share/OpenHarmony2.0_20210604/out/ohos-arm-release/clang_x64/arkcompiler/ets_runtime:/home/share/OpenHarmony2.0_20210604/out/ohos-arm-release/clang_x64/global/i18n_standard:/home/share/OpenHarmony2.0_20210604/prebuilts/clang/ohos/linux-x86_64/llvm/lib/ --ark-frontend=ts2panda '
149        --threads=15
150        --mode=only strict mode
151        --timeout=60000
152        --tempDir=out/test262
153        --test262Dir=test262/data
154        --saveCompiledTests
155        test262/data/test_es51/language/statements/break/12.8-1.js
156
157FAIL test262/data/test_es51/language/statements/break/12.8-1.js (strict mode)
158
159Ran 1 tests
1600 passed
1611 failed
162used time is: 0:00:13.303865
163```
164
165* `default` indicates `non-strict` mode; `strict mode` indicates the strict mode.
166
167* After the execution finished, the following files are generated under directory `out/test262/` (you can specified it in `test262/config.py`):
168
169```
170-rw-rw-r-- 1 zgy zgy 7583 Nov 21 18:18 12.8-1-default.abc
171-rw-rw-r-- 1 zgy zgy 415 Nov 21 18:18 12.8-1.js.panda.default.err
172-rw-rw-r-- 1 zgy zgy 4389 Nov 21 18:18 12.8-1.js.panda.default.fail
173-rw-rw-r-- 1 zgy zgy 415 Nov 21 18:18 12.8-1.js.panda.strict.err
174-rw-rw-r-- 1 zgy zgy 4403 Nov 21 18:18 12.8-1.js.panda.strict.fail
175-rw-rw-r-- 1 zgy zgy 7601 Nov 21 18:18 12.8-1-strict.abc
176```
177
178`.abc` indicates the generated binary `abc` file.
179
180`.err` indicates that an error occurred during the test.
181
182`.fail/.pass` is the file saved after `js` file has been preprocessed.
183
184The `result.txt` file is generated under directory `out/test262` to save statistics after the test finished.
185