• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3
4"""
5Copyright (c) 2021-2022 Huawei Device Co., Ltd.
6Licensed under the Apache License, Version 2.0 (the "License");
7you may not use this file except in compliance with the License.
8You may obtain a copy of the License at
9
10    http://www.apache.org/licenses/LICENSE-2.0
11
12Unless required by applicable law or agreed to in writing, software
13distributed under the License is distributed on an "AS IS" BASIS,
14WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15See the License for the specific language governing permissions and
16limitations under the License.
17
18Description: Execute 262 test suite configuration file
19"""
20
21
22import os
23from multiprocessing import cpu_count
24
25DATA_DIR = os.path.join("test262", "data")
26ESHOST_DIR = os.path.join("test262", "eshost")
27HARNESS_DIR = os.path.join("test262", "harness")
28
29BASE_OUT_DIR = os.path.join("out", "test262")
30
31CUR_FILE_DIR = os.path.dirname(__file__)
32CODE_ROOT = os.path.abspath(os.path.join(CUR_FILE_DIR, "../../.."))
33LLVM_DIR = f"{CODE_ROOT}/prebuilts/clang/ohos/linux-x86_64/llvm/lib/"
34
35DEFAULT_MODE = 2
36
37TEST_FULL_DIR = os.path.join(DATA_DIR, "test")
38TEST_ES5_DIR = os.path.join(DATA_DIR, "test_es51")
39TEST_ES2015_DIR = os.path.join(DATA_DIR, "test_es2015")
40TEST_ES2021_DIR = os.path.join(DATA_DIR, "test_es2021")
41TEST_ES2022_DIR = os.path.join(DATA_DIR, "test_es2022")
42TEST_ES2023_DIR = os.path.join(DATA_DIR, "test_es2023")
43TEST_INTL_DIR = os.path.join(DATA_DIR, "test_intl")
44TEST_CI_DIR = os.path.join(DATA_DIR, "test_CI")
45
46HISPARK_TAURUS_PRODUCT_NAME = "hispark_taurus"
47RK3568_PRODUCT_NAME = "rk3568"
48DEFAULT_PRODUCT_NAME = HISPARK_TAURUS_PRODUCT_NAME
49
50ARGS_PREFIX = f"{CODE_ROOT}/out/"
51ARK_DIR_SUFFIX = "/clang_x64/arkcompiler/ets_frontend"
52ICUI_DIR_SUFFIX = "/clang_x64/thirdparty/icu"
53ARK_JS_RUNTIME_DIR_SUFFIX = "/clang_x64/arkcompiler/ets_runtime"
54ZLIB_DIR_SUFFIX = "/clang_x64/thirdparty/zlib"
55
56DEFAULT_ARK_DIR = f"{CODE_ROOT}/out/hispark_taurus/clang_x64/arkcompiler/ets_frontend"
57DEFAULT_ICUI_DIR = f"{CODE_ROOT}/out/hispark_taurus/clang_x64/thirdparty/icu"
58DEFAULT_ARK_JS_RUNTIME_DIR = f"{CODE_ROOT}/out/hispark_taurus/clang_x64/arkcompiler/ets_runtime"
59DEFAULT_ZLIB_DIR = f"{CODE_ROOT}/out/hispark_taurus/clang_x64/thirdparty/zlib"
60
61DEFAULT_ARK_TOOL = os.path.join(DEFAULT_ARK_JS_RUNTIME_DIR, "ark_js_vm")
62DEFAULT_LIBS_DIR = f"{DEFAULT_ICUI_DIR}:{LLVM_DIR}:{DEFAULT_ARK_JS_RUNTIME_DIR}:{DEFAULT_ZLIB_DIR}"
63DEFAULT_ARK_AOT_TOOL = os.path.join(DEFAULT_ARK_JS_RUNTIME_DIR, "ark_aot_compiler")
64
65DEFAULT_HOST_TYPE = "panda"
66DEFAULT_HOST_PATH = "python3"
67DEFAULT_THREADS = min(cpu_count(), 32)
68DEFAULT_OTHER_ARGS = "--saveCompiledTests"
69TEST262_RUNNER_SCRIPT = os.path.join(HARNESS_DIR, "bin", "run.js")
70DEFAULT_TIMEOUT = 60000
71
72ES5_LIST_FILE = os.path.join("test262", "es5_tests.txt")
73ES2015_LIST_FILE = os.path.join("test262", "es2015_tests.txt")
74INTL_LIST_FILE = os.path.join("test262", "intl_tests.txt")
75ES2021_LIST_FILE = os.path.join("test262", "es2021_tests.txt")
76ES2022_LIST_FILE = os.path.join("test262", "es2022_tests.txt")
77ES2023_LIST_FILE = os.path.join("test262", "es2023_tests.txt")
78CI_LIST_FILE = os.path.join("test262", "CI_tests.txt")
79MODULE_LIST = []
80DYNAMIC_IMPORT_LIST = []
81with open(os.path.join("test262", "module_tests.txt")) as m_file:
82    MODULE_LIST = m_file.read().splitlines()
83with open(os.path.join("test262", "dynamicImport_tests.txt")) as d_file:
84    DYNAMIC_IMPORT_LIST = d_file.read().splitlines()
85
86TEST262_GIT_HASH = "bad7c0487ee1edf4a9059ff2a51fd19fc2d53170"
87HARNESS_GIT_HASH = "9c499f028eb24e67781435c0bb442e00343eb39d"
88ESHOST_GIT_HASH = "fa2d4d27d9d6152002bdef36ee2d17e98b886268"
89ESNEXT_GIT_HASH = "281eb10b2844929a7c0ac04527f5b42ce56509fd"
90
91TEST262_GIT_URL = "https://gitee.com/hufeng20/test262.git"
92ESHOST_GIT_URL = "https://gitee.com/hufeng20/eshost.git"
93HARNESS_GIT_URL = "https://gitee.com/hufeng20/test262-harness.git"
94
95SKIP_LIST_FILE = os.path.join("test262", "skip_tests.json")
96ES2ABC_SKIP_LIST_FILE = os.path.join("test262", "es2abc_skip_tests.json")
97TS2ABC_SKIP_LIST_FILE = os.path.join("test262", "ts2abc_skip_tests.json")
98INTL_SKIP_LIST_FILE = os.path.join("test262", "intl_skip_tests.json")
99TS2ABC_SKIP_FORCE_GC_LIST_FILE = os.path.join("test262", "force_gc_skip_tests.json")
100SKIP_LIST_FILES = [SKIP_LIST_FILE, INTL_SKIP_LIST_FILE]
101ALL_SKIP_TESTS = []
102INTL_SKIP_TESTS = []
103SKIP_FORCE_GC_LIST_FILES = []
104FORCE_GC_SKIP_TESTS = []
105
106ARK_FRONTEND_LIST = [
107    "ts2panda",
108    "es2panda"
109]
110
111ARK_FRONTEND_BINARY_LIST = [
112    os.path.join(DEFAULT_ARK_DIR, "build", "src", "index.js"),
113    os.path.join(DEFAULT_ARK_DIR, "es2abc")
114]
115
116DEFAULT_ARK_FRONTEND = ARK_FRONTEND_LIST[0]
117DEFAULT_ARK_FRONTEND_BINARY = ARK_FRONTEND_BINARY_LIST[0]
118DEFAULT_MERGE_ABC_BINARY = os.path.join(DEFAULT_ARK_DIR, "merge_abc")
119
120ARK_ARCH_LIST = [
121    "x64",
122    "aarch64",
123    "arm"
124]
125
126DEFAULT_ARK_ARCH = ARK_ARCH_LIST[0]
127DEFAULT_OPT_LEVEL = 2
128DEFAULT_ES2ABC_THREAD_COUNT = 0
129DEFAULT_MERGE_ABC_MODE = 1
130
131OHOS_TYPESCRIPT = "ohos-typescript-4.2.3-r2.tgz"
132OHOS_TYPESCRIPT_TGZ_PATH = f"{CODE_ROOT}/third_party/typescript/build_package/{OHOS_TYPESCRIPT}"
133