13af6ab5fSopenharmony_ci## File overview: 23af6ab5fSopenharmony_ci``` 33af6ab5fSopenharmony_cies5_tests.txt: This file contains a list of ES5 test cases. If useful cases are found missing, you can add them as needed. 43af6ab5fSopenharmony_cies2015_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. 53af6ab5fSopenharmony_cies2021_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. 63af6ab5fSopenharmony_ciintl_tests.txt: This file contains a list of internationalization test cases. If you find useful cases missing, you can add them as needed. 73af6ab5fSopenharmony_ciskip_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. 83af6ab5fSopenharmony_ciintl_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. 93af6ab5fSopenharmony_ci``` 103af6ab5fSopenharmony_ci 113af6ab5fSopenharmony_ci## 1. Compile ts2abc and ark_js_vm project 123af6ab5fSopenharmony_ci``` 133af6ab5fSopenharmony_ci./build.sh --product-name hispark_taurus_standard --build-target ark_js_vm --build-target ark_ts2abc_build 143af6ab5fSopenharmony_ci``` 153af6ab5fSopenharmony_ci 163af6ab5fSopenharmony_ci## 2 Run test cases 173af6ab5fSopenharmony_ci 183af6ab5fSopenharmony_ci### 2.1 Options 193af6ab5fSopenharmony_ci``` 203af6ab5fSopenharmony_ciusage: run_test262.py [-h] [--dir DIR] [--file FILE] [--mode [{1,2,3}]] 213af6ab5fSopenharmony_ci [--es51] [--es2015 [{all,only}]] [--esnext] 223af6ab5fSopenharmony_ci [--engine FILE] [--babel] [--timeout TIMEOUT] 233af6ab5fSopenharmony_ci [--threads THREADS] [--hostArgs HOSTARGS] 243af6ab5fSopenharmony_ci [--ark-aot] 253af6ab5fSopenharmony_ci [--ark-aot-tool ARK_AOT_TOOL] 263af6ab5fSopenharmony_ci [--ark-tool ARK_TOOL] 273af6ab5fSopenharmony_ci [--ark-frontend-tool ARK_FRONTEND_TOOL] 283af6ab5fSopenharmony_ci [--libs-dir LIBS_DIR] 293af6ab5fSopenharmony_ci [--ark-frontend [{ts2panda,es2panda}]] 303af6ab5fSopenharmony_ci 313af6ab5fSopenharmony_cioptional arguments: 323af6ab5fSopenharmony_ci -h, --help Show this help message and exit 333af6ab5fSopenharmony_ci --dir DIR Directory to test 343af6ab5fSopenharmony_ci --file FILE File to test 353af6ab5fSopenharmony_ci --mode [{1,2,3}] selection information as: 1: only default 2: 363af6ab5fSopenharmony_ci only strict mode 3: both default and strict mode 373af6ab5fSopenharmony_ci --es51 Run test262 ES5.1 version 383af6ab5fSopenharmony_ci --es2015 [{all,only}] 393af6ab5fSopenharmony_ci Run test262 - ES2015. all: Contains all use cases for 403af6ab5fSopenharmony_ci ES5 and ES2015, only: Only include use cases for 413af6ab5fSopenharmony_ci ES2015 423af6ab5fSopenharmony_ci --esnext Run test262 - ES.next. 433af6ab5fSopenharmony_ci --engine FILE Other engine binarys to run tests with 443af6ab5fSopenharmony_ci (as:d8,hermes,jsc,qjs...) 453af6ab5fSopenharmony_ci --babel Whether to use Babel conversion 463af6ab5fSopenharmony_ci --timeout TIMEOUT Set a custom test timeout in milliseconds !!! 473af6ab5fSopenharmony_ci --threads THREADS Run this many tests in parallel. Note that the browser 483af6ab5fSopenharmony_ci runners don't work great with t > 1. 493af6ab5fSopenharmony_ci --hostArgs HOSTARGS command-line arguments to pass to eshost host 503af6ab5fSopenharmony_ci --ark-aot Run test262 with aot 513af6ab5fSopenharmony_ci --ark-aot-tool ARK_AOT_TOOL 523af6ab5fSopenharmony_ci ark's aot tool 533af6ab5fSopenharmony_ci --ark-tool ARK_TOOL ark's binary tool 543af6ab5fSopenharmony_ci --ark-frontend-tool ARK_FRONTEND_TOOL 553af6ab5fSopenharmony_ci ark frontend conversion tool 563af6ab5fSopenharmony_ci --libs-dir LIBS_DIR The path collection of dependent so, divided by':' 573af6ab5fSopenharmony_ci --ark-frontend [{ts2panda,es2panda}] 583af6ab5fSopenharmony_ci Choose one of them 593af6ab5fSopenharmony_ci``` 603af6ab5fSopenharmony_ci 613af6ab5fSopenharmony_ci### 2.2 Run all the test cases 623af6ab5fSopenharmony_ci 633af6ab5fSopenharmony_ci``` 643af6ab5fSopenharmony_cipython3 test262/run_test262.py 653af6ab5fSopenharmony_ci``` 663af6ab5fSopenharmony_ci 673af6ab5fSopenharmony_ci### 2.3 Run `es51` related test cases 683af6ab5fSopenharmony_ci 693af6ab5fSopenharmony_ci```python 703af6ab5fSopenharmony_cipython3 test262/run_test262.py --es51 713af6ab5fSopenharmony_ci``` 723af6ab5fSopenharmony_ci 733af6ab5fSopenharmony_ciAfter the execution finished, a directory named `test_es51` is created under directory `test262/data` , which is used to store all `es51` cases. 743af6ab5fSopenharmony_ci 753af6ab5fSopenharmony_ci### 2.4 Run `es2015` related test cases 763af6ab5fSopenharmony_ci#### 2.4.1 only include use cases for ES2015 773af6ab5fSopenharmony_ci```python 783af6ab5fSopenharmony_cipython3 test262/run_test262.py --es2015 only 793af6ab5fSopenharmony_ci``` 803af6ab5fSopenharmony_ci#### 2.4.2 Contains all use cases for ES5 and ES2015 813af6ab5fSopenharmony_ci```python 823af6ab5fSopenharmony_cipython3 test262/run_test262.py --es2015 all 833af6ab5fSopenharmony_ci``` 843af6ab5fSopenharmony_ci 853af6ab5fSopenharmony_ci### 2.5 Run single test case 863af6ab5fSopenharmony_ci 873af6ab5fSopenharmony_ci```python 883af6ab5fSopenharmony_cipython3 test262/run_test262.py --file test262/data/test_es5/language/statements/break/12.8-1.js 893af6ab5fSopenharmony_ci``` 903af6ab5fSopenharmony_ci 913af6ab5fSopenharmony_ci### 2.6 Run all the test cases under specified directory 923af6ab5fSopenharmony_ci 933af6ab5fSopenharmony_ci```python 943af6ab5fSopenharmony_cipython3 test262/run_test262.py --dir test262/data/test_es5/language/statements 953af6ab5fSopenharmony_ci``` 963af6ab5fSopenharmony_ci 973af6ab5fSopenharmony_ci### 2.7 Run single test case with other engines. Take d8 as an example 983af6ab5fSopenharmony_ci 993af6ab5fSopenharmony_ci```python 1003af6ab5fSopenharmony_ci 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 1013af6ab5fSopenharmony_ci``` 1023af6ab5fSopenharmony_ci### 2.8 Run single test case with `babel` conversion 1033af6ab5fSopenharmony_ci``` 1043af6ab5fSopenharmony_cipython3 test262/run_test262.py --babel --file test262/data/test_es5/language/statements/break/12.8-1.js 1053af6ab5fSopenharmony_ci``` 1063af6ab5fSopenharmony_ci 1073af6ab5fSopenharmony_ci### 2.9 Get test result 1083af6ab5fSopenharmony_ci 1093af6ab5fSopenharmony_citake the following code as an example: 1103af6ab5fSopenharmony_ci 1113af6ab5fSopenharmony_ci```shell 1123af6ab5fSopenharmony_cizgy@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 1133af6ab5fSopenharmony_ci 1143af6ab5fSopenharmony_ciWait a moment.......... 1153af6ab5fSopenharmony_ci 1163af6ab5fSopenharmony_ci07-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/.. 1173af6ab5fSopenharmony_cinpm WARN ts2panda@1.0.0 No description 1183af6ab5fSopenharmony_cinpm WARN ts2panda@1.0.0 No repository field. 1193af6ab5fSopenharmony_cinpm WARN ts2panda@1.0.0 No license field. 1203af6ab5fSopenharmony_cinpm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents): 1213af6ab5fSopenharmony_cinpm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) 1223af6ab5fSopenharmony_ci 1233af6ab5fSopenharmony_ciup to date in 2.225s 1243af6ab5fSopenharmony_ci 1253af6ab5fSopenharmony_ci28 packages are looking for funding 1263af6ab5fSopenharmony_ci run `npm fund` for details 1273af6ab5fSopenharmony_ci 1283af6ab5fSopenharmony_ci07-30 16:56:06.746184 D:>>> command: npm install | dir: test262/eshost 1293af6ab5fSopenharmony_ciup to date in 1.446s 1303af6ab5fSopenharmony_ci 1313af6ab5fSopenharmony_ci1 package is looking for funding 1323af6ab5fSopenharmony_ci run `npm fund` for details 1333af6ab5fSopenharmony_ci 1343af6ab5fSopenharmony_ci07-30 16:56:08.767037 D:>>> command: npm install | dir: test262/harness 1353af6ab5fSopenharmony_ciup to date in 2.412s 1363af6ab5fSopenharmony_ci07-30 16:56:11.836409 D:>>> command: git checkout -- . | dir: test262/data 1373af6ab5fSopenharmony_ci07-30 16:56:12.012115 D:>>> command: git checkout 9ca13b12728b7e0089c7eb03fa2bd17f8abe297f | dir: test262/data 1383af6ab5fSopenharmony_ciHEAD is now at 9ca13b1272 Fix typo in BigIntArray property descriptor test 1393af6ab5fSopenharmony_ci07-30 16:56:12.275768 D:>>> command: git checkout -- . | dir: test262/eshost 1403af6ab5fSopenharmony_ci07-30 16:56:12.280134 D:>>> command: git apply ../eshost.patch | dir: test262/eshost 1413af6ab5fSopenharmony_ci07-30 16:56:12.283263 D:>>> command: git checkout -- . | dir: test262/harness 1423af6ab5fSopenharmony_ci07-30 16:56:12.288134 D:>>> command: git apply ../harness.patch | dir: test262/harness 1433af6ab5fSopenharmony_ciTest command: 1443af6ab5fSopenharmony_ci node 1453af6ab5fSopenharmony_ci test262/harness/bin/run.js 1463af6ab5fSopenharmony_ci --hostType=panda 1473af6ab5fSopenharmony_ci --hostPath=python3 1483af6ab5fSopenharmony_ci --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 ' 1493af6ab5fSopenharmony_ci --threads=15 1503af6ab5fSopenharmony_ci --mode=only strict mode 1513af6ab5fSopenharmony_ci --timeout=60000 1523af6ab5fSopenharmony_ci --tempDir=out/test262 1533af6ab5fSopenharmony_ci --test262Dir=test262/data 1543af6ab5fSopenharmony_ci --saveCompiledTests 1553af6ab5fSopenharmony_ci test262/data/test_es51/language/statements/break/12.8-1.js 1563af6ab5fSopenharmony_ci 1573af6ab5fSopenharmony_ciFAIL test262/data/test_es51/language/statements/break/12.8-1.js (strict mode) 1583af6ab5fSopenharmony_ci 1593af6ab5fSopenharmony_ciRan 1 tests 1603af6ab5fSopenharmony_ci0 passed 1613af6ab5fSopenharmony_ci1 failed 1623af6ab5fSopenharmony_ciused time is: 0:00:13.303865 1633af6ab5fSopenharmony_ci``` 1643af6ab5fSopenharmony_ci 1653af6ab5fSopenharmony_ci* `default` indicates `non-strict` mode; `strict mode` indicates the strict mode. 1663af6ab5fSopenharmony_ci 1673af6ab5fSopenharmony_ci* After the execution finished, the following files are generated under directory `out/test262/` (you can specified it in `test262/config.py`): 1683af6ab5fSopenharmony_ci 1693af6ab5fSopenharmony_ci``` 1703af6ab5fSopenharmony_ci-rw-rw-r-- 1 zgy zgy 7583 Nov 21 18:18 12.8-1-default.abc 1713af6ab5fSopenharmony_ci-rw-rw-r-- 1 zgy zgy 415 Nov 21 18:18 12.8-1.js.panda.default.err 1723af6ab5fSopenharmony_ci-rw-rw-r-- 1 zgy zgy 4389 Nov 21 18:18 12.8-1.js.panda.default.fail 1733af6ab5fSopenharmony_ci-rw-rw-r-- 1 zgy zgy 415 Nov 21 18:18 12.8-1.js.panda.strict.err 1743af6ab5fSopenharmony_ci-rw-rw-r-- 1 zgy zgy 4403 Nov 21 18:18 12.8-1.js.panda.strict.fail 1753af6ab5fSopenharmony_ci-rw-rw-r-- 1 zgy zgy 7601 Nov 21 18:18 12.8-1-strict.abc 1763af6ab5fSopenharmony_ci``` 1773af6ab5fSopenharmony_ci 1783af6ab5fSopenharmony_ci`.abc` indicates the generated binary `abc` file. 1793af6ab5fSopenharmony_ci 1803af6ab5fSopenharmony_ci`.err` indicates that an error occurred during the test. 1813af6ab5fSopenharmony_ci 1823af6ab5fSopenharmony_ci`.fail/.pass` is the file saved after `js` file has been preprocessed. 1833af6ab5fSopenharmony_ci 1843af6ab5fSopenharmony_ciThe `result.txt` file is generated under directory `out/test262` to save statistics after the test finished. 185