# 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_LLVM_ONLY = false } if (is_standard_system || ark_standalone_build) { _icu_path_ = "thirdparty/icu" } else { _icu_path_ = "global/i18n" } common_options = "" if (defined(disable_force_gc) && disable_force_gc) { common_options += " --enable-force-gc=false" } if (defined(timeout)) { _timeout_ = timeout } else { _timeout_ = 1200 } 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", "${_timeout_}", ] 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", "${_timeout_}", ] 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_gen_js_ = false if (defined(invoker.is_gen_js_by_script) && invoker.is_gen_js_by_script) { _is_gen_js_ = 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 } _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_abc_path_ = "$target_out_dir/${_target_name_}.abc" _test_expect_path_ = "${_src_dir_}/expect_output.txt" if (_is_gen_js_) { _test_js_template_path_ = "${_src_dir_}/${_target_name_}.${_src_postfix_}" _test_js_path_ = "$target_out_dir/${_target_name_}.${_src_postfix_}" } else { _test_js_path_ = "${_src_dir_}/${_target_name_}.${_src_postfix_}" } 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 ] } } if (_is_gen_js_) { action("gen_${_target_name_}_js_file") { script = "../../quickfix/generate_js_and_merge_file.py" src_file = rebase_path(_test_js_template_path_) dst_file = rebase_path(_test_js_path_) args = [ "--input=$src_file", "--output=$dst_file", ] inputs = [ _test_js_template_path_ ] outputs = [ _test_js_path_ ] } } es2abc_gen_newest_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_gen_js_) { extra_dependencies = [ ":gen_${_target_name_}_js_file" ] } 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.async_load_abc_test) && invoker.async_load_abc_test) { js_vm_options += " --async-load-abc-test=true" } if (defined(invoker.is_enable_enableArkTools) && invoker.is_enable_enableArkTools) { js_vm_options += " --enable-ark-tools=true" js_vm_options += " --enable-force-gc=false" } _icu_data_path_options_ = " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data") js_vm_options += _icu_data_path_options_ js_vm_options += common_options 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.async_load_abc_test) && invoker.async_load_abc_test) { js_vm_options += " --async-load-abc-test=true" } 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" js_vm_options += common_options _icu_data_path_options_ = " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data") js_vm_options += _icu_data_path_options_ 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.async_load_abc_test) && invoker.async_load_abc_test) { _asm_run_options_ += " --async-load-abc-test=true" } if (defined(invoker.is_set_elements_kind) && invoker.is_set_elements_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" _asm_run_options_ += common_options _icu_data_path_options_ = " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data") _asm_run_options_ += _icu_data_path_options_ 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.async_load_abc_test) && invoker.async_load_abc_test) { _asm_run_options_ += " --async-load-abc-test=true" } if (defined(invoker.is_set_elements_kind) && invoker.is_set_elements_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_ += common_options _icu_data_path_options_ = " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data") _asm_run_options_ += _icu_data_path_options_ 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.async_load_abc_test) && invoker.async_load_abc_test) { _asm_run_options_ += " --async-load-abc-test=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_ += common_options _icu_data_path_options_ = " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data") _asm_run_options_ += _icu_data_path_options_ 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.async_load_abc_test) && invoker.async_load_abc_test) { _asm_run_options_ += " --async-load-abc-test=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" _asm_run_options_ += common_options _icu_data_path_options_ = " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data") _asm_run_options_ += _icu_data_path_options_ 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_moduletest_assert_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_gen_js_ = false if (defined(invoker.is_gen_js_by_script) && invoker.is_gen_js_by_script) { _is_gen_js_ = 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 } _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_abc_path_ = "$target_out_dir/${_target_name_}.abc" if (_is_gen_js_) { _test_js_template_path_ = "${_src_dir_}/${_target_name_}.${_src_postfix_}" _test_js_path_ = "$target_out_dir/${_target_name_}.${_src_postfix_}" } else { _test_js_path_ = "${_src_dir_}/${_target_name_}.${_src_postfix_}" } 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 ] } } if (_is_gen_js_) { action("gen_${_target_name_}_js_file") { script = "../../quickfix/generate_js_and_merge_file.py" src_file = rebase_path(_test_js_template_path_) dst_file = rebase_path(_test_js_path_) args = [ "--input=$src_file", "--output=$dst_file", ] inputs = [ _test_js_template_path_ ] outputs = [ _test_js_path_ ] } } es2abc_gen_newest_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_gen_js_) { extra_dependencies = [ ":gen_${_target_name_}_js_file" ] } 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 = [ merge_file ] } else { in_puts = [ _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_}AssertAction") { 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 += " --test-assert=true" js_vm_options += common_options 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-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_abc_path_ ] inputs += _extra_modules_ outputs = [ "$target_out_dir/${_target_name_}Assert/" ] } action("${_target_name_}ContextAssertAction") { 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" js_vm_options += " --test-assert=true" js_vm_options += common_options 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-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_abc_path_ ] inputs += _extra_modules_ outputs = [ "$target_out_dir/${_target_name_}ContextAssert/" ] } action("${_target_name_}AsmAssertAction") { 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_elements_kind) && invoker.is_set_elements_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" _asm_run_options_ += " --test-assert=true" _asm_run_options_ += common_options 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-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_abc_path_ ] inputs += _extra_modules_ outputs = [ "$target_out_dir/${_target_name_}AsmAssert/" ] } action("${_target_name_}AsmContextAssertAction") { 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_elements_kind) && invoker.is_set_elements_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_ = " --test-assert=true" _asm_run_options_ += common_options 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-out", "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_abc_path_ ] inputs += _extra_modules_ outputs = [ "$target_out_dir/${_target_name_}AsmAssertContext/" ] } action("${_target_name_}AsmSingleStepAssertAction") { 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_ += " --test-assert=true" _asm_run_options_ += common_options args = [ "--script-file", rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm", "--script-options", _asm_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_abc_path_ ] inputs += _extra_modules_ outputs = [ "$target_out_dir/${_target_name_}AsmSingleStepAssert/" ] } action("${_target_name_}AsmSingleStepContextAssertAction") { 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" _asm_run_options_ += " --test-assert=true" _asm_run_options_ += common_options args = [ "--script-file", rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm", "--script-options", _asm_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_abc_path_ ] inputs += _extra_modules_ outputs = [ "$target_out_dir/${_target_name_}AsmSingleStepContextAssert/" ] } } 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 (target_cpu == "x64" || (ark_standalone_build && run_with_qemu && host_os == "linux" && target_os == "ohos" && target_cpu == "arm64")) { _test_aot_path_litecg_ = "$target_out_dir/litecg/${_target_name_}.an" _test_aot_snapshot_path_litecg_ = "$target_out_dir/litecg/${_target_name_}.ai" _test_aot_arg_litecg_ = "$target_out_dir/litecg/${_target_name_}" } if (defined(invoker.is_common_js) && invoker.is_common_js) { extra_args = [ "--commonjs" ] } else { extra_args = [ "--module" ] } extra_args += [ "--merge-abc" ] es2abc_gen_newest_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" } _aot_run_options_ += common_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_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=true" if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) { _aot_compile_options_ += " --compiler-pgo-profiler-path=" + rebase_path(_test_aot_arg_) + "/modules.ap" } _aot_compile_options_ += common_options 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_opt_array_bounds_check_elimination) && invoker.is_enable_opt_array_bounds_check_elimination) { _aot_compile_options_ += " --compiler-opt-array-bounds-check-elimination=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 (defined(invoker.disable_opt_loop_peeling) && invoker.disable_opt_loop_peeling) { _aot_compile_options_ += " --compiler-opt-loop-peeling=false" } if (defined(invoker.is_enable_pgo_space) && invoker.is_enable_pgo_space) { _aot_compile_options_ += " --compiler-enable-pgo-space=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_ _is_test_llvm_only_ = defined(invoker.is_test_llvm_only) && invoker.is_test_llvm_only if (!_is_test_llvm_only_) { if (target_cpu == "x64") { deps += [ ":${_target_name_}AotActionWithLiteCG" ] } else if (ark_standalone_build && run_with_qemu && host_os == "linux" && target_os == "ohos" && target_cpu == "arm64") { deps += [ ":${_target_name_}AotActionWithLiteCGQemu" ] } } 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" } _aot_run_options_ += common_options 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_ _is_test_llvm_only_ = defined(invoker.is_test_llvm_only) && invoker.is_test_llvm_only if (!_is_test_llvm_only_) { if (target_cpu == "x64") { deps += [ ":${_target_name_}AotContextActionWithLiteCG" ] } else if (ark_standalone_build && run_with_qemu && host_os == "linux" && target_os == "ohos" && target_cpu == "arm64") { deps += [ ":${_target_name_}AotContextActionWithLiteCGQemu" ] } } 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_}" _aot_run_options_ += common_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.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/" ] } if (target_cpu == "x64") { action("${_target_name_}AotCompileActionWithLiteCG") { 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_litecg_) + " --log-level=" + _test_aot_log_level + " --log-components=compiler" + " --compiler-opt-type-lowering=false" + " --compiler-opt-inlining=false" + " --compiler-opt-loop-peeling=true" + " --compiler-enable-litecg=true" 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=ture" } 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_opt_array_bounds_check_elimination) && invoker.is_enable_opt_array_bounds_check_elimination) { _aot_compile_options_ += " --compiler-opt-array-bounds-check-elimination=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 (defined(invoker.disable_opt_loop_peeling) && invoker.disable_opt_loop_peeling) { _aot_compile_options_ += " --compiler-opt-loop-peeling=false" } if (defined(invoker.is_enable_pgo_space) && invoker.is_enable_pgo_space) { _aot_compile_options_ += " --compiler-enable-pgo-space=true" } _aot_compile_options_ += common_options 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_litecg_, _test_aot_snapshot_path_litecg_, ] } action("${_target_name_}AotActionWithLiteCG") { 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_}AotCompileActionWithLiteCG", ":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_litecg_) + " --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" } _aot_run_options_ += common_options 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_ 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_}/LiteCG/" ] } action("${_target_name_}AotContextActionWithLiteCG") { 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_}AotCompileActionWithLiteCG", ":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_litecg_) + " --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" } _aot_run_options_ += common_options 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/LiteCG/" ] } } else if (ark_standalone_build && run_with_qemu && host_os == "linux" && target_os == "ohos" && target_cpu == "arm64") { import("$ark_third_party_root/musl/musl_template.gni") import("$build_root/config/qemu/config.gni") action("${_target_name_}AotCompileActionWithLiteCGQemu") { 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_litecg_) + " --log-level=" + _test_aot_log_level + " --log-components=compiler" + " --compiler-opt-type-lowering=false" + " --compiler-opt-inlining=false" + " --compiler-opt-loop-peeling=true" + " --compiler-enable-litecg=true" + " --compiler-target-triple=aarch64-unknown-linux-gnu" 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=ture" } 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_opt_array_bounds_check_elimination) && invoker.is_enable_opt_array_bounds_check_elimination) { _aot_compile_options_ += " --compiler-opt-array-bounds-check-elimination=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 (defined(invoker.disable_opt_loop_peeling) && invoker.disable_opt_loop_peeling) { _aot_compile_options_ += " --compiler-opt-loop-peeling=false" } if (defined(invoker.is_enable_pgo_space) && invoker.is_enable_pgo_space) { _aot_compile_options_ += " --compiler-enable-pgo-space=true" } _aot_compile_options_ += common_options 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_litecg_, _test_aot_snapshot_path_litecg_, ] } action("${_target_name_}AotActionWithLiteCGQemu") { testonly = true _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${default_toolchain})" _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir") deps = [ ":${_target_name_}AotCompileActionWithLiteCGQemu", ":gen_${_target_name_}_abc", "$ark_third_party_root/musl:soft_create_linker_for_qemu", _host_jsvm_target_, ] deps += _deps_ script = "//arkcompiler/ets_runtime/script/run_ark_executable.py" _aot_run_options_ = " --aot-file=" + rebase_path(_test_aot_arg_litecg_) + " --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" } _aot_run_options_ += common_options 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_ 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_), "--qemu-binary-path", "${QEMU_INSTALLATION_PATH}/bin/qemu-${musl_arch}", "--qemu-ld-prefix", rebase_path(musl_linker_so_out_dir, root_build_dir), "--clang-lib-path", rebase_path("${clang_base_path}/lib/${musl_arch}-linux-ohos:", root_build_dir) + 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_}/LiteCG/" ] } action("${_target_name_}AotContextActionWithLiteCGQemu") { testonly = true _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${default_toolchain})" _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir") deps = [ ":${_target_name_}AotCompileActionWithLiteCGQemu", ":gen_${_target_name_}_abc", "$ark_third_party_root/musl:soft_create_linker_for_qemu", _host_jsvm_target_, ] deps += _deps_ script = "//arkcompiler/ets_runtime/script/run_ark_executable.py" _aot_run_options_ = " --aot-file=" + rebase_path(_test_aot_arg_litecg_) + " --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" } _aot_run_options_ += common_options 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_), "--qemu-binary-path", "${QEMU_INSTALLATION_PATH}/bin/qemu-${musl_arch}", "--qemu-ld-prefix", rebase_path(musl_linker_so_out_dir, root_build_dir), "--clang-lib-path", rebase_path("${clang_base_path}/lib/${musl_arch}-linux-ohos:", root_build_dir) + 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/LiteCG/" ] } } } template("host_aot_js_assert_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_arg_ = "$target_out_dir/${_target_name_}" _test_aot_log_level = "info" if (defined(invoker.is_common_js) && invoker.is_common_js) { extra_args = [ "--commonjs" ] } else { extra_args = [ "--module" ] } extra_args += [ "--merge-abc" ] es2abc_gen_newest_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_ ] out_puts = [ _test_abc_path_ ] } _script_args_ = rebase_path(_test_abc_path_) action("${_target_name_}PgoExecuteAssert") { 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" } _aot_run_options_ += common_options if (defined(invoker.log_option)) { _aot_run_options_ += invoker.log_option } _aot_run_options_ += " --test-assert=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-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_abc_path_ ] outputs = [ "$target_out_dir/${_target_name_}/pgoassert" ] } action("${_target_name_}AotCompileAssertAction") { 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_}PgoExecuteAssert" ] } 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=true" 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_pgo_space) && invoker.is_enable_pgo_space) { _aot_compile_options_ += " --compiler-enable-pgo-space=true" } if (defined(invoker.is_enable_opt_array_bounds_check_elimination) && invoker.is_enable_opt_array_bounds_check_elimination) { _aot_compile_options_ += " --compiler-opt-array-bounds-check-elimination=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" } _aot_compile_options_ += common_options _aot_compile_options_ += " --test-assert=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 = [ "$target_out_dir/${_target_name_}AotCompileAssert.an", "$target_out_dir/${_target_name_}AotCompileAssert.ai", ] } action("${_target_name_}AotAssertAction") { 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_}AotCompileAssertAction", ":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" } _aot_run_options_ += common_options 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 } _aot_run_options_ += " --test-assert=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-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_abc_path_ ] outputs = [ "$target_out_dir/${_target_name_}AotAssert/" ] } action("${_target_name_}AotContextAssertAction") { 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_}AotCompileAssertAction", ":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" } _aot_run_options_ += common_options 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" _aot_run_options_ += " --test-assert=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-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_abc_path_ ] outputs = [ "$target_out_dir/${_target_name_}ContextAssert/" ] } } 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 } if (defined(invoker.gen_ts_by_script) && invoker.gen_ts_by_script) { _test_ts_template_path_ = "${_src_dir_}/${_target_name_}.ts" _test_ts_path_ = "$target_out_dir/${_target_name_}.ts" } else { _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_profiler_path_ = "${_test_aot_arg_}/modules.ap" _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_slowpath_expect_path_ = _test_expect_path_ _test_pgo_expect_path_ = "${_src_dir_}/pgo_expect_output.txt" _is_test_llvm_only_ = TEST_LLVM_ONLY if (!TEST_LLVM_ONLY && defined(invoker.is_test_llvm_only) && invoker.is_test_llvm_only) { _is_test_llvm_only_ = true } if (defined(invoker.use_one_expect_path) && invoker.use_one_expect_path) { _test_pgo_expect_path_ = _test_expect_path_ } if (defined(invoker.use_distinct_slowpath_expect_path) && invoker.use_distinct_slowpath_expect_path) { _test_slowpath_expect_path_ = "${_src_dir_}/slowpath_expect_output.txt" } if (target_cpu == "x64" || (ark_standalone_build && run_with_qemu && host_os == "linux" && target_os == "ohos" && target_cpu == "arm64")) { _test_aot_path_litecg_ = "$target_out_dir/litecg/${_target_name_}.an" _test_aot_snapshot_path_litecg_ = "$target_out_dir/litecg/${_target_name_}.ai" _test_aot_arg_litecg_ = "$target_out_dir/litecg/${_target_name_}" _test_aot_path_slowpath_litecg_ = "$target_out_dir/slowpath/litecg/${_target_name_}.an" _test_aot_snapshot_path_slowpath_litecg_ = "$target_out_dir/slowpath/litecg/${_target_name_}.ai" _test_aot_arg_slowpath_litecg_ = "$target_out_dir/slowpath/litecg/${_target_name_}" } if (defined(invoker.gen_expect_output) && invoker.gen_expect_output) { _test_expect_path_ = "$target_out_dir/expect_output.txt" _test_pgo_expect_path_ = "$target_out_dir/pgo_expect_output.txt" _test_slowpath_expect_path_ = _test_expect_path_ action("${_target_name_}GenExpectOutput") { script = "$js_root/script/gen_expect_output.sh" sources = [ _test_ts_path_ ] outputs = [ _test_expect_path_ ] args = [ "aot" ] + rebase_path(sources + outputs) } action("${_target_name_}PgoGenExpectOutput") { script = "$js_root/script/gen_expect_output.sh" sources = [ _test_ts_path_ ] outputs = [ _test_pgo_expect_path_ ] args = [ "pgo" ] + rebase_path(sources + outputs) } _deps_ += [ ":${_target_name_}GenExpectOutput", ":${_target_name_}PgoGenExpectOutput", ] } if (defined(invoker.gen_ts_by_script) && invoker.gen_ts_by_script) { action("gen_${_target_name_}_ts") { script = "//arkcompiler/ets_runtime/test/quickfix/generate_js_and_merge_file.py" src_file = rebase_path(_test_ts_template_path_) dst_file = rebase_path(_test_ts_path_) args = [ "--input=$src_file", "--output=$dst_file", ] inputs = [ _test_ts_template_path_ ] outputs = [ _test_ts_path_ ] } } es2abc_gen_newest_abc("gen_${_target_name_}_abc") { extra_visibility = [ ":*" ] # Only targets in this file can depend on this. extra_dependencies = _deps_ if (defined(invoker.gen_ts_by_script) && invoker.gen_ts_by_script) { extra_dependencies += [ ":gen_${_target_name_}_ts" ] } 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" ] 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_profiler_path_) 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_force_ic) && !invoker.is_enable_force_ic) { _aot_run_options_ += " --enable-force-ic=false" } _aot_run_options_ += common_options 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 = [ _test_profiler_path_ ] } 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=true" if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) { _aot_compile_options_ += " --compiler-pgo-profiler-path=" + rebase_path(_test_profiler_path_) } 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_opt_array_bounds_check_elimination) && invoker.is_enable_opt_array_bounds_check_elimination) { _aot_compile_options_ += " --compiler-opt-array-bounds-check-elimination=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 (defined(invoker.disable_opt_loop_peeling) && invoker.disable_opt_loop_peeling) { _aot_compile_options_ += " --compiler-opt-loop-peeling=false" } if (defined(invoker.is_enable_pgo_space) && invoker.is_enable_pgo_space) { _aot_compile_options_ += " --compiler-enable-pgo-space=true" } _aot_compile_options_ += common_options 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=true" 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_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_opt_array_bounds_check_elimination) && invoker.is_enable_opt_array_bounds_check_elimination) { _aot_compile_options_ += " --compiler-opt-array-bounds-check-elimination=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 (defined(invoker.disable_opt_loop_peeling) && invoker.disable_opt_loop_peeling) { _aot_compile_options_ += " --compiler-opt-loop-peeling=false" } if (defined(invoker.is_enable_pgo_space) && invoker.is_enable_pgo_space) { _aot_compile_options_ += " --compiler-enable-pgo-space=true" } _aot_compile_options_ += common_options 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_ _is_test_llvm_only_ = defined(invoker.is_test_llvm_only) && invoker.is_test_llvm_only if (!_is_test_llvm_only_) { if (target_cpu == "x64") { deps += [ ":${_target_name_}AotActionWithLiteCG" ] } else if (ark_standalone_build && run_with_qemu && host_os == "linux" && target_os == "ohos" && target_cpu == "arm64") { deps += [ ":${_target_name_}AotActionWithLiteCGQemu" ] } } 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" } _aot_run_options_ += common_options 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_ _is_test_llvm_only_ = defined(invoker.is_test_llvm_only) && invoker.is_test_llvm_only if (!_is_test_llvm_only_) { if (target_cpu == "x64") { deps += [ ":${_target_name_}AotContextActionWithLiteCG" ] } else if (ark_standalone_build && run_with_qemu && host_os == "linux" && target_os == "ohos" && target_cpu == "arm64") { deps += [ ":${_target_name_}AotContextActionWithLiteCGQemu" ] } } 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" } _aot_run_options_ += common_options 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 } _aot_run_options_ += common_options args = [ "--script-file", rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm", "--script-options", _aot_run_options_, "--script-args", _script_args_, "--timeout-limit", "${_timeout_}", "--expect-file", rebase_path(_test_slowpath_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" ] } if (target_cpu == "x64") { action("${_target_name_}AotCompileActionWithLiteCG") { 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_litecg_) + " --log-level=" + _test_aot_log_level + " --log-components=compiler" + " --compiler-opt-inlining=false" + " --compiler-opt-loop-peeling=true" + " --compiler-enable-litecg=true" if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) { _aot_compile_options_ += " --compiler-pgo-profiler-path=" + rebase_path(_test_profiler_path_) } 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=ture" } 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_opt_array_bounds_check_elimination) && invoker.is_enable_opt_array_bounds_check_elimination) { _aot_compile_options_ += " --compiler-opt-array-bounds-check-elimination=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 (defined(invoker.disable_opt_loop_peeling) && invoker.disable_opt_loop_peeling) { _aot_compile_options_ += " --compiler-opt-loop-peeling=false" } if (defined(invoker.is_enable_pgo_space) && invoker.is_enable_pgo_space) { _aot_compile_options_ += " --compiler-enable-pgo-space=true" } _aot_compile_options_ += common_options 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_litecg_, _test_aot_snapshot_path_litecg_, ] } action("${_target_name_}AotCompileActionSlowPathWithLiteCG") { 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_litecg_) + " --log-level=" + _test_aot_log_level + " --log-components=compiler" + " --compiler-opt-type-lowering=false" + " --compiler-opt-inlining=false" + " --compiler-opt-loop-peeling=true" + " --compiler-enable-litecg=true" 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_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_opt_array_bounds_check_elimination) && invoker.is_enable_opt_array_bounds_check_elimination) { _aot_compile_options_ += " --compiler-opt-array-bounds-check-elimination=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 (defined(invoker.disable_opt_loop_peeling) && invoker.disable_opt_loop_peeling) { _aot_compile_options_ += " --compiler-opt-loop-peeling=false" } if (defined(invoker.is_enable_pgo_space) && invoker.is_enable_pgo_space) { _aot_compile_options_ += " --compiler-enable-pgo-space=true" } _aot_compile_options_ += common_options 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_litecg_, _test_aot_snapshot_path_slowpath_litecg_, ] } action("${_target_name_}AotActionWithLiteCG") { 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_}AotCompileActionWithLiteCG", ":gen_${_target_name_}_abc", _host_jsvm_target_, ] if (!defined(invoker.is_only_typed_path) || !invoker.is_only_typed_path) { deps += [ ":${_target_name_}AotActionSlowPathWithLiteCG" ] } deps += _deps_ script = "//arkcompiler/ets_runtime/script/run_ark_executable.py" _aot_run_options_ = " --aot-file=" + rebase_path(_test_aot_arg_litecg_) + " --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" } _aot_run_options_ += common_options 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_}/LiteCG/" ] } action("${_target_name_}AotContextActionWithLiteCG") { 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_}AotCompileActionWithLiteCG", ":gen_${_target_name_}_abc", _host_jsvm_target_, ] if (!defined(invoker.is_only_typed_path) || !invoker.is_only_typed_path) { deps += [ ":${_target_name_}AotActionSlowPathWithLiteCG" ] } deps += _deps_ script = "//arkcompiler/ets_runtime/script/run_ark_executable.py" _aot_run_options_ = " --aot-file=" + rebase_path(_test_aot_arg_litecg_) + " --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" } _aot_run_options_ += common_options 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/LiteCG/" ] } action("${_target_name_}AotActionSlowPathWithLiteCG") { 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_}AotCompileActionSlowPathWithLiteCG", ":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_litecg_) + " --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_ += common_options args = [ "--script-file", rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm", "--script-options", _aot_run_options_, "--script-args", _script_args_, "--timeout-limit", "${_timeout_}", "--expect-file", rebase_path(_test_slowpath_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/LiteCG" ] } } else if (ark_standalone_build && run_with_qemu && host_os == "linux" && target_os == "ohos" && target_cpu == "arm64") { import("$ark_third_party_root/musl/musl_template.gni") import("$build_root/config/qemu/config.gni") action("${_target_name_}AotCompileActionWithLiteCGQemu") { 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_litecg_) + " --log-level=" + _test_aot_log_level + " --log-components=compiler" + " --compiler-opt-inlining=false" + " --compiler-opt-loop-peeling=true" + " --compiler-enable-litecg=true" + " --compiler-target-triple=aarch64-unknown-linux-gnu" if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) { _aot_compile_options_ += " --compiler-pgo-profiler-path=" + rebase_path(_test_profiler_path_) } 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=ture" } 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_opt_array_bounds_check_elimination) && invoker.is_enable_opt_array_bounds_check_elimination) { _aot_compile_options_ += " --compiler-opt-array-bounds-check-elimination=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 (defined(invoker.disable_opt_loop_peeling) && invoker.disable_opt_loop_peeling) { _aot_compile_options_ += " --compiler-opt-loop-peeling=false" } if (defined(invoker.is_enable_pgo_space) && invoker.is_enable_pgo_space) { _aot_compile_options_ += " --compiler-enable-pgo-space=true" } _aot_compile_options_ += common_options 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_litecg_, _test_aot_snapshot_path_litecg_, ] } action("${_target_name_}AotCompileActionSlowPathWithLiteCGQemu") { 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_litecg_) + " --log-level=" + _test_aot_log_level + " --log-components=compiler" + " --compiler-opt-type-lowering=false" + " --compiler-opt-inlining=false" + " --compiler-opt-loop-peeling=true" + " --compiler-enable-litecg=true" + " --compiler-target-triple=aarch64-unknown-linux-gnu" 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_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_opt_array_bounds_check_elimination) && invoker.is_enable_opt_array_bounds_check_elimination) { _aot_compile_options_ += " --compiler-opt-array-bounds-check-elimination=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 (defined(invoker.disable_opt_loop_peeling) && invoker.disable_opt_loop_peeling) { _aot_compile_options_ += " --compiler-opt-loop-peeling=false" } if (defined(invoker.is_enable_pgo_space) && invoker.is_enable_pgo_space) { _aot_compile_options_ += " --compiler-enable-pgo-space=true" } _aot_compile_options_ += common_options 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_litecg_, _test_aot_snapshot_path_slowpath_litecg_, ] } action("${_target_name_}AotActionWithLiteCGQemu") { testonly = true _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${default_toolchain})" _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir") deps = [ ":${_target_name_}AotCompileActionWithLiteCGQemu", ":gen_${_target_name_}_abc", "$ark_third_party_root/musl:soft_create_linker_for_qemu", _host_jsvm_target_, ] if (!defined(invoker.is_only_typed_path) || !invoker.is_only_typed_path) { deps += [ ":${_target_name_}AotActionSlowPathWithLiteCGQemu" ] } deps += _deps_ script = "//arkcompiler/ets_runtime/script/run_ark_executable.py" _aot_run_options_ = " --aot-file=" + rebase_path(_test_aot_arg_litecg_) + " --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" } _aot_run_options_ += common_options 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_), "--qemu-binary-path", "${QEMU_INSTALLATION_PATH}/bin/qemu-${musl_arch}", "--qemu-ld-prefix", rebase_path(musl_linker_so_out_dir, root_build_dir), "--clang-lib-path", rebase_path("${clang_base_path}/lib/${musl_arch}-linux-ohos:", root_build_dir) + 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_}/LiteCG/" ] } action("${_target_name_}AotContextActionWithLiteCGQemu") { testonly = true _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${default_toolchain})" _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir") deps = [ ":${_target_name_}AotCompileActionWithLiteCGQemu", ":gen_${_target_name_}_abc", "$ark_third_party_root/musl:soft_create_linker_for_qemu", _host_jsvm_target_, ] if (!defined(invoker.is_only_typed_path) || !invoker.is_only_typed_path) { deps += [ ":${_target_name_}AotActionSlowPathWithLiteCGQemu" ] } deps += _deps_ script = "//arkcompiler/ets_runtime/script/run_ark_executable.py" _aot_run_options_ = " --aot-file=" + rebase_path(_test_aot_arg_litecg_) + " --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" } _aot_run_options_ += common_options 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_), "--qemu-binary-path", "${QEMU_INSTALLATION_PATH}/bin/qemu-${musl_arch}", "--qemu-ld-prefix", rebase_path(musl_linker_so_out_dir, root_build_dir), "--clang-lib-path", rebase_path("${clang_base_path}/lib/${musl_arch}-linux-ohos:", root_build_dir) + 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/LiteCG/" ] } action("${_target_name_}AotActionSlowPathWithLiteCGQemu") { testonly = true _host_jsvm_target_ = "$js_root/ecmascript/js_vm:ark_js_vm(${default_toolchain})" _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir") deps = [ ":${_target_name_}AotCompileActionSlowPathWithLiteCGQemu", ":gen_${_target_name_}_abc", "$ark_third_party_root/musl:soft_create_linker_for_qemu", _host_jsvm_target_, ] deps += _deps_ script = "$js_root/script/run_ark_executable.py" _aot_run_options_ = " --aot-file=" + rebase_path(_test_aot_arg_slowpath_litecg_) + " --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" } _aot_run_options_ += common_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_), "--qemu-binary-path", "${QEMU_INSTALLATION_PATH}/bin/qemu-${musl_arch}", "--qemu-ld-prefix", rebase_path(musl_linker_so_out_dir, root_build_dir), "--clang-lib-path", rebase_path("${clang_base_path}/lib/${musl_arch}-linux-ohos:", root_build_dir) + 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/LiteCG" ] } } } template("host_aot_assert_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_arg_ = "$target_out_dir/${_target_name_}" _test_aot_arg_slowpath_ = "$target_out_dir/slowpath/${_target_name_}" _test_aot_log_level = "info" es2abc_gen_newest_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" ] 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_ ] out_puts = [ _test_abc_path_ ] } _script_args_ = rebase_path(_test_abc_path_) action("${_target_name_}PgoExecuteAssert") { 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 } _aot_run_options_ += " --test-assert=true" _aot_run_options_ += common_options 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_abc_path_ ] outputs = [ "$target_out_dir/${_target_name_}/pgoassert" ] } action("${_target_name_}AotCompileAssertAction") { 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_}PgoExecuteAssert" ] } 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=true" 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_pgo_space) && invoker.is_enable_pgo_space) { _aot_compile_options_ += " --compiler-enable-pgo-space=true" } if (defined(invoker.is_enable_opt_array_bounds_check_elimination) && invoker.is_enable_opt_array_bounds_check_elimination) { _aot_compile_options_ += " --compiler-opt-array-bounds-check-elimination=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" } _aot_compile_options_ += common_options _aot_compile_options_ += " --test-assert=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_abc_path_ ] outputs = [ "$target_out_dir/${_target_name_}AotCompileAssert.an", "$target_out_dir/${_target_name_}AotCompileAssert.ai", ] } action("${_target_name_}AotCompileAssertActionSlowPath") { 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=true" if (defined(invoker.aot_log_option)) { _aot_compile_options_ += invoker.aot_log_option } 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_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_pgo_space) && invoker.is_enable_pgo_space) { _aot_compile_options_ += " --compiler-enable-pgo-space=true" } if (defined(invoker.is_enable_opt_array_bounds_check_elimination) && invoker.is_enable_opt_array_bounds_check_elimination) { _aot_compile_options_ += " --compiler-opt-array-bounds-check-elimination=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" } _aot_compile_options_ += common_options _aot_compile_options_ += " --test-assert=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_abc_path_ ] outputs = [ "$target_out_dir/slowpath/${_target_name_}AotCompileAssert.an", "$target_out_dir/slowpath/${_target_name_}AotCompileAssert.ai", ] } action("${_target_name_}AotAssertAction") { 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_}AotCompileAssertAction", ":gen_${_target_name_}_abc", _host_jsvm_target_, ] if (!defined(invoker.is_only_typed_path) || !invoker.is_only_typed_path) { deps += [ ":${_target_name_}AotAssertActionSlowPath" ] } 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" } _aot_run_options_ += " --test-assert=true" _aot_run_options_ += common_options 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_abc_path_ ] outputs = [ "$target_out_dir/${_target_name_}AotAssert/" ] } action("${_target_name_}AotContextAssertAction") { 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_}AotCompileAssertAction", ":gen_${_target_name_}_abc", _host_jsvm_target_, ] if (!defined(invoker.is_only_typed_path) || !invoker.is_only_typed_path) { deps += [ ":${_target_name_}AotAssertActionSlowPath" ] } 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" } _aot_run_options_ += " --test-assert=true" _aot_run_options_ += common_options 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_abc_path_ ] outputs = [ "$target_out_dir/${_target_name_}ContextAssert/" ] } action("${_target_name_}AotAssertActionSlowPath") { 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_}AotCompileAssertActionSlowPath", ":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 } _aot_run_options_ += " --test-assert=true" _aot_run_options_ += common_options 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_abc_path_ ] outputs = [ "$target_out_dir/${_target_name_}/AssertSlowPath" ] } } 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_newest_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 } _aot_run_options_ += common_options 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_ if (target_cpu == "x64") { deps += [ ":${_target_name_}Es2abcAotTypeInferActionWithLiteCG" ] } # Pgo Execute deps += [ ":${_target_name_}PgoExecute" ] script = "//arkcompiler/ets_runtime/script/run_ark_executable.py" _aot_compile_options_ = " --compiler-opt-type-lowering=false" + " --compiler-opt-loop-peeling=true" # Pgo Option _aot_compile_options_ += " --compiler-pgo-profiler-path=" + rebase_path(_test_aot_arg_) + "/modules.ap" _aot_compile_options_ += common_options 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/" ] } action("${_target_name_}Es2abcAotTypeInferActionWithLiteCG") { 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-opt-type-lowering=false" + " --compiler-opt-loop-peeling=true" + " --compiler-enable-litecg=true" # Pgo Option _aot_compile_options_ += " --compiler-pgo-profiler-path=" + rebase_path(_test_aot_arg_) + "/modules.ap" _aot_compile_options_ += common_options 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/LiteCG/" ] } } 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_}/" if (defined(invoker.is_gen_js_by_script) && invoker.is_gen_js_by_script) { action("gen_${_target_name_}_${filename}_js_file_and_merge") { script = "//arkcompiler/ets_runtime/test/quickfix/generate_js_and_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 ] } } else { 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_newest_abc("gen_${_target_name_}_${filename}_abc") { extra_visibility = [ ":*" ] # Only targets in this file can depend on this. if (defined(invoker.is_gen_js_by_script) && invoker.is_gen_js_by_script) { extra_dependencies = [ ":gen_${_target_name_}_${filename}_js_file_and_merge" ] } else { 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", "${_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 = [] outputs = [ "$target_out_dir/${_target_name_}/" ] } } template("host_aot_builtin_inlining_test_action") { host_aot_test_action("${target_name}") { forward_variables_from(invoker, "*") is_enable_pgo = true is_only_typed_path = true is_enable_opt_inlining = true is_enable_trace_deopt = true log_option = " --log-info=trace" is_enable_inline_trace = true is_enable_enableArkTools = true gen_expect_output = true is_test_llvm_only = true deps = [] } } template("host_jit_test_action") { _target_name_ = "${target_name}" _deps_ = invoker.deps _test_ts_path_ = "./${_target_name_}.ts" _test_abc_path_ = "$target_out_dir/${_target_name_}.abc" _script_args_ = rebase_path(_test_abc_path_) _test_expect_path_ = "./expect_output.txt" es2abc_gen_newest_abc("gen_${_target_name_}_abc") { extra_visibility = [ ":*" ] # Only targets in this file can depend on this. 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 = [ "--module", "--merge-abc", ] in_puts = [ _test_ts_path_ ] out_puts = [ _test_abc_path_ ] } action("${_target_name_}JitAction") { testonly = true script = "//arkcompiler/ets_runtime/script/run_ark_executable.py" _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})" _host_jsoptimizer_lib_ = "//arkcompiler/ets_runtime/ecmascript/compiler:libark_jsoptimizer(${host_toolchain})" _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir") _jit_run_options_ = " --asm-interpreter=true" + " --compiler-enable-jit=true" + " --compiler-enable-jit-pgo=true" + " --compiler-jit-hotness-threshold=5" + " --enable-pgo-profiler=true" + " --compiler-enable-litecg=true" + " --entry-point=${_target_name_} " _jit_run_options_ += common_options if (defined(invoker.enable_osr) && invoker.enable_osr) { _jit_run_options_ += " --compiler-enable-osr=true " _jit_run_options_ += " --compiler-osr-hotness-threshold=1 " } if (defined(invoker.extra_option)) { _jit_run_options_ += invoker.extra_option } deps = [ ":gen_${_target_name_}_abc", _host_jsoptimizer_lib_, _host_jsvm_target_, ] deps += _deps_ args = [ "--script-file", rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm", "--script-options", _jit_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_}/" ] } }