arkcompiler_ets_runtime/test/test_helper.gni
weng-xi 193c85989b Optimize the AOT slowpath for the delobjprop instruction
Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I8Y3DO
Signed-off-by: weng-xi <wengxi1@huawei.com>
Change-Id: I7776e60c1291cdfb233d1a16aa6959c6e1499459
2024-01-23 14:49:57 +08:00

1798 lines
59 KiB
Plaintext

# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni")
import("//arkcompiler/ets_runtime/js_runtime_config.gni")
import("$build_root/test.gni")
declare_args() {
TEST_LITECG = false
}
if (is_standard_system || ark_standalone_build) {
_icu_path_ = "thirdparty/icu"
} else {
_icu_path_ = "global/i18n"
}
template("host_unittest_action") {
_target_name_ = "${target_name}"
# unittest for phone running
ohos_unittest(_target_name_) {
resource_config_file =
"//arkcompiler/ets_runtime/test/resource/js_runtime/ohos_test.xml"
forward_variables_from(invoker, "*")
}
_module_out_path_ = invoker.module_out_path
# unittest for host running
action("${_target_name_}ActionWithoutQemu") {
testonly = true
_host_test_target_ = ":${_target_name_}(${host_toolchain})"
_root_out_dir_ = get_label_info(_host_test_target_, "root_out_dir")
deps = [ _host_test_target_ ]
script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
args = [
"--script-file",
rebase_path(_root_out_dir_) +
"/tests/unittest/${_module_out_path_}/${_target_name_}",
"--expect-output",
"0",
"--env-path",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
rebase_path(_root_out_dir_) + "/test/test:" +
rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
rebase_path(_root_out_dir_) +
"/thirdparty/bounds_checking_function:" +
rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
"--timeout-limit",
"1200",
]
inputs = [
"$_root_out_dir_/tests/unittest/${_module_out_path_}/${_target_name_}",
]
outputs = [ "$target_out_dir/${_target_name_}/" ]
}
if (ark_standalone_build && host_os == "linux" && target_os == "ohos") {
import("$ark_third_party_root/musl/musl_template.gni")
import("$build_root/config/qemu/config.gni")
action("${_target_name_}ActionWithQemu") {
testonly = true
_host_test_target_ = ":${_target_name_}"
# path of root_out_dir based on root_src_dir
_root_out_dir_ = get_label_info(_host_test_target_, "root_out_dir")
deps = [
"$ark_third_party_root/musl:soft_create_linker_for_qemu",
_host_test_target_,
]
script = "${js_root}/script/run_ark_executable.py"
args = [
"--script-file",
rebase_path(
"$_root_out_dir_/tests/unittest/${_module_out_path_}/${_target_name_}",
root_build_dir),
"--expect-output",
"0",
"--clang-lib-path",
rebase_path("${clang_base_path}/lib/${musl_arch}-linux-ohos",
root_build_dir),
"--qemu-binary-path",
"${QEMU_INSTALLATION_PATH}/bin/qemu-${musl_arch}",
"--qemu-ld-prefix",
rebase_path(musl_linker_so_out_dir, root_build_dir),
"--timeout-limit",
"1200",
]
inputs = [
"$_root_out_dir_/tests/unittest/${_module_out_path_}/${_target_name_}",
]
outputs = [ "$target_out_dir/${_target_name_}WithQemu/" ]
}
}
group("${_target_name_}Action") {
testonly = true
deps = []
if (ark_standalone_build && host_os == "linux" && target_os == "ohos" &&
run_with_qemu) {
deps += [ ":${_target_name_}ActionWithQemu" ]
} else {
deps += [ ":${_target_name_}ActionWithoutQemu" ]
}
}
}
template("host_moduletest_action") {
_target_name_ = "${target_name}"
_deps_ = invoker.deps
_is_module_ = false
if (defined(invoker.is_module) && invoker.is_module) {
_is_module_ = true
}
_is_commonjs_ = false
if (defined(invoker.is_commonjs) && invoker.is_commonjs) {
_is_commonjs_ = true
}
_is_merge_ = false
if (defined(invoker.is_merge) && invoker.is_merge) {
_is_merge_ = true
}
_is_merge_abc_ = false
if (defined(invoker.is_merge_abc) && invoker.is_merge_abc) {
_is_merge_abc_ = true
}
_timeout_ = "200"
if (defined(invoker.timeout)) {
_timeout_ = invoker.timeout
}
_src_dir_ = "."
if (defined(invoker.src_dir) && invoker.src_dir != "") {
_src_dir_ = invoker.src_dir
}
_src_postfix_ = "js"
if (defined(invoker.src_postfix) && invoker.src_postfix != "") {
_src_postfix_ = invoker.src_postfix
}
_test_js_path_ = "${_src_dir_}/${_target_name_}.${_src_postfix_}"
_test_abc_path_ = "$target_out_dir/${_target_name_}.abc"
_test_expect_path_ = "${_src_dir_}/expect_output.txt"
if (_is_merge_abc_) {
merge_file_raw = "./${_target_name_}.txt"
merge_file = "$target_out_dir/${_target_name_}.txt"
merge_file_prefix =
"//arkcompiler/ets_runtime/test/moduletest/${_target_name_}/"
action("gen_${_target_name_}_merge_file") {
script = "../../quickfix/generate_merge_file.py"
args = [
"--input",
rebase_path(merge_file_raw),
"--output",
rebase_path(merge_file),
"--prefix",
rebase_path(merge_file_prefix),
]
inputs = [ merge_file_raw ]
outputs = [ merge_file ]
}
}
es2abc_gen_abc("gen_${_target_name_}_abc") {
extra_visibility = [ ":*" ] # Only targets in this file can depend on this.
extra_dependencies = _deps_
src_js = rebase_path(_test_js_path_)
dst_file = rebase_path(_test_abc_path_)
extra_args = []
if (_is_module_) {
extra_args += [ "--module" ]
}
if (_is_commonjs_) {
extra_args += [ "--commonjs" ]
}
if (_is_merge_) {
extra_args += [ "--merge-abc" ]
}
if (_is_merge_abc_) {
extra_dependencies = [ ":gen_${_target_name_}_merge_file" ]
src_js = "@" + rebase_path(merge_file)
in_puts = [
_test_expect_path_,
merge_file,
]
} else {
in_puts = [
_test_expect_path_,
_test_js_path_,
]
}
out_puts = [ _test_abc_path_ ]
}
_extra_modules_ = []
if (defined(invoker.extra_modules)) {
foreach(module, invoker.extra_modules) {
_extra_modules_ += [ "$target_out_dir/${module}.abc" ]
}
}
if (defined(invoker.entry_point)) {
_script_args_ = invoker.entry_point
_script_args_ += " " + rebase_path(_test_abc_path_)
} else {
_script_args_ = rebase_path(_test_abc_path_)
}
foreach(extra_module, _extra_modules_) {
_script_args_ += ":" + rebase_path(extra_module)
}
action("${_target_name_}Action") {
testonly = true
_host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
_root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
deps = [
":gen_${_target_name_}_abc",
_host_jsvm_target_,
]
deps += _deps_
script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
js_vm_options = " --asm-interpreter=false"
if (defined(invoker.is_set_maxNonmovableSpaceCapacity) &&
invoker.is_set_maxNonmovableSpaceCapacity) {
js_vm_options += " --max-unmovable-space=524288" # 0.5M
}
if (defined(invoker.is_enable_enableArkTools) &&
invoker.is_enable_enableArkTools) {
js_vm_options += " --enable-ark-tools=true"
js_vm_options += " --enable-force-gc=false"
}
args = [
"--script-file",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
"--script-options",
js_vm_options,
"--script-args",
_script_args_,
"--timeout-limit",
"${_timeout_}",
"--expect-file",
rebase_path(_test_expect_path_),
"--env-path",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
rebase_path(_root_out_dir_) +
"/thirdparty/bounds_checking_function:" +
rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
]
inputs = [ _test_abc_path_ ]
inputs += _extra_modules_
outputs = [ "$target_out_dir/${_target_name_}/" ]
}
action("${_target_name_}ContextAction") {
testonly = true
_host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
_root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
deps = [
":gen_${_target_name_}_abc",
_host_jsvm_target_,
]
deps += _deps_
script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
js_vm_options = " --asm-interpreter=false"
if (defined(invoker.is_set_maxNonmovableSpaceCapacity) &&
invoker.is_set_maxNonmovableSpaceCapacity) {
js_vm_options += " --max-unmovable-space=524288" # 0.5M
}
if (defined(invoker.is_enable_enableArkTools) &&
invoker.is_enable_enableArkTools) {
js_vm_options += " --enable-ark-tools=true"
js_vm_options += " --enable-force-gc=false"
}
js_vm_options += " --enable-context=true"
args = [
"--script-file",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
"--script-options",
js_vm_options,
"--script-args",
_script_args_,
"--timeout-limit",
"${_timeout_}",
"--expect-file",
rebase_path(_test_expect_path_),
"--env-path",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
rebase_path(_root_out_dir_) +
"/thirdparty/bounds_checking_function:" +
rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
]
inputs = [ _test_abc_path_ ]
inputs += _extra_modules_
outputs = [ "$target_out_dir/${_target_name_}Context/" ]
}
action("${_target_name_}AsmAction") {
testonly = true
_host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
_root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
deps = [
":gen_${_target_name_}_abc",
_host_jsvm_target_,
]
deps += _deps_
script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
_asm_run_options_ = " --asm-interpreter=true"
if (defined(invoker.is_set_maxNonmovableSpaceCapacity) &&
invoker.is_set_maxNonmovableSpaceCapacity) {
_asm_run_options_ += " --max-unmovable-space=524288" # 0.5M
}
if (defined(invoker.is_set_elemens_kind) && invoker.is_set_elemens_kind) {
_asm_run_options_ += " --enable-elements-kind=true"
}
if (defined(invoker.is_enable_enableArkTools) &&
invoker.is_enable_enableArkTools) {
_asm_run_options_ += " --enable-ark-tools=true"
_asm_run_options_ += " --enable-force-gc=false"
}
_asm_run_options_ += " --enable-context=true"
args = [
"--script-file",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
"--script-options",
_asm_run_options_,
"--script-args",
_script_args_,
"--timeout-limit",
"${_timeout_}",
"--expect-file",
rebase_path(_test_expect_path_),
"--env-path",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
rebase_path(_root_out_dir_) +
"/thirdparty/bounds_checking_function:" +
rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
]
inputs = [ _test_abc_path_ ]
inputs += _extra_modules_
outputs = [ "$target_out_dir/${_target_name_}Asm/" ]
}
action("${_target_name_}AsmContextAction") {
testonly = true
_host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
_root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
deps = [
":gen_${_target_name_}_abc",
_host_jsvm_target_,
]
deps += _deps_
script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
_asm_run_options_ = " --asm-interpreter=true"
if (defined(invoker.is_set_maxNonmovableSpaceCapacity) &&
invoker.is_set_maxNonmovableSpaceCapacity) {
_asm_run_options_ += " --max-unmovable-space=524288" # 0.5M
}
if (defined(invoker.is_set_elemens_kind) && invoker.is_set_elemens_kind) {
_asm_run_options_ += " --enable-elements-kind=true"
}
if (defined(invoker.is_enable_enableArkTools) &&
invoker.is_enable_enableArkTools) {
_asm_run_options_ += " --enable-ark-tools=true"
_asm_run_options_ += " --enable-force-gc=false"
}
args = [
"--script-file",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
"--script-options",
_asm_run_options_,
"--script-args",
_script_args_,
"--timeout-limit",
"${_timeout_}",
"--expect-file",
rebase_path(_test_expect_path_),
"--env-path",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
rebase_path(_root_out_dir_) +
"/thirdparty/bounds_checking_function:" +
rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
]
inputs = [ _test_abc_path_ ]
inputs += _extra_modules_
outputs = [ "$target_out_dir/${_target_name_}AsmContext/" ]
}
action("${_target_name_}AsmSingleStepAction") {
testonly = true
_host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
_root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
deps = [
":gen_${_target_name_}_abc",
_host_jsvm_target_,
]
deps += _deps_
script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
# 214: all bytecodes
_asm_run_options_ =
" --asm-interpreter=true --asm-opcode-disable-range=0,214"
if (defined(invoker.is_set_maxNonmovableSpaceCapacity) &&
invoker.is_set_maxNonmovableSpaceCapacity) {
_asm_run_options_ += " --max-unmovable-space=524288" # 0.5M
}
if (defined(invoker.is_enable_enableArkTools) &&
invoker.is_enable_enableArkTools) {
_asm_run_options_ += " --enable-ark-tools=true"
_asm_run_options_ += " --enable-force-gc=false"
}
args = [
"--script-file",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
"--script-options",
_asm_run_options_,
"--script-args",
_script_args_,
"--expect-file",
rebase_path(_test_expect_path_),
"--env-path",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
rebase_path(_root_out_dir_) +
"/thirdparty/bounds_checking_function:" +
rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
]
inputs = [ _test_abc_path_ ]
inputs += _extra_modules_
outputs = [ "$target_out_dir/${_target_name_}AsmSingleStep/" ]
}
action("${_target_name_}AsmSingleStepContextAction") {
testonly = true
_host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
_root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
deps = [
":gen_${_target_name_}_abc",
_host_jsvm_target_,
]
deps += _deps_
script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
# 214: all bytecodes
_asm_run_options_ =
" --asm-interpreter=true --asm-opcode-disable-range=0,214"
if (defined(invoker.is_set_maxNonmovableSpaceCapacity) &&
invoker.is_set_maxNonmovableSpaceCapacity) {
_asm_run_options_ += " --max-unmovable-space=524288" # 0.5M
}
if (defined(invoker.is_enable_enableArkTools) &&
invoker.is_enable_enableArkTools) {
_asm_run_options_ += " --enable-ark-tools=true"
_asm_run_options_ += " --enable-force-gc=false"
}
_asm_run_options_ += " --enable-context=true"
args = [
"--script-file",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
"--script-options",
_asm_run_options_,
"--script-args",
_script_args_,
"--expect-file",
rebase_path(_test_expect_path_),
"--env-path",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
rebase_path(_root_out_dir_) +
"/thirdparty/bounds_checking_function:" +
rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
]
inputs = [ _test_abc_path_ ]
inputs += _extra_modules_
outputs = [ "$target_out_dir/${_target_name_}AsmSingleStepContext/" ]
}
}
template("host_aot_js_test_action") {
_target_name_ = "${target_name}"
_deps_ = invoker.deps
_test_ts_path_ = "./${_target_name_}.js"
_test_abc_path_ = "$target_out_dir/${_target_name_}.abc"
_test_aot_path_ = "$target_out_dir/${_target_name_}.an"
_test_aot_snapshot_path_ = "$target_out_dir/${_target_name_}.ai"
_test_aot_arg_ = "$target_out_dir/${_target_name_}"
_test_aot_log_level = "info"
_test_expect_path_ = "./expect_output.txt"
_test_pgo_expect_path_ = "./pgo_expect_output.txt"
if (defined(invoker.is_common_js) && invoker.is_common_js) {
extra_args = [ "--commonjs" ]
} else {
extra_args = [ "--module" ]
}
extra_args += [ "--merge-abc" ]
es2abc_gen_abc("gen_${_target_name_}_abc") {
extra_visibility = [ ":*" ] # Only targets in this file can depend on this.
extra_dependencies = _deps_
if (defined(invoker.run_multi_file_tests) && invoker.run_multi_file_tests) {
src_js = rebase_path("./")
} else {
src_js = rebase_path(_test_ts_path_)
}
dst_file = rebase_path(_test_abc_path_)
in_puts = [
_test_ts_path_,
_test_expect_path_,
]
out_puts = [ _test_abc_path_ ]
}
_script_args_ = rebase_path(_test_abc_path_)
action("${_target_name_}PgoExecute") {
testonly = true
_host_jsvm_target_ =
"$js_root/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
_root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
deps = [
":gen_${_target_name_}_abc",
_host_jsvm_target_,
]
deps += _deps_
script = "$js_root/script/run_ark_executable.py"
_aot_run_options_ =
" --asm-interpreter=true" + " --entry-point=${_target_name_}" +
" --enable-pgo-profiler=true" + " --compiler-pgo-profiler-path=" +
rebase_path(_test_aot_arg_) + "/modules.ap"
if (defined(invoker.is_enable_enableArkTools) &&
invoker.is_enable_enableArkTools) {
_aot_run_options_ += " --enable-ark-tools=true"
_aot_run_options_ += " --enable-force-gc=false"
}
if (defined(invoker.disable_force_gc) && invoker.disable_force_gc) {
_aot_run_options_ += " --enable-force-gc=false"
}
if (defined(invoker.log_option)) {
_aot_run_options_ += invoker.log_option
}
args = [
"--script-file",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
"--script-options",
_aot_run_options_,
"--script-args",
_script_args_,
"--expect-file",
rebase_path(_test_pgo_expect_path_),
"--env-path",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
rebase_path(_root_out_dir_) +
"/thirdparty/bounds_checking_function:" +
rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
]
inputs = [ _test_abc_path_ ]
outputs = [ "$target_out_dir/${_target_name_}/pgo" ]
}
action("${_target_name_}AotCompileAction") {
testonly = true
_host_aot_target_ = "//arkcompiler/ets_runtime/ecmascript/compiler:ark_aot_compiler(${host_toolchain})"
_root_out_dir_ = get_label_info(_host_aot_target_, "root_out_dir")
deps = [
":gen_${_target_name_}_abc",
_host_aot_target_,
]
deps += _deps_
if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
deps += [ ":${_target_name_}PgoExecute" ]
}
script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
_aot_compile_options_ = " --aot-file=" + rebase_path(_test_aot_arg_) +
" --log-level=" + _test_aot_log_level + " --log-components=compiler --compiler-opt-type-lowering=false --compiler-opt-inlining=false" + " --compiler-opt-loop-peeling=false"
if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
_aot_compile_options_ += " --compiler-pgo-profiler-path=" +
rebase_path(_test_aot_arg_) + "/modules.ap"
}
if (defined(invoker.is_enable_trace_deopt) &&
invoker.is_enable_trace_deopt) {
_aot_compile_options_ += " --compiler-trace-deopt=true"
}
if (defined(invoker.is_enable_opt_inlining) &&
invoker.is_enable_opt_inlining) {
_aot_compile_options_ +=
" --compiler-opt-inlining=true --compiler-opt-type-lowering=true"
}
if (defined(invoker.is_enable_typed_op_profiler) &&
invoker.is_enable_typed_op_profiler) {
_aot_compile_options_ += " --compiler-typed-op-profiler=true "
}
if (defined(invoker.is_enable_lowering_builtin) &&
invoker.is_enable_lowering_builtin) {
_aot_compile_options_ += " --compiler-enable-lowering-builtin=true"
}
if (defined(invoker.is_enable_native_inline) &&
invoker.is_enable_native_inline) {
_aot_compile_options_ += " --compiler-enable-native-inline"
}
if (defined(invoker.is_enable_opt_loop_peeling) &&
invoker.is_enable_opt_loop_peeling) {
_aot_compile_options_ += " --compiler-opt-loop-peeling=true"
}
if (defined(invoker.is_enable_inline_trace) &&
invoker.is_enable_inline_trace) {
_aot_compile_options_ += " --compiler-trace-inline=true"
}
if (defined(invoker.userDefinedMethodsInModule) &&
invoker.userDefinedMethodsInModule) {
_aot_compile_options_ += " --compiler-module-methods=2"
}
if (TEST_LITECG) {
_aot_compile_options_ += " --compiler-enable-litecg=true"
}
args = [
"--script-file",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_aot_compiler",
"--script-options",
_aot_compile_options_,
"--script-args",
_script_args_,
"--expect-sub-output",
"ts aot compile success",
"--env-path",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
rebase_path(_root_out_dir_) +
"/thirdparty/bounds_checking_function:" +
rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
]
inputs = [ _test_abc_path_ ]
outputs = [
_test_aot_path_,
_test_aot_snapshot_path_,
]
}
action("${_target_name_}AotAction") {
testonly = true
_host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
_root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
deps = [
":${_target_name_}AotCompileAction",
":gen_${_target_name_}_abc",
_host_jsvm_target_,
]
deps += _deps_
script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
_aot_run_options_ =
" --aot-file=" + rebase_path(_test_aot_arg_) +
" --asm-interpreter=true" + " --entry-point=${_target_name_}"
if (defined(invoker.is_enable_enableArkTools) &&
invoker.is_enable_enableArkTools) {
_aot_run_options_ += " --enable-ark-tools=true"
_aot_run_options_ += " --enable-force-gc=false"
}
if (defined(invoker.log_option)) {
_aot_run_options_ += invoker.log_option
}
if (defined(invoker.is_enable_typed_op_profiler) &&
invoker.is_enable_typed_op_profiler) {
_aot_run_options_ += " --compiler-typed-op-profiler=ture"
}
if (defined(invoker.is_enable_lowering_builtin) &&
invoker.is_enable_lowering_builtin) {
_aot_run_options_ += " --compiler-enable-lowering-builtin=true"
}
_icu_data_path_options_ =
" --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
_aot_run_options_ += _icu_data_path_options_
if (defined(invoker.log_option)) {
_aot_run_options_ += invoker.log_option
}
args = [
"--script-file",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
"--script-options",
_aot_run_options_,
"--script-args",
_script_args_,
"--expect-file",
rebase_path(_test_expect_path_),
"--env-path",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
rebase_path(_root_out_dir_) +
"/thirdparty/bounds_checking_function:" +
rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
]
inputs = [ _test_abc_path_ ]
outputs = [ "$target_out_dir/${_target_name_}/" ]
}
action("${_target_name_}AotContextAction") {
testonly = true
_host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
_root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
deps = [
":${_target_name_}AotCompileAction",
":gen_${_target_name_}_abc",
_host_jsvm_target_,
]
deps += _deps_
script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
_aot_run_options_ =
" --aot-file=" + rebase_path(_test_aot_arg_) +
" --asm-interpreter=true" + " --entry-point=${_target_name_}"
if (defined(invoker.is_enable_enableArkTools) &&
invoker.is_enable_enableArkTools) {
_aot_run_options_ += " --enable-ark-tools=true"
_aot_run_options_ += " --enable-force-gc=false"
}
if (defined(invoker.disable_force_gc) && invoker.disable_force_gc) {
_aot_run_options_ += " --enable-force-gc=false"
}
if (defined(invoker.log_option)) {
_aot_run_options_ += invoker.log_option
}
if (defined(invoker.is_enable_typed_op_profiler) &&
invoker.is_enable_typed_op_profiler) {
_aot_run_options_ += " --compiler-typed-op-profiler=ture"
}
if (defined(invoker.is_enable_lowering_builtin) &&
invoker.is_enable_lowering_builtin) {
_aot_run_options_ += " --compiler-enable-lowering-builtin=true"
}
_icu_data_path_options_ =
" --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
_aot_run_options_ += _icu_data_path_options_
_aot_run_options_ += " --enable-context=true"
args = [
"--script-file",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
"--script-options",
_aot_run_options_,
"--script-args",
_script_args_,
"--expect-file",
rebase_path(_test_expect_path_),
"--env-path",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
rebase_path(_root_out_dir_) +
"/thirdparty/bounds_checking_function:" +
rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
]
inputs = [ _test_abc_path_ ]
outputs = [ "$target_out_dir/${_target_name_}Context/" ]
}
}
template("host_aot_test_action") {
_target_name_ = "${target_name}"
_deps_ = invoker.deps
_src_dir_ = "."
if (defined(invoker.src_dir) && invoker.src_dir != "") {
_src_dir_ = invoker.src_dir
}
_test_ts_path_ = "${_src_dir_}/${_target_name_}.ts"
_test_abc_path_ = "$target_out_dir/${_target_name_}.abc"
_test_aot_path_ = "$target_out_dir/${_target_name_}.an"
_test_aot_snapshot_path_ = "$target_out_dir/${_target_name_}.ai"
_test_aot_arg_ = "$target_out_dir/${_target_name_}"
_test_aot_path_slowpath_ = "$target_out_dir/slowpath/${_target_name_}.an"
_test_aot_snapshot_path_slowpath_ =
"$target_out_dir/slowpath/${_target_name_}.ai"
_test_aot_arg_slowpath_ = "$target_out_dir/slowpath/${_target_name_}"
_test_aot_log_level = "info"
_test_expect_path_ = "${_src_dir_}/expect_output.txt"
_test_pgo_expect_path_ = "${_src_dir_}/pgo_expect_output.txt"
es2abc_gen_abc("gen_${_target_name_}_abc") {
extra_visibility = [ ":*" ] # Only targets in this file can depend on this.
extra_dependencies = _deps_
if (defined(invoker.run_multi_file_tests) && invoker.run_multi_file_tests) {
src_js = rebase_path("./")
} else {
src_js = rebase_path(_test_ts_path_)
}
dst_file = rebase_path(_test_abc_path_)
extension = "ts"
extra_args = [
"--merge-abc",
"--type-extractor",
]
if (!(defined(invoker.without_module) && invoker.without_module)) {
extra_args += [ "--module" ]
}
if (defined(invoker.is_debug_abc) && invoker.is_debug_abc) {
extra_args += [ "--debug" ]
}
in_puts = [
_test_ts_path_,
_test_expect_path_,
]
out_puts = [ _test_abc_path_ ]
}
_script_args_ = rebase_path(_test_abc_path_)
action("${_target_name_}PgoExecute") {
testonly = true
_host_jsvm_target_ =
"$js_root/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
_root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
deps = [
":gen_${_target_name_}_abc",
_host_jsvm_target_,
]
deps += _deps_
script = "$js_root/script/run_ark_executable.py"
_aot_run_options_ =
" --asm-interpreter=true" + " --entry-point=${_target_name_}" +
" --enable-pgo-profiler=true" + " --compiler-pgo-profiler-path=" +
rebase_path(_test_aot_arg_) + "/modules.ap"
if (defined(invoker.is_enable_enableArkTools) &&
invoker.is_enable_enableArkTools) {
_aot_run_options_ += " --enable-ark-tools=true"
_aot_run_options_ += " --enable-force-gc=false"
}
if (defined(invoker.log_option)) {
_aot_run_options_ += invoker.log_option
}
args = [
"--script-file",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
"--script-options",
_aot_run_options_,
"--script-args",
_script_args_,
"--expect-file",
rebase_path(_test_pgo_expect_path_),
"--env-path",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
rebase_path(_root_out_dir_) +
"/thirdparty/bounds_checking_function:" +
rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
]
inputs = [ _test_abc_path_ ]
outputs = [ "$target_out_dir/${_target_name_}/pgo" ]
}
action("${_target_name_}AotCompileAction") {
testonly = true
_host_aot_target_ = "//arkcompiler/ets_runtime/ecmascript/compiler:ark_aot_compiler(${host_toolchain})"
_root_out_dir_ = get_label_info(_host_aot_target_, "root_out_dir")
deps = [
":gen_${_target_name_}_abc",
_host_aot_target_,
]
deps += _deps_
if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
deps += [ ":${_target_name_}PgoExecute" ]
}
script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
_aot_compile_options_ =
" --aot-file=" + rebase_path(_test_aot_arg_) + " --log-level=" +
_test_aot_log_level + " --log-components=compiler" +
" --compiler-opt-inlining=false" + " --compiler-opt-loop-peeling=false"
if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
_aot_compile_options_ += " --compiler-pgo-profiler-path=" +
rebase_path(_test_aot_arg_) + "/modules.ap"
}
if (defined(invoker.is_enable_trace_deopt) &&
invoker.is_enable_trace_deopt) {
_aot_compile_options_ += " --compiler-trace-deopt=true"
}
if (defined(invoker.is_enable_builtins_dts) &&
invoker.is_enable_builtins_dts) {
deps += [ "//arkcompiler/ets_runtime:es2abc_gen_builtins_d_abc" ]
_aot_compile_options_ += " --builtins-dts=" + rebase_path(root_out_dir) + "/obj/arkcompiler/ets_runtime/lib_ark_builtins/es2abc/lib_ark_builtins.d.abc"
}
if (defined(invoker.is_enable_opt_inlining) &&
invoker.is_enable_opt_inlining) {
_aot_compile_options_ +=
" --compiler-opt-inlining=true --compiler-opt-type-lowering=true"
}
if (defined(invoker.is_enable_typed_op_profiler) &&
invoker.is_enable_typed_op_profiler) {
_aot_compile_options_ += " --compiler-typed-op-profiler=true "
}
if (defined(invoker.is_enable_lowering_builtin) &&
invoker.is_enable_lowering_builtin) {
_aot_compile_options_ += " --compiler-enable-lowering-builtin=true"
}
if (defined(invoker.is_enable_native_inline) &&
invoker.is_enable_native_inline) {
_aot_compile_options_ += " --compiler-enable-native-inline"
}
if (defined(invoker.is_enable_opt_loop_peeling) &&
invoker.is_enable_opt_loop_peeling) {
_aot_compile_options_ += " --compiler-opt-loop-peeling=true"
}
if (defined(invoker.is_enable_inline_trace) &&
invoker.is_enable_inline_trace) {
_aot_compile_options_ += " --compiler-trace-inline=true"
}
if (defined(invoker.userDefinedMethodsInModule) &&
invoker.userDefinedMethodsInModule) {
_aot_compile_options_ += " --compiler-module-methods=2"
}
if (TEST_LITECG) {
_aot_compile_options_ += " --compiler-enable-litecg=true"
}
args = [
"--script-file",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_aot_compiler",
"--script-options",
_aot_compile_options_,
"--script-args",
_script_args_,
"--expect-sub-output",
"ts aot compile success",
"--env-path",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
rebase_path(_root_out_dir_) +
"/thirdparty/bounds_checking_function:" +
rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
]
inputs = [ _test_abc_path_ ]
outputs = [
_test_aot_path_,
_test_aot_snapshot_path_,
]
}
action("${_target_name_}AotCompileActionSlowPath") {
testonly = true
_host_aot_target_ =
"$js_root/ecmascript/compiler:ark_aot_compiler(${host_toolchain})"
_root_out_dir_ = get_label_info(_host_aot_target_, "root_out_dir")
deps = [
":gen_${_target_name_}_abc",
_host_aot_target_,
]
deps += _deps_
script = "$js_root/script/run_ark_executable.py"
_aot_compile_options_ =
" --aot-file=" + rebase_path(_test_aot_arg_slowpath_) +
" --log-level=" + _test_aot_log_level + " --log-components=compiler" +
" --compiler-opt-type-lowering=false" +
" --compiler-opt-inlining=false" + " --compiler-opt-loop-peeling=false"
if (defined(invoker.is_enable_trace_deopt) &&
invoker.is_enable_trace_deopt) {
_aot_compile_options_ += " --compiler-trace-deopt=true"
}
if (defined(invoker.is_enable_builtins_dts) &&
invoker.is_enable_builtins_dts) {
deps += [ "//arkcompiler/ets_runtime:es2abc_gen_builtins_d_abc" ]
_aot_compile_options_ += " --builtins-dts=" + rebase_path(root_out_dir) + "/obj/arkcompiler/ets_runtime/lib_ark_builtins/es2abc/lib_ark_builtins.d.abc"
}
if (defined(invoker.is_enable_opt_inlining) &&
invoker.is_enable_opt_inlining) {
_aot_compile_options_ +=
" --compiler-opt-inlining=true --compiler-opt-type-lowering=true"
}
if (defined(invoker.is_enable_native_inline) &&
invoker.is_enable_native_inline) {
_aot_compile_options_ += " --compiler-enable-native-inline"
}
if (defined(invoker.is_enable_opt_loop_peeling) &&
invoker.is_enable_opt_loop_peeling) {
_aot_compile_options_ += " --compiler-opt-loop-peeling=true"
}
if (defined(invoker.is_enable_inline_trace) &&
invoker.is_enable_inline_trace) {
_aot_compile_options_ += " --compiler-trace-inline=true"
}
if (defined(invoker.userDefinedMethodsInModule) &&
invoker.userDefinedMethodsInModule) {
_aot_compile_options_ += " --compiler-module-methods=2"
}
if (TEST_LITECG) {
_aot_compile_options_ += " --compiler-enable-litecg=true"
}
args = [
"--script-file",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_aot_compiler",
"--script-options",
_aot_compile_options_,
"--script-args",
_script_args_,
"--expect-sub-output",
"ts aot compile success",
"--env-path",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
rebase_path(_root_out_dir_) +
"/thirdparty/bounds_checking_function:" +
rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
]
inputs = [ _test_abc_path_ ]
outputs = [
_test_aot_path_slowpath_,
_test_aot_snapshot_path_slowpath_,
]
}
action("${_target_name_}AotAction") {
testonly = true
_host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
_root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
deps = [
":${_target_name_}AotCompileAction",
":gen_${_target_name_}_abc",
_host_jsvm_target_,
]
if (!defined(invoker.is_only_typed_path) || !invoker.is_only_typed_path) {
deps += [ ":${_target_name_}AotActionSlowPath" ]
}
deps += _deps_
script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
_aot_run_options_ =
" --aot-file=" + rebase_path(_test_aot_arg_) +
" --asm-interpreter=true" + " --entry-point=${_target_name_}"
_icu_data_path_options_ =
" --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
_aot_run_options_ += _icu_data_path_options_
if (defined(invoker.is_enable_enableArkTools) &&
invoker.is_enable_enableArkTools) {
_aot_run_options_ += " --enable-ark-tools=true"
_aot_run_options_ += " --enable-force-gc=false"
}
if (defined(invoker.log_option)) {
_aot_run_options_ += invoker.log_option
}
if (defined(invoker.is_enable_typed_op_profiler) &&
invoker.is_enable_typed_op_profiler) {
_aot_run_options_ += " --compiler-typed-op-profiler=ture"
}
if (defined(invoker.is_enable_lowering_builtin) &&
invoker.is_enable_lowering_builtin) {
_aot_run_options_ += " --compiler-enable-lowering-builtin=true"
}
if (defined(invoker.is_enable_trace_deopt) &&
invoker.is_enable_trace_deopt) {
_aot_run_options_ += " --compiler-trace-deopt=true"
}
args = [
"--script-file",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
"--script-options",
_aot_run_options_,
"--script-args",
_script_args_,
"--expect-file",
rebase_path(_test_expect_path_),
"--env-path",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
rebase_path(_root_out_dir_) +
"/thirdparty/bounds_checking_function:" +
rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
]
inputs = [ _test_abc_path_ ]
outputs = [ "$target_out_dir/${_target_name_}/" ]
}
action("${_target_name_}AotContextAction") {
testonly = true
_host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
_root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
deps = [
":${_target_name_}AotCompileAction",
":gen_${_target_name_}_abc",
_host_jsvm_target_,
]
if (!defined(invoker.is_only_typed_path) || !invoker.is_only_typed_path) {
deps += [ ":${_target_name_}AotActionSlowPath" ]
}
deps += _deps_
script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
_aot_run_options_ =
" --aot-file=" + rebase_path(_test_aot_arg_) +
" --asm-interpreter=true" + " --entry-point=${_target_name_}"
_icu_data_path_options_ =
" --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
_aot_run_options_ += _icu_data_path_options_
if (defined(invoker.is_enable_enableArkTools) &&
invoker.is_enable_enableArkTools) {
_aot_run_options_ += " --enable-ark-tools=true"
_aot_run_options_ += " --enable-force-gc=false"
}
if (defined(invoker.log_option)) {
_aot_run_options_ += invoker.log_option
}
_aot_run_options_ += " --enable-context=true"
if (defined(invoker.is_enable_typed_op_profiler) &&
invoker.is_enable_typed_op_profiler) {
_aot_run_options_ += " --compiler-typed-op-profiler=ture"
}
if (defined(invoker.is_enable_lowering_builtin) &&
invoker.is_enable_lowering_builtin) {
_aot_run_options_ += " --compiler-enable-lowering-builtin=true"
}
if (defined(invoker.is_enable_trace_deopt) &&
invoker.is_enable_trace_deopt) {
_aot_run_options_ += " --compiler-trace-deopt=true"
}
args = [
"--script-file",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
"--script-options",
_aot_run_options_,
"--script-args",
_script_args_,
"--expect-file",
rebase_path(_test_expect_path_),
"--env-path",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
rebase_path(_root_out_dir_) +
"/thirdparty/bounds_checking_function:" +
rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
]
inputs = [ _test_abc_path_ ]
outputs = [ "$target_out_dir/${_target_name_}Context/" ]
}
action("${_target_name_}AotActionSlowPath") {
testonly = true
_host_jsvm_target_ =
"$js_root/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
_root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
deps = [
":${_target_name_}AotCompileActionSlowPath",
":gen_${_target_name_}_abc",
_host_jsvm_target_,
]
deps += _deps_
script = "$js_root/script/run_ark_executable.py"
_aot_run_options_ =
" --aot-file=" + rebase_path(_test_aot_arg_slowpath_) +
" --asm-interpreter=true" + " --entry-point=${_target_name_}"
_icu_data_path_options_ =
" --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
_aot_run_options_ += _icu_data_path_options_
if (defined(invoker.is_enable_enableArkTools) &&
invoker.is_enable_enableArkTools) {
_aot_run_options_ += " --enable-ark-tools=true"
_aot_run_options_ += " --enable-force-gc=false"
}
if (defined(invoker.log_option)) {
_aot_run_options_ += invoker.log_option
}
args = [
"--script-file",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
"--script-options",
_aot_run_options_,
"--script-args",
_script_args_,
"--expect-file",
rebase_path(_test_expect_path_),
"--env-path",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
rebase_path(_root_out_dir_) +
"/thirdparty/bounds_checking_function:" +
rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
]
inputs = [ _test_abc_path_ ]
outputs = [ "$target_out_dir/${_target_name_}/SlowPath" ]
}
}
template("host_typeinfer_test_action") {
_target_name_ = "${target_name}"
_deps_ = invoker.deps
_host_aot_target_ =
"$js_root/ecmascript/compiler:ark_aot_compiler(${host_toolchain})"
_test_ts_path_ = "./${_target_name_}.ts"
_test_es2abc_abc_path_ = "$target_out_dir/es2abc/${_target_name_}.abc"
es2abc_gen_abc("es2abc_gen_${_target_name_}_abc") {
extra_visibility = [ ":*" ] # Only targets in this file can depend on this.
extra_dependencies = _deps_
if (defined(invoker.is_multi_file_tests) && invoker.is_multi_file_tests) {
_test_es2abc_ts_path_ = "."
} else {
_test_es2abc_ts_path_ = _test_ts_path_
}
src_js = rebase_path(_test_es2abc_ts_path_)
dst_file = rebase_path(_test_es2abc_abc_path_)
extension = "ts"
extra_args = [
"--module",
"--merge-abc",
"--type-extractor",
]
in_puts = [ _test_ts_path_ ]
out_puts = [ _test_es2abc_abc_path_ ]
}
action("${_target_name_}Es2abcAotTypeInferAction") {
testonly = true
_script_args_ = rebase_path(_test_es2abc_abc_path_)
_root_out_dir_ = get_label_info(_host_aot_target_, "root_out_dir")
deps = [
":es2abc_gen_${_target_name_}_abc",
_host_aot_target_,
]
deps += _deps_
script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
_aot_compile_options_ = " --compiler-assert-types=true" +
" --compiler-opt-type-lowering=false" +
" --compiler-opt-loop-peeling=false"
if (defined(invoker.is_enable_builtins_dts) &&
invoker.is_enable_builtins_dts) {
deps += [ "//arkcompiler/ets_runtime:es2abc_gen_builtins_d_abc" ]
_aot_compile_options_ += " --builtins-dts=" + rebase_path(root_out_dir) + "/obj/arkcompiler/ets_runtime/lib_ark_builtins/es2abc/lib_ark_builtins.d.abc"
}
if (defined(invoker.is_enable_global_typeinfer) &&
invoker.is_enable_global_typeinfer) {
_aot_compile_options_ += " --compiler-opt-global-typeinfer=true"
}
if (TEST_LITECG) {
_aot_compile_options_ += " --compiler-enable-litecg=true"
}
args = [
"--script-file",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_aot_compiler",
"--script-options",
_aot_compile_options_,
"--script-args",
_script_args_,
"--expect-output",
"0",
"--env-path",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
rebase_path(_root_out_dir_) +
"/thirdparty/bounds_checking_function:" +
rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
]
inputs = [ _test_es2abc_abc_path_ ]
outputs = [ "$target_out_dir/${_target_name_}/es2abc/" ]
}
}
template("host_pgotypeinfer_test_action") {
_target_name_ = "${target_name}"
_deps_ = invoker.deps
_test_ts_path_ = "./${_target_name_}.js"
_test_aot_arg_ = "$target_out_dir/${_target_name_}"
_host_aot_target_ =
"$js_root/ecmascript/compiler:ark_aot_compiler(${host_toolchain})"
_test_es2abc_abc_path_ = "$target_out_dir/es2abc/${_target_name_}.abc"
if (defined(invoker.is_common_js) && invoker.is_common_js) {
extra_args = [ "--commonjs" ]
} else {
extra_args = [ "--module" ]
}
extra_args += [ "--merge-abc" ]
es2abc_gen_abc("es2abc_gen_${_target_name_}_abc") {
extra_visibility = [ ":*" ] # Only targets in this file can depend on this.
extra_dependencies = _deps_
if (defined(invoker.is_multi_file_tests) && invoker.is_multi_file_tests) {
_test_es2abc_ts_path_ = "."
} else {
_test_es2abc_ts_path_ = _test_ts_path_
}
src_js = rebase_path(_test_es2abc_ts_path_)
dst_file = rebase_path(_test_es2abc_abc_path_)
in_puts = [ _test_ts_path_ ]
out_puts = [ _test_es2abc_abc_path_ ]
}
_script_args_ = rebase_path(_test_es2abc_abc_path_)
action("${_target_name_}PgoExecute") {
testonly = true
_host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
_root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
deps = [
":es2abc_gen_${_target_name_}_abc",
_host_jsvm_target_,
]
deps += _deps_
script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
_aot_run_options_ =
" --asm-interpreter=true" + " --entry-point=${_target_name_}" +
" --enable-pgo-profiler=true" + " --compiler-pgo-profiler-path=" +
rebase_path(_test_aot_arg_) + "/modules.ap"
if (defined(invoker.is_enable_enableArkTools) &&
invoker.is_enable_enableArkTools) {
_aot_run_options_ += " --enable-ark-tools=true"
_aot_run_options_ += " --enable-force-gc=false"
}
if (defined(invoker.log_option)) {
_aot_run_options_ += invoker.log_option
}
args = [
"--script-file",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
"--script-options",
_aot_run_options_,
"--script-args",
_script_args_,
"--expect-output",
"0",
"--env-path",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
rebase_path(_root_out_dir_) +
"/thirdparty/bounds_checking_function:" +
rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
]
inputs = [ _test_es2abc_abc_path_ ]
outputs = [ "$target_out_dir/${_target_name_}/pgo" ]
}
action("${_target_name_}Es2abcAotTypeInferAction") {
testonly = true
_script_args_ = rebase_path(_test_es2abc_abc_path_)
_root_out_dir_ = get_label_info(_host_aot_target_, "root_out_dir")
deps = [
":es2abc_gen_${_target_name_}_abc",
_host_aot_target_,
]
deps += _deps_
# Pgo Execute
deps += [ ":${_target_name_}PgoExecute" ]
script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
_aot_compile_options_ = " --compiler-assert-types=true" +
" --compiler-opt-type-lowering=false" +
" --compiler-opt-loop-peeling=false"
# Pgo Option
_aot_compile_options_ += " --compiler-pgo-profiler-path=" +
rebase_path(_test_aot_arg_) + "/modules.ap"
if (defined(invoker.is_enable_builtins_dts) &&
invoker.is_enable_builtins_dts) {
deps += [ "//arkcompiler/ets_runtime:es2abc_gen_builtins_d_abc" ]
_aot_compile_options_ += " --builtins-dts=" + rebase_path(root_out_dir) + "/obj/arkcompiler/ets_runtime/lib_ark_builtins/es2abc/lib_ark_builtins.d.abc"
}
if (defined(invoker.is_enable_global_typeinfer) &&
invoker.is_enable_global_typeinfer) {
_aot_compile_options_ += " --compiler-opt-global-typeinfer=true"
}
args = [
"--script-file",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_aot_compiler",
"--script-options",
_aot_compile_options_,
"--script-args",
_script_args_,
"--expect-output",
"0",
"--env-path",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
rebase_path(_root_out_dir_) +
"/thirdparty/bounds_checking_function:" +
rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
]
inputs = [ _test_es2abc_abc_path_ ]
outputs = [ "$target_out_dir/${_target_name_}/es2abc/" ]
}
}
template("host_quickfix_test_action") {
_target_name_ = "${target_name}"
_test_expect_path_ = "./${_target_name_}/expect_output.txt"
_test_file_name_ = [
"base",
"test",
"retest",
"patch",
]
if (defined(invoker.extra_patches)) {
_test_file_name_ += invoker.extra_patches
}
if (defined(invoker.entry_point)) {
_script_args_ = invoker.entry_point + " "
}
if (defined(invoker.is_hotpatch) && invoker.is_hotpatch) {
_test_map_path_ = "$target_out_dir/${_target_name_}/base.map"
}
foreach(filename, _test_file_name_) {
merge_file_raw = "//arkcompiler/ets_runtime/test/quickfix/"
if (filename == "test" || filename == "retest") {
merge_file_raw += "${filename}.txt"
} else {
merge_file_raw += "${_target_name_}/${filename}.txt"
}
merge_file = "$target_out_dir/${_target_name_}/${filename}.txt"
merge_file_prefix =
"//arkcompiler/ets_runtime/test/quickfix/${_target_name_}/"
action("gen_${_target_name_}_${filename}_merge_file") {
script = "//arkcompiler/ets_runtime/test/quickfix/generate_merge_file.py"
args = [
"--input",
rebase_path(merge_file_raw),
"--output",
rebase_path(merge_file),
"--prefix",
rebase_path(merge_file_prefix),
]
inputs = [ merge_file_raw ]
outputs = [ merge_file ]
}
abc_path = "$target_out_dir/${_target_name_}/${filename}.abc"
es2abc_gen_abc("gen_${_target_name_}_${filename}_abc") {
extra_visibility =
[ ":*" ] # Only targets in this file can depend on this.
extra_dependencies = [ ":gen_${_target_name_}_${filename}_merge_file" ]
if (defined(invoker.is_hotpatch) && filename == "patch") {
extra_dependencies += [ ":gen_${_target_name_}_base_abc" ]
}
src_js = "@" + rebase_path(merge_file)
dst_file = rebase_path(abc_path)
extra_args = [
"--module",
"--merge-abc",
]
if (defined(invoker.is_hotpatch) && filename == "patch") {
extra_args += [ "--generate-patch" ]
}
if (defined(invoker.is_hotpatch) && filename == "base") {
dump_symbol_table = rebase_path(_test_map_path_)
}
if (defined(invoker.is_hotpatch) && filename == "patch") {
input_symbol_table = rebase_path(_test_map_path_)
}
in_puts = [
_test_expect_path_,
merge_file,
]
if (defined(invoker.is_hotpatch) && filename == "patch") {
in_puts += [ _test_map_path_ ]
}
out_puts = [ abc_path ]
if (defined(invoker.is_hotpatch) && filename == "base") {
out_puts += [ _test_map_path_ ]
}
}
if (filename != _test_file_name_[0]) {
_script_args_ += ":"
}
_script_args_ += rebase_path(abc_path)
}
action("${_target_name_}QuickfixAction") {
testonly = true
_host_quickfix_target_ = "//arkcompiler/ets_runtime/ecmascript/quick_fix:quick_fix(${host_toolchain})"
_root_out_dir_ = get_label_info(_host_quickfix_target_, "root_out_dir")
deps = [ _host_quickfix_target_ ]
foreach(filename, _test_file_name_) {
deps += [ ":gen_${_target_name_}_${filename}_abc" ]
}
script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
quickfix_options = " --merge-abc true "
if (is_mac) {
quickfix_options = " --merge-abc true --asm-interpreter=false"
}
args = [
"--script-file",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/quick_fix",
"--script-options",
quickfix_options,
"--script-args",
_script_args_,
"--timeout-limit",
"500",
"--expect-file",
rebase_path(_test_expect_path_),
"--env-path",
rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
rebase_path(_root_out_dir_) +
"/thirdparty/bounds_checking_function:" +
rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
]
inputs = []
outputs = [ "$target_out_dir/${_target_name_}/" ]
}
}