0532773c创建于 2月28日历史提交
# Copyright (c) 2021-2026 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("//build/config/components/ets_frontend/es2abc_config.gni")
import("//arkcompiler/ets_runtime/js_runtime_config.gni")
import("$build_root/test.gni")

declare_args() {
  TEST_LLVM_ONLY = false

  # Turn off to disable lite compile version JIT tests
  enable_jit_lite_compile_test = true
}

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_ = 2400
}
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, "*")
    if (!defined(deps)) {
      deps = []
    }
    if (!defined(external_deps)) {
      external_deps = []
    }
    # hiviewdfx libraries
    external_deps += hiviewdfx_ext_deps
    deps += hiviewdfx_deps
  }

  _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_) + "/${_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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
      "--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_ ]
    }
  }
  _module_variants_ = [
    {
      suffix = ""
      out_dir = "$target_out_dir"
      expect_prefix = ""
      extra_args = []
    },
  ]
  if (defined(invoker.es2abc_extra_args)) {
    _module_variants_ += [
      {
        suffix = "Callable"
        out_dir = "$target_out_dir/callable"
        expect_prefix = "callable_"
        extra_args = invoker.es2abc_extra_args
      },
    ]
  }

  _base_test_expect_path_ = _test_expect_path_

  foreach(_variant_, _module_variants_) {
    _variant_suffix_ = _variant_.suffix
    _variant_out_dir_ = _variant_.out_dir
    _variant_extra_args_ = _variant_.extra_args

    _test_abc_path_ = "${_variant_out_dir_}/${_target_name_}.abc"
    _test_expect_path_ = _base_test_expect_path_
    if (_variant_.expect_prefix != "") {
      _expect_dir_ = get_path_info(_base_test_expect_path_, "dir")
      _expect_file_ = get_path_info(_base_test_expect_path_, "file")
      _test_expect_path_ =
          "${_expect_dir_}/${_variant_.expect_prefix}${_expect_file_}"
    }

    es2abc_gen_newest_abc("gen_${_target_name_}_abc${_variant_suffix_}") {
      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 (_variant_extra_args_ != []) {
        extra_args += _variant_extra_args_
      }
      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${_variant_suffix_}") {
      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${_variant_suffix_}",
        _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.disable_force_gc) && invoker.disable_force_gc) {
        js_vm_options += " --enable-force-gc=false"
      }

      if (defined(invoker.is_enable_enableArkTools) &&
          invoker.is_enable_enableArkTools) {
        js_vm_options += " --enable-ark-tools=true"
        js_vm_options += " --enable-force-gc=false"
      }

      if (defined(invoker.disable_heap_verify) && invoker.disable_heap_verify) {
        js_vm_options += " --enable-heap-verify=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:") +
            rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
      ]

      inputs = [ _test_abc_path_ ]
      inputs += _extra_modules_

      outputs = [ "$target_out_dir/${_target_name_}${_variant_suffix_}/" ]
    }

    action("${_target_name_}ContextAction${_variant_suffix_}") {
      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${_variant_suffix_}",
        _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.disable_force_gc) && invoker.disable_force_gc) {
        js_vm_options += " --enable-force-gc=false"
      }

      if (defined(invoker.is_enable_enableArkTools) &&
          invoker.is_enable_enableArkTools) {
        js_vm_options += " --enable-ark-tools=true"
        js_vm_options += " --enable-force-gc=false"
      }

      if (defined(invoker.disable_heap_verify) && invoker.disable_heap_verify) {
        js_vm_options += " --enable-heap-verify=false"
      }
      js_vm_options += " --multi-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:") +
            rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
      ]

      inputs = [ _test_abc_path_ ]
      inputs += _extra_modules_

      outputs = [ "$target_out_dir/${_target_name_}${_variant_suffix_}Context/" ]
    }
    action("${_target_name_}AsmAction${_variant_suffix_}") {
    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${_variant_suffix_}",
      _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.disable_force_gc) && invoker.disable_force_gc) {
      _asm_run_options_ += " --enable-force-gc=false"
    }

    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"
    }

    if (defined(invoker.disable_heap_verify) && invoker.disable_heap_verify) {
      _asm_run_options_ += " --enable-heap-verify=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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    inputs = [ _test_abc_path_ ]
    inputs += _extra_modules_

    outputs = [ "$target_out_dir/${_target_name_}${_variant_suffix_}Asm/" ]
  }

  action("${_target_name_}AsmContextAction${_variant_suffix_}") {
    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${_variant_suffix_}",
      _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.disable_force_gc) && invoker.disable_force_gc) {
      _asm_run_options_ += " --enable-force-gc=false"
    }

    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"
    }

    if (defined(invoker.disable_heap_verify) && invoker.disable_heap_verify) {
      _asm_run_options_ += " --enable-heap-verify=false"
    }
    _asm_run_options_ += " --multi-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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    inputs = [ _test_abc_path_ ]
    inputs += _extra_modules_

    outputs = [ "$target_out_dir/${_target_name_}${_variant_suffix_}AsmContext/" ]
  }

  action("${_target_name_}AsmSingleStepAction${_variant_suffix_}") {
    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${_variant_suffix_}",
      _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.disable_force_gc) && invoker.disable_force_gc) {
      _asm_run_options_ += " --enable-force-gc=false"
    }

    if (defined(invoker.is_enable_enableArkTools) &&
        invoker.is_enable_enableArkTools) {
      _asm_run_options_ += " --enable-ark-tools=true"
      _asm_run_options_ += " --enable-force-gc=false"
    }

    if (defined(invoker.disable_heap_verify) && invoker.disable_heap_verify) {
      _asm_run_options_ += " --enable-heap-verify=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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    inputs = [ _test_abc_path_ ]
    inputs += _extra_modules_

    outputs = [ "$target_out_dir/${_target_name_}${_variant_suffix_}AsmSingleStep/" ]
  }

  action("${_target_name_}AsmSingleStepContextAction${_variant_suffix_}") {
    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${_variant_suffix_}",
      _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.disable_force_gc) && invoker.disable_force_gc) {
      _asm_run_options_ += " --enable-force-gc=false"
    }

    if (defined(invoker.is_enable_enableArkTools) &&
        invoker.is_enable_enableArkTools) {
      _asm_run_options_ += " --enable-ark-tools=true"
      _asm_run_options_ += " --enable-force-gc=false"
    }

    if (defined(invoker.disable_heap_verify) && invoker.disable_heap_verify) {
      _asm_run_options_ += " --enable-heap-verify=false"
    }
    _asm_run_options_ += " --multi-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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    inputs = [ _test_abc_path_ ]
    inputs += _extra_modules_

    outputs = [ "$target_out_dir/${_target_name_}${_variant_suffix_}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 (defined(invoker.es2abc_extra_args)) {
      extra_args += invoker.es2abc_extra_args
    }
    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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    inputs = [ _test_abc_path_ ]
    inputs += _extra_modules_

    outputs = [ "$target_out_dir/${_target_name_}Assert/" ]
  }
  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

      deps = [ ":gen_${_target_name_}_abc" ]
      _test_abc_path_ = "$target_out_dir/${_target_name_}.abc"
      script = "${js_root}/script/run_ark_executable.py"

      args = [
        "--qemu-binary-path",
        "${QEMU_INSTALLATION_PATH}/bin/qemu-${musl_arch}",
        "--L",
        "./common/common/libc/",
        "--expect-output",
        "1",
        "--arkjsvmpath",
        "./arkcompiler/ets_runtime/ark_js_vm",
        "--test-abc-path",
        "$target_out_dir/${_target_name_}.abc",
      ]

      inputs = [ _test_abc_path_ ]

      outputs = [ "$target_out_dir/${_target_name_}WithQemu/" ]
    }
  }
  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 += " --multi-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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    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_ += " --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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    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_ += " --multi-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-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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    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_ += " --multi-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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    inputs = [ _test_abc_path_ ]
    inputs += _extra_modules_

    outputs = [ "$target_out_dir/${_target_name_}AsmSingleStepContextAssert/" ]
  }
}

template("host_perf_test_action") {
  _target_name_ = "${target_name}"
  _deps_ = invoker.deps
  _is_module_ = false
  if (defined(invoker.is_module) && invoker.is_module) {
    _is_module_ = true
  }
  _is_commonjs_ = false
  if (defined(invoker.is_commonjs) && invoker.is_commonjs) {
    _is_commonjs_ = true
  }
  _is_merge_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_js_path_ = "${_src_dir_}/${_target_name_}.${_src_postfix_}"

  if (_is_merge_abc_) {
    merge_file_raw = "./${_target_name_}/fileInfo.txt"
    merge_file = "$target_out_dir/${_target_name_}.txt"
    merge_file_prefix = "./"

    action("gen_${_target_name_}_merge_file") {
      script = "../../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 ]
    }
  }

  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_module_) {
      extra_args += [ "--module" ]
    }
    if (_is_commonjs_) {
      extra_args += [ "--commonjs" ]
    }
    if (_is_merge_abc_) {
      extra_args += [ "--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_ ]
  }

  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_)
  }

  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.disable_force_gc) && invoker.disable_force_gc) {
      js_vm_options += " --enable-force-gc=false"
    }
    js_vm_options += common_options
    js_vm_options += " --entry-point=${_target_name_}"
    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",
      "300",
      "--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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    inputs = [ _test_abc_path_ ]

    outputs = [ "$target_out_dir/${_target_name_}/" ]
  }

  action("${_target_name_}AsmAction") {
    testonly = true

    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
    deps = [
      ":gen_${_target_name_}_abc",
      _host_jsvm_target_,
    ]
    deps += _deps_

    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"

    _asm_run_options_ = " --asm-interpreter=true"
    if (defined(invoker.is_set_maxNonmovableSpaceCapacity) &&
        invoker.is_set_maxNonmovableSpaceCapacity) {
      _asm_run_options_ += " --max-unmovable-space=524288"  # 0.5M
    }

    if (defined(invoker.is_set_elements_kind) && invoker.is_set_elements_kind) {
      _asm_run_options_ += " --enable-elements-kind=true"
    }

    if (defined(invoker.disable_force_gc) && invoker.disable_force_gc) {
      _asm_run_options_ += " --enable-force-gc=false"
    }
    _asm_run_options_ += common_options
    _asm_run_options_ += " --entry-point=${_target_name_}"
    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",
      "300",
      "--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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    inputs = [ _test_abc_path_ ]

    outputs = [ "$target_out_dir/Asm_${_target_name_}/" ]
  }
}


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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    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=true"
    }

    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.is_enable_builtins_trace) &&
        invoker.is_enable_builtins_trace) {
      _aot_compile_options_ += " --compiler-trace-builtins=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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    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=true"
    }

    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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    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=true"
    }

    if (defined(invoker.is_enable_lowering_builtin) &&
        invoker.is_enable_lowering_builtin) {
      _aot_run_options_ += " --compiler-enable-lowering-builtin=true"
    }

    _aot_run_options_ += " --multi-context=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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    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=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=true"
      }

      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.is_enable_builtins_trace) &&
          invoker.is_enable_builtins_trace) {
        _aot_compile_options_ += " --compiler-trace-builtins=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:") +
            rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
      ]

      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_}"

      _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=true"
      }

      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:") +
            rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
      ]

      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_}"

      _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.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=true"
      }

      if (defined(invoker.is_enable_lowering_builtin) &&
          invoker.is_enable_lowering_builtin) {
        _aot_run_options_ += " --compiler-enable-lowering-builtin=true"
      }

      _aot_run_options_ += " --multi-context=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:") +
            rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
      ]

      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=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=true"
      }

      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.is_enable_builtins_trace) &&
          invoker.is_enable_builtins_trace) {
        _aot_compile_options_ += " --compiler-trace-builtins=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:") +
            rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
      ]

      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_,
      ]
      if (is_ohos && run_with_qemu) {
        deps +=
            [ "//arkcompiler/ets_runtime/ecmascript/compiler:gen_stub_file" ]
      }
      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_}" +
          " --open-ark-tools=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.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=true"
      }

      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_,
      ]
      if (is_ohos && run_with_qemu) {
        deps +=
            [ "//arkcompiler/ets_runtime/ecmascript/compiler:gen_stub_file" ]
      }
      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_}" +
          " --open-ark-tools=true"

      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=true"
      }

      if (defined(invoker.is_enable_lowering_builtin) &&
          invoker.is_enable_lowering_builtin) {
        _aot_run_options_ += " --compiler-enable-lowering-builtin=true"
      }

      _aot_run_options_ += " --multi-context=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_}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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    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=true"
    }

    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.is_enable_builtins_trace) &&
        invoker.is_enable_builtins_trace) {
      _aot_compile_options_ += " --compiler-trace-builtins=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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    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=true"
    }

    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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    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=true"
    }

    if (defined(invoker.is_enable_lowering_builtin) &&
        invoker.is_enable_lowering_builtin) {
      _aot_run_options_ += " --compiler-enable-lowering-builtin=true"
    }

    _aot_run_options_ += " --multi-context=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_ += " --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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    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_aot_log_level = "info"

  if (defined(invoker.use_error)) {
    _expect_output_option_ = "--expect-sub-error"
    _test_pgo_expect_path_ = invoker.use_error
    _test_expect_path_ = invoker.use_error
  } else {
    _expect_output_option_ = "--expect-file"
    _test_pgo_expect_path_ = rebase_path("${_src_dir_}/pgo_expect_output.txt")
    _test_expect_path_ = rebase_path("${_src_dir_}/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.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_ ]
    }
  }

  _aot_variants_ = [
    {
      suffix = ""
      out_dir = "$target_out_dir"
      expect_prefix = ""
      extra_args = []
    },
  ]
  if (defined(invoker.es2abc_extra_args)) {
    _aot_variants_ += [
      {
        suffix = "Callable"
        out_dir = "$target_out_dir/callable"
        expect_prefix = "callable_"
        extra_args = invoker.es2abc_extra_args
      },
    ]
  }

  _base_test_expect_path_ = _test_expect_path_
  _base_test_pgo_expect_path_ = _test_pgo_expect_path_

  foreach(_variant_, _aot_variants_) {
    _variant_suffix_ = _variant_.suffix
    _variant_out_dir_ = _variant_.out_dir
    _variant_extra_args_ = _variant_.extra_args
    _variant_deps_ = _deps_

    if (defined(invoker.gen_ts_by_script) && invoker.gen_ts_by_script) {
      _variant_deps_ += [ ":gen_${_target_name_}_ts" ]
    }

    _test_expect_path_ = _base_test_expect_path_
    _test_pgo_expect_path_ = _base_test_pgo_expect_path_
    if (!defined(invoker.use_error) && _variant_.expect_prefix != "") {
      _expect_dir_ = get_path_info(_base_test_expect_path_, "dir")
      _expect_file_ = get_path_info(_base_test_expect_path_, "file")
      _test_expect_path_ =
          "${_expect_dir_}/${_variant_.expect_prefix}${_expect_file_}"
      _pgo_expect_dir_ = get_path_info(_base_test_pgo_expect_path_, "dir")
      _pgo_expect_file_ = get_path_info(_base_test_pgo_expect_path_, "file")
      _test_pgo_expect_path_ =
          "${_pgo_expect_dir_}/${_variant_.expect_prefix}${_pgo_expect_file_}"
    }

    _test_abc_path_ = "${_variant_out_dir_}/${_target_name_}.abc"
    _test_aot_path_ = "${_variant_out_dir_}/${_target_name_}.an"
    _test_aot_snapshot_path_ = "${_variant_out_dir_}/${_target_name_}.ai"
    _test_aot_arg_ = "${_variant_out_dir_}/${_target_name_}"
    _test_profiler_path_ = "${_test_aot_arg_}/modules.ap"
    _variant_slowpath_out_dir_ = "${_variant_out_dir_}/slowpath"
    _test_aot_path_slowpath_ =
        "${_variant_slowpath_out_dir_}/${_target_name_}.an"
    _test_aot_snapshot_path_slowpath_ =
        "${_variant_slowpath_out_dir_}/${_target_name_}.ai"
    _test_aot_arg_slowpath_ =
        "${_variant_slowpath_out_dir_}/${_target_name_}"

    if (target_cpu == "x64" ||
        (ark_standalone_build && run_with_qemu && host_os == "linux" &&
         target_os == "ohos" && target_cpu == "arm64")) {
      _variant_litecg_out_dir_ = "${_variant_out_dir_}/litecg"
      _variant_slowpath_litecg_out_dir_ =
          "${_variant_out_dir_}/slowpath/litecg"
      _test_aot_path_litecg_ =
          "${_variant_litecg_out_dir_}/${_target_name_}.an"
      _test_aot_snapshot_path_litecg_ =
          "${_variant_litecg_out_dir_}/${_target_name_}.ai"
      _test_aot_arg_litecg_ =
          "${_variant_litecg_out_dir_}/${_target_name_}"
      _test_aot_path_slowpath_litecg_ =
          "${_variant_slowpath_litecg_out_dir_}/${_target_name_}.an"
      _test_aot_snapshot_path_slowpath_litecg_ =
          "${_variant_slowpath_litecg_out_dir_}/${_target_name_}.ai"
      _test_aot_arg_slowpath_litecg_ =
          "${_variant_slowpath_litecg_out_dir_}/${_target_name_}"
    }

    if (defined(invoker.gen_expect_output) && invoker.gen_expect_output &&
        _variant_.expect_prefix == "") {
      _raw_expect_path_ = "${_variant_out_dir_}/expect_output.txt"
      _raw_pgo_expect_path_ = "${_variant_out_dir_}/pgo_expect_output.txt"
      _test_expect_path_ = rebase_path(_raw_expect_path_)
      _test_pgo_expect_path_ = rebase_path(_raw_pgo_expect_path_)
      action("${_target_name_}GenExpectOutput${_variant_suffix_}") {
        script = "$js_root/script/gen_expect_output.sh"
        sources = [ _test_ts_path_ ]
        outputs = [ _raw_expect_path_ ]
        args = [ "aot" ] + rebase_path(sources + outputs)
      }

      action("${_target_name_}PgoGenExpectOutput${_variant_suffix_}") {
        script = "$js_root/script/gen_expect_output.sh"
        sources = [ _test_ts_path_ ]
        outputs = [ _raw_pgo_expect_path_ ]
        args = [ "pgo" ] + rebase_path(sources + outputs)
      }
      _variant_deps_ += [
        ":${_target_name_}GenExpectOutput${_variant_suffix_}",
        ":${_target_name_}PgoGenExpectOutput${_variant_suffix_}",
      ]
    }

    es2abc_gen_newest_abc("gen_${_target_name_}_abc${_variant_suffix_}") {
      extra_visibility = [ ":*" ]  # Only targets in this file can depend on this.
      extra_dependencies = _variant_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" ]
      }
      if (_variant_extra_args_ != []) {
        extra_args += _variant_extra_args_
      }

      in_puts = [ _test_ts_path_ ]
      if (!defined(invoker.use_error)) {
        in_puts += [ _test_expect_path_ ]
      }
      out_puts = [ _test_abc_path_ ]
    }

    _script_args_ = rebase_path(_test_abc_path_)

    action("${_target_name_}PgoExecute${_variant_suffix_}") {
      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${_variant_suffix_}",
        _host_jsvm_target_,
      ]
      deps += _variant_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_)

      _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_pgo_napi) && invoker.is_enable_pgo_napi) {
      _aot_run_options_ += " --enable-pgo-napi=true"
    }
    _aot_run_options_ += common_options
      args = []
      if (target_cpu == "x64" ||
          (ark_standalone_build && run_with_qemu && host_os == "linux" &&
           target_os == "ohos" && target_cpu == "arm64")) {
        foreach(clean_path, [
                  rebase_path(_test_profiler_path_),
                  rebase_path(_test_aot_path_),
                  rebase_path(_test_aot_snapshot_path_),
                  rebase_path(_test_aot_path_litecg_),
                  rebase_path(_test_aot_snapshot_path_litecg_),
                ]) {
          args += [
            "--clean-path",
            clean_path,
          ]
        }
      } else {
        foreach(clean_path, [
                  rebase_path(_test_profiler_path_),
                  rebase_path(_test_aot_path_),
                  rebase_path(_test_aot_snapshot_path_),
                ]) {
          args += [
            "--clean-path",
            clean_path,
          ]
        }
      }
      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_option_,
        _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:") +
            rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
      ]

      inputs = [ _test_abc_path_ ]

      outputs = [ _test_profiler_path_ ]
    }

    action("${_target_name_}AotCompileAction${_variant_suffix_}") {
      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${_variant_suffix_}",
        _host_aot_target_,
      ]
      deps += _variant_deps_

      if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
        deps += [ ":${_target_name_}PgoExecute${_variant_suffix_}" ]
      }

      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=true"
      }

      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.is_enable_builtins_trace) &&
          invoker.is_enable_builtins_trace) {
        _aot_compile_options_ += " --compiler-trace-builtins=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 = []
      foreach(clean_path, [
                rebase_path(_test_aot_path_),
                rebase_path(_test_aot_snapshot_path_),
              ]) {
        args += [
          "--clean-path",
          clean_path,
        ]
      }
      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:") +
            rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
      ]

      inputs = [ _test_abc_path_ ]

      outputs = [
        _test_aot_path_,
        _test_aot_snapshot_path_,
      ]
    }

    action("${_target_name_}AotCompileActionSlowPath${_variant_suffix_}") {
      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${_variant_suffix_}",
        _host_aot_target_,
      ]
      deps += _variant_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=true"
      }

      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.is_enable_builtins_trace) &&
          invoker.is_enable_builtins_trace) {
        _aot_compile_options_ += " --compiler-trace-builtins=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 = []
      foreach(clean_path, [
                rebase_path(_test_aot_path_slowpath_),
                rebase_path(_test_aot_snapshot_path_slowpath_),
              ]) {
        args += [
          "--clean-path",
          clean_path,
        ]
      }
      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:") +
            rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
      ]

      inputs = [ _test_abc_path_ ]

      outputs = [
        _test_aot_path_slowpath_,
        _test_aot_snapshot_path_slowpath_,
      ]
    }

    action("${_target_name_}AotAction${_variant_suffix_}") {
      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${_variant_suffix_}",
        ":gen_${_target_name_}_abc${_variant_suffix_}",
        _host_jsvm_target_,
      ]
      if (!defined(invoker.is_only_typed_path) || !invoker.is_only_typed_path) {
        deps += [ ":${_target_name_}AotActionSlowPath${_variant_suffix_}" ]
      }
      deps += _variant_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${_variant_suffix_}" ]
        } else if (ark_standalone_build && run_with_qemu && host_os == "linux" &&
                   target_os == "ohos" && target_cpu == "arm64") {
          deps += [ ":${_target_name_}AotActionWithLiteCGQemu${_variant_suffix_}" ]
        }
      }

      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=true"
      }

      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_output_option_,
        _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:") +
            rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
      ]

      inputs = [ _test_abc_path_ ]

      outputs = [ "${_variant_out_dir_}/${_target_name_}/" ]
    }

    action("${_target_name_}AotContextAction${_variant_suffix_}") {
      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${_variant_suffix_}",
        ":gen_${_target_name_}_abc${_variant_suffix_}",
        _host_jsvm_target_,
      ]
      if (!defined(invoker.is_only_typed_path) || !invoker.is_only_typed_path) {
        deps += [ ":${_target_name_}AotActionSlowPath${_variant_suffix_}" ]
      }
      deps += _variant_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${_variant_suffix_}" ]
        } else if (ark_standalone_build && run_with_qemu && host_os == "linux" &&
                   target_os == "ohos" && target_cpu == "arm64") {
          deps +=
              [ ":${_target_name_}AotContextActionWithLiteCGQemu${_variant_suffix_}" ]
        }
      }

      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=true"
      }
      _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"
      }

      _aot_run_options_ += " --multi-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_output_option_,
        _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:") +
            rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
      ]

      inputs = [ _test_abc_path_ ]

      outputs = [ "${_variant_out_dir_}/${_target_name_}Context/" ]
    }

    action("${_target_name_}AotActionSlowPath${_variant_suffix_}") {
      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${_variant_suffix_}",
        ":gen_${_target_name_}_abc${_variant_suffix_}",
        _host_jsvm_target_,
      ]
      deps += _variant_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_output_option_,
        _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:") +
            rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
      ]

      inputs = [ _test_abc_path_ ]

      outputs = [ "${_variant_out_dir_}/${_target_name_}/SlowPath" ]
    }

    if (target_cpu == "x64") {
      action("${_target_name_}AotCompileActionWithLiteCG${_variant_suffix_}") {
        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${_variant_suffix_}",
          _host_aot_target_,
        ]
        deps += _variant_deps_

        if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
          deps += [ ":${_target_name_}PgoExecute${_variant_suffix_}" ]
        }

        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=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=true"
        }

        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.is_enable_builtins_trace) &&
            invoker.is_enable_builtins_trace) {
          _aot_compile_options_ += " --compiler-trace-builtins=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 = []
        foreach(clean_path, [
                  rebase_path(_test_aot_path_litecg_),
                  rebase_path(_test_aot_snapshot_path_litecg_),
                ]) {
          args += [
            "--clean-path",
            clean_path,
          ]
        }
        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:") +
              rebase_path(_root_out_dir_) +
              "/hmosbundlemanager/zlib_override/",
        ]

        inputs = [ _test_abc_path_ ]

        outputs = [
          _test_aot_path_litecg_,
          _test_aot_snapshot_path_litecg_,
        ]
      }

      action("${_target_name_}AotCompileActionSlowPathWithLiteCG${_variant_suffix_}") {
        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${_variant_suffix_}",
          _host_aot_target_,
        ]
        deps += _variant_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=true"
        }

        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.is_enable_builtins_trace) &&
            invoker.is_enable_builtins_trace) {
          _aot_compile_options_ += " --compiler-trace-builtins=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 = []
        foreach(clean_path, [
                  rebase_path(_test_aot_path_slowpath_litecg_),
                  rebase_path(_test_aot_snapshot_path_slowpath_litecg_),
                ]) {
          args += [
            "--clean-path",
            clean_path,
          ]
        }
        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:") +
              rebase_path(_root_out_dir_) +
              "/hmosbundlemanager/zlib_override/",
        ]

        inputs = [ _test_abc_path_ ]

        outputs = [
          _test_aot_path_slowpath_litecg_,
          _test_aot_snapshot_path_slowpath_litecg_,
        ]
      }

      action("${_target_name_}AotActionWithLiteCG${_variant_suffix_}") {
        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${_variant_suffix_}",
          ":gen_${_target_name_}_abc${_variant_suffix_}",
          _host_jsvm_target_,
        ]
        if (!defined(invoker.is_only_typed_path) ||
            !invoker.is_only_typed_path) {
          deps +=
              [ ":${_target_name_}AotActionSlowPathWithLiteCG${_variant_suffix_}" ]
        }
        deps += _variant_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=true"
        }

        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_output_option_,
          _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:") +
              rebase_path(_root_out_dir_) +
              "/hmosbundlemanager/zlib_override/",
        ]

        inputs = [ _test_abc_path_ ]

        outputs = [ "${_variant_out_dir_}/${_target_name_}/LiteCG/" ]
      }

      action("${_target_name_}AotContextActionWithLiteCG${_variant_suffix_}") {
        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${_variant_suffix_}",
          ":gen_${_target_name_}_abc${_variant_suffix_}",
          _host_jsvm_target_,
        ]
        if (!defined(invoker.is_only_typed_path) ||
            !invoker.is_only_typed_path) {
          deps +=
              [ ":${_target_name_}AotActionSlowPathWithLiteCG${_variant_suffix_}" ]
        }
        deps += _variant_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_ += " --multi-context=true"

        if (defined(invoker.is_enable_typed_op_profiler) &&
            invoker.is_enable_typed_op_profiler) {
          _aot_run_options_ += " --compiler-typed-op-profiler=true"
        }

        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_output_option_,
          _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:") +
              rebase_path(_root_out_dir_) +
              "/hmosbundlemanager/zlib_override/",
        ]

        inputs = [ _test_abc_path_ ]

        outputs = [ "${_variant_out_dir_}/${_target_name_}Context/LiteCG/" ]
      }

      action("${_target_name_}AotActionSlowPathWithLiteCG${_variant_suffix_}") {
        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${_variant_suffix_}",
          ":gen_${_target_name_}_abc${_variant_suffix_}",
          _host_jsvm_target_,
        ]
        deps += _variant_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_output_option_,
          _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:") +
              rebase_path(_root_out_dir_) +
              "/hmosbundlemanager/zlib_override/",
        ]

        inputs = [ _test_abc_path_ ]

        outputs = [ "${_variant_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${_variant_suffix_}") {
        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${_variant_suffix_}",
          _host_aot_target_,
        ]
        deps += _variant_deps_

        if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
          deps += [ ":${_target_name_}PgoExecute${_variant_suffix_}" ]
        }

        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=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=true"
        }

        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.is_enable_builtins_trace) &&
            invoker.is_enable_builtins_trace) {
          _aot_compile_options_ += " --compiler-trace-builtins=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:") +
              rebase_path(_root_out_dir_) +
              "/hmosbundlemanager/zlib_override/",
        ]

        inputs = [ _test_abc_path_ ]

        outputs = [
          _test_aot_path_litecg_,
          _test_aot_snapshot_path_litecg_,
        ]
      }

      action("${_target_name_}AotCompileActionSlowPathWithLiteCGQemu${_variant_suffix_}") {
        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${_variant_suffix_}",
          _host_aot_target_,
        ]
        deps += _variant_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=true"
        }

        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.is_enable_builtins_trace) &&
            invoker.is_enable_builtins_trace) {
          _aot_compile_options_ += " --compiler-trace-builtins=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:") +
              rebase_path(_root_out_dir_) +
              "/hmosbundlemanager/zlib_override/",
        ]

        inputs = [ _test_abc_path_ ]

        outputs = [
          _test_aot_path_slowpath_litecg_,
          _test_aot_snapshot_path_slowpath_litecg_,
        ]
      }

      action("${_target_name_}AotActionWithLiteCGQemu${_variant_suffix_}") {
        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${_variant_suffix_}",
          ":gen_${_target_name_}_abc${_variant_suffix_}",
          "$ark_third_party_root/musl:soft_create_linker_for_qemu",
          _host_jsvm_target_,
        ]
        if (is_ohos && run_with_qemu) {
          deps +=
              [ "//arkcompiler/ets_runtime/ecmascript/compiler:gen_stub_file" ]
        }
        if (!defined(invoker.is_only_typed_path) ||
            !invoker.is_only_typed_path) {
          deps +=
              [ ":${_target_name_}AotActionSlowPathWithLiteCGQemu${_variant_suffix_}" ]
        }
        deps += _variant_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_}" +
            " --open-ark-tools=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.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=true"
        }

        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_output_option_,
          _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 = [ "${_variant_out_dir_}/${_target_name_}/LiteCG/" ]
      }

      action("${_target_name_}AotContextActionWithLiteCGQemu${_variant_suffix_}") {
        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${_variant_suffix_}",
          ":gen_${_target_name_}_abc${_variant_suffix_}",
          "$ark_third_party_root/musl:soft_create_linker_for_qemu",
          _host_jsvm_target_,
        ]
        if (is_ohos && run_with_qemu) {
          deps +=
              [ "//arkcompiler/ets_runtime/ecmascript/compiler:gen_stub_file" ]
        }
        if (!defined(invoker.is_only_typed_path) ||
            !invoker.is_only_typed_path) {
          deps +=
              [ ":${_target_name_}AotActionSlowPathWithLiteCGQemu${_variant_suffix_}" ]
        }
        deps += _variant_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_}" +
            " --open-ark-tools=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.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_ += " --multi-context=true"

        if (defined(invoker.is_enable_typed_op_profiler) &&
            invoker.is_enable_typed_op_profiler) {
          _aot_run_options_ += " --compiler-typed-op-profiler=true"
        }

        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_output_option_,
          _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 = [ "${_variant_out_dir_}/${_target_name_}Context/LiteCG/" ]
      }

      action("${_target_name_}AotActionSlowPathWithLiteCGQemu${_variant_suffix_}") {
        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${_variant_suffix_}",
          ":gen_${_target_name_}_abc${_variant_suffix_}",
          "$ark_third_party_root/musl:soft_create_linker_for_qemu",
          _host_jsvm_target_,
        ]
        if (is_ohos && run_with_qemu) {
          deps +=
              [ "//arkcompiler/ets_runtime/ecmascript/compiler:gen_stub_file" ]
        }
        deps += _variant_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_}" +
            " --open-ark-tools=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.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_output_option_,
          _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 = [ "${_variant_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" ]
    }
    if (defined(invoker.es2abc_extra_args)) {
      extra_args += invoker.es2abc_extra_args
    }
    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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    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=true"
    }

    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.is_enable_builtins_trace) &&
        invoker.is_enable_builtins_trace) {
      _aot_compile_options_ += " --compiler-trace-builtins=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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    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=true"
    }

    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.is_enable_builtins_trace) &&
        invoker.is_enable_builtins_trace) {
      _aot_compile_options_ += " --compiler-trace-builtins=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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    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=true"
    }

    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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    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_ += " --multi-context=true"

    if (defined(invoker.is_enable_typed_op_profiler) &&
        invoker.is_enable_typed_op_profiler) {
      _aot_run_options_ += " --compiler-typed-op-profiler=true"
    }

    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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    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_builtins_trace = true
    is_enable_enableArkTools = true
    gen_expect_output = true
    is_test_llvm_only = true
    deps = []
  }
}

template("host_jit_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"
  _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",
    ]
    if (defined(invoker.es2abc_extra_args)) {
      extra_args += invoker.es2abc_extra_args
    }
    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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    inputs = [ _test_abc_path_ ]

    outputs = [ "$target_out_dir/${_target_name_}/" ]
  }

  # run jit test with --compiler-enable-jit-lite-compile=true
  if (enable_jit_lite_compile_test) {
    action("${_target_name_}JitLiteCompileAction") {
      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_ =
          " --enable-force-gc=false" +
          " --asm-interpreter=true" +
          " --compiler-enable-jit=true" +
          " --compiler-enable-jit-pgo=true" +
          " --compiler-jit-hotness-threshold=5" +
          " --compiler-enable-litecg=true" +
          " --compiler-enable-jit-lite-compile=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:") +
            rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
      ]

      inputs = [ _test_abc_path_ ]
      outputs = [ "$target_out_dir/${_target_name_}_jit_lite_compile/" ]
    }
  }
}

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"

  _jit_variants_ = [
    {
      suffix = ""
      abc_path = _test_abc_path_
      script_args = _script_args_
      expect_path = _test_expect_path_
      extra_args = []
    },
  ]

  if (defined(invoker.es2abc_extra_args)) {
    _test_abc_extra_path_ =
        "$target_out_dir/callable/${_target_name_}.abc"
    _script_args_extra_ = rebase_path(_test_abc_extra_path_)
    _test_expect_extra_path_ = "./callable_expect_output.txt"
    _jit_variants_ += [
      {
        suffix = "Callable"
        abc_path = _test_abc_extra_path_
        script_args = _script_args_extra_
        expect_path = _test_expect_extra_path_
        extra_args = invoker.es2abc_extra_args
      },
    ]
  }

  foreach(_variant_, _jit_variants_) {
    es2abc_gen_newest_abc("gen_${_target_name_}_abc${_variant_.suffix}") {
      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(_variant_.abc_path)
      extension = "ts"
      extra_args = [
        "--module",
        "--merge-abc",
      ]
      if (_variant_.extra_args != []) {
        extra_args += _variant_.extra_args
      }
      in_puts = [ _test_ts_path_ ]
      out_puts = [ _variant_.abc_path ]
    }
  }

  _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" + " --enable-force-gc=false" +
      " --entry-point=${_target_name_} "
  _jit_run_options_ += common_options

  if (defined(invoker.jit_method_dichotomy_filter) && invoker.jit_method_dichotomy_filter) {
      _method_dichotomy_file_path_ = rebase_path("./method_compiled_by_jit.cfg")
      _jit_run_options_ += " --compiler-jit-method-path=${_method_dichotomy_file_path_} "
  }

  if (defined(invoker.reset_jit_hotness)) {
    _new_hotness_ = "--compiler-jit-hotness-threshold=" + invoker.reset_jit_hotness
    _jit_run_options_ += _new_hotness_
  } else {
    _jit_run_options_ += "--compiler-jit-hotness-threshold=5 "
  }
  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
  }

  foreach(_variant_, _jit_variants_) {
    action("${_target_name_}JitAction${_variant_.suffix}") {
      testonly = true
      script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"

      deps = [
        ":gen_${_target_name_}_abc${_variant_.suffix}",
        _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",
        _variant_.script_args,
        "--expect-file",
        rebase_path(_variant_.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:") +
            rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
      ]

      inputs = [ _variant_.abc_path ]

      outputs = [ "$target_out_dir/${_target_name_}${_variant_.suffix}/" ]
    }
  }

  # run jit test with --compiler-enable-jit-lite-compile=true
  if (enable_jit_lite_compile_test) {
    _jit_lite_run_options_ =
        " --enable-force-gc=false" +
        " --asm-interpreter=true" +
        " --compiler-enable-jit=true" +
        " --compiler-enable-jit-pgo=true" +
        " --compiler-jit-hotness-threshold=5" +
        " --compiler-enable-litecg=true" +
        " --compiler-enable-jit-lite-compile=true" +
        " --entry-point=${_target_name_} "
    _jit_lite_run_options_ += common_options

    if (defined(invoker.enable_osr) && invoker.enable_osr) {
      _jit_lite_run_options_ += " --compiler-enable-osr=true "
      _jit_lite_run_options_ += " --compiler-osr-hotness-threshold=1 "
    }
    if (defined(invoker.extra_option)) {
      _jit_lite_run_options_ += invoker.extra_option
    }

    foreach(_variant_, _jit_variants_) {
      action("${_target_name_}JitLiteCompileAction${_variant_.suffix}") {
        testonly = true
        script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"

        deps = [
          ":gen_${_target_name_}_abc${_variant_.suffix}",
          _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_lite_run_options_,
          "--script-args",
          _variant_.script_args,
          "--expect-file",
          rebase_path(_variant_.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:") +
              rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
        ]

        inputs = [ _variant_.abc_path ]
        outputs = [ "$target_out_dir/${_target_name_}_jit_lite_compile${_variant_.suffix}/" ]
      }
    }
  }
}

template("host_baseline_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_}BaselineJitAction") {
    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")
    _baseline_jit_run_options_ =
        " --asm-interpreter=true" + " --enable-force-gc=false" +
        " --compiler-enable-baselinejit=true" +
        " --entry-point=${_target_name_} "
    _baseline_jit_run_options_ += common_options

    if (defined(invoker.extra_option)) {
      _baseline_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",
      _baseline_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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    inputs = [ _test_abc_path_ ]

    outputs = [ "$target_out_dir/${_target_name_}/" ]
  }
}

template("host_aot_js_double_pgo_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"

  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_
    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_}FirstPgoExecute") {
    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.log_option)) {
      _aot_run_options_ += invoker.log_option
    }

    _aot_run_options_ += " --enable-ark-tools=true"
    _aot_run_options_ += " --enable-force-gc=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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    inputs = [ _test_abc_path_ ]

    outputs = [ "$target_out_dir/${_target_name_}/firstpgo" ]
  }

  action("${_target_name_}SecondPgoExecute") {
    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_,
      ":${_target_name_}FirstPgoExecute",
    ]
    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"

    _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_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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    inputs = [ _test_abc_path_ ]

    outputs = [ "$target_out_dir/${_target_name_}/secondpgo" ]
  }

  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_,
      ":${_target_name_}SecondPgoExecute",
    ]
    deps += _deps_

    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"
    _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-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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    inputs = [ _test_abc_path_ ]

    outputs = [
      _test_aot_path_,
      _test_aot_snapshot_path_,
    ]
  }

  action("${_target_name_}AotAction") {
    testonly = true

    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")

    deps = [
      ":${_target_name_}AotCompileAction",
      ":gen_${_target_name_}_abc",
      _host_jsvm_target_,
    ]
    deps += _deps_

    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"

    _aot_run_options_ =
        " --aot-file=" + rebase_path(_test_aot_arg_) +
        " --asm-interpreter=true" + " --entry-point=${_target_name_}"

    if (defined(invoker.log_option)) {
      _aot_run_options_ += invoker.log_option
    }
    _aot_run_options_ += " --enable-ark-tools=true"
    _aot_run_options_ += " --enable-force-gc=false"
    _aot_run_options_ += common_options

    _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:") +
          rebase_path(_root_out_dir_) + "/hmosbundlemanager/zlib_override/",
    ]

    inputs = [ _test_abc_path_ ]

    outputs = [ "$target_out_dir/${_target_name_}/" ]
  }
}