13af6ab5fSopenharmony_ci#!/usr/bin/env python3
23af6ab5fSopenharmony_ci# -*- coding: utf-8 -*-
33af6ab5fSopenharmony_ci
43af6ab5fSopenharmony_ci"""
53af6ab5fSopenharmony_ciCopyright (c) 2022 Huawei Device Co., Ltd.
63af6ab5fSopenharmony_ciLicensed under the Apache License, Version 2.0 (the "License");
73af6ab5fSopenharmony_ciyou may not use this file except in compliance with the License.
83af6ab5fSopenharmony_ciYou may obtain a copy of the License at
93af6ab5fSopenharmony_ci
103af6ab5fSopenharmony_ci    http://www.apache.org/licenses/LICENSE-2.0
113af6ab5fSopenharmony_ci
123af6ab5fSopenharmony_ciUnless required by applicable law or agreed to in writing, software
133af6ab5fSopenharmony_cidistributed under the License is distributed on an "AS IS" BASIS,
143af6ab5fSopenharmony_ciWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
153af6ab5fSopenharmony_ciSee the License for the specific language governing permissions and
163af6ab5fSopenharmony_cilimitations under the License.
173af6ab5fSopenharmony_ci
183af6ab5fSopenharmony_ciDescription: Use ark to execute test 262 test suite
193af6ab5fSopenharmony_ci"""
203af6ab5fSopenharmony_ci
213af6ab5fSopenharmony_ciimport os
223af6ab5fSopenharmony_ciimport sys
233af6ab5fSopenharmony_ciimport platform
243af6ab5fSopenharmony_ciimport json
253af6ab5fSopenharmony_ciTS_GIT_PATH = 'https://gitee.com/zhangrengao1/TypeScript.git'
263af6ab5fSopenharmony_ciTS_TAG = "v4.3.5"
273af6ab5fSopenharmony_ci
283af6ab5fSopenharmony_ciEXPECT_DIR = os.path.join("testTs", "expect")
293af6ab5fSopenharmony_ciOUT_DIR = os.path.join("out")
303af6ab5fSopenharmony_ciOUT_TEST_DIR = os.path.join("out", "testTs")
313af6ab5fSopenharmony_ciOUT_RESULT_FILE = os.path.join("out", "testTs", "result.txt")
323af6ab5fSopenharmony_ciTEST_DIR = os.path.join("testTs")
333af6ab5fSopenharmony_ciTS_CASES_DIR = os.path.join(".", "testTs", "test")
343af6ab5fSopenharmony_ciSKIP_FILE_PATH = os.path.join("testTs", "skip_tests.json")
353af6ab5fSopenharmony_ciCUR_FILE_DIR = os.path.dirname(__file__)
363af6ab5fSopenharmony_ciIMPORT_FILE_PATH = os.path.join(CUR_FILE_DIR, "import_tests.json")
373af6ab5fSopenharmony_ciCODE_ROOT = os.path.abspath(os.path.join(CUR_FILE_DIR, "../../.."))
383af6ab5fSopenharmony_ci
393af6ab5fSopenharmony_ciIS_LINUX_ARM64 = (sys.platform == "linux" and platform.machine().lower() == "aarch64")
403af6ab5fSopenharmony_ciCLANG_TOOLCHAIN = "clang_arm64" if IS_LINUX_ARM64 else "clang_x64"
413af6ab5fSopenharmony_ciARK_DIR = f"{CODE_ROOT}/out/hispark_taurus/{CLANG_TOOLCHAIN}/arkcompiler/ets_frontend"
423af6ab5fSopenharmony_ci
433af6ab5fSopenharmony_ciWORK_PATH = f'{CODE_ROOT}/arkcompiler/ets_frontend'
443af6ab5fSopenharmony_ci
453af6ab5fSopenharmony_ciDEFAULT_ARK_FRONTEND_TOOL = os.path.join(ARK_DIR, "build", "src", "index.js")
463af6ab5fSopenharmony_ci
473af6ab5fSopenharmony_ciTEST_PATH = os.sep.join([".", "testTs", "test"])
483af6ab5fSopenharmony_ciOUT_PATH = os.sep.join([".", "out", "testTs"])
493af6ab5fSopenharmony_ciEXPECT_PATH = os.sep.join([".", "testTs", "expect"])
503af6ab5fSopenharmony_ciTS_EXT = ".ts"
513af6ab5fSopenharmony_ciTXT_EXT = ".txt"
523af6ab5fSopenharmony_ciABC_EXT = ".abc"
533af6ab5fSopenharmony_ciIMPORT_TEST = ""
543af6ab5fSopenharmony_ciwith open(IMPORT_FILE_PATH, 'r') as f:
553af6ab5fSopenharmony_ci    content = f.read()
563af6ab5fSopenharmony_ci    IMPORT_TEST = json.loads(content)
57