• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni")
15import("//arkcompiler/ets_runtime/js_runtime_config.gni")
16import("$build_root/test.gni")
17
18declare_args() {
19  TEST_LLVM_ONLY = false
20}
21
22if (is_standard_system || ark_standalone_build) {
23  _icu_path_ = "thirdparty/icu"
24} else {
25  _icu_path_ = "global/i18n"
26}
27
28common_options = ""
29if (defined(disable_force_gc) && disable_force_gc) {
30  common_options += " --enable-force-gc=false"
31}
32if (defined(timeout)) {
33  _timeout_ = timeout
34} else {
35  _timeout_ = 1200
36}
37template("host_unittest_action") {
38  _target_name_ = "${target_name}"
39
40  # unittest for phone running
41  ohos_unittest(_target_name_) {
42    resource_config_file =
43        "//arkcompiler/ets_runtime/test/resource/js_runtime/ohos_test.xml"
44    forward_variables_from(invoker, "*")
45  }
46
47  _module_out_path_ = invoker.module_out_path
48
49  # unittest for host running
50  action("${_target_name_}ActionWithoutQemu") {
51    testonly = true
52
53    _host_test_target_ = ":${_target_name_}(${host_toolchain})"
54    _root_out_dir_ = get_label_info(_host_test_target_, "root_out_dir")
55
56    deps = [ _host_test_target_ ]
57
58    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
59
60    args = [
61      "--script-file",
62      rebase_path(_root_out_dir_) +
63          "/tests/unittest/${_module_out_path_}/${_target_name_}",
64      "--expect-output",
65      "0",
66      "--env-path",
67      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
68          rebase_path(_root_out_dir_) + "/test/test:" +
69          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
70          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
71          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
72          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
73          rebase_path(_root_out_dir_) +
74          "/thirdparty/bounds_checking_function:" +
75          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
76      "--timeout-limit",
77      "${_timeout_}",
78    ]
79
80    inputs = [
81      "$_root_out_dir_/tests/unittest/${_module_out_path_}/${_target_name_}",
82    ]
83    outputs = [ "$target_out_dir/${_target_name_}/" ]
84  }
85  if (ark_standalone_build && host_os == "linux" && target_os == "ohos") {
86    import("$ark_third_party_root/musl/musl_template.gni")
87    import("$build_root/config/qemu/config.gni")
88
89    action("${_target_name_}ActionWithQemu") {
90      testonly = true
91
92      _host_test_target_ = ":${_target_name_}"
93
94      # path of root_out_dir based on root_src_dir
95      _root_out_dir_ = get_label_info(_host_test_target_, "root_out_dir")
96
97      deps = [
98        "$ark_third_party_root/musl:soft_create_linker_for_qemu",
99        _host_test_target_,
100      ]
101
102      script = "${js_root}/script/run_ark_executable.py"
103
104      args = [
105        "--script-file",
106        rebase_path(
107            "$_root_out_dir_/tests/unittest/${_module_out_path_}/${_target_name_}",
108            root_build_dir),
109        "--expect-output",
110        "0",
111        "--clang-lib-path",
112        rebase_path("${clang_base_path}/lib/${musl_arch}-linux-ohos",
113                    root_build_dir),
114        "--qemu-binary-path",
115        "${QEMU_INSTALLATION_PATH}/bin/qemu-${musl_arch}",
116        "--qemu-ld-prefix",
117        rebase_path(musl_linker_so_out_dir, root_build_dir),
118        "--timeout-limit",
119        "${_timeout_}",
120      ]
121
122      inputs = [
123        "$_root_out_dir_/tests/unittest/${_module_out_path_}/${_target_name_}",
124      ]
125      outputs = [ "$target_out_dir/${_target_name_}WithQemu/" ]
126    }
127  }
128  group("${_target_name_}Action") {
129    testonly = true
130
131    deps = []
132    if (ark_standalone_build && host_os == "linux" && target_os == "ohos" &&
133        run_with_qemu) {
134      deps += [ ":${_target_name_}ActionWithQemu" ]
135    } else {
136      deps += [ ":${_target_name_}ActionWithoutQemu" ]
137    }
138  }
139}
140
141template("host_moduletest_action") {
142  _target_name_ = "${target_name}"
143  _deps_ = invoker.deps
144  _is_module_ = false
145  if (defined(invoker.is_module) && invoker.is_module) {
146    _is_module_ = true
147  }
148  _is_commonjs_ = false
149  if (defined(invoker.is_commonjs) && invoker.is_commonjs) {
150    _is_commonjs_ = true
151  }
152  _is_gen_js_ = false
153  if (defined(invoker.is_gen_js_by_script) && invoker.is_gen_js_by_script) {
154    _is_gen_js_ = true
155  }
156  _is_merge_ = false
157  if (defined(invoker.is_merge) && invoker.is_merge) {
158    _is_merge_ = true
159  }
160  _is_merge_abc_ = false
161  if (defined(invoker.is_merge_abc) && invoker.is_merge_abc) {
162    _is_merge_abc_ = true
163  }
164
165  _src_dir_ = "."
166  if (defined(invoker.src_dir) && invoker.src_dir != "") {
167    _src_dir_ = invoker.src_dir
168  }
169
170  _src_postfix_ = "js"
171  if (defined(invoker.src_postfix) && invoker.src_postfix != "") {
172    _src_postfix_ = invoker.src_postfix
173  }
174
175  _test_abc_path_ = "$target_out_dir/${_target_name_}.abc"
176  _test_expect_path_ = "${_src_dir_}/expect_output.txt"
177  if (_is_gen_js_) {
178    _test_js_template_path_ = "${_src_dir_}/${_target_name_}.${_src_postfix_}"
179    _test_js_path_ = "$target_out_dir/${_target_name_}.${_src_postfix_}"
180  } else {
181    _test_js_path_ = "${_src_dir_}/${_target_name_}.${_src_postfix_}"
182  }
183
184  if (_is_merge_abc_) {
185    merge_file_raw = "./${_target_name_}.txt"
186    merge_file = "$target_out_dir/${_target_name_}.txt"
187    merge_file_prefix =
188        "//arkcompiler/ets_runtime/test/moduletest/${_target_name_}/"
189
190    action("gen_${_target_name_}_merge_file") {
191      script = "../../quickfix/generate_merge_file.py"
192      args = [
193        "--input",
194        rebase_path(merge_file_raw),
195        "--output",
196        rebase_path(merge_file),
197        "--prefix",
198        rebase_path(merge_file_prefix),
199      ]
200
201      inputs = [ merge_file_raw ]
202      outputs = [ merge_file ]
203    }
204  }
205  if (_is_gen_js_) {
206    action("gen_${_target_name_}_js_file") {
207      script = "../../quickfix/generate_js_and_merge_file.py"
208      src_file = rebase_path(_test_js_template_path_)
209      dst_file = rebase_path(_test_js_path_)
210      args = [
211        "--input=$src_file",
212        "--output=$dst_file",
213      ]
214      inputs = [ _test_js_template_path_ ]
215      outputs = [ _test_js_path_ ]
216    }
217  }
218  es2abc_gen_newest_abc("gen_${_target_name_}_abc") {
219    extra_visibility = [ ":*" ]  # Only targets in this file can depend on this.
220    extra_dependencies = _deps_
221    src_js = rebase_path(_test_js_path_)
222    dst_file = rebase_path(_test_abc_path_)
223    extra_args = []
224    if (_is_gen_js_) {
225      extra_dependencies = [ ":gen_${_target_name_}_js_file" ]
226    }
227    if (_is_module_) {
228      extra_args += [ "--module" ]
229    }
230    if (_is_commonjs_) {
231      extra_args += [ "--commonjs" ]
232    }
233    if (_is_merge_) {
234      extra_args += [ "--merge-abc" ]
235    }
236    if (_is_merge_abc_) {
237      extra_dependencies = [ ":gen_${_target_name_}_merge_file" ]
238      src_js = "@" + rebase_path(merge_file)
239      in_puts = [
240        _test_expect_path_,
241        merge_file,
242      ]
243    } else {
244      in_puts = [
245        _test_expect_path_,
246        _test_js_path_,
247      ]
248    }
249    out_puts = [ _test_abc_path_ ]
250  }
251
252  _extra_modules_ = []
253  if (defined(invoker.extra_modules)) {
254    foreach(module, invoker.extra_modules) {
255      _extra_modules_ += [ "$target_out_dir/${module}.abc" ]
256    }
257  }
258  if (defined(invoker.entry_point)) {
259    _script_args_ = invoker.entry_point
260    _script_args_ += " " + rebase_path(_test_abc_path_)
261  } else {
262    _script_args_ = rebase_path(_test_abc_path_)
263  }
264  foreach(extra_module, _extra_modules_) {
265    _script_args_ += ":" + rebase_path(extra_module)
266  }
267
268  action("${_target_name_}Action") {
269    testonly = true
270
271    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
272    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
273    deps = [
274      ":gen_${_target_name_}_abc",
275      _host_jsvm_target_,
276    ]
277    deps += _deps_
278
279    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
280
281    js_vm_options = " --asm-interpreter=false"
282    if (defined(invoker.is_set_maxNonmovableSpaceCapacity) &&
283        invoker.is_set_maxNonmovableSpaceCapacity) {
284      js_vm_options += " --max-unmovable-space=524288"  # 0.5M
285    }
286
287    if (defined(invoker.async_load_abc_test) && invoker.async_load_abc_test) {
288      js_vm_options += " --async-load-abc-test=true"
289    }
290
291    if (defined(invoker.disable_force_gc) && invoker.disable_force_gc) {
292      js_vm_options += " --enable-force-gc=false"
293    }
294
295    if (defined(invoker.is_enable_enableArkTools) &&
296        invoker.is_enable_enableArkTools) {
297      js_vm_options += " --enable-ark-tools=true"
298      js_vm_options += " --enable-force-gc=false"
299    }
300
301    if (defined(invoker.disable_heap_verify) && invoker.disable_heap_verify) {
302      js_vm_options += " --enable-heap-verify=false"
303    }
304    _icu_data_path_options_ =
305        " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
306    js_vm_options += _icu_data_path_options_
307    js_vm_options += common_options
308    args = [
309      "--script-file",
310      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
311      "--script-options",
312      js_vm_options,
313      "--script-args",
314      _script_args_,
315      "--timeout-limit",
316      "${_timeout_}",
317      "--expect-file",
318      rebase_path(_test_expect_path_),
319      "--env-path",
320      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
321          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
322          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
323          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
324          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
325          rebase_path(_root_out_dir_) +
326          "/thirdparty/bounds_checking_function:" +
327          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
328    ]
329
330    inputs = [ _test_abc_path_ ]
331    inputs += _extra_modules_
332
333    outputs = [ "$target_out_dir/${_target_name_}/" ]
334  }
335
336  action("${_target_name_}ContextAction") {
337    testonly = true
338
339    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
340    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
341    deps = [
342      ":gen_${_target_name_}_abc",
343      _host_jsvm_target_,
344    ]
345    deps += _deps_
346
347    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
348
349    js_vm_options = " --asm-interpreter=false"
350    if (defined(invoker.is_set_maxNonmovableSpaceCapacity) &&
351        invoker.is_set_maxNonmovableSpaceCapacity) {
352      js_vm_options += " --max-unmovable-space=524288"  # 0.5M
353    }
354
355    if (defined(invoker.async_load_abc_test) && invoker.async_load_abc_test) {
356      js_vm_options += " --async-load-abc-test=true"
357    }
358
359    if (defined(invoker.disable_force_gc) && invoker.disable_force_gc) {
360      js_vm_options += " --enable-force-gc=false"
361    }
362
363    if (defined(invoker.is_enable_enableArkTools) &&
364        invoker.is_enable_enableArkTools) {
365      js_vm_options += " --enable-ark-tools=true"
366      js_vm_options += " --enable-force-gc=false"
367    }
368
369    if (defined(invoker.disable_heap_verify) && invoker.disable_heap_verify) {
370      js_vm_options += " --enable-heap-verify=false"
371    }
372    js_vm_options += " --enable-context=true"
373    js_vm_options += common_options
374    _icu_data_path_options_ =
375        " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
376    js_vm_options += _icu_data_path_options_
377    args = [
378      "--script-file",
379      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
380      "--script-options",
381      js_vm_options,
382      "--script-args",
383      _script_args_,
384      "--timeout-limit",
385      "${_timeout_}",
386      "--expect-file",
387      rebase_path(_test_expect_path_),
388      "--env-path",
389      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
390          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
391          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
392          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
393          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
394          rebase_path(_root_out_dir_) +
395          "/thirdparty/bounds_checking_function:" +
396          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
397    ]
398
399    inputs = [ _test_abc_path_ ]
400    inputs += _extra_modules_
401
402    outputs = [ "$target_out_dir/${_target_name_}Context/" ]
403  }
404
405  action("${_target_name_}AsmAction") {
406    testonly = true
407
408    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
409    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
410    deps = [
411      ":gen_${_target_name_}_abc",
412      _host_jsvm_target_,
413    ]
414    deps += _deps_
415
416    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
417
418    _asm_run_options_ = " --asm-interpreter=true"
419    if (defined(invoker.is_set_maxNonmovableSpaceCapacity) &&
420        invoker.is_set_maxNonmovableSpaceCapacity) {
421      _asm_run_options_ += " --max-unmovable-space=524288"  # 0.5M
422    }
423
424    if (defined(invoker.async_load_abc_test) && invoker.async_load_abc_test) {
425      _asm_run_options_ += " --async-load-abc-test=true"
426    }
427
428    if (defined(invoker.disable_force_gc) && invoker.disable_force_gc) {
429      _asm_run_options_ += " --enable-force-gc=false"
430    }
431
432    if (defined(invoker.is_set_elements_kind) && invoker.is_set_elements_kind) {
433      _asm_run_options_ += " --enable-elements-kind=true"
434    }
435
436    if (defined(invoker.is_enable_enableArkTools) &&
437        invoker.is_enable_enableArkTools) {
438      _asm_run_options_ += " --enable-ark-tools=true"
439      _asm_run_options_ += " --enable-force-gc=false"
440    }
441
442    if (defined(invoker.disable_heap_verify) && invoker.disable_heap_verify) {
443      _asm_run_options_ += " --enable-heap-verify=false"
444    }
445    _asm_run_options_ += " --enable-context=true"
446    _asm_run_options_ += common_options
447    _icu_data_path_options_ =
448        " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
449    _asm_run_options_ += _icu_data_path_options_
450    args = [
451      "--script-file",
452      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
453      "--script-options",
454      _asm_run_options_,
455      "--script-args",
456      _script_args_,
457      "--timeout-limit",
458      "${_timeout_}",
459      "--expect-file",
460      rebase_path(_test_expect_path_),
461      "--env-path",
462      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
463          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
464          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
465          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
466          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
467          rebase_path(_root_out_dir_) +
468          "/thirdparty/bounds_checking_function:" +
469          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
470    ]
471
472    inputs = [ _test_abc_path_ ]
473    inputs += _extra_modules_
474
475    outputs = [ "$target_out_dir/${_target_name_}Asm/" ]
476  }
477
478  action("${_target_name_}AsmContextAction") {
479    testonly = true
480
481    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
482    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
483    deps = [
484      ":gen_${_target_name_}_abc",
485      _host_jsvm_target_,
486    ]
487    deps += _deps_
488
489    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
490
491    _asm_run_options_ = " --asm-interpreter=true"
492    if (defined(invoker.is_set_maxNonmovableSpaceCapacity) &&
493        invoker.is_set_maxNonmovableSpaceCapacity) {
494      _asm_run_options_ += " --max-unmovable-space=524288"  # 0.5M
495    }
496
497    if (defined(invoker.async_load_abc_test) && invoker.async_load_abc_test) {
498      _asm_run_options_ += " --async-load-abc-test=true"
499    }
500
501    if (defined(invoker.disable_force_gc) && invoker.disable_force_gc) {
502      _asm_run_options_ += " --enable-force-gc=false"
503    }
504
505    if (defined(invoker.is_set_elements_kind) && invoker.is_set_elements_kind) {
506      _asm_run_options_ += " --enable-elements-kind=true"
507    }
508
509    if (defined(invoker.is_enable_enableArkTools) &&
510        invoker.is_enable_enableArkTools) {
511      _asm_run_options_ += " --enable-ark-tools=true"
512      _asm_run_options_ += " --enable-force-gc=false"
513    }
514
515    if (defined(invoker.disable_heap_verify) && invoker.disable_heap_verify) {
516      _asm_run_options_ += " --enable-heap-verify=false"
517    }
518    _asm_run_options_ += common_options
519    _icu_data_path_options_ =
520        " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
521    _asm_run_options_ += _icu_data_path_options_
522    args = [
523      "--script-file",
524      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
525      "--script-options",
526      _asm_run_options_,
527      "--script-args",
528      _script_args_,
529      "--timeout-limit",
530      "${_timeout_}",
531      "--expect-file",
532      rebase_path(_test_expect_path_),
533      "--env-path",
534      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
535          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
536          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
537          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
538          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
539          rebase_path(_root_out_dir_) +
540          "/thirdparty/bounds_checking_function:" +
541          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
542    ]
543
544    inputs = [ _test_abc_path_ ]
545    inputs += _extra_modules_
546
547    outputs = [ "$target_out_dir/${_target_name_}AsmContext/" ]
548  }
549
550  action("${_target_name_}AsmSingleStepAction") {
551    testonly = true
552
553    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
554    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
555    deps = [
556      ":gen_${_target_name_}_abc",
557      _host_jsvm_target_,
558    ]
559    deps += _deps_
560
561    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
562
563    # 214: all bytecodes
564    _asm_run_options_ =
565        " --asm-interpreter=true --asm-opcode-disable-range=0,214"
566    if (defined(invoker.is_set_maxNonmovableSpaceCapacity) &&
567        invoker.is_set_maxNonmovableSpaceCapacity) {
568      _asm_run_options_ += " --max-unmovable-space=524288"  # 0.5M
569    }
570
571    if (defined(invoker.async_load_abc_test) && invoker.async_load_abc_test) {
572      _asm_run_options_ += " --async-load-abc-test=true"
573    }
574
575    if (defined(invoker.disable_force_gc) && invoker.disable_force_gc) {
576      _asm_run_options_ += " --enable-force-gc=false"
577    }
578
579    if (defined(invoker.is_enable_enableArkTools) &&
580        invoker.is_enable_enableArkTools) {
581      _asm_run_options_ += " --enable-ark-tools=true"
582      _asm_run_options_ += " --enable-force-gc=false"
583    }
584
585    if (defined(invoker.disable_heap_verify) && invoker.disable_heap_verify) {
586      _asm_run_options_ += " --enable-heap-verify=false"
587    }
588    _asm_run_options_ += common_options
589    _icu_data_path_options_ =
590        " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
591    _asm_run_options_ += _icu_data_path_options_
592    args = [
593      "--script-file",
594      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
595      "--script-options",
596      _asm_run_options_,
597      "--script-args",
598      _script_args_,
599      "--expect-file",
600      rebase_path(_test_expect_path_),
601      "--env-path",
602      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
603          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
604          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
605          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
606          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
607          rebase_path(_root_out_dir_) +
608          "/thirdparty/bounds_checking_function:" +
609          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
610    ]
611
612    inputs = [ _test_abc_path_ ]
613    inputs += _extra_modules_
614
615    outputs = [ "$target_out_dir/${_target_name_}AsmSingleStep/" ]
616  }
617
618  action("${_target_name_}AsmSingleStepContextAction") {
619    testonly = true
620
621    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
622    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
623    deps = [
624      ":gen_${_target_name_}_abc",
625      _host_jsvm_target_,
626    ]
627    deps += _deps_
628
629    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
630
631    # 214: all bytecodes
632    _asm_run_options_ =
633        " --asm-interpreter=true --asm-opcode-disable-range=0,214"
634    if (defined(invoker.is_set_maxNonmovableSpaceCapacity) &&
635        invoker.is_set_maxNonmovableSpaceCapacity) {
636      _asm_run_options_ += " --max-unmovable-space=524288"  # 0.5M
637    }
638
639    if (defined(invoker.async_load_abc_test) && invoker.async_load_abc_test) {
640      _asm_run_options_ += " --async-load-abc-test=true"
641    }
642
643    if (defined(invoker.disable_force_gc) && invoker.disable_force_gc) {
644      _asm_run_options_ += " --enable-force-gc=false"
645    }
646
647    if (defined(invoker.is_enable_enableArkTools) &&
648        invoker.is_enable_enableArkTools) {
649      _asm_run_options_ += " --enable-ark-tools=true"
650      _asm_run_options_ += " --enable-force-gc=false"
651    }
652
653    if (defined(invoker.disable_heap_verify) && invoker.disable_heap_verify) {
654      _asm_run_options_ += " --enable-heap-verify=false"
655    }
656    _asm_run_options_ += " --enable-context=true"
657    _asm_run_options_ += common_options
658    _icu_data_path_options_ =
659        " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
660    _asm_run_options_ += _icu_data_path_options_
661    args = [
662      "--script-file",
663      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
664      "--script-options",
665      _asm_run_options_,
666      "--script-args",
667      _script_args_,
668      "--expect-file",
669      rebase_path(_test_expect_path_),
670      "--env-path",
671      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
672          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
673          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
674          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
675          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
676          rebase_path(_root_out_dir_) +
677          "/thirdparty/bounds_checking_function:" +
678          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
679    ]
680
681    inputs = [ _test_abc_path_ ]
682    inputs += _extra_modules_
683
684    outputs = [ "$target_out_dir/${_target_name_}AsmSingleStepContext/" ]
685  }
686}
687
688template("host_moduletest_assert_action") {
689  _target_name_ = "${target_name}"
690  _deps_ = invoker.deps
691  _is_module_ = false
692  if (defined(invoker.is_module) && invoker.is_module) {
693    _is_module_ = true
694  }
695  _is_commonjs_ = false
696  if (defined(invoker.is_commonjs) && invoker.is_commonjs) {
697    _is_commonjs_ = true
698  }
699  _is_gen_js_ = false
700  if (defined(invoker.is_gen_js_by_script) && invoker.is_gen_js_by_script) {
701    _is_gen_js_ = true
702  }
703  _is_merge_ = false
704  if (defined(invoker.is_merge) && invoker.is_merge) {
705    _is_merge_ = true
706  }
707  _is_merge_abc_ = false
708  if (defined(invoker.is_merge_abc) && invoker.is_merge_abc) {
709    _is_merge_abc_ = true
710  }
711
712  _src_dir_ = "."
713  if (defined(invoker.src_dir) && invoker.src_dir != "") {
714    _src_dir_ = invoker.src_dir
715  }
716
717  _src_postfix_ = "js"
718  if (defined(invoker.src_postfix) && invoker.src_postfix != "") {
719    _src_postfix_ = invoker.src_postfix
720  }
721
722  _test_abc_path_ = "$target_out_dir/${_target_name_}.abc"
723
724  if (_is_gen_js_) {
725    _test_js_template_path_ = "${_src_dir_}/${_target_name_}.${_src_postfix_}"
726    _test_js_path_ = "$target_out_dir/${_target_name_}.${_src_postfix_}"
727  } else {
728    _test_js_path_ = "${_src_dir_}/${_target_name_}.${_src_postfix_}"
729  }
730
731  if (_is_merge_abc_) {
732    merge_file_raw = "./${_target_name_}.txt"
733    merge_file = "$target_out_dir/${_target_name_}.txt"
734    merge_file_prefix =
735        "//arkcompiler/ets_runtime/test/moduletest/${_target_name_}/"
736
737    action("gen_${_target_name_}_merge_file") {
738      script = "../../quickfix/generate_merge_file.py"
739      args = [
740        "--input",
741        rebase_path(merge_file_raw),
742        "--output",
743        rebase_path(merge_file),
744        "--prefix",
745        rebase_path(merge_file_prefix),
746      ]
747
748      inputs = [ merge_file_raw ]
749      outputs = [ merge_file ]
750    }
751  }
752  if (_is_gen_js_) {
753    action("gen_${_target_name_}_js_file") {
754      script = "../../quickfix/generate_js_and_merge_file.py"
755      src_file = rebase_path(_test_js_template_path_)
756      dst_file = rebase_path(_test_js_path_)
757      args = [
758        "--input=$src_file",
759        "--output=$dst_file",
760      ]
761      inputs = [ _test_js_template_path_ ]
762      outputs = [ _test_js_path_ ]
763    }
764  }
765
766  es2abc_gen_newest_abc("gen_${_target_name_}_abc") {
767    extra_visibility = [ ":*" ]  # Only targets in this file can depend on this.
768    extra_dependencies = _deps_
769    src_js = rebase_path(_test_js_path_)
770    dst_file = rebase_path(_test_abc_path_)
771    extra_args = []
772    if (_is_gen_js_) {
773      extra_dependencies = [ ":gen_${_target_name_}_js_file" ]
774    }
775    if (_is_module_) {
776      extra_args += [ "--module" ]
777    }
778    if (_is_commonjs_) {
779      extra_args += [ "--commonjs" ]
780    }
781    if (_is_merge_) {
782      extra_args += [ "--merge-abc" ]
783    }
784    if (_is_merge_abc_) {
785      extra_dependencies = [ ":gen_${_target_name_}_merge_file" ]
786      src_js = "@" + rebase_path(merge_file)
787      in_puts = [ merge_file ]
788    } else {
789      in_puts = [ _test_js_path_ ]
790    }
791    out_puts = [ _test_abc_path_ ]
792  }
793
794  _extra_modules_ = []
795  if (defined(invoker.extra_modules)) {
796    foreach(module, invoker.extra_modules) {
797      _extra_modules_ += [ "$target_out_dir/${module}.abc" ]
798    }
799  }
800  if (defined(invoker.entry_point)) {
801    _script_args_ = invoker.entry_point
802    _script_args_ += " " + rebase_path(_test_abc_path_)
803  } else {
804    _script_args_ = rebase_path(_test_abc_path_)
805  }
806  foreach(extra_module, _extra_modules_) {
807    _script_args_ += ":" + rebase_path(extra_module)
808  }
809
810  action("${_target_name_}AssertAction") {
811    testonly = true
812
813    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
814    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
815    deps = [
816      ":gen_${_target_name_}_abc",
817      _host_jsvm_target_,
818    ]
819    deps += _deps_
820
821    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
822
823    js_vm_options = " --asm-interpreter=false"
824    if (defined(invoker.is_set_maxNonmovableSpaceCapacity) &&
825        invoker.is_set_maxNonmovableSpaceCapacity) {
826      js_vm_options += " --max-unmovable-space=524288"  # 0.5M
827    }
828
829    if (defined(invoker.is_enable_enableArkTools) &&
830        invoker.is_enable_enableArkTools) {
831      js_vm_options += " --enable-ark-tools=true"
832      js_vm_options += " --enable-force-gc=false"
833    }
834    js_vm_options += " --test-assert=true"
835    js_vm_options += common_options
836    args = [
837      "--script-file",
838      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
839      "--script-options",
840      js_vm_options,
841      "--script-args",
842      _script_args_,
843      "--timeout-limit",
844      "${_timeout_}",
845      "--expect-output",
846      "0",
847      "--env-path",
848      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
849          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
850          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
851          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
852          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
853          rebase_path(_root_out_dir_) +
854          "/thirdparty/bounds_checking_function:" +
855          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
856    ]
857
858    inputs = [ _test_abc_path_ ]
859    inputs += _extra_modules_
860
861    outputs = [ "$target_out_dir/${_target_name_}Assert/" ]
862  }
863
864  action("${_target_name_}ContextAssertAction") {
865    testonly = true
866
867    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
868    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
869    deps = [
870      ":gen_${_target_name_}_abc",
871      _host_jsvm_target_,
872    ]
873    deps += _deps_
874
875    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
876
877    js_vm_options = " --asm-interpreter=false"
878    if (defined(invoker.is_set_maxNonmovableSpaceCapacity) &&
879        invoker.is_set_maxNonmovableSpaceCapacity) {
880      js_vm_options += " --max-unmovable-space=524288"  # 0.5M
881    }
882
883    if (defined(invoker.is_enable_enableArkTools) &&
884        invoker.is_enable_enableArkTools) {
885      js_vm_options += " --enable-ark-tools=true"
886      js_vm_options += " --enable-force-gc=false"
887    }
888    js_vm_options += " --enable-context=true"
889    js_vm_options += " --test-assert=true"
890    js_vm_options += common_options
891    args = [
892      "--script-file",
893      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
894      "--script-options",
895      js_vm_options,
896      "--script-args",
897      _script_args_,
898      "--timeout-limit",
899      "${_timeout_}",
900      "--expect-output",
901      "0",
902      "--env-path",
903      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
904          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
905          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
906          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
907          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
908          rebase_path(_root_out_dir_) +
909          "/thirdparty/bounds_checking_function:" +
910          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
911    ]
912
913    inputs = [ _test_abc_path_ ]
914    inputs += _extra_modules_
915
916    outputs = [ "$target_out_dir/${_target_name_}ContextAssert/" ]
917  }
918
919  action("${_target_name_}AsmAssertAction") {
920    testonly = true
921
922    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
923    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
924    deps = [
925      ":gen_${_target_name_}_abc",
926      _host_jsvm_target_,
927    ]
928    deps += _deps_
929
930    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
931
932    _asm_run_options_ = " --asm-interpreter=true"
933    if (defined(invoker.is_set_maxNonmovableSpaceCapacity) &&
934        invoker.is_set_maxNonmovableSpaceCapacity) {
935      _asm_run_options_ += " --max-unmovable-space=524288"  # 0.5M
936    }
937
938    if (defined(invoker.is_set_elements_kind) && invoker.is_set_elements_kind) {
939      _asm_run_options_ += " --enable-elements-kind=true"
940    }
941
942    if (defined(invoker.is_enable_enableArkTools) &&
943        invoker.is_enable_enableArkTools) {
944      _asm_run_options_ += " --enable-ark-tools=true"
945      _asm_run_options_ += " --enable-force-gc=false"
946    }
947    _asm_run_options_ += " --enable-context=true"
948    _asm_run_options_ += " --test-assert=true"
949    _asm_run_options_ += common_options
950    args = [
951      "--script-file",
952      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
953      "--script-options",
954      _asm_run_options_,
955      "--script-args",
956      _script_args_,
957      "--timeout-limit",
958      "${_timeout_}",
959      "--expect-output",
960      "0",
961      "--env-path",
962      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
963          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
964          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
965          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
966          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
967          rebase_path(_root_out_dir_) +
968          "/thirdparty/bounds_checking_function:" +
969          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
970    ]
971
972    inputs = [ _test_abc_path_ ]
973    inputs += _extra_modules_
974
975    outputs = [ "$target_out_dir/${_target_name_}AsmAssert/" ]
976  }
977
978  action("${_target_name_}AsmContextAssertAction") {
979    testonly = true
980
981    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
982    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
983    deps = [
984      ":gen_${_target_name_}_abc",
985      _host_jsvm_target_,
986    ]
987    deps += _deps_
988
989    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
990
991    _asm_run_options_ = " --asm-interpreter=true"
992    if (defined(invoker.is_set_maxNonmovableSpaceCapacity) &&
993        invoker.is_set_maxNonmovableSpaceCapacity) {
994      _asm_run_options_ += " --max-unmovable-space=524288"  # 0.5M
995    }
996
997    if (defined(invoker.is_set_elements_kind) && invoker.is_set_elements_kind) {
998      _asm_run_options_ += " --enable-elements-kind=true"
999    }
1000
1001    if (defined(invoker.is_enable_enableArkTools) &&
1002        invoker.is_enable_enableArkTools) {
1003      _asm_run_options_ += " --enable-ark-tools=true"
1004      _asm_run_options_ += " --enable-force-gc=false"
1005    }
1006    _asm_run_options_ = " --test-assert=true"
1007    _asm_run_options_ += common_options
1008    args = [
1009      "--script-file",
1010      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
1011      "--script-options",
1012      _asm_run_options_,
1013      "--script-args",
1014      _script_args_,
1015      "--timeout-limit",
1016      "${_timeout_}",
1017      "--expect-out",
1018      "0",
1019      "--env-path",
1020      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
1021          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
1022          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
1023          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
1024          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
1025          rebase_path(_root_out_dir_) +
1026          "/thirdparty/bounds_checking_function:" +
1027          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
1028    ]
1029
1030    inputs = [ _test_abc_path_ ]
1031    inputs += _extra_modules_
1032
1033    outputs = [ "$target_out_dir/${_target_name_}AsmAssertContext/" ]
1034  }
1035
1036  action("${_target_name_}AsmSingleStepAssertAction") {
1037    testonly = true
1038
1039    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
1040    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
1041    deps = [
1042      ":gen_${_target_name_}_abc",
1043      _host_jsvm_target_,
1044    ]
1045    deps += _deps_
1046
1047    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
1048
1049    # 214: all bytecodes
1050    _asm_run_options_ =
1051        " --asm-interpreter=true --asm-opcode-disable-range=0,214"
1052    if (defined(invoker.is_set_maxNonmovableSpaceCapacity) &&
1053        invoker.is_set_maxNonmovableSpaceCapacity) {
1054      _asm_run_options_ += " --max-unmovable-space=524288"  # 0.5M
1055    }
1056
1057    if (defined(invoker.is_enable_enableArkTools) &&
1058        invoker.is_enable_enableArkTools) {
1059      _asm_run_options_ += " --enable-ark-tools=true"
1060      _asm_run_options_ += " --enable-force-gc=false"
1061    }
1062    _asm_run_options_ += " --test-assert=true"
1063    _asm_run_options_ += common_options
1064    args = [
1065      "--script-file",
1066      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
1067      "--script-options",
1068      _asm_run_options_,
1069      "--script-args",
1070      _script_args_,
1071      "--expect-output",
1072      "0",
1073      "--env-path",
1074      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
1075          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
1076          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
1077          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
1078          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
1079          rebase_path(_root_out_dir_) +
1080          "/thirdparty/bounds_checking_function:" +
1081          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
1082    ]
1083
1084    inputs = [ _test_abc_path_ ]
1085    inputs += _extra_modules_
1086
1087    outputs = [ "$target_out_dir/${_target_name_}AsmSingleStepAssert/" ]
1088  }
1089
1090  action("${_target_name_}AsmSingleStepContextAssertAction") {
1091    testonly = true
1092
1093    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
1094    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
1095    deps = [
1096      ":gen_${_target_name_}_abc",
1097      _host_jsvm_target_,
1098    ]
1099    deps += _deps_
1100
1101    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
1102
1103    # 214: all bytecodes
1104    _asm_run_options_ =
1105        " --asm-interpreter=true --asm-opcode-disable-range=0,214"
1106    if (defined(invoker.is_set_maxNonmovableSpaceCapacity) &&
1107        invoker.is_set_maxNonmovableSpaceCapacity) {
1108      _asm_run_options_ += " --max-unmovable-space=524288"  # 0.5M
1109    }
1110
1111    if (defined(invoker.is_enable_enableArkTools) &&
1112        invoker.is_enable_enableArkTools) {
1113      _asm_run_options_ += " --enable-ark-tools=true"
1114      _asm_run_options_ += " --enable-force-gc=false"
1115    }
1116    _asm_run_options_ += " --enable-context=true"
1117    _asm_run_options_ += " --test-assert=true"
1118    _asm_run_options_ += common_options
1119
1120    args = [
1121      "--script-file",
1122      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
1123      "--script-options",
1124      _asm_run_options_,
1125      "--script-args",
1126      _script_args_,
1127      "--expect-output",
1128      "0",
1129      "--env-path",
1130      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
1131          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
1132          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
1133          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
1134          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
1135          rebase_path(_root_out_dir_) +
1136          "/thirdparty/bounds_checking_function:" +
1137          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
1138    ]
1139
1140    inputs = [ _test_abc_path_ ]
1141    inputs += _extra_modules_
1142
1143    outputs = [ "$target_out_dir/${_target_name_}AsmSingleStepContextAssert/" ]
1144  }
1145}
1146
1147template("host_aot_js_test_action") {
1148  _target_name_ = "${target_name}"
1149  _deps_ = invoker.deps
1150
1151  _test_ts_path_ = "./${_target_name_}.js"
1152  _test_abc_path_ = "$target_out_dir/${_target_name_}.abc"
1153  _test_aot_path_ = "$target_out_dir/${_target_name_}.an"
1154  _test_aot_snapshot_path_ = "$target_out_dir/${_target_name_}.ai"
1155  _test_aot_arg_ = "$target_out_dir/${_target_name_}"
1156  _test_aot_log_level = "info"
1157  _test_expect_path_ = "./expect_output.txt"
1158  _test_pgo_expect_path_ = "./pgo_expect_output.txt"
1159  if (target_cpu == "x64" ||
1160      (ark_standalone_build && run_with_qemu && host_os == "linux" &&
1161       target_os == "ohos" && target_cpu == "arm64")) {
1162    _test_aot_path_litecg_ = "$target_out_dir/litecg/${_target_name_}.an"
1163    _test_aot_snapshot_path_litecg_ =
1164        "$target_out_dir/litecg/${_target_name_}.ai"
1165    _test_aot_arg_litecg_ = "$target_out_dir/litecg/${_target_name_}"
1166  }
1167
1168  if (defined(invoker.is_common_js) && invoker.is_common_js) {
1169    extra_args = [ "--commonjs" ]
1170  } else {
1171    extra_args = [ "--module" ]
1172  }
1173  extra_args += [ "--merge-abc" ]
1174
1175  es2abc_gen_newest_abc("gen_${_target_name_}_abc") {
1176    extra_visibility = [ ":*" ]  # Only targets in this file can depend on this.
1177    extra_dependencies = _deps_
1178    if (defined(invoker.run_multi_file_tests) && invoker.run_multi_file_tests) {
1179      src_js = rebase_path("./")
1180    } else {
1181      src_js = rebase_path(_test_ts_path_)
1182    }
1183    dst_file = rebase_path(_test_abc_path_)
1184
1185    in_puts = [
1186      _test_ts_path_,
1187      _test_expect_path_,
1188    ]
1189    out_puts = [ _test_abc_path_ ]
1190  }
1191
1192  _script_args_ = rebase_path(_test_abc_path_)
1193
1194  action("${_target_name_}PgoExecute") {
1195    testonly = true
1196    _host_jsvm_target_ =
1197        "$js_root/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
1198    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
1199
1200    deps = [
1201      ":gen_${_target_name_}_abc",
1202      _host_jsvm_target_,
1203    ]
1204    deps += _deps_
1205
1206    script = "$js_root/script/run_ark_executable.py"
1207
1208    _aot_run_options_ =
1209        " --asm-interpreter=true" + " --entry-point=${_target_name_}" +
1210        " --enable-pgo-profiler=true" + " --compiler-pgo-profiler-path=" +
1211        rebase_path(_test_aot_arg_) + "/modules.ap"
1212
1213    if (defined(invoker.is_enable_enableArkTools) &&
1214        invoker.is_enable_enableArkTools) {
1215      _aot_run_options_ += " --enable-ark-tools=true"
1216      _aot_run_options_ += " --enable-force-gc=false"
1217    }
1218
1219    if (defined(invoker.disable_force_gc) && invoker.disable_force_gc) {
1220      _aot_run_options_ += " --enable-force-gc=false"
1221    }
1222
1223    _aot_run_options_ += common_options
1224    if (defined(invoker.log_option)) {
1225      _aot_run_options_ += invoker.log_option
1226    }
1227
1228    args = [
1229      "--script-file",
1230      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
1231      "--script-options",
1232      _aot_run_options_,
1233      "--script-args",
1234      _script_args_,
1235      "--expect-file",
1236      rebase_path(_test_pgo_expect_path_),
1237      "--env-path",
1238      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
1239          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
1240          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
1241          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
1242          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
1243          rebase_path(_root_out_dir_) +
1244          "/thirdparty/bounds_checking_function:" +
1245          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
1246    ]
1247
1248    inputs = [ _test_abc_path_ ]
1249
1250    outputs = [ "$target_out_dir/${_target_name_}/pgo" ]
1251  }
1252
1253  action("${_target_name_}AotCompileAction") {
1254    testonly = true
1255
1256    _host_aot_target_ = "//arkcompiler/ets_runtime/ecmascript/compiler:ark_aot_compiler(${host_toolchain})"
1257    _root_out_dir_ = get_label_info(_host_aot_target_, "root_out_dir")
1258    deps = [
1259      ":gen_${_target_name_}_abc",
1260      _host_aot_target_,
1261    ]
1262    deps += _deps_
1263
1264    if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
1265      deps += [ ":${_target_name_}PgoExecute" ]
1266    }
1267
1268    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
1269
1270    _aot_compile_options_ = " --aot-file=" + rebase_path(_test_aot_arg_) +
1271                            " --log-level=" + _test_aot_log_level + " --log-components=compiler --compiler-opt-type-lowering=false --compiler-opt-inlining=false" + " --compiler-opt-loop-peeling=true"
1272    if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
1273      _aot_compile_options_ += " --compiler-pgo-profiler-path=" +
1274                               rebase_path(_test_aot_arg_) + "/modules.ap"
1275    }
1276    _aot_compile_options_ += common_options
1277    if (defined(invoker.is_enable_trace_deopt) &&
1278        invoker.is_enable_trace_deopt) {
1279      _aot_compile_options_ += " --compiler-trace-deopt=true"
1280    }
1281
1282    if (defined(invoker.is_enable_opt_inlining) &&
1283        invoker.is_enable_opt_inlining) {
1284      _aot_compile_options_ +=
1285          " --compiler-opt-inlining=true --compiler-opt-type-lowering=true"
1286    }
1287
1288    if (defined(invoker.is_enable_typed_op_profiler) &&
1289        invoker.is_enable_typed_op_profiler) {
1290      _aot_compile_options_ += " --compiler-typed-op-profiler=true"
1291    }
1292
1293    if (defined(invoker.is_enable_lowering_builtin) &&
1294        invoker.is_enable_lowering_builtin) {
1295      _aot_compile_options_ += " --compiler-enable-lowering-builtin=true"
1296    }
1297
1298    if (defined(invoker.is_enable_native_inline) &&
1299        invoker.is_enable_native_inline) {
1300      _aot_compile_options_ += " --compiler-enable-native-inline=true"
1301    }
1302
1303    if (defined(invoker.is_enable_opt_loop_peeling) &&
1304        invoker.is_enable_opt_loop_peeling) {
1305      _aot_compile_options_ += " --compiler-opt-loop-peeling=true"
1306    }
1307
1308    if (defined(invoker.is_enable_opt_array_bounds_check_elimination) &&
1309        invoker.is_enable_opt_array_bounds_check_elimination) {
1310      _aot_compile_options_ +=
1311          " --compiler-opt-array-bounds-check-elimination=true"
1312    }
1313
1314    if (defined(invoker.is_enable_inline_trace) &&
1315        invoker.is_enable_inline_trace) {
1316      _aot_compile_options_ += " --compiler-trace-inline=true"
1317    }
1318
1319    if (defined(invoker.is_enable_builtins_trace) &&
1320        invoker.is_enable_builtins_trace) {
1321      _aot_compile_options_ += " --compiler-trace-builtins=true"
1322    }
1323
1324    if (defined(invoker.userDefinedMethodsInModule) &&
1325        invoker.userDefinedMethodsInModule) {
1326      _aot_compile_options_ += " --compiler-module-methods=2"
1327    }
1328
1329    if (defined(invoker.disable_opt_loop_peeling) &&
1330        invoker.disable_opt_loop_peeling) {
1331      _aot_compile_options_ += " --compiler-opt-loop-peeling=false"
1332    }
1333
1334    if (defined(invoker.is_enable_pgo_space) && invoker.is_enable_pgo_space) {
1335      _aot_compile_options_ += " --compiler-enable-pgo-space=true"
1336    }
1337
1338    args = [
1339      "--script-file",
1340      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_aot_compiler",
1341      "--script-options",
1342      _aot_compile_options_,
1343      "--script-args",
1344      _script_args_,
1345      "--expect-sub-output",
1346      "ts aot compile success",
1347      "--env-path",
1348      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
1349          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
1350          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
1351          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
1352          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
1353          rebase_path(_root_out_dir_) +
1354          "/thirdparty/bounds_checking_function:" +
1355          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
1356    ]
1357
1358    inputs = [ _test_abc_path_ ]
1359
1360    outputs = [
1361      _test_aot_path_,
1362      _test_aot_snapshot_path_,
1363    ]
1364  }
1365
1366  action("${_target_name_}AotAction") {
1367    testonly = true
1368
1369    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
1370    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
1371
1372    deps = [
1373      ":${_target_name_}AotCompileAction",
1374      ":gen_${_target_name_}_abc",
1375      _host_jsvm_target_,
1376    ]
1377    deps += _deps_
1378    _is_test_llvm_only_ =
1379        defined(invoker.is_test_llvm_only) && invoker.is_test_llvm_only
1380    if (!_is_test_llvm_only_) {
1381      if (target_cpu == "x64") {
1382        deps += [ ":${_target_name_}AotActionWithLiteCG" ]
1383      } else if (ark_standalone_build && run_with_qemu && host_os == "linux" &&
1384                 target_os == "ohos" && target_cpu == "arm64") {
1385        deps += [ ":${_target_name_}AotActionWithLiteCGQemu" ]
1386      }
1387    }
1388
1389    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
1390
1391    _aot_run_options_ =
1392        " --aot-file=" + rebase_path(_test_aot_arg_) +
1393        " --asm-interpreter=true" + " --entry-point=${_target_name_}"
1394
1395    if (defined(invoker.is_enable_enableArkTools) &&
1396        invoker.is_enable_enableArkTools) {
1397      _aot_run_options_ += " --enable-ark-tools=true"
1398      _aot_run_options_ += " --enable-force-gc=false"
1399    }
1400    _aot_run_options_ += common_options
1401    if (defined(invoker.log_option)) {
1402      _aot_run_options_ += invoker.log_option
1403    }
1404
1405    if (defined(invoker.is_enable_typed_op_profiler) &&
1406        invoker.is_enable_typed_op_profiler) {
1407      _aot_run_options_ += " --compiler-typed-op-profiler=true"
1408    }
1409
1410    if (defined(invoker.is_enable_lowering_builtin) &&
1411        invoker.is_enable_lowering_builtin) {
1412      _aot_run_options_ += " --compiler-enable-lowering-builtin=true"
1413    }
1414
1415    _icu_data_path_options_ =
1416        " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
1417    _aot_run_options_ += _icu_data_path_options_
1418
1419    if (defined(invoker.log_option)) {
1420      _aot_run_options_ += invoker.log_option
1421    }
1422
1423    args = [
1424      "--script-file",
1425      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
1426      "--script-options",
1427      _aot_run_options_,
1428      "--script-args",
1429      _script_args_,
1430      "--expect-file",
1431      rebase_path(_test_expect_path_),
1432      "--env-path",
1433      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
1434          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
1435          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
1436          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
1437          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
1438          rebase_path(_root_out_dir_) +
1439          "/thirdparty/bounds_checking_function:" +
1440          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
1441    ]
1442
1443    inputs = [ _test_abc_path_ ]
1444
1445    outputs = [ "$target_out_dir/${_target_name_}/" ]
1446  }
1447
1448  action("${_target_name_}AotContextAction") {
1449    testonly = true
1450
1451    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
1452    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
1453
1454    deps = [
1455      ":${_target_name_}AotCompileAction",
1456      ":gen_${_target_name_}_abc",
1457      _host_jsvm_target_,
1458    ]
1459    deps += _deps_
1460
1461    _is_test_llvm_only_ =
1462        defined(invoker.is_test_llvm_only) && invoker.is_test_llvm_only
1463    if (!_is_test_llvm_only_) {
1464      if (target_cpu == "x64") {
1465        deps += [ ":${_target_name_}AotContextActionWithLiteCG" ]
1466      } else if (ark_standalone_build && run_with_qemu && host_os == "linux" &&
1467                 target_os == "ohos" && target_cpu == "arm64") {
1468        deps += [ ":${_target_name_}AotContextActionWithLiteCGQemu" ]
1469      }
1470    }
1471
1472    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
1473
1474    _aot_run_options_ =
1475        " --aot-file=" + rebase_path(_test_aot_arg_) +
1476        " --asm-interpreter=true" + " --entry-point=${_target_name_}"
1477
1478    _aot_run_options_ += common_options
1479    if (defined(invoker.is_enable_enableArkTools) &&
1480        invoker.is_enable_enableArkTools) {
1481      _aot_run_options_ += " --enable-ark-tools=true"
1482      _aot_run_options_ += " --enable-force-gc=false"
1483    }
1484
1485    if (defined(invoker.disable_force_gc) && invoker.disable_force_gc) {
1486      _aot_run_options_ += " --enable-force-gc=false"
1487    }
1488
1489    if (defined(invoker.log_option)) {
1490      _aot_run_options_ += invoker.log_option
1491    }
1492
1493    if (defined(invoker.is_enable_typed_op_profiler) &&
1494        invoker.is_enable_typed_op_profiler) {
1495      _aot_run_options_ += " --compiler-typed-op-profiler=true"
1496    }
1497
1498    if (defined(invoker.is_enable_lowering_builtin) &&
1499        invoker.is_enable_lowering_builtin) {
1500      _aot_run_options_ += " --compiler-enable-lowering-builtin=true"
1501    }
1502
1503    _icu_data_path_options_ =
1504        " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
1505    _aot_run_options_ += _icu_data_path_options_
1506    _aot_run_options_ += " --enable-context=true"
1507
1508    args = [
1509      "--script-file",
1510      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
1511      "--script-options",
1512      _aot_run_options_,
1513      "--script-args",
1514      _script_args_,
1515      "--expect-file",
1516      rebase_path(_test_expect_path_),
1517      "--env-path",
1518      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
1519          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
1520          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
1521          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
1522          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
1523          rebase_path(_root_out_dir_) +
1524          "/thirdparty/bounds_checking_function:" +
1525          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
1526    ]
1527
1528    inputs = [ _test_abc_path_ ]
1529
1530    outputs = [ "$target_out_dir/${_target_name_}Context/" ]
1531  }
1532
1533  if (target_cpu == "x64") {
1534    action("${_target_name_}AotCompileActionWithLiteCG") {
1535      testonly = true
1536
1537      _host_aot_target_ = "//arkcompiler/ets_runtime/ecmascript/compiler:ark_aot_compiler(${host_toolchain})"
1538      _root_out_dir_ = get_label_info(_host_aot_target_, "root_out_dir")
1539      deps = [
1540        ":gen_${_target_name_}_abc",
1541        _host_aot_target_,
1542      ]
1543      deps += _deps_
1544
1545      if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
1546        deps += [ ":${_target_name_}PgoExecute" ]
1547      }
1548
1549      script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
1550
1551      _aot_compile_options_ =
1552          " --aot-file=" + rebase_path(_test_aot_arg_litecg_) +
1553          " --log-level=" + _test_aot_log_level + " --log-components=compiler" +
1554          " --compiler-opt-type-lowering=false" +
1555          " --compiler-opt-inlining=false" +
1556          " --compiler-opt-loop-peeling=true" + " --compiler-enable-litecg=true"
1557
1558      if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
1559        _aot_compile_options_ += " --compiler-pgo-profiler-path=" +
1560                                 rebase_path(_test_aot_arg_) + "/modules.ap"
1561      }
1562
1563      if (defined(invoker.is_enable_trace_deopt) &&
1564          invoker.is_enable_trace_deopt) {
1565        _aot_compile_options_ += " --compiler-trace-deopt=true"
1566      }
1567
1568      if (defined(invoker.is_enable_opt_inlining) &&
1569          invoker.is_enable_opt_inlining) {
1570        _aot_compile_options_ +=
1571            " --compiler-opt-inlining=true --compiler-opt-type-lowering=true"
1572      }
1573
1574      if (defined(invoker.is_enable_typed_op_profiler) &&
1575          invoker.is_enable_typed_op_profiler) {
1576        _aot_compile_options_ += " --compiler-typed-op-profiler=true"
1577      }
1578
1579      if (defined(invoker.is_enable_lowering_builtin) &&
1580          invoker.is_enable_lowering_builtin) {
1581        _aot_compile_options_ += " --compiler-enable-lowering-builtin=true"
1582      }
1583
1584      if (defined(invoker.is_enable_native_inline) &&
1585          invoker.is_enable_native_inline) {
1586        _aot_compile_options_ += " --compiler-enable-native-inline=true"
1587      }
1588
1589      if (defined(invoker.is_enable_opt_loop_peeling) &&
1590          invoker.is_enable_opt_loop_peeling) {
1591        _aot_compile_options_ += " --compiler-opt-loop-peeling=true"
1592      }
1593
1594      if (defined(invoker.is_enable_opt_array_bounds_check_elimination) &&
1595          invoker.is_enable_opt_array_bounds_check_elimination) {
1596        _aot_compile_options_ +=
1597            " --compiler-opt-array-bounds-check-elimination=true"
1598      }
1599
1600      if (defined(invoker.is_enable_inline_trace) &&
1601          invoker.is_enable_inline_trace) {
1602        _aot_compile_options_ += " --compiler-trace-inline=true"
1603      }
1604
1605      if (defined(invoker.is_enable_builtins_trace) &&
1606          invoker.is_enable_builtins_trace) {
1607        _aot_compile_options_ += " --compiler-trace-builtins=true"
1608      }
1609
1610      if (defined(invoker.userDefinedMethodsInModule) &&
1611          invoker.userDefinedMethodsInModule) {
1612        _aot_compile_options_ += " --compiler-module-methods=2"
1613      }
1614
1615      if (defined(invoker.disable_opt_loop_peeling) &&
1616          invoker.disable_opt_loop_peeling) {
1617        _aot_compile_options_ += " --compiler-opt-loop-peeling=false"
1618      }
1619
1620      if (defined(invoker.is_enable_pgo_space) && invoker.is_enable_pgo_space) {
1621        _aot_compile_options_ += " --compiler-enable-pgo-space=true"
1622      }
1623
1624      _aot_compile_options_ += common_options
1625      args = [
1626        "--script-file",
1627        rebase_path(_root_out_dir_) +
1628            "/arkcompiler/ets_runtime/ark_aot_compiler",
1629        "--script-options",
1630        _aot_compile_options_,
1631        "--script-args",
1632        _script_args_,
1633        "--expect-sub-output",
1634        "ts aot compile success",
1635        "--env-path",
1636        rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
1637            rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
1638            rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
1639            rebase_path(_root_out_dir_) +
1640            "/resourceschedule/frame_aware_sched:" +
1641            rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
1642            rebase_path(_root_out_dir_) +
1643            "/thirdparty/bounds_checking_function:" +
1644            rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
1645      ]
1646
1647      inputs = [ _test_abc_path_ ]
1648
1649      outputs = [
1650        _test_aot_path_litecg_,
1651        _test_aot_snapshot_path_litecg_,
1652      ]
1653    }
1654
1655    action("${_target_name_}AotActionWithLiteCG") {
1656      testonly = true
1657
1658      _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
1659      _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
1660
1661      deps = [
1662        ":${_target_name_}AotCompileActionWithLiteCG",
1663        ":gen_${_target_name_}_abc",
1664        _host_jsvm_target_,
1665      ]
1666      deps += _deps_
1667
1668      script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
1669
1670      _aot_run_options_ =
1671          " --aot-file=" + rebase_path(_test_aot_arg_litecg_) +
1672          " --asm-interpreter=true" + " --entry-point=${_target_name_}"
1673
1674      _icu_data_path_options_ =
1675          " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
1676      _aot_run_options_ += _icu_data_path_options_
1677
1678      if (defined(invoker.is_enable_enableArkTools) &&
1679          invoker.is_enable_enableArkTools) {
1680        _aot_run_options_ += " --enable-ark-tools=true"
1681        _aot_run_options_ += " --enable-force-gc=false"
1682      }
1683      _aot_run_options_ += common_options
1684      if (defined(invoker.log_option)) {
1685        _aot_run_options_ += invoker.log_option
1686      }
1687
1688      if (defined(invoker.is_enable_typed_op_profiler) &&
1689          invoker.is_enable_typed_op_profiler) {
1690        _aot_run_options_ += " --compiler-typed-op-profiler=true"
1691      }
1692
1693      if (defined(invoker.is_enable_lowering_builtin) &&
1694          invoker.is_enable_lowering_builtin) {
1695        _aot_run_options_ += " --compiler-enable-lowering-builtin=true"
1696      }
1697
1698      _icu_data_path_options_ =
1699          " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
1700      _aot_run_options_ += _icu_data_path_options_
1701
1702      args = [
1703        "--script-file",
1704        rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
1705        "--script-options",
1706        _aot_run_options_,
1707        "--script-args",
1708        _script_args_,
1709        "--expect-file",
1710        rebase_path(_test_expect_path_),
1711        "--env-path",
1712        rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
1713            rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
1714            rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
1715            rebase_path(_root_out_dir_) +
1716            "/resourceschedule/frame_aware_sched:" +
1717            rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
1718            rebase_path(_root_out_dir_) +
1719            "/thirdparty/bounds_checking_function:" +
1720            rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
1721      ]
1722
1723      inputs = [ _test_abc_path_ ]
1724
1725      outputs = [ "$target_out_dir/${_target_name_}/LiteCG/" ]
1726    }
1727
1728    action("${_target_name_}AotContextActionWithLiteCG") {
1729      testonly = true
1730
1731      _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
1732      _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
1733
1734      deps = [
1735        ":${_target_name_}AotCompileActionWithLiteCG",
1736        ":gen_${_target_name_}_abc",
1737        _host_jsvm_target_,
1738      ]
1739      deps += _deps_
1740
1741      script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
1742
1743      _aot_run_options_ =
1744          " --aot-file=" + rebase_path(_test_aot_arg_litecg_) +
1745          " --asm-interpreter=true" + " --entry-point=${_target_name_}"
1746
1747      _icu_data_path_options_ =
1748          " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
1749      _aot_run_options_ += _icu_data_path_options_
1750
1751      if (defined(invoker.is_enable_enableArkTools) &&
1752          invoker.is_enable_enableArkTools) {
1753        _aot_run_options_ += " --enable-ark-tools=true"
1754        _aot_run_options_ += " --enable-force-gc=false"
1755      }
1756
1757      if (defined(invoker.disable_force_gc) && invoker.disable_force_gc) {
1758        _aot_run_options_ += " --enable-force-gc=false"
1759      }
1760      _aot_run_options_ += common_options
1761
1762      if (defined(invoker.log_option)) {
1763        _aot_run_options_ += invoker.log_option
1764      }
1765
1766      if (defined(invoker.is_enable_typed_op_profiler) &&
1767          invoker.is_enable_typed_op_profiler) {
1768        _aot_run_options_ += " --compiler-typed-op-profiler=true"
1769      }
1770
1771      if (defined(invoker.is_enable_lowering_builtin) &&
1772          invoker.is_enable_lowering_builtin) {
1773        _aot_run_options_ += " --compiler-enable-lowering-builtin=true"
1774      }
1775
1776      _icu_data_path_options_ =
1777          " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
1778      _aot_run_options_ += _icu_data_path_options_
1779      _aot_run_options_ += " --enable-context=true"
1780
1781      args = [
1782        "--script-file",
1783        rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
1784        "--script-options",
1785        _aot_run_options_,
1786        "--script-args",
1787        _script_args_,
1788        "--expect-file",
1789        rebase_path(_test_expect_path_),
1790        "--env-path",
1791        rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
1792            rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
1793            rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
1794            rebase_path(_root_out_dir_) +
1795            "/resourceschedule/frame_aware_sched:" +
1796            rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
1797            rebase_path(_root_out_dir_) +
1798            "/thirdparty/bounds_checking_function:" +
1799            rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
1800      ]
1801
1802      inputs = [ _test_abc_path_ ]
1803
1804      outputs = [ "$target_out_dir/${_target_name_}Context/LiteCG/" ]
1805    }
1806  } else if (ark_standalone_build && run_with_qemu && host_os == "linux" &&
1807             target_os == "ohos" && target_cpu == "arm64") {
1808    import("$ark_third_party_root/musl/musl_template.gni")
1809    import("$build_root/config/qemu/config.gni")
1810
1811    action("${_target_name_}AotCompileActionWithLiteCGQemu") {
1812      testonly = true
1813
1814      _host_aot_target_ = "//arkcompiler/ets_runtime/ecmascript/compiler:ark_aot_compiler(${host_toolchain})"
1815      _root_out_dir_ = get_label_info(_host_aot_target_, "root_out_dir")
1816      deps = [
1817        ":gen_${_target_name_}_abc",
1818        _host_aot_target_,
1819      ]
1820      deps += _deps_
1821
1822      if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
1823        deps += [ ":${_target_name_}PgoExecute" ]
1824      }
1825
1826      script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
1827
1828      _aot_compile_options_ =
1829          " --aot-file=" + rebase_path(_test_aot_arg_litecg_) +
1830          " --log-level=" + _test_aot_log_level + " --log-components=compiler" +
1831          " --compiler-opt-type-lowering=false" +
1832          " --compiler-opt-inlining=false" +
1833          " --compiler-opt-loop-peeling=true" +
1834          " --compiler-enable-litecg=true" +
1835          " --compiler-target-triple=aarch64-unknown-linux-gnu"
1836
1837      if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
1838        _aot_compile_options_ += " --compiler-pgo-profiler-path=" +
1839                                 rebase_path(_test_aot_arg_) + "/modules.ap"
1840      }
1841
1842      if (defined(invoker.is_enable_trace_deopt) &&
1843          invoker.is_enable_trace_deopt) {
1844        _aot_compile_options_ += " --compiler-trace-deopt=true"
1845      }
1846
1847      if (defined(invoker.is_enable_opt_inlining) &&
1848          invoker.is_enable_opt_inlining) {
1849        _aot_compile_options_ +=
1850            " --compiler-opt-inlining=true --compiler-opt-type-lowering=true"
1851      }
1852
1853      if (defined(invoker.is_enable_typed_op_profiler) &&
1854          invoker.is_enable_typed_op_profiler) {
1855        _aot_compile_options_ += " --compiler-typed-op-profiler=true"
1856      }
1857
1858      if (defined(invoker.is_enable_lowering_builtin) &&
1859          invoker.is_enable_lowering_builtin) {
1860        _aot_compile_options_ += " --compiler-enable-lowering-builtin=true"
1861      }
1862
1863      if (defined(invoker.is_enable_native_inline) &&
1864          invoker.is_enable_native_inline) {
1865        _aot_compile_options_ += " --compiler-enable-native-inline=true"
1866      }
1867
1868      if (defined(invoker.is_enable_opt_loop_peeling) &&
1869          invoker.is_enable_opt_loop_peeling) {
1870        _aot_compile_options_ += " --compiler-opt-loop-peeling=true"
1871      }
1872
1873      if (defined(invoker.is_enable_opt_array_bounds_check_elimination) &&
1874          invoker.is_enable_opt_array_bounds_check_elimination) {
1875        _aot_compile_options_ +=
1876            " --compiler-opt-array-bounds-check-elimination=true"
1877      }
1878
1879      if (defined(invoker.is_enable_inline_trace) &&
1880          invoker.is_enable_inline_trace) {
1881        _aot_compile_options_ += " --compiler-trace-inline=true"
1882      }
1883
1884      if (defined(invoker.is_enable_builtins_trace) &&
1885          invoker.is_enable_builtins_trace) {
1886        _aot_compile_options_ += " --compiler-trace-builtins=true"
1887      }
1888
1889      if (defined(invoker.userDefinedMethodsInModule) &&
1890          invoker.userDefinedMethodsInModule) {
1891        _aot_compile_options_ += " --compiler-module-methods=2"
1892      }
1893
1894      if (defined(invoker.disable_opt_loop_peeling) &&
1895          invoker.disable_opt_loop_peeling) {
1896        _aot_compile_options_ += " --compiler-opt-loop-peeling=false"
1897      }
1898
1899      if (defined(invoker.is_enable_pgo_space) && invoker.is_enable_pgo_space) {
1900        _aot_compile_options_ += " --compiler-enable-pgo-space=true"
1901      }
1902
1903      _aot_compile_options_ += common_options
1904      args = [
1905        "--script-file",
1906        rebase_path(_root_out_dir_) +
1907            "/arkcompiler/ets_runtime/ark_aot_compiler",
1908        "--script-options",
1909        _aot_compile_options_,
1910        "--script-args",
1911        _script_args_,
1912        "--expect-sub-output",
1913        "ts aot compile success",
1914        "--env-path",
1915        rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
1916            rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
1917            rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
1918            rebase_path(_root_out_dir_) +
1919            "/resourceschedule/frame_aware_sched:" +
1920            rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
1921            rebase_path(_root_out_dir_) +
1922            "/thirdparty/bounds_checking_function:" +
1923            rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
1924      ]
1925
1926      inputs = [ _test_abc_path_ ]
1927
1928      outputs = [
1929        _test_aot_path_litecg_,
1930        _test_aot_snapshot_path_litecg_,
1931      ]
1932    }
1933
1934    action("${_target_name_}AotActionWithLiteCGQemu") {
1935      testonly = true
1936
1937      _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${default_toolchain})"
1938      _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
1939
1940      deps = [
1941        ":${_target_name_}AotCompileActionWithLiteCGQemu",
1942        ":gen_${_target_name_}_abc",
1943        "$ark_third_party_root/musl:soft_create_linker_for_qemu",
1944        _host_jsvm_target_,
1945      ]
1946      deps += _deps_
1947
1948      script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
1949
1950      _aot_run_options_ =
1951          " --aot-file=" + rebase_path(_test_aot_arg_litecg_) +
1952          " --asm-interpreter=true" + " --entry-point=${_target_name_}"
1953
1954      _icu_data_path_options_ =
1955          " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
1956      _aot_run_options_ += _icu_data_path_options_
1957
1958      if (defined(invoker.is_enable_enableArkTools) &&
1959          invoker.is_enable_enableArkTools) {
1960        _aot_run_options_ += " --enable-ark-tools=true"
1961        _aot_run_options_ += " --enable-force-gc=false"
1962      }
1963      _aot_run_options_ += common_options
1964      if (defined(invoker.log_option)) {
1965        _aot_run_options_ += invoker.log_option
1966      }
1967
1968      if (defined(invoker.is_enable_typed_op_profiler) &&
1969          invoker.is_enable_typed_op_profiler) {
1970        _aot_run_options_ += " --compiler-typed-op-profiler=true"
1971      }
1972
1973      if (defined(invoker.is_enable_lowering_builtin) &&
1974          invoker.is_enable_lowering_builtin) {
1975        _aot_run_options_ += " --compiler-enable-lowering-builtin=true"
1976      }
1977
1978      _icu_data_path_options_ =
1979          " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
1980      _aot_run_options_ += _icu_data_path_options_
1981
1982      args = [
1983        "--script-file",
1984        rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
1985        "--script-options",
1986        _aot_run_options_,
1987        "--script-args",
1988        _script_args_,
1989        "--expect-file",
1990        rebase_path(_test_expect_path_),
1991        "--qemu-binary-path",
1992        "${QEMU_INSTALLATION_PATH}/bin/qemu-${musl_arch}",
1993        "--qemu-ld-prefix",
1994        rebase_path(musl_linker_so_out_dir, root_build_dir),
1995        "--clang-lib-path",
1996        rebase_path("${clang_base_path}/lib/${musl_arch}-linux-ohos:",
1997                    root_build_dir) + rebase_path(_root_out_dir_) +
1998            "/arkcompiler/ets_runtime:" + rebase_path(_root_out_dir_) +
1999            "/${_icu_path_}:" + rebase_path(_root_out_dir_) +
2000            "/thirdparty/zlib:" + rebase_path(_root_out_dir_) +
2001            "/resourceschedule/frame_aware_sched:" +
2002            rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
2003            rebase_path(_root_out_dir_) +
2004            "/thirdparty/bounds_checking_function:" +
2005            rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
2006      ]
2007
2008      inputs = [ _test_abc_path_ ]
2009
2010      outputs = [ "$target_out_dir/${_target_name_}/LiteCG/" ]
2011    }
2012
2013    action("${_target_name_}AotContextActionWithLiteCGQemu") {
2014      testonly = true
2015
2016      _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${default_toolchain})"
2017      _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
2018
2019      deps = [
2020        ":${_target_name_}AotCompileActionWithLiteCGQemu",
2021        ":gen_${_target_name_}_abc",
2022        "$ark_third_party_root/musl:soft_create_linker_for_qemu",
2023        _host_jsvm_target_,
2024      ]
2025      deps += _deps_
2026
2027      script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
2028
2029      _aot_run_options_ =
2030          " --aot-file=" + rebase_path(_test_aot_arg_litecg_) +
2031          " --asm-interpreter=true" + " --entry-point=${_target_name_}"
2032
2033      if (defined(invoker.is_enable_enableArkTools) &&
2034          invoker.is_enable_enableArkTools) {
2035        _aot_run_options_ += " --enable-ark-tools=true"
2036        _aot_run_options_ += " --enable-force-gc=false"
2037      }
2038
2039      if (defined(invoker.disable_force_gc) && invoker.disable_force_gc) {
2040        _aot_run_options_ += " --enable-force-gc=false"
2041      }
2042
2043      _aot_run_options_ += common_options
2044
2045      if (defined(invoker.log_option)) {
2046        _aot_run_options_ += invoker.log_option
2047      }
2048
2049      if (defined(invoker.is_enable_typed_op_profiler) &&
2050          invoker.is_enable_typed_op_profiler) {
2051        _aot_run_options_ += " --compiler-typed-op-profiler=true"
2052      }
2053
2054      if (defined(invoker.is_enable_lowering_builtin) &&
2055          invoker.is_enable_lowering_builtin) {
2056        _aot_run_options_ += " --compiler-enable-lowering-builtin=true"
2057      }
2058
2059      _icu_data_path_options_ =
2060          " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
2061      _aot_run_options_ += _icu_data_path_options_
2062      _aot_run_options_ += " --enable-context=true"
2063
2064      args = [
2065        "--script-file",
2066        rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
2067        "--script-options",
2068        _aot_run_options_,
2069        "--script-args",
2070        _script_args_,
2071        "--expect-file",
2072        rebase_path(_test_expect_path_),
2073        "--qemu-binary-path",
2074        "${QEMU_INSTALLATION_PATH}/bin/qemu-${musl_arch}",
2075        "--qemu-ld-prefix",
2076        rebase_path(musl_linker_so_out_dir, root_build_dir),
2077        "--clang-lib-path",
2078        rebase_path("${clang_base_path}/lib/${musl_arch}-linux-ohos:",
2079                    root_build_dir) + rebase_path(_root_out_dir_) +
2080            "/arkcompiler/ets_runtime:" + rebase_path(_root_out_dir_) +
2081            "/${_icu_path_}:" + rebase_path(_root_out_dir_) +
2082            "/thirdparty/zlib:" + rebase_path(_root_out_dir_) +
2083            "/resourceschedule/frame_aware_sched:" +
2084            rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
2085            rebase_path(_root_out_dir_) +
2086            "/thirdparty/bounds_checking_function:" +
2087            rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
2088      ]
2089
2090      inputs = [ _test_abc_path_ ]
2091
2092      outputs = [ "$target_out_dir/${_target_name_}Context/LiteCG/" ]
2093    }
2094  }
2095}
2096
2097template("host_aot_js_assert_test_action") {
2098  _target_name_ = "${target_name}"
2099  _deps_ = invoker.deps
2100
2101  _test_ts_path_ = "./${_target_name_}.js"
2102  _test_abc_path_ = "$target_out_dir/${_target_name_}.abc"
2103  _test_aot_arg_ = "$target_out_dir/${_target_name_}"
2104  _test_aot_log_level = "info"
2105
2106  if (defined(invoker.is_common_js) && invoker.is_common_js) {
2107    extra_args = [ "--commonjs" ]
2108  } else {
2109    extra_args = [ "--module" ]
2110  }
2111  extra_args += [ "--merge-abc" ]
2112
2113  es2abc_gen_newest_abc("gen_${_target_name_}_abc") {
2114    extra_visibility = [ ":*" ]  # Only targets in this file can depend on this.
2115    extra_dependencies = _deps_
2116    if (defined(invoker.run_multi_file_tests) && invoker.run_multi_file_tests) {
2117      src_js = rebase_path("./")
2118    } else {
2119      src_js = rebase_path(_test_ts_path_)
2120    }
2121    dst_file = rebase_path(_test_abc_path_)
2122
2123    in_puts = [ _test_ts_path_ ]
2124    out_puts = [ _test_abc_path_ ]
2125  }
2126
2127  _script_args_ = rebase_path(_test_abc_path_)
2128
2129  action("${_target_name_}PgoExecuteAssert") {
2130    testonly = true
2131    _host_jsvm_target_ =
2132        "$js_root/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
2133    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
2134
2135    deps = [
2136      ":gen_${_target_name_}_abc",
2137      _host_jsvm_target_,
2138    ]
2139    deps += _deps_
2140
2141    script = "$js_root/script/run_ark_executable.py"
2142
2143    _aot_run_options_ =
2144        " --asm-interpreter=true" + " --entry-point=${_target_name_}" +
2145        " --enable-pgo-profiler=true" + " --compiler-pgo-profiler-path=" +
2146        rebase_path(_test_aot_arg_) + "/modules.ap"
2147
2148    if (defined(invoker.is_enable_enableArkTools) &&
2149        invoker.is_enable_enableArkTools) {
2150      _aot_run_options_ += " --enable-ark-tools=true"
2151      _aot_run_options_ += " --enable-force-gc=false"
2152    }
2153
2154    if (defined(invoker.disable_force_gc) && invoker.disable_force_gc) {
2155      _aot_run_options_ += " --enable-force-gc=false"
2156    }
2157
2158    _aot_run_options_ += common_options
2159
2160    if (defined(invoker.log_option)) {
2161      _aot_run_options_ += invoker.log_option
2162    }
2163
2164    _aot_run_options_ += " --test-assert=true"
2165
2166    args = [
2167      "--script-file",
2168      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
2169      "--script-options",
2170      _aot_run_options_,
2171      "--script-args",
2172      _script_args_,
2173      "--expect-output",
2174      "0",
2175      "--env-path",
2176      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
2177          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
2178          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
2179          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
2180          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
2181          rebase_path(_root_out_dir_) +
2182          "/thirdparty/bounds_checking_function:" +
2183          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
2184    ]
2185
2186    inputs = [ _test_abc_path_ ]
2187
2188    outputs = [ "$target_out_dir/${_target_name_}/pgoassert" ]
2189  }
2190
2191  action("${_target_name_}AotCompileAssertAction") {
2192    testonly = true
2193
2194    _host_aot_target_ = "//arkcompiler/ets_runtime/ecmascript/compiler:ark_aot_compiler(${host_toolchain})"
2195    _root_out_dir_ = get_label_info(_host_aot_target_, "root_out_dir")
2196    deps = [
2197      ":gen_${_target_name_}_abc",
2198      _host_aot_target_,
2199    ]
2200    deps += _deps_
2201
2202    if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
2203      deps += [ ":${_target_name_}PgoExecuteAssert" ]
2204    }
2205
2206    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
2207
2208    _aot_compile_options_ = " --aot-file=" + rebase_path(_test_aot_arg_) +
2209                            " --log-level=" + _test_aot_log_level + " --log-components=compiler --compiler-opt-type-lowering=false --compiler-opt-inlining=false" + " --compiler-opt-loop-peeling=true"
2210
2211    if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
2212      _aot_compile_options_ += " --compiler-pgo-profiler-path=" +
2213                               rebase_path(_test_aot_arg_) + "/modules.ap"
2214    }
2215
2216    if (defined(invoker.is_enable_trace_deopt) &&
2217        invoker.is_enable_trace_deopt) {
2218      _aot_compile_options_ += " --compiler-trace-deopt=true"
2219    }
2220
2221    if (defined(invoker.is_enable_opt_inlining) &&
2222        invoker.is_enable_opt_inlining) {
2223      _aot_compile_options_ +=
2224          " --compiler-opt-inlining=true --compiler-opt-type-lowering=true"
2225    }
2226
2227    if (defined(invoker.is_enable_typed_op_profiler) &&
2228        invoker.is_enable_typed_op_profiler) {
2229      _aot_compile_options_ += " --compiler-typed-op-profiler=true "
2230    }
2231
2232    if (defined(invoker.is_enable_lowering_builtin) &&
2233        invoker.is_enable_lowering_builtin) {
2234      _aot_compile_options_ += " --compiler-enable-lowering-builtin=true"
2235    }
2236
2237    if (defined(invoker.is_enable_native_inline) &&
2238        invoker.is_enable_native_inline) {
2239      _aot_compile_options_ += " --compiler-enable-native-inline=true"
2240    }
2241
2242    if (defined(invoker.is_enable_opt_loop_peeling) &&
2243        invoker.is_enable_opt_loop_peeling) {
2244      _aot_compile_options_ += " --compiler-opt-loop-peeling=true"
2245    }
2246
2247    if (defined(invoker.is_enable_pgo_space) && invoker.is_enable_pgo_space) {
2248      _aot_compile_options_ += " --compiler-enable-pgo-space=true"
2249    }
2250
2251    if (defined(invoker.is_enable_opt_array_bounds_check_elimination) &&
2252        invoker.is_enable_opt_array_bounds_check_elimination) {
2253      _aot_compile_options_ +=
2254          " --compiler-opt-array-bounds-check-elimination=true"
2255    }
2256
2257    if (defined(invoker.is_enable_inline_trace) &&
2258        invoker.is_enable_inline_trace) {
2259      _aot_compile_options_ += " --compiler-trace-inline=true"
2260    }
2261
2262    if (defined(invoker.is_enable_builtins_trace) &&
2263        invoker.is_enable_builtins_trace) {
2264      _aot_compile_options_ += " --compiler-trace-builtins=true"
2265    }
2266
2267    if (defined(invoker.userDefinedMethodsInModule) &&
2268        invoker.userDefinedMethodsInModule) {
2269      _aot_compile_options_ += " --compiler-module-methods=2"
2270    }
2271    _aot_compile_options_ += common_options
2272    _aot_compile_options_ += " --test-assert=true"
2273
2274    args = [
2275      "--script-file",
2276      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_aot_compiler",
2277      "--script-options",
2278      _aot_compile_options_,
2279      "--script-args",
2280      _script_args_,
2281      "--expect-sub-output",
2282      "ts aot compile success",
2283      "--env-path",
2284      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
2285          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
2286          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
2287          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
2288          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
2289          rebase_path(_root_out_dir_) +
2290          "/thirdparty/bounds_checking_function:" +
2291          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
2292    ]
2293
2294    inputs = [ _test_abc_path_ ]
2295
2296    outputs = [
2297      "$target_out_dir/${_target_name_}AotCompileAssert.an",
2298      "$target_out_dir/${_target_name_}AotCompileAssert.ai",
2299    ]
2300  }
2301
2302  action("${_target_name_}AotAssertAction") {
2303    testonly = true
2304
2305    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
2306    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
2307
2308    deps = [
2309      ":${_target_name_}AotCompileAssertAction",
2310      ":gen_${_target_name_}_abc",
2311      _host_jsvm_target_,
2312    ]
2313    deps += _deps_
2314
2315    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
2316
2317    _aot_run_options_ =
2318        " --aot-file=" + rebase_path(_test_aot_arg_) +
2319        " --asm-interpreter=true" + " --entry-point=${_target_name_}"
2320
2321    if (defined(invoker.is_enable_enableArkTools) &&
2322        invoker.is_enable_enableArkTools) {
2323      _aot_run_options_ += " --enable-ark-tools=true"
2324      _aot_run_options_ += " --enable-force-gc=false"
2325    }
2326    _aot_run_options_ += common_options
2327    if (defined(invoker.log_option)) {
2328      _aot_run_options_ += invoker.log_option
2329    }
2330
2331    if (defined(invoker.is_enable_typed_op_profiler) &&
2332        invoker.is_enable_typed_op_profiler) {
2333      _aot_run_options_ += " --compiler-typed-op-profiler=true"
2334    }
2335
2336    if (defined(invoker.is_enable_lowering_builtin) &&
2337        invoker.is_enable_lowering_builtin) {
2338      _aot_run_options_ += " --compiler-enable-lowering-builtin=true"
2339    }
2340
2341    _icu_data_path_options_ =
2342        " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
2343    _aot_run_options_ += _icu_data_path_options_
2344
2345    if (defined(invoker.log_option)) {
2346      _aot_run_options_ += invoker.log_option
2347    }
2348
2349    _aot_run_options_ += " --test-assert=true"
2350
2351    args = [
2352      "--script-file",
2353      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
2354      "--script-options",
2355      _aot_run_options_,
2356      "--script-args",
2357      _script_args_,
2358      "--expect-output",
2359      "0",
2360      "--env-path",
2361      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
2362          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
2363          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
2364          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
2365          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
2366          rebase_path(_root_out_dir_) +
2367          "/thirdparty/bounds_checking_function:" +
2368          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
2369    ]
2370
2371    inputs = [ _test_abc_path_ ]
2372
2373    outputs = [ "$target_out_dir/${_target_name_}AotAssert/" ]
2374  }
2375
2376  action("${_target_name_}AotContextAssertAction") {
2377    testonly = true
2378
2379    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
2380    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
2381
2382    deps = [
2383      ":${_target_name_}AotCompileAssertAction",
2384      ":gen_${_target_name_}_abc",
2385      _host_jsvm_target_,
2386    ]
2387    deps += _deps_
2388
2389    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
2390
2391    _aot_run_options_ =
2392        " --aot-file=" + rebase_path(_test_aot_arg_) +
2393        " --asm-interpreter=true" + " --entry-point=${_target_name_}"
2394
2395    if (defined(invoker.is_enable_enableArkTools) &&
2396        invoker.is_enable_enableArkTools) {
2397      _aot_run_options_ += " --enable-ark-tools=true"
2398      _aot_run_options_ += " --enable-force-gc=false"
2399    }
2400
2401    if (defined(invoker.disable_force_gc) && invoker.disable_force_gc) {
2402      _aot_run_options_ += " --enable-force-gc=false"
2403    }
2404    _aot_run_options_ += common_options
2405
2406    if (defined(invoker.log_option)) {
2407      _aot_run_options_ += invoker.log_option
2408    }
2409
2410    if (defined(invoker.is_enable_typed_op_profiler) &&
2411        invoker.is_enable_typed_op_profiler) {
2412      _aot_run_options_ += " --compiler-typed-op-profiler=true"
2413    }
2414
2415    if (defined(invoker.is_enable_lowering_builtin) &&
2416        invoker.is_enable_lowering_builtin) {
2417      _aot_run_options_ += " --compiler-enable-lowering-builtin=true"
2418    }
2419
2420    _icu_data_path_options_ =
2421        " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
2422    _aot_run_options_ += _icu_data_path_options_
2423    _aot_run_options_ += " --enable-context=true"
2424    _aot_run_options_ += " --test-assert=true"
2425
2426    args = [
2427      "--script-file",
2428      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
2429      "--script-options",
2430      _aot_run_options_,
2431      "--script-args",
2432      _script_args_,
2433      "--expect-output",
2434      "0",
2435      "--env-path",
2436      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
2437          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
2438          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
2439          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
2440          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
2441          rebase_path(_root_out_dir_) +
2442          "/thirdparty/bounds_checking_function:" +
2443          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
2444    ]
2445
2446    inputs = [ _test_abc_path_ ]
2447
2448    outputs = [ "$target_out_dir/${_target_name_}ContextAssert/" ]
2449  }
2450}
2451
2452template("host_aot_test_action") {
2453  _target_name_ = "${target_name}"
2454  _deps_ = invoker.deps
2455
2456  _src_dir_ = "."
2457  if (defined(invoker.src_dir) && invoker.src_dir != "") {
2458    _src_dir_ = invoker.src_dir
2459  }
2460
2461  if (defined(invoker.gen_ts_by_script) && invoker.gen_ts_by_script) {
2462    _test_ts_template_path_ = "${_src_dir_}/${_target_name_}.ts"
2463    _test_ts_path_ = "$target_out_dir/${_target_name_}.ts"
2464  } else {
2465    _test_ts_path_ = "${_src_dir_}/${_target_name_}.ts"
2466  }
2467  _test_abc_path_ = "$target_out_dir/${_target_name_}.abc"
2468  _test_aot_path_ = "$target_out_dir/${_target_name_}.an"
2469  _test_aot_snapshot_path_ = "$target_out_dir/${_target_name_}.ai"
2470  _test_aot_arg_ = "$target_out_dir/${_target_name_}"
2471  _test_profiler_path_ = "${_test_aot_arg_}/modules.ap"
2472  _test_aot_path_slowpath_ = "$target_out_dir/slowpath/${_target_name_}.an"
2473  _test_aot_snapshot_path_slowpath_ =
2474      "$target_out_dir/slowpath/${_target_name_}.ai"
2475  _test_aot_arg_slowpath_ = "$target_out_dir/slowpath/${_target_name_}"
2476  _test_aot_log_level = "info"
2477
2478  if (defined(invoker.use_error)) {
2479    _expect_output_option_ = "--expect-sub-error"
2480    _test_pgo_expect_path_ = invoker.use_error
2481    _test_expect_path_ = invoker.use_error
2482  } else {
2483    _expect_output_option_ = "--expect-file"
2484    _test_pgo_expect_path_ = rebase_path("${_src_dir_}/pgo_expect_output.txt")
2485    _test_expect_path_ = rebase_path("${_src_dir_}/expect_output.txt")
2486  }
2487
2488  _is_test_llvm_only_ = TEST_LLVM_ONLY
2489  if (!TEST_LLVM_ONLY && defined(invoker.is_test_llvm_only) &&
2490      invoker.is_test_llvm_only) {
2491    _is_test_llvm_only_ = true
2492  }
2493  if (defined(invoker.use_one_expect_path) && invoker.use_one_expect_path) {
2494    _test_pgo_expect_path_ = _test_expect_path_
2495  }
2496  if (target_cpu == "x64" ||
2497      (ark_standalone_build && run_with_qemu && host_os == "linux" &&
2498       target_os == "ohos" && target_cpu == "arm64")) {
2499    _test_aot_path_litecg_ = "$target_out_dir/litecg/${_target_name_}.an"
2500    _test_aot_snapshot_path_litecg_ =
2501        "$target_out_dir/litecg/${_target_name_}.ai"
2502    _test_aot_arg_litecg_ = "$target_out_dir/litecg/${_target_name_}"
2503    _test_aot_path_slowpath_litecg_ =
2504        "$target_out_dir/slowpath/litecg/${_target_name_}.an"
2505    _test_aot_snapshot_path_slowpath_litecg_ =
2506        "$target_out_dir/slowpath/litecg/${_target_name_}.ai"
2507    _test_aot_arg_slowpath_litecg_ =
2508        "$target_out_dir/slowpath/litecg/${_target_name_}"
2509  }
2510
2511  if (defined(invoker.gen_expect_output) && invoker.gen_expect_output) {
2512    _raw_expect_path_ = "$target_out_dir/expect_output.txt"
2513    _raw_pgo_expect_path_ = "$target_out_dir/pgo_expect_output.txt"
2514    _test_expect_path_ = rebase_path("$target_out_dir/expect_output.txt")
2515    _test_pgo_expect_path_ =
2516        rebase_path("$target_out_dir/pgo_expect_output.txt")
2517    action("${_target_name_}GenExpectOutput") {
2518      script = "$js_root/script/gen_expect_output.sh"
2519      sources = [ _test_ts_path_ ]
2520      outputs = [ _raw_expect_path_ ]
2521      args = [ "aot" ] + rebase_path(sources + outputs)
2522    }
2523
2524    action("${_target_name_}PgoGenExpectOutput") {
2525      script = "$js_root/script/gen_expect_output.sh"
2526      sources = [ _test_ts_path_ ]
2527      outputs = [ _raw_pgo_expect_path_ ]
2528      args = [ "pgo" ] + rebase_path(sources + outputs)
2529    }
2530    _deps_ += [
2531      ":${_target_name_}GenExpectOutput",
2532      ":${_target_name_}PgoGenExpectOutput",
2533    ]
2534  }
2535
2536  if (defined(invoker.gen_ts_by_script) && invoker.gen_ts_by_script) {
2537    action("gen_${_target_name_}_ts") {
2538      script = "//arkcompiler/ets_runtime/test/quickfix/generate_js_and_merge_file.py"
2539      src_file = rebase_path(_test_ts_template_path_)
2540      dst_file = rebase_path(_test_ts_path_)
2541      args = [
2542        "--input=$src_file",
2543        "--output=$dst_file",
2544      ]
2545      inputs = [ _test_ts_template_path_ ]
2546      outputs = [ _test_ts_path_ ]
2547    }
2548  }
2549
2550  es2abc_gen_newest_abc("gen_${_target_name_}_abc") {
2551    extra_visibility = [ ":*" ]  # Only targets in this file can depend on this.
2552    extra_dependencies = _deps_
2553    if (defined(invoker.gen_ts_by_script) && invoker.gen_ts_by_script) {
2554      extra_dependencies += [ ":gen_${_target_name_}_ts" ]
2555    }
2556    if (defined(invoker.run_multi_file_tests) && invoker.run_multi_file_tests) {
2557      src_js = rebase_path("./")
2558    } else {
2559      src_js = rebase_path(_test_ts_path_)
2560    }
2561    dst_file = rebase_path(_test_abc_path_)
2562    extension = "ts"
2563    extra_args = [ "--merge-abc" ]
2564
2565    if (!(defined(invoker.without_module) && invoker.without_module)) {
2566      extra_args += [ "--module" ]
2567    }
2568
2569    if (defined(invoker.is_debug_abc) && invoker.is_debug_abc) {
2570      extra_args += [ "--debug" ]
2571    }
2572
2573    in_puts = [ _test_ts_path_ ]
2574    if (!defined(invoker.use_error)) {
2575      in_puts += [ _test_expect_path_ ]
2576    }
2577    out_puts = [ _test_abc_path_ ]
2578  }
2579
2580  _script_args_ = rebase_path(_test_abc_path_)
2581
2582  action("${_target_name_}PgoExecute") {
2583    testonly = true
2584    _host_jsvm_target_ =
2585        "$js_root/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
2586    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
2587
2588    deps = [
2589      ":gen_${_target_name_}_abc",
2590      _host_jsvm_target_,
2591    ]
2592    deps += _deps_
2593
2594    script = "$js_root/script/run_ark_executable.py"
2595
2596    _aot_run_options_ =
2597        " --asm-interpreter=true" + " --entry-point=${_target_name_}" +
2598        " --enable-pgo-profiler=true" + " --compiler-pgo-profiler-path=" +
2599        rebase_path(_test_profiler_path_)
2600
2601    _icu_data_path_options_ =
2602        " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
2603    _aot_run_options_ += _icu_data_path_options_
2604
2605    if (defined(invoker.is_enable_enableArkTools) &&
2606        invoker.is_enable_enableArkTools) {
2607      _aot_run_options_ += " --enable-ark-tools=true"
2608      _aot_run_options_ += " --enable-force-gc=false"
2609    }
2610    if (defined(invoker.log_option)) {
2611      _aot_run_options_ += invoker.log_option
2612    }
2613    _aot_run_options_ += common_options
2614    args = [
2615      "--script-file",
2616      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
2617      "--script-options",
2618      _aot_run_options_,
2619      "--script-args",
2620      _script_args_,
2621      _expect_output_option_,
2622      _test_pgo_expect_path_,
2623      "--env-path",
2624      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
2625          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
2626          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
2627          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
2628          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
2629          rebase_path(_root_out_dir_) +
2630          "/thirdparty/bounds_checking_function:" +
2631          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
2632    ]
2633
2634    inputs = [ _test_abc_path_ ]
2635
2636    outputs = [ _test_profiler_path_ ]
2637  }
2638
2639  action("${_target_name_}AotCompileAction") {
2640    testonly = true
2641
2642    _host_aot_target_ = "//arkcompiler/ets_runtime/ecmascript/compiler:ark_aot_compiler(${host_toolchain})"
2643    _root_out_dir_ = get_label_info(_host_aot_target_, "root_out_dir")
2644    deps = [
2645      ":gen_${_target_name_}_abc",
2646      _host_aot_target_,
2647    ]
2648    deps += _deps_
2649
2650    if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
2651      deps += [ ":${_target_name_}PgoExecute" ]
2652    }
2653
2654    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
2655
2656    _aot_compile_options_ =
2657        " --aot-file=" + rebase_path(_test_aot_arg_) + " --log-level=" +
2658        _test_aot_log_level + " --log-components=compiler" +
2659        " --compiler-opt-inlining=false" + " --compiler-opt-loop-peeling=true"
2660
2661    if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
2662      _aot_compile_options_ +=
2663          " --compiler-pgo-profiler-path=" + rebase_path(_test_profiler_path_)
2664    }
2665    if (defined(invoker.is_enable_trace_deopt) &&
2666        invoker.is_enable_trace_deopt) {
2667      _aot_compile_options_ += " --compiler-trace-deopt=true"
2668    }
2669    if (defined(invoker.is_enable_opt_inlining) &&
2670        invoker.is_enable_opt_inlining) {
2671      _aot_compile_options_ +=
2672          " --compiler-opt-inlining=true --compiler-opt-type-lowering=true"
2673    }
2674
2675    if (defined(invoker.is_enable_typed_op_profiler) &&
2676        invoker.is_enable_typed_op_profiler) {
2677      _aot_compile_options_ += " --compiler-typed-op-profiler=true "
2678    }
2679
2680    if (defined(invoker.is_enable_lowering_builtin) &&
2681        invoker.is_enable_lowering_builtin) {
2682      _aot_compile_options_ += " --compiler-enable-lowering-builtin=true"
2683    }
2684
2685    if (defined(invoker.is_enable_native_inline) &&
2686        invoker.is_enable_native_inline) {
2687      _aot_compile_options_ += " --compiler-enable-native-inline=true"
2688    }
2689
2690    if (defined(invoker.is_enable_opt_loop_peeling) &&
2691        invoker.is_enable_opt_loop_peeling) {
2692      _aot_compile_options_ += " --compiler-opt-loop-peeling=true"
2693    }
2694
2695    if (defined(invoker.is_enable_opt_array_bounds_check_elimination) &&
2696        invoker.is_enable_opt_array_bounds_check_elimination) {
2697      _aot_compile_options_ +=
2698          " --compiler-opt-array-bounds-check-elimination=true"
2699    }
2700
2701    if (defined(invoker.is_enable_inline_trace) &&
2702        invoker.is_enable_inline_trace) {
2703      _aot_compile_options_ += " --compiler-trace-inline=true"
2704    }
2705
2706    if (defined(invoker.is_enable_builtins_trace) &&
2707        invoker.is_enable_builtins_trace) {
2708      _aot_compile_options_ += " --compiler-trace-builtins=true"
2709    }
2710
2711    if (defined(invoker.userDefinedMethodsInModule) &&
2712        invoker.userDefinedMethodsInModule) {
2713      _aot_compile_options_ += " --compiler-module-methods=2"
2714    }
2715
2716    if (defined(invoker.disable_opt_loop_peeling) &&
2717        invoker.disable_opt_loop_peeling) {
2718      _aot_compile_options_ += " --compiler-opt-loop-peeling=false"
2719    }
2720
2721    if (defined(invoker.is_enable_pgo_space) && invoker.is_enable_pgo_space) {
2722      _aot_compile_options_ += " --compiler-enable-pgo-space=true"
2723    }
2724
2725    _aot_compile_options_ += common_options
2726    args = [
2727      "--script-file",
2728      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_aot_compiler",
2729      "--script-options",
2730      _aot_compile_options_,
2731      "--script-args",
2732      _script_args_,
2733      "--expect-sub-output",
2734      "ts aot compile success",
2735      "--env-path",
2736      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
2737          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
2738          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
2739          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
2740          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
2741          rebase_path(_root_out_dir_) +
2742          "/thirdparty/bounds_checking_function:" +
2743          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
2744    ]
2745
2746    inputs = [ _test_abc_path_ ]
2747
2748    outputs = [
2749      _test_aot_path_,
2750      _test_aot_snapshot_path_,
2751    ]
2752  }
2753
2754  action("${_target_name_}AotCompileActionSlowPath") {
2755    testonly = true
2756    _host_aot_target_ =
2757        "$js_root/ecmascript/compiler:ark_aot_compiler(${host_toolchain})"
2758    _root_out_dir_ = get_label_info(_host_aot_target_, "root_out_dir")
2759    deps = [
2760      ":gen_${_target_name_}_abc",
2761      _host_aot_target_,
2762    ]
2763    deps += _deps_
2764
2765    script = "$js_root/script/run_ark_executable.py"
2766
2767    _aot_compile_options_ =
2768        " --aot-file=" + rebase_path(_test_aot_arg_slowpath_) +
2769        " --log-level=" + _test_aot_log_level + " --log-components=compiler" +
2770        " --compiler-opt-type-lowering=false" +
2771        " --compiler-opt-inlining=false" + " --compiler-opt-loop-peeling=true"
2772
2773    if (defined(invoker.is_enable_trace_deopt) &&
2774        invoker.is_enable_trace_deopt) {
2775      _aot_compile_options_ += " --compiler-trace-deopt=true"
2776    }
2777
2778    if (defined(invoker.is_enable_opt_inlining) &&
2779        invoker.is_enable_opt_inlining) {
2780      _aot_compile_options_ +=
2781          " --compiler-opt-inlining=true --compiler-opt-type-lowering=true"
2782    }
2783
2784    if (defined(invoker.is_enable_native_inline) &&
2785        invoker.is_enable_native_inline) {
2786      _aot_compile_options_ += " --compiler-enable-native-inline=true"
2787    }
2788
2789    if (defined(invoker.is_enable_opt_loop_peeling) &&
2790        invoker.is_enable_opt_loop_peeling) {
2791      _aot_compile_options_ += " --compiler-opt-loop-peeling=true"
2792    }
2793
2794    if (defined(invoker.is_enable_opt_array_bounds_check_elimination) &&
2795        invoker.is_enable_opt_array_bounds_check_elimination) {
2796      _aot_compile_options_ +=
2797          " --compiler-opt-array-bounds-check-elimination=true"
2798    }
2799
2800    if (defined(invoker.is_enable_inline_trace) &&
2801        invoker.is_enable_inline_trace) {
2802      _aot_compile_options_ += " --compiler-trace-inline=true"
2803    }
2804
2805    if (defined(invoker.is_enable_builtins_trace) &&
2806        invoker.is_enable_builtins_trace) {
2807      _aot_compile_options_ += " --compiler-trace-builtins=true"
2808    }
2809
2810    if (defined(invoker.userDefinedMethodsInModule) &&
2811        invoker.userDefinedMethodsInModule) {
2812      _aot_compile_options_ += " --compiler-module-methods=2"
2813    }
2814
2815    if (defined(invoker.disable_opt_loop_peeling) &&
2816        invoker.disable_opt_loop_peeling) {
2817      _aot_compile_options_ += " --compiler-opt-loop-peeling=false"
2818    }
2819
2820    if (defined(invoker.is_enable_pgo_space) && invoker.is_enable_pgo_space) {
2821      _aot_compile_options_ += " --compiler-enable-pgo-space=true"
2822    }
2823
2824    _aot_compile_options_ += common_options
2825    args = [
2826      "--script-file",
2827      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_aot_compiler",
2828      "--script-options",
2829      _aot_compile_options_,
2830      "--script-args",
2831      _script_args_,
2832      "--expect-sub-output",
2833      "ts aot compile success",
2834      "--env-path",
2835      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
2836          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
2837          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
2838          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
2839          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
2840          rebase_path(_root_out_dir_) +
2841          "/thirdparty/bounds_checking_function:" +
2842          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
2843    ]
2844
2845    inputs = [ _test_abc_path_ ]
2846
2847    outputs = [
2848      _test_aot_path_slowpath_,
2849      _test_aot_snapshot_path_slowpath_,
2850    ]
2851  }
2852
2853  action("${_target_name_}AotAction") {
2854    testonly = true
2855    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
2856    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
2857
2858    deps = [
2859      ":${_target_name_}AotCompileAction",
2860      ":gen_${_target_name_}_abc",
2861      _host_jsvm_target_,
2862    ]
2863    if (!defined(invoker.is_only_typed_path) || !invoker.is_only_typed_path) {
2864      deps += [ ":${_target_name_}AotActionSlowPath" ]
2865    }
2866    deps += _deps_
2867
2868    _is_test_llvm_only_ =
2869        defined(invoker.is_test_llvm_only) && invoker.is_test_llvm_only
2870    if (!_is_test_llvm_only_) {
2871      if (target_cpu == "x64") {
2872        deps += [ ":${_target_name_}AotActionWithLiteCG" ]
2873      } else if (ark_standalone_build && run_with_qemu && host_os == "linux" &&
2874                 target_os == "ohos" && target_cpu == "arm64") {
2875        deps += [ ":${_target_name_}AotActionWithLiteCGQemu" ]
2876      }
2877    }
2878
2879    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
2880
2881    _aot_run_options_ =
2882        " --aot-file=" + rebase_path(_test_aot_arg_) +
2883        " --asm-interpreter=true" + " --entry-point=${_target_name_}"
2884
2885    _icu_data_path_options_ =
2886        " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
2887    _aot_run_options_ += _icu_data_path_options_
2888
2889    if (defined(invoker.is_enable_enableArkTools) &&
2890        invoker.is_enable_enableArkTools) {
2891      _aot_run_options_ += " --enable-ark-tools=true"
2892      _aot_run_options_ += " --enable-force-gc=false"
2893    }
2894    _aot_run_options_ += common_options
2895    if (defined(invoker.log_option)) {
2896      _aot_run_options_ += invoker.log_option
2897    }
2898
2899    if (defined(invoker.is_enable_typed_op_profiler) &&
2900        invoker.is_enable_typed_op_profiler) {
2901      _aot_run_options_ += " --compiler-typed-op-profiler=true"
2902    }
2903
2904    if (defined(invoker.is_enable_lowering_builtin) &&
2905        invoker.is_enable_lowering_builtin) {
2906      _aot_run_options_ += " --compiler-enable-lowering-builtin=true"
2907    }
2908
2909    if (defined(invoker.is_enable_trace_deopt) &&
2910        invoker.is_enable_trace_deopt) {
2911      _aot_run_options_ += " --compiler-trace-deopt=true"
2912    }
2913
2914    args = [
2915      "--script-file",
2916      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
2917      "--script-options",
2918      _aot_run_options_,
2919      "--script-args",
2920      _script_args_,
2921      _expect_output_option_,
2922      _test_expect_path_,
2923      "--env-path",
2924      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
2925          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
2926          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
2927          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
2928          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
2929          rebase_path(_root_out_dir_) +
2930          "/thirdparty/bounds_checking_function:" +
2931          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
2932    ]
2933
2934    inputs = [ _test_abc_path_ ]
2935
2936    outputs = [ "$target_out_dir/${_target_name_}/" ]
2937  }
2938
2939  action("${_target_name_}AotContextAction") {
2940    testonly = true
2941    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
2942    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
2943
2944    deps = [
2945      ":${_target_name_}AotCompileAction",
2946      ":gen_${_target_name_}_abc",
2947      _host_jsvm_target_,
2948    ]
2949    if (!defined(invoker.is_only_typed_path) || !invoker.is_only_typed_path) {
2950      deps += [ ":${_target_name_}AotActionSlowPath" ]
2951    }
2952    deps += _deps_
2953
2954    _is_test_llvm_only_ =
2955        defined(invoker.is_test_llvm_only) && invoker.is_test_llvm_only
2956    if (!_is_test_llvm_only_) {
2957      if (target_cpu == "x64") {
2958        deps += [ ":${_target_name_}AotContextActionWithLiteCG" ]
2959      } else if (ark_standalone_build && run_with_qemu && host_os == "linux" &&
2960                 target_os == "ohos" && target_cpu == "arm64") {
2961        deps += [ ":${_target_name_}AotContextActionWithLiteCGQemu" ]
2962      }
2963    }
2964
2965    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
2966
2967    _aot_run_options_ =
2968        " --aot-file=" + rebase_path(_test_aot_arg_) +
2969        " --asm-interpreter=true" + " --entry-point=${_target_name_}"
2970
2971    _icu_data_path_options_ =
2972        " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
2973    _aot_run_options_ += _icu_data_path_options_
2974
2975    if (defined(invoker.is_enable_enableArkTools) &&
2976        invoker.is_enable_enableArkTools) {
2977      _aot_run_options_ += " --enable-ark-tools=true"
2978      _aot_run_options_ += " --enable-force-gc=false"
2979    }
2980    if (defined(invoker.log_option)) {
2981      _aot_run_options_ += invoker.log_option
2982    }
2983    _aot_run_options_ += " --enable-context=true"
2984
2985    if (defined(invoker.is_enable_typed_op_profiler) &&
2986        invoker.is_enable_typed_op_profiler) {
2987      _aot_run_options_ += " --compiler-typed-op-profiler=true"
2988    }
2989    _aot_run_options_ += common_options
2990    if (defined(invoker.is_enable_lowering_builtin) &&
2991        invoker.is_enable_lowering_builtin) {
2992      _aot_run_options_ += " --compiler-enable-lowering-builtin=true"
2993    }
2994
2995    if (defined(invoker.is_enable_trace_deopt) &&
2996        invoker.is_enable_trace_deopt) {
2997      _aot_run_options_ += " --compiler-trace-deopt=true"
2998    }
2999
3000    args = [
3001      "--script-file",
3002      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
3003      "--script-options",
3004      _aot_run_options_,
3005      "--script-args",
3006      _script_args_,
3007      _expect_output_option_,
3008      _test_expect_path_,
3009      "--env-path",
3010      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
3011          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
3012          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
3013          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
3014          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
3015          rebase_path(_root_out_dir_) +
3016          "/thirdparty/bounds_checking_function:" +
3017          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
3018    ]
3019
3020    inputs = [ _test_abc_path_ ]
3021
3022    outputs = [ "$target_out_dir/${_target_name_}Context/" ]
3023  }
3024
3025  action("${_target_name_}AotActionSlowPath") {
3026    testonly = true
3027    _host_jsvm_target_ =
3028        "$js_root/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
3029    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
3030
3031    deps = [
3032      ":${_target_name_}AotCompileActionSlowPath",
3033      ":gen_${_target_name_}_abc",
3034      _host_jsvm_target_,
3035    ]
3036    deps += _deps_
3037
3038    script = "$js_root/script/run_ark_executable.py"
3039
3040    _aot_run_options_ =
3041        " --aot-file=" + rebase_path(_test_aot_arg_slowpath_) +
3042        " --asm-interpreter=true" + " --entry-point=${_target_name_}"
3043
3044    _icu_data_path_options_ =
3045        " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
3046    _aot_run_options_ += _icu_data_path_options_
3047
3048    if (defined(invoker.is_enable_enableArkTools) &&
3049        invoker.is_enable_enableArkTools) {
3050      _aot_run_options_ += " --enable-ark-tools=true"
3051      _aot_run_options_ += " --enable-force-gc=false"
3052    }
3053    if (defined(invoker.log_option)) {
3054      _aot_run_options_ += invoker.log_option
3055    }
3056    _aot_run_options_ += common_options
3057    args = [
3058      "--script-file",
3059      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
3060      "--script-options",
3061      _aot_run_options_,
3062      "--script-args",
3063      _script_args_,
3064      "--timeout-limit",
3065      "${_timeout_}",
3066      _expect_output_option_,
3067      _test_expect_path_,
3068      "--env-path",
3069      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
3070          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
3071          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
3072          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
3073          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
3074          rebase_path(_root_out_dir_) +
3075          "/thirdparty/bounds_checking_function:" +
3076          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
3077    ]
3078
3079    inputs = [ _test_abc_path_ ]
3080
3081    outputs = [ "$target_out_dir/${_target_name_}/SlowPath" ]
3082  }
3083
3084  if (target_cpu == "x64") {
3085    action("${_target_name_}AotCompileActionWithLiteCG") {
3086      testonly = true
3087
3088      _host_aot_target_ = "//arkcompiler/ets_runtime/ecmascript/compiler:ark_aot_compiler(${host_toolchain})"
3089      _root_out_dir_ = get_label_info(_host_aot_target_, "root_out_dir")
3090      deps = [
3091        ":gen_${_target_name_}_abc",
3092        _host_aot_target_,
3093      ]
3094      deps += _deps_
3095
3096      if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
3097        deps += [ ":${_target_name_}PgoExecute" ]
3098      }
3099
3100      script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
3101
3102      _aot_compile_options_ =
3103          " --aot-file=" + rebase_path(_test_aot_arg_litecg_) +
3104          " --log-level=" + _test_aot_log_level + " --log-components=compiler" +
3105          " --compiler-opt-inlining=false" +
3106          " --compiler-opt-loop-peeling=true" + " --compiler-enable-litecg=true"
3107
3108      if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
3109        _aot_compile_options_ +=
3110            " --compiler-pgo-profiler-path=" + rebase_path(_test_profiler_path_)
3111      }
3112      if (defined(invoker.is_enable_trace_deopt) &&
3113          invoker.is_enable_trace_deopt) {
3114        _aot_compile_options_ += " --compiler-trace-deopt=true"
3115      }
3116      if (defined(invoker.is_enable_opt_inlining) &&
3117          invoker.is_enable_opt_inlining) {
3118        _aot_compile_options_ +=
3119            " --compiler-opt-inlining=true --compiler-opt-type-lowering=true"
3120      }
3121
3122      if (defined(invoker.is_enable_typed_op_profiler) &&
3123          invoker.is_enable_typed_op_profiler) {
3124        _aot_compile_options_ += " --compiler-typed-op-profiler=true"
3125      }
3126
3127      if (defined(invoker.is_enable_lowering_builtin) &&
3128          invoker.is_enable_lowering_builtin) {
3129        _aot_compile_options_ += " --compiler-enable-lowering-builtin=true"
3130      }
3131
3132      if (defined(invoker.is_enable_native_inline) &&
3133          invoker.is_enable_native_inline) {
3134        _aot_compile_options_ += " --compiler-enable-native-inline=true"
3135      }
3136
3137      if (defined(invoker.is_enable_opt_loop_peeling) &&
3138          invoker.is_enable_opt_loop_peeling) {
3139        _aot_compile_options_ += " --compiler-opt-loop-peeling=true"
3140      }
3141
3142      if (defined(invoker.is_enable_opt_array_bounds_check_elimination) &&
3143          invoker.is_enable_opt_array_bounds_check_elimination) {
3144        _aot_compile_options_ +=
3145            " --compiler-opt-array-bounds-check-elimination=true"
3146      }
3147
3148      if (defined(invoker.is_enable_inline_trace) &&
3149          invoker.is_enable_inline_trace) {
3150        _aot_compile_options_ += " --compiler-trace-inline=true"
3151      }
3152
3153      if (defined(invoker.is_enable_builtins_trace) &&
3154          invoker.is_enable_builtins_trace) {
3155        _aot_compile_options_ += " --compiler-trace-builtins=true"
3156      }
3157
3158      if (defined(invoker.userDefinedMethodsInModule) &&
3159          invoker.userDefinedMethodsInModule) {
3160        _aot_compile_options_ += " --compiler-module-methods=2"
3161      }
3162
3163      if (defined(invoker.disable_opt_loop_peeling) &&
3164          invoker.disable_opt_loop_peeling) {
3165        _aot_compile_options_ += " --compiler-opt-loop-peeling=false"
3166      }
3167
3168      if (defined(invoker.is_enable_pgo_space) && invoker.is_enable_pgo_space) {
3169        _aot_compile_options_ += " --compiler-enable-pgo-space=true"
3170      }
3171
3172      _aot_compile_options_ += common_options
3173      args = [
3174        "--script-file",
3175        rebase_path(_root_out_dir_) +
3176            "/arkcompiler/ets_runtime/ark_aot_compiler",
3177        "--script-options",
3178        _aot_compile_options_,
3179        "--script-args",
3180        _script_args_,
3181        "--expect-sub-output",
3182        "ts aot compile success",
3183        "--env-path",
3184        rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
3185            rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
3186            rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
3187            rebase_path(_root_out_dir_) +
3188            "/resourceschedule/frame_aware_sched:" +
3189            rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
3190            rebase_path(_root_out_dir_) +
3191            "/thirdparty/bounds_checking_function:" +
3192            rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
3193      ]
3194
3195      inputs = [ _test_abc_path_ ]
3196
3197      outputs = [
3198        _test_aot_path_litecg_,
3199        _test_aot_snapshot_path_litecg_,
3200      ]
3201    }
3202
3203    action("${_target_name_}AotCompileActionSlowPathWithLiteCG") {
3204      testonly = true
3205      _host_aot_target_ =
3206          "$js_root/ecmascript/compiler:ark_aot_compiler(${host_toolchain})"
3207      _root_out_dir_ = get_label_info(_host_aot_target_, "root_out_dir")
3208      deps = [
3209        ":gen_${_target_name_}_abc",
3210        _host_aot_target_,
3211      ]
3212      deps += _deps_
3213
3214      script = "$js_root/script/run_ark_executable.py"
3215
3216      _aot_compile_options_ =
3217          " --aot-file=" + rebase_path(_test_aot_arg_slowpath_litecg_) +
3218          " --log-level=" + _test_aot_log_level + " --log-components=compiler" +
3219          " --compiler-opt-type-lowering=false" +
3220          " --compiler-opt-inlining=false" +
3221          " --compiler-opt-loop-peeling=true" + " --compiler-enable-litecg=true"
3222      if (defined(invoker.is_enable_trace_deopt) &&
3223          invoker.is_enable_trace_deopt) {
3224        _aot_compile_options_ += " --compiler-trace-deopt=true"
3225      }
3226
3227      if (defined(invoker.is_enable_opt_inlining) &&
3228          invoker.is_enable_opt_inlining) {
3229        _aot_compile_options_ +=
3230            " --compiler-opt-inlining=true --compiler-opt-type-lowering=true"
3231      }
3232
3233      if (defined(invoker.is_enable_native_inline) &&
3234          invoker.is_enable_native_inline) {
3235        _aot_compile_options_ += " --compiler-enable-native-inline=true"
3236      }
3237
3238      if (defined(invoker.is_enable_opt_loop_peeling) &&
3239          invoker.is_enable_opt_loop_peeling) {
3240        _aot_compile_options_ += " --compiler-opt-loop-peeling=true"
3241      }
3242
3243      if (defined(invoker.is_enable_opt_array_bounds_check_elimination) &&
3244          invoker.is_enable_opt_array_bounds_check_elimination) {
3245        _aot_compile_options_ +=
3246            " --compiler-opt-array-bounds-check-elimination=true"
3247      }
3248
3249      if (defined(invoker.is_enable_inline_trace) &&
3250          invoker.is_enable_inline_trace) {
3251        _aot_compile_options_ += " --compiler-trace-inline=true"
3252      }
3253
3254      if (defined(invoker.is_enable_builtins_trace) &&
3255          invoker.is_enable_builtins_trace) {
3256        _aot_compile_options_ += " --compiler-trace-builtins=true"
3257      }
3258
3259      if (defined(invoker.userDefinedMethodsInModule) &&
3260          invoker.userDefinedMethodsInModule) {
3261        _aot_compile_options_ += " --compiler-module-methods=2"
3262      }
3263
3264      if (defined(invoker.disable_opt_loop_peeling) &&
3265          invoker.disable_opt_loop_peeling) {
3266        _aot_compile_options_ += " --compiler-opt-loop-peeling=false"
3267      }
3268
3269      if (defined(invoker.is_enable_pgo_space) && invoker.is_enable_pgo_space) {
3270        _aot_compile_options_ += " --compiler-enable-pgo-space=true"
3271      }
3272
3273      _aot_compile_options_ += common_options
3274      args = [
3275        "--script-file",
3276        rebase_path(_root_out_dir_) +
3277            "/arkcompiler/ets_runtime/ark_aot_compiler",
3278        "--script-options",
3279        _aot_compile_options_,
3280        "--script-args",
3281        _script_args_,
3282        "--expect-sub-output",
3283        "ts aot compile success",
3284        "--env-path",
3285        rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
3286            rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
3287            rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
3288            rebase_path(_root_out_dir_) +
3289            "/resourceschedule/frame_aware_sched:" +
3290            rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
3291            rebase_path(_root_out_dir_) +
3292            "/thirdparty/bounds_checking_function:" +
3293            rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
3294      ]
3295
3296      inputs = [ _test_abc_path_ ]
3297
3298      outputs = [
3299        _test_aot_path_slowpath_litecg_,
3300        _test_aot_snapshot_path_slowpath_litecg_,
3301      ]
3302    }
3303
3304    action("${_target_name_}AotActionWithLiteCG") {
3305      testonly = true
3306      _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
3307      _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
3308
3309      deps = [
3310        ":${_target_name_}AotCompileActionWithLiteCG",
3311        ":gen_${_target_name_}_abc",
3312        _host_jsvm_target_,
3313      ]
3314      if (!defined(invoker.is_only_typed_path) || !invoker.is_only_typed_path) {
3315        deps += [ ":${_target_name_}AotActionSlowPathWithLiteCG" ]
3316      }
3317      deps += _deps_
3318
3319      script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
3320
3321      _aot_run_options_ =
3322          " --aot-file=" + rebase_path(_test_aot_arg_litecg_) +
3323          " --asm-interpreter=true" + " --entry-point=${_target_name_}"
3324
3325      _icu_data_path_options_ =
3326          " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
3327      _aot_run_options_ += _icu_data_path_options_
3328
3329      if (defined(invoker.is_enable_enableArkTools) &&
3330          invoker.is_enable_enableArkTools) {
3331        _aot_run_options_ += " --enable-ark-tools=true"
3332        _aot_run_options_ += " --enable-force-gc=false"
3333      }
3334      _aot_run_options_ += common_options
3335      if (defined(invoker.log_option)) {
3336        _aot_run_options_ += invoker.log_option
3337      }
3338
3339      if (defined(invoker.is_enable_typed_op_profiler) &&
3340          invoker.is_enable_typed_op_profiler) {
3341        _aot_run_options_ += " --compiler-typed-op-profiler=true"
3342      }
3343
3344      if (defined(invoker.is_enable_lowering_builtin) &&
3345          invoker.is_enable_lowering_builtin) {
3346        _aot_run_options_ += " --compiler-enable-lowering-builtin=true"
3347      }
3348
3349      if (defined(invoker.is_enable_trace_deopt) &&
3350          invoker.is_enable_trace_deopt) {
3351        _aot_run_options_ += " --compiler-trace-deopt=true"
3352      }
3353
3354      args = [
3355        "--script-file",
3356        rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
3357        "--script-options",
3358        _aot_run_options_,
3359        "--script-args",
3360        _script_args_,
3361        _expect_output_option_,
3362        _test_expect_path_,
3363        "--env-path",
3364        rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
3365            rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
3366            rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
3367            rebase_path(_root_out_dir_) +
3368            "/resourceschedule/frame_aware_sched:" +
3369            rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
3370            rebase_path(_root_out_dir_) +
3371            "/thirdparty/bounds_checking_function:" +
3372            rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
3373      ]
3374
3375      inputs = [ _test_abc_path_ ]
3376
3377      outputs = [ "$target_out_dir/${_target_name_}/LiteCG/" ]
3378    }
3379
3380    action("${_target_name_}AotContextActionWithLiteCG") {
3381      testonly = true
3382      _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
3383      _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
3384
3385      deps = [
3386        ":${_target_name_}AotCompileActionWithLiteCG",
3387        ":gen_${_target_name_}_abc",
3388        _host_jsvm_target_,
3389      ]
3390      if (!defined(invoker.is_only_typed_path) || !invoker.is_only_typed_path) {
3391        deps += [ ":${_target_name_}AotActionSlowPathWithLiteCG" ]
3392      }
3393      deps += _deps_
3394
3395      script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
3396
3397      _aot_run_options_ =
3398          " --aot-file=" + rebase_path(_test_aot_arg_litecg_) +
3399          " --asm-interpreter=true" + " --entry-point=${_target_name_}"
3400
3401      _icu_data_path_options_ =
3402          " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
3403      _aot_run_options_ += _icu_data_path_options_
3404
3405      if (defined(invoker.is_enable_enableArkTools) &&
3406          invoker.is_enable_enableArkTools) {
3407        _aot_run_options_ += " --enable-ark-tools=true"
3408        _aot_run_options_ += " --enable-force-gc=false"
3409      }
3410      _aot_run_options_ += common_options
3411      if (defined(invoker.log_option)) {
3412        _aot_run_options_ += invoker.log_option
3413      }
3414      _aot_run_options_ += " --enable-context=true"
3415
3416      if (defined(invoker.is_enable_typed_op_profiler) &&
3417          invoker.is_enable_typed_op_profiler) {
3418        _aot_run_options_ += " --compiler-typed-op-profiler=true"
3419      }
3420
3421      if (defined(invoker.is_enable_lowering_builtin) &&
3422          invoker.is_enable_lowering_builtin) {
3423        _aot_run_options_ += " --compiler-enable-lowering-builtin=true"
3424      }
3425
3426      if (defined(invoker.is_enable_trace_deopt) &&
3427          invoker.is_enable_trace_deopt) {
3428        _aot_run_options_ += " --compiler-trace-deopt=true"
3429      }
3430
3431      args = [
3432        "--script-file",
3433        rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
3434        "--script-options",
3435        _aot_run_options_,
3436        "--script-args",
3437        _script_args_,
3438        _expect_output_option_,
3439        _test_expect_path_,
3440        "--env-path",
3441        rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
3442            rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
3443            rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
3444            rebase_path(_root_out_dir_) +
3445            "/resourceschedule/frame_aware_sched:" +
3446            rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
3447            rebase_path(_root_out_dir_) +
3448            "/thirdparty/bounds_checking_function:" +
3449            rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
3450      ]
3451
3452      inputs = [ _test_abc_path_ ]
3453
3454      outputs = [ "$target_out_dir/${_target_name_}Context/LiteCG/" ]
3455    }
3456
3457    action("${_target_name_}AotActionSlowPathWithLiteCG") {
3458      testonly = true
3459      _host_jsvm_target_ =
3460          "$js_root/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
3461      _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
3462
3463      deps = [
3464        ":${_target_name_}AotCompileActionSlowPathWithLiteCG",
3465        ":gen_${_target_name_}_abc",
3466        _host_jsvm_target_,
3467      ]
3468      deps += _deps_
3469
3470      script = "$js_root/script/run_ark_executable.py"
3471
3472      _aot_run_options_ =
3473          " --aot-file=" + rebase_path(_test_aot_arg_slowpath_litecg_) +
3474          " --asm-interpreter=true" + " --entry-point=${_target_name_}"
3475
3476      _icu_data_path_options_ =
3477          " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
3478      _aot_run_options_ += _icu_data_path_options_
3479
3480      if (defined(invoker.is_enable_enableArkTools) &&
3481          invoker.is_enable_enableArkTools) {
3482        _aot_run_options_ += " --enable-ark-tools=true"
3483        _aot_run_options_ += " --enable-force-gc=false"
3484      }
3485
3486      if (defined(invoker.log_option)) {
3487        _aot_run_options_ += invoker.log_option
3488      }
3489      _aot_run_options_ += common_options
3490      args = [
3491        "--script-file",
3492        rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
3493        "--script-options",
3494        _aot_run_options_,
3495        "--script-args",
3496        _script_args_,
3497        "--timeout-limit",
3498        "${_timeout_}",
3499        _expect_output_option_,
3500        _test_expect_path_,
3501        "--env-path",
3502        rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
3503            rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
3504            rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
3505            rebase_path(_root_out_dir_) +
3506            "/resourceschedule/frame_aware_sched:" +
3507            rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
3508            rebase_path(_root_out_dir_) +
3509            "/thirdparty/bounds_checking_function:" +
3510            rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
3511      ]
3512
3513      inputs = [ _test_abc_path_ ]
3514
3515      outputs = [ "$target_out_dir/${_target_name_}/SlowPath/LiteCG" ]
3516    }
3517  } else if (ark_standalone_build && run_with_qemu && host_os == "linux" &&
3518             target_os == "ohos" && target_cpu == "arm64") {
3519    import("$ark_third_party_root/musl/musl_template.gni")
3520    import("$build_root/config/qemu/config.gni")
3521
3522    action("${_target_name_}AotCompileActionWithLiteCGQemu") {
3523      testonly = true
3524
3525      _host_aot_target_ = "//arkcompiler/ets_runtime/ecmascript/compiler:ark_aot_compiler(${host_toolchain})"
3526      _root_out_dir_ = get_label_info(_host_aot_target_, "root_out_dir")
3527      deps = [
3528        ":gen_${_target_name_}_abc",
3529        _host_aot_target_,
3530      ]
3531      deps += _deps_
3532
3533      if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
3534        deps += [ ":${_target_name_}PgoExecute" ]
3535      }
3536
3537      script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
3538
3539      _aot_compile_options_ =
3540          " --aot-file=" + rebase_path(_test_aot_arg_litecg_) +
3541          " --log-level=" + _test_aot_log_level + " --log-components=compiler" +
3542          " --compiler-opt-inlining=false" +
3543          " --compiler-opt-loop-peeling=true" +
3544          " --compiler-enable-litecg=true" +
3545          " --compiler-target-triple=aarch64-unknown-linux-gnu"
3546
3547      if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
3548        _aot_compile_options_ +=
3549            " --compiler-pgo-profiler-path=" + rebase_path(_test_profiler_path_)
3550      }
3551      if (defined(invoker.is_enable_trace_deopt) &&
3552          invoker.is_enable_trace_deopt) {
3553        _aot_compile_options_ += " --compiler-trace-deopt=true"
3554      }
3555      if (defined(invoker.is_enable_opt_inlining) &&
3556          invoker.is_enable_opt_inlining) {
3557        _aot_compile_options_ +=
3558            " --compiler-opt-inlining=true --compiler-opt-type-lowering=true"
3559      }
3560
3561      if (defined(invoker.is_enable_typed_op_profiler) &&
3562          invoker.is_enable_typed_op_profiler) {
3563        _aot_compile_options_ += " --compiler-typed-op-profiler=true"
3564      }
3565
3566      if (defined(invoker.is_enable_lowering_builtin) &&
3567          invoker.is_enable_lowering_builtin) {
3568        _aot_compile_options_ += " --compiler-enable-lowering-builtin=true"
3569      }
3570
3571      if (defined(invoker.is_enable_native_inline) &&
3572          invoker.is_enable_native_inline) {
3573        _aot_compile_options_ += " --compiler-enable-native-inline=true"
3574      }
3575
3576      if (defined(invoker.is_enable_opt_loop_peeling) &&
3577          invoker.is_enable_opt_loop_peeling) {
3578        _aot_compile_options_ += " --compiler-opt-loop-peeling=true"
3579      }
3580
3581      if (defined(invoker.is_enable_opt_array_bounds_check_elimination) &&
3582          invoker.is_enable_opt_array_bounds_check_elimination) {
3583        _aot_compile_options_ +=
3584            " --compiler-opt-array-bounds-check-elimination=true"
3585      }
3586
3587      if (defined(invoker.is_enable_inline_trace) &&
3588          invoker.is_enable_inline_trace) {
3589        _aot_compile_options_ += " --compiler-trace-inline=true"
3590      }
3591
3592      if (defined(invoker.is_enable_builtins_trace) &&
3593          invoker.is_enable_builtins_trace) {
3594        _aot_compile_options_ += " --compiler-trace-builtins=true"
3595      }
3596
3597      if (defined(invoker.userDefinedMethodsInModule) &&
3598          invoker.userDefinedMethodsInModule) {
3599        _aot_compile_options_ += " --compiler-module-methods=2"
3600      }
3601
3602      if (defined(invoker.disable_opt_loop_peeling) &&
3603          invoker.disable_opt_loop_peeling) {
3604        _aot_compile_options_ += " --compiler-opt-loop-peeling=false"
3605      }
3606
3607      if (defined(invoker.is_enable_pgo_space) && invoker.is_enable_pgo_space) {
3608        _aot_compile_options_ += " --compiler-enable-pgo-space=true"
3609      }
3610
3611      _aot_compile_options_ += common_options
3612      args = [
3613        "--script-file",
3614        rebase_path(_root_out_dir_) +
3615            "/arkcompiler/ets_runtime/ark_aot_compiler",
3616        "--script-options",
3617        _aot_compile_options_,
3618        "--script-args",
3619        _script_args_,
3620        "--expect-sub-output",
3621        "ts aot compile success",
3622        "--env-path",
3623        rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
3624            rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
3625            rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
3626            rebase_path(_root_out_dir_) +
3627            "/resourceschedule/frame_aware_sched:" +
3628            rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
3629            rebase_path(_root_out_dir_) +
3630            "/thirdparty/bounds_checking_function:" +
3631            rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
3632      ]
3633
3634      inputs = [ _test_abc_path_ ]
3635
3636      outputs = [
3637        _test_aot_path_litecg_,
3638        _test_aot_snapshot_path_litecg_,
3639      ]
3640    }
3641
3642    action("${_target_name_}AotCompileActionSlowPathWithLiteCGQemu") {
3643      testonly = true
3644      _host_aot_target_ =
3645          "$js_root/ecmascript/compiler:ark_aot_compiler(${host_toolchain})"
3646      _root_out_dir_ = get_label_info(_host_aot_target_, "root_out_dir")
3647      deps = [
3648        ":gen_${_target_name_}_abc",
3649        _host_aot_target_,
3650      ]
3651      deps += _deps_
3652
3653      script = "$js_root/script/run_ark_executable.py"
3654
3655      _aot_compile_options_ =
3656          " --aot-file=" + rebase_path(_test_aot_arg_slowpath_litecg_) +
3657          " --log-level=" + _test_aot_log_level + " --log-components=compiler" +
3658          " --compiler-opt-type-lowering=false" +
3659          " --compiler-opt-inlining=false" +
3660          " --compiler-opt-loop-peeling=true" +
3661          " --compiler-enable-litecg=true" +
3662          " --compiler-target-triple=aarch64-unknown-linux-gnu"
3663      if (defined(invoker.is_enable_trace_deopt) &&
3664          invoker.is_enable_trace_deopt) {
3665        _aot_compile_options_ += " --compiler-trace-deopt=true"
3666      }
3667
3668      if (defined(invoker.is_enable_opt_inlining) &&
3669          invoker.is_enable_opt_inlining) {
3670        _aot_compile_options_ +=
3671            " --compiler-opt-inlining=true --compiler-opt-type-lowering=true"
3672      }
3673
3674      if (defined(invoker.is_enable_native_inline) &&
3675          invoker.is_enable_native_inline) {
3676        _aot_compile_options_ += " --compiler-enable-native-inline=true"
3677      }
3678
3679      if (defined(invoker.is_enable_opt_loop_peeling) &&
3680          invoker.is_enable_opt_loop_peeling) {
3681        _aot_compile_options_ += " --compiler-opt-loop-peeling=true"
3682      }
3683
3684      if (defined(invoker.is_enable_opt_array_bounds_check_elimination) &&
3685          invoker.is_enable_opt_array_bounds_check_elimination) {
3686        _aot_compile_options_ +=
3687            " --compiler-opt-array-bounds-check-elimination=true"
3688      }
3689
3690      if (defined(invoker.is_enable_inline_trace) &&
3691          invoker.is_enable_inline_trace) {
3692        _aot_compile_options_ += " --compiler-trace-inline=true"
3693      }
3694
3695      if (defined(invoker.is_enable_builtins_trace) &&
3696          invoker.is_enable_builtins_trace) {
3697        _aot_compile_options_ += " --compiler-trace-builtins=true"
3698      }
3699
3700      if (defined(invoker.userDefinedMethodsInModule) &&
3701          invoker.userDefinedMethodsInModule) {
3702        _aot_compile_options_ += " --compiler-module-methods=2"
3703      }
3704
3705      if (defined(invoker.disable_opt_loop_peeling) &&
3706          invoker.disable_opt_loop_peeling) {
3707        _aot_compile_options_ += " --compiler-opt-loop-peeling=false"
3708      }
3709
3710      if (defined(invoker.is_enable_pgo_space) && invoker.is_enable_pgo_space) {
3711        _aot_compile_options_ += " --compiler-enable-pgo-space=true"
3712      }
3713
3714      _aot_compile_options_ += common_options
3715      args = [
3716        "--script-file",
3717        rebase_path(_root_out_dir_) +
3718            "/arkcompiler/ets_runtime/ark_aot_compiler",
3719        "--script-options",
3720        _aot_compile_options_,
3721        "--script-args",
3722        _script_args_,
3723        "--expect-sub-output",
3724        "ts aot compile success",
3725        "--env-path",
3726        rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
3727            rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
3728            rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
3729            rebase_path(_root_out_dir_) +
3730            "/resourceschedule/frame_aware_sched:" +
3731            rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
3732            rebase_path(_root_out_dir_) +
3733            "/thirdparty/bounds_checking_function:" +
3734            rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
3735      ]
3736
3737      inputs = [ _test_abc_path_ ]
3738
3739      outputs = [
3740        _test_aot_path_slowpath_litecg_,
3741        _test_aot_snapshot_path_slowpath_litecg_,
3742      ]
3743    }
3744
3745    action("${_target_name_}AotActionWithLiteCGQemu") {
3746      testonly = true
3747      _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${default_toolchain})"
3748      _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
3749
3750      deps = [
3751        ":${_target_name_}AotCompileActionWithLiteCGQemu",
3752        ":gen_${_target_name_}_abc",
3753        "$ark_third_party_root/musl:soft_create_linker_for_qemu",
3754        _host_jsvm_target_,
3755      ]
3756      if (!defined(invoker.is_only_typed_path) || !invoker.is_only_typed_path) {
3757        deps += [ ":${_target_name_}AotActionSlowPathWithLiteCGQemu" ]
3758      }
3759      deps += _deps_
3760
3761      script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
3762
3763      _aot_run_options_ =
3764          " --aot-file=" + rebase_path(_test_aot_arg_litecg_) +
3765          " --asm-interpreter=true" + " --entry-point=${_target_name_}"
3766
3767      _icu_data_path_options_ =
3768          " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
3769      _aot_run_options_ += _icu_data_path_options_
3770
3771      if (defined(invoker.is_enable_enableArkTools) &&
3772          invoker.is_enable_enableArkTools) {
3773        _aot_run_options_ += " --enable-ark-tools=true"
3774        _aot_run_options_ += " --enable-force-gc=false"
3775      }
3776      _aot_run_options_ += common_options
3777      if (defined(invoker.log_option)) {
3778        _aot_run_options_ += invoker.log_option
3779      }
3780
3781      if (defined(invoker.is_enable_typed_op_profiler) &&
3782          invoker.is_enable_typed_op_profiler) {
3783        _aot_run_options_ += " --compiler-typed-op-profiler=true"
3784      }
3785
3786      if (defined(invoker.is_enable_lowering_builtin) &&
3787          invoker.is_enable_lowering_builtin) {
3788        _aot_run_options_ += " --compiler-enable-lowering-builtin=true"
3789      }
3790
3791      if (defined(invoker.is_enable_trace_deopt) &&
3792          invoker.is_enable_trace_deopt) {
3793        _aot_run_options_ += " --compiler-trace-deopt=true"
3794      }
3795
3796      args = [
3797        "--script-file",
3798        rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
3799        "--script-options",
3800        _aot_run_options_,
3801        "--script-args",
3802        _script_args_,
3803        _expect_output_option_,
3804        _test_expect_path_,
3805        "--qemu-binary-path",
3806        "${QEMU_INSTALLATION_PATH}/bin/qemu-${musl_arch}",
3807        "--qemu-ld-prefix",
3808        rebase_path(musl_linker_so_out_dir, root_build_dir),
3809        "--clang-lib-path",
3810        rebase_path("${clang_base_path}/lib/${musl_arch}-linux-ohos:",
3811                    root_build_dir) + rebase_path(_root_out_dir_) +
3812            "/arkcompiler/ets_runtime:" + rebase_path(_root_out_dir_) +
3813            "/${_icu_path_}:" + rebase_path(_root_out_dir_) +
3814            "/thirdparty/zlib:" + rebase_path(_root_out_dir_) +
3815            "/resourceschedule/frame_aware_sched:" +
3816            rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
3817            rebase_path(_root_out_dir_) +
3818            "/thirdparty/bounds_checking_function:" +
3819            rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
3820      ]
3821
3822      inputs = [ _test_abc_path_ ]
3823
3824      outputs = [ "$target_out_dir/${_target_name_}/LiteCG/" ]
3825    }
3826
3827    action("${_target_name_}AotContextActionWithLiteCGQemu") {
3828      testonly = true
3829      _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${default_toolchain})"
3830      _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
3831
3832      deps = [
3833        ":${_target_name_}AotCompileActionWithLiteCGQemu",
3834        ":gen_${_target_name_}_abc",
3835        "$ark_third_party_root/musl:soft_create_linker_for_qemu",
3836        _host_jsvm_target_,
3837      ]
3838      if (!defined(invoker.is_only_typed_path) || !invoker.is_only_typed_path) {
3839        deps += [ ":${_target_name_}AotActionSlowPathWithLiteCGQemu" ]
3840      }
3841      deps += _deps_
3842
3843      script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
3844
3845      _aot_run_options_ =
3846          " --aot-file=" + rebase_path(_test_aot_arg_litecg_) +
3847          " --asm-interpreter=true" + " --entry-point=${_target_name_}"
3848
3849      _icu_data_path_options_ =
3850          " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
3851      _aot_run_options_ += _icu_data_path_options_
3852
3853      if (defined(invoker.is_enable_enableArkTools) &&
3854          invoker.is_enable_enableArkTools) {
3855        _aot_run_options_ += " --enable-ark-tools=true"
3856        _aot_run_options_ += " --enable-force-gc=false"
3857      }
3858      _aot_run_options_ += common_options
3859      if (defined(invoker.log_option)) {
3860        _aot_run_options_ += invoker.log_option
3861      }
3862      _aot_run_options_ += " --enable-context=true"
3863
3864      if (defined(invoker.is_enable_typed_op_profiler) &&
3865          invoker.is_enable_typed_op_profiler) {
3866        _aot_run_options_ += " --compiler-typed-op-profiler=true"
3867      }
3868
3869      if (defined(invoker.is_enable_lowering_builtin) &&
3870          invoker.is_enable_lowering_builtin) {
3871        _aot_run_options_ += " --compiler-enable-lowering-builtin=true"
3872      }
3873
3874      if (defined(invoker.is_enable_trace_deopt) &&
3875          invoker.is_enable_trace_deopt) {
3876        _aot_run_options_ += " --compiler-trace-deopt=true"
3877      }
3878
3879      args = [
3880        "--script-file",
3881        rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
3882        "--script-options",
3883        _aot_run_options_,
3884        "--script-args",
3885        _script_args_,
3886        _expect_output_option_,
3887        _test_expect_path_,
3888        "--qemu-binary-path",
3889        "${QEMU_INSTALLATION_PATH}/bin/qemu-${musl_arch}",
3890        "--qemu-ld-prefix",
3891        rebase_path(musl_linker_so_out_dir, root_build_dir),
3892        "--clang-lib-path",
3893        rebase_path("${clang_base_path}/lib/${musl_arch}-linux-ohos:",
3894                    root_build_dir) + rebase_path(_root_out_dir_) +
3895            "/arkcompiler/ets_runtime:" + rebase_path(_root_out_dir_) +
3896            "/${_icu_path_}:" + rebase_path(_root_out_dir_) +
3897            "/thirdparty/zlib:" + rebase_path(_root_out_dir_) +
3898            "/resourceschedule/frame_aware_sched:" +
3899            rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
3900            rebase_path(_root_out_dir_) +
3901            "/thirdparty/bounds_checking_function:" +
3902            rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
3903      ]
3904
3905      inputs = [ _test_abc_path_ ]
3906
3907      outputs = [ "$target_out_dir/${_target_name_}Context/LiteCG/" ]
3908    }
3909
3910    action("${_target_name_}AotActionSlowPathWithLiteCGQemu") {
3911      testonly = true
3912      _host_jsvm_target_ =
3913          "$js_root/ecmascript/js_vm:ark_js_vm(${default_toolchain})"
3914      _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
3915
3916      deps = [
3917        ":${_target_name_}AotCompileActionSlowPathWithLiteCGQemu",
3918        ":gen_${_target_name_}_abc",
3919        "$ark_third_party_root/musl:soft_create_linker_for_qemu",
3920        _host_jsvm_target_,
3921      ]
3922      deps += _deps_
3923
3924      script = "$js_root/script/run_ark_executable.py"
3925
3926      _aot_run_options_ =
3927          " --aot-file=" + rebase_path(_test_aot_arg_slowpath_litecg_) +
3928          " --asm-interpreter=true" + " --entry-point=${_target_name_}"
3929
3930      _icu_data_path_options_ =
3931          " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
3932      _aot_run_options_ += _icu_data_path_options_
3933
3934      if (defined(invoker.is_enable_enableArkTools) &&
3935          invoker.is_enable_enableArkTools) {
3936        _aot_run_options_ += " --enable-ark-tools=true"
3937        _aot_run_options_ += " --enable-force-gc=false"
3938      }
3939      _aot_run_options_ += common_options
3940      if (defined(invoker.log_option)) {
3941        _aot_run_options_ += invoker.log_option
3942      }
3943
3944      args = [
3945        "--script-file",
3946        rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
3947        "--script-options",
3948        _aot_run_options_,
3949        "--script-args",
3950        _script_args_,
3951        _expect_output_option_,
3952        _test_expect_path_,
3953        "--qemu-binary-path",
3954        "${QEMU_INSTALLATION_PATH}/bin/qemu-${musl_arch}",
3955        "--qemu-ld-prefix",
3956        rebase_path(musl_linker_so_out_dir, root_build_dir),
3957        "--clang-lib-path",
3958        rebase_path("${clang_base_path}/lib/${musl_arch}-linux-ohos:",
3959                    root_build_dir) + rebase_path(_root_out_dir_) +
3960            "/arkcompiler/ets_runtime:" + rebase_path(_root_out_dir_) +
3961            "/${_icu_path_}:" + rebase_path(_root_out_dir_) +
3962            "/thirdparty/zlib:" + rebase_path(_root_out_dir_) +
3963            "/resourceschedule/frame_aware_sched:" +
3964            rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
3965            rebase_path(_root_out_dir_) +
3966            "/thirdparty/bounds_checking_function:" +
3967            rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
3968      ]
3969
3970      inputs = [ _test_abc_path_ ]
3971
3972      outputs = [ "$target_out_dir/${_target_name_}/SlowPath/LiteCG" ]
3973    }
3974  }
3975}
3976
3977template("host_aot_assert_test_action") {
3978  _target_name_ = "${target_name}"
3979  _deps_ = invoker.deps
3980
3981  _src_dir_ = "."
3982  if (defined(invoker.src_dir) && invoker.src_dir != "") {
3983    _src_dir_ = invoker.src_dir
3984  }
3985
3986  _test_ts_path_ = "${_src_dir_}/${_target_name_}.ts"
3987  _test_abc_path_ = "$target_out_dir/${_target_name_}.abc"
3988  _test_aot_arg_ = "$target_out_dir/${_target_name_}"
3989  _test_aot_arg_slowpath_ = "$target_out_dir/slowpath/${_target_name_}"
3990  _test_aot_log_level = "info"
3991
3992  es2abc_gen_newest_abc("gen_${_target_name_}_abc") {
3993    extra_visibility = [ ":*" ]  # Only targets in this file can depend on this.
3994    extra_dependencies = _deps_
3995    if (defined(invoker.run_multi_file_tests) && invoker.run_multi_file_tests) {
3996      src_js = rebase_path("./")
3997    } else {
3998      src_js = rebase_path(_test_ts_path_)
3999    }
4000    dst_file = rebase_path(_test_abc_path_)
4001    extension = "ts"
4002    extra_args = [ "--merge-abc" ]
4003
4004    if (!(defined(invoker.without_module) && invoker.without_module)) {
4005      extra_args += [ "--module" ]
4006    }
4007
4008    if (defined(invoker.is_debug_abc) && invoker.is_debug_abc) {
4009      extra_args += [ "--debug" ]
4010    }
4011    in_puts = [ _test_ts_path_ ]
4012    out_puts = [ _test_abc_path_ ]
4013  }
4014
4015  _script_args_ = rebase_path(_test_abc_path_)
4016
4017  action("${_target_name_}PgoExecuteAssert") {
4018    testonly = true
4019    _host_jsvm_target_ =
4020        "$js_root/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
4021    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
4022
4023    deps = [
4024      ":gen_${_target_name_}_abc",
4025      _host_jsvm_target_,
4026    ]
4027    deps += _deps_
4028
4029    script = "$js_root/script/run_ark_executable.py"
4030
4031    _aot_run_options_ =
4032        " --asm-interpreter=true" + " --entry-point=${_target_name_}" +
4033        " --enable-pgo-profiler=true" + " --compiler-pgo-profiler-path=" +
4034        rebase_path(_test_aot_arg_) + "/modules.ap"
4035
4036    if (defined(invoker.is_enable_enableArkTools) &&
4037        invoker.is_enable_enableArkTools) {
4038      _aot_run_options_ += " --enable-ark-tools=true"
4039      _aot_run_options_ += " --enable-force-gc=false"
4040    }
4041    if (defined(invoker.log_option)) {
4042      _aot_run_options_ += invoker.log_option
4043    }
4044    _aot_run_options_ += " --test-assert=true"
4045    _aot_run_options_ += common_options
4046    args = [
4047      "--script-file",
4048      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
4049      "--script-options",
4050      _aot_run_options_,
4051      "--script-args",
4052      _script_args_,
4053      "--expect-output",
4054      "0",
4055      "--env-path",
4056      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
4057          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
4058          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
4059          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
4060          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
4061          rebase_path(_root_out_dir_) +
4062          "/thirdparty/bounds_checking_function:" +
4063          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
4064    ]
4065
4066    inputs = [ _test_abc_path_ ]
4067
4068    outputs = [ "$target_out_dir/${_target_name_}/pgoassert" ]
4069  }
4070
4071  action("${_target_name_}AotCompileAssertAction") {
4072    testonly = true
4073
4074    _host_aot_target_ = "//arkcompiler/ets_runtime/ecmascript/compiler:ark_aot_compiler(${host_toolchain})"
4075    _root_out_dir_ = get_label_info(_host_aot_target_, "root_out_dir")
4076    deps = [
4077      ":gen_${_target_name_}_abc",
4078      _host_aot_target_,
4079    ]
4080    deps += _deps_
4081
4082    if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
4083      deps += [ ":${_target_name_}PgoExecuteAssert" ]
4084    }
4085
4086    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
4087
4088    _aot_compile_options_ =
4089        " --aot-file=" + rebase_path(_test_aot_arg_) + " --log-level=" +
4090        _test_aot_log_level + " --log-components=compiler" +
4091        " --compiler-opt-inlining=false" + " --compiler-opt-loop-peeling=true"
4092
4093    if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
4094      _aot_compile_options_ += " --compiler-pgo-profiler-path=" +
4095                               rebase_path(_test_aot_arg_) + "/modules.ap"
4096    }
4097    if (defined(invoker.is_enable_trace_deopt) &&
4098        invoker.is_enable_trace_deopt) {
4099      _aot_compile_options_ += " --compiler-trace-deopt=true"
4100    }
4101    if (defined(invoker.is_enable_opt_inlining) &&
4102        invoker.is_enable_opt_inlining) {
4103      _aot_compile_options_ +=
4104          " --compiler-opt-inlining=true --compiler-opt-type-lowering=true"
4105    }
4106
4107    if (defined(invoker.is_enable_typed_op_profiler) &&
4108        invoker.is_enable_typed_op_profiler) {
4109      _aot_compile_options_ += " --compiler-typed-op-profiler=true "
4110    }
4111
4112    if (defined(invoker.is_enable_lowering_builtin) &&
4113        invoker.is_enable_lowering_builtin) {
4114      _aot_compile_options_ += " --compiler-enable-lowering-builtin=true"
4115    }
4116
4117    if (defined(invoker.is_enable_native_inline) &&
4118        invoker.is_enable_native_inline) {
4119      _aot_compile_options_ += " --compiler-enable-native-inline=true"
4120    }
4121
4122    if (defined(invoker.is_enable_opt_loop_peeling) &&
4123        invoker.is_enable_opt_loop_peeling) {
4124      _aot_compile_options_ += " --compiler-opt-loop-peeling=true"
4125    }
4126
4127    if (defined(invoker.is_enable_pgo_space) && invoker.is_enable_pgo_space) {
4128      _aot_compile_options_ += " --compiler-enable-pgo-space=true"
4129    }
4130
4131    if (defined(invoker.is_enable_opt_array_bounds_check_elimination) &&
4132        invoker.is_enable_opt_array_bounds_check_elimination) {
4133      _aot_compile_options_ +=
4134          " --compiler-opt-array-bounds-check-elimination=true"
4135    }
4136
4137    if (defined(invoker.is_enable_inline_trace) &&
4138        invoker.is_enable_inline_trace) {
4139      _aot_compile_options_ += " --compiler-trace-inline=true"
4140    }
4141
4142    if (defined(invoker.is_enable_builtins_trace) &&
4143        invoker.is_enable_builtins_trace) {
4144      _aot_compile_options_ += " --compiler-trace-builtins=true"
4145    }
4146
4147    if (defined(invoker.userDefinedMethodsInModule) &&
4148        invoker.userDefinedMethodsInModule) {
4149      _aot_compile_options_ += " --compiler-module-methods=2"
4150    }
4151    _aot_compile_options_ += common_options
4152    _aot_compile_options_ += " --test-assert=true"
4153
4154    args = [
4155      "--script-file",
4156      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_aot_compiler",
4157      "--script-options",
4158      _aot_compile_options_,
4159      "--script-args",
4160      _script_args_,
4161      "--expect-output",
4162      "0",
4163      "--env-path",
4164      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
4165          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
4166          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
4167          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
4168          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
4169          rebase_path(_root_out_dir_) +
4170          "/thirdparty/bounds_checking_function:" +
4171          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
4172    ]
4173
4174    inputs = [ _test_abc_path_ ]
4175
4176    outputs = [
4177      "$target_out_dir/${_target_name_}AotCompileAssert.an",
4178      "$target_out_dir/${_target_name_}AotCompileAssert.ai",
4179    ]
4180  }
4181
4182  action("${_target_name_}AotCompileAssertActionSlowPath") {
4183    testonly = true
4184    _host_aot_target_ =
4185        "$js_root/ecmascript/compiler:ark_aot_compiler(${host_toolchain})"
4186    _root_out_dir_ = get_label_info(_host_aot_target_, "root_out_dir")
4187    deps = [
4188      ":gen_${_target_name_}_abc",
4189      _host_aot_target_,
4190    ]
4191    deps += _deps_
4192
4193    script = "$js_root/script/run_ark_executable.py"
4194
4195    _aot_compile_options_ =
4196        " --aot-file=" + rebase_path(_test_aot_arg_slowpath_) +
4197        " --log-level=" + _test_aot_log_level + " --log-components=compiler" +
4198        " --compiler-opt-type-lowering=false" +
4199        " --compiler-opt-inlining=false" + " --compiler-opt-loop-peeling=true"
4200
4201    if (defined(invoker.aot_log_option)) {
4202      _aot_compile_options_ += invoker.aot_log_option
4203    }
4204
4205    if (defined(invoker.is_enable_trace_deopt) &&
4206        invoker.is_enable_trace_deopt) {
4207      _aot_compile_options_ += " --compiler-trace-deopt=true"
4208    }
4209
4210    if (defined(invoker.is_enable_opt_inlining) &&
4211        invoker.is_enable_opt_inlining) {
4212      _aot_compile_options_ +=
4213          " --compiler-opt-inlining=true --compiler-opt-type-lowering=true"
4214    }
4215
4216    if (defined(invoker.is_enable_native_inline) &&
4217        invoker.is_enable_native_inline) {
4218      _aot_compile_options_ += " --compiler-enable-native-inline=true"
4219    }
4220
4221    if (defined(invoker.is_enable_opt_loop_peeling) &&
4222        invoker.is_enable_opt_loop_peeling) {
4223      _aot_compile_options_ += " --compiler-opt-loop-peeling=true"
4224    }
4225
4226    if (defined(invoker.is_enable_pgo_space) && invoker.is_enable_pgo_space) {
4227      _aot_compile_options_ += " --compiler-enable-pgo-space=true"
4228    }
4229
4230    if (defined(invoker.is_enable_opt_array_bounds_check_elimination) &&
4231        invoker.is_enable_opt_array_bounds_check_elimination) {
4232      _aot_compile_options_ +=
4233          " --compiler-opt-array-bounds-check-elimination=true"
4234    }
4235
4236    if (defined(invoker.is_enable_inline_trace) &&
4237        invoker.is_enable_inline_trace) {
4238      _aot_compile_options_ += " --compiler-trace-inline=true"
4239    }
4240
4241    if (defined(invoker.is_enable_builtins_trace) &&
4242        invoker.is_enable_builtins_trace) {
4243      _aot_compile_options_ += " --compiler-trace-builtins=true"
4244    }
4245
4246    if (defined(invoker.userDefinedMethodsInModule) &&
4247        invoker.userDefinedMethodsInModule) {
4248      _aot_compile_options_ += " --compiler-module-methods=2"
4249    }
4250    _aot_compile_options_ += common_options
4251    _aot_compile_options_ += " --test-assert=true"
4252
4253    args = [
4254      "--script-file",
4255      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_aot_compiler",
4256      "--script-options",
4257      _aot_compile_options_,
4258      "--script-args",
4259      _script_args_,
4260      "--expect-output",
4261      "0",
4262      "--env-path",
4263      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
4264          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
4265          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
4266          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
4267          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
4268          rebase_path(_root_out_dir_) +
4269          "/thirdparty/bounds_checking_function:" +
4270          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
4271    ]
4272
4273    inputs = [ _test_abc_path_ ]
4274
4275    outputs = [
4276      "$target_out_dir/slowpath/${_target_name_}AotCompileAssert.an",
4277      "$target_out_dir/slowpath/${_target_name_}AotCompileAssert.ai",
4278    ]
4279  }
4280
4281  action("${_target_name_}AotAssertAction") {
4282    testonly = true
4283    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
4284    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
4285
4286    deps = [
4287      ":${_target_name_}AotCompileAssertAction",
4288      ":gen_${_target_name_}_abc",
4289      _host_jsvm_target_,
4290    ]
4291    if (!defined(invoker.is_only_typed_path) || !invoker.is_only_typed_path) {
4292      deps += [ ":${_target_name_}AotAssertActionSlowPath" ]
4293    }
4294    deps += _deps_
4295
4296    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
4297
4298    _aot_run_options_ =
4299        " --aot-file=" + rebase_path(_test_aot_arg_) +
4300        " --asm-interpreter=true" + " --entry-point=${_target_name_}"
4301
4302    _icu_data_path_options_ =
4303        " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
4304    _aot_run_options_ += _icu_data_path_options_
4305
4306    if (defined(invoker.is_enable_enableArkTools) &&
4307        invoker.is_enable_enableArkTools) {
4308      _aot_run_options_ += " --enable-ark-tools=true"
4309      _aot_run_options_ += " --enable-force-gc=false"
4310    }
4311
4312    if (defined(invoker.log_option)) {
4313      _aot_run_options_ += invoker.log_option
4314    }
4315
4316    if (defined(invoker.is_enable_typed_op_profiler) &&
4317        invoker.is_enable_typed_op_profiler) {
4318      _aot_run_options_ += " --compiler-typed-op-profiler=true"
4319    }
4320
4321    if (defined(invoker.is_enable_lowering_builtin) &&
4322        invoker.is_enable_lowering_builtin) {
4323      _aot_run_options_ += " --compiler-enable-lowering-builtin=true"
4324    }
4325
4326    if (defined(invoker.is_enable_trace_deopt) &&
4327        invoker.is_enable_trace_deopt) {
4328      _aot_run_options_ += " --compiler-trace-deopt=true"
4329    }
4330
4331    _aot_run_options_ += " --test-assert=true"
4332    _aot_run_options_ += common_options
4333    args = [
4334      "--script-file",
4335      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
4336      "--script-options",
4337      _aot_run_options_,
4338      "--script-args",
4339      _script_args_,
4340      "--expect-output",
4341      "0",
4342      "--env-path",
4343      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
4344          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
4345          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
4346          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
4347          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
4348          rebase_path(_root_out_dir_) +
4349          "/thirdparty/bounds_checking_function:" +
4350          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
4351    ]
4352
4353    inputs = [ _test_abc_path_ ]
4354
4355    outputs = [ "$target_out_dir/${_target_name_}AotAssert/" ]
4356  }
4357
4358  action("${_target_name_}AotContextAssertAction") {
4359    testonly = true
4360    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
4361    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
4362
4363    deps = [
4364      ":${_target_name_}AotCompileAssertAction",
4365      ":gen_${_target_name_}_abc",
4366      _host_jsvm_target_,
4367    ]
4368    if (!defined(invoker.is_only_typed_path) || !invoker.is_only_typed_path) {
4369      deps += [ ":${_target_name_}AotAssertActionSlowPath" ]
4370    }
4371    deps += _deps_
4372
4373    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
4374
4375    _aot_run_options_ =
4376        " --aot-file=" + rebase_path(_test_aot_arg_) +
4377        " --asm-interpreter=true" + " --entry-point=${_target_name_}"
4378
4379    _icu_data_path_options_ =
4380        " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
4381    _aot_run_options_ += _icu_data_path_options_
4382
4383    if (defined(invoker.is_enable_enableArkTools) &&
4384        invoker.is_enable_enableArkTools) {
4385      _aot_run_options_ += " --enable-ark-tools=true"
4386      _aot_run_options_ += " --enable-force-gc=false"
4387    }
4388    if (defined(invoker.log_option)) {
4389      _aot_run_options_ += invoker.log_option
4390    }
4391    _aot_run_options_ += " --enable-context=true"
4392
4393    if (defined(invoker.is_enable_typed_op_profiler) &&
4394        invoker.is_enable_typed_op_profiler) {
4395      _aot_run_options_ += " --compiler-typed-op-profiler=true"
4396    }
4397
4398    if (defined(invoker.is_enable_lowering_builtin) &&
4399        invoker.is_enable_lowering_builtin) {
4400      _aot_run_options_ += " --compiler-enable-lowering-builtin=true"
4401    }
4402
4403    if (defined(invoker.is_enable_trace_deopt) &&
4404        invoker.is_enable_trace_deopt) {
4405      _aot_run_options_ += " --compiler-trace-deopt=true"
4406    }
4407
4408    _aot_run_options_ += " --test-assert=true"
4409    _aot_run_options_ += common_options
4410    args = [
4411      "--script-file",
4412      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
4413      "--script-options",
4414      _aot_run_options_,
4415      "--script-args",
4416      _script_args_,
4417      "--expect-output",
4418      "0",
4419      "--env-path",
4420      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
4421          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
4422          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
4423          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
4424          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
4425          rebase_path(_root_out_dir_) +
4426          "/thirdparty/bounds_checking_function:" +
4427          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
4428    ]
4429
4430    inputs = [ _test_abc_path_ ]
4431
4432    outputs = [ "$target_out_dir/${_target_name_}ContextAssert/" ]
4433  }
4434
4435  action("${_target_name_}AotAssertActionSlowPath") {
4436    testonly = true
4437    _host_jsvm_target_ =
4438        "$js_root/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
4439    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
4440
4441    deps = [
4442      ":${_target_name_}AotCompileAssertActionSlowPath",
4443      ":gen_${_target_name_}_abc",
4444      _host_jsvm_target_,
4445    ]
4446    deps += _deps_
4447
4448    script = "$js_root/script/run_ark_executable.py"
4449
4450    _aot_run_options_ =
4451        " --aot-file=" + rebase_path(_test_aot_arg_slowpath_) +
4452        " --asm-interpreter=true" + " --entry-point=${_target_name_}"
4453
4454    _icu_data_path_options_ =
4455        " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
4456    _aot_run_options_ += _icu_data_path_options_
4457
4458    if (defined(invoker.is_enable_enableArkTools) &&
4459        invoker.is_enable_enableArkTools) {
4460      _aot_run_options_ += " --enable-ark-tools=true"
4461      _aot_run_options_ += " --enable-force-gc=false"
4462    }
4463    if (defined(invoker.log_option)) {
4464      _aot_run_options_ += invoker.log_option
4465    }
4466
4467    _aot_run_options_ += " --test-assert=true"
4468    _aot_run_options_ += common_options
4469    args = [
4470      "--script-file",
4471      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
4472      "--script-options",
4473      _aot_run_options_,
4474      "--script-args",
4475      _script_args_,
4476      "--expect-output",
4477      "0",
4478      "--env-path",
4479      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
4480          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
4481          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
4482          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
4483          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
4484          rebase_path(_root_out_dir_) +
4485          "/thirdparty/bounds_checking_function:" +
4486          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
4487    ]
4488
4489    inputs = [ _test_abc_path_ ]
4490
4491    outputs = [ "$target_out_dir/${_target_name_}/AssertSlowPath" ]
4492  }
4493}
4494
4495template("host_pgotypeinfer_test_action") {
4496  _target_name_ = "${target_name}"
4497  _deps_ = invoker.deps
4498
4499  _test_ts_path_ = "./${_target_name_}.js"
4500  _test_aot_arg_ = "$target_out_dir/${_target_name_}"
4501
4502  _host_aot_target_ =
4503      "$js_root/ecmascript/compiler:ark_aot_compiler(${host_toolchain})"
4504
4505  _test_es2abc_abc_path_ = "$target_out_dir/es2abc/${_target_name_}.abc"
4506
4507  if (defined(invoker.is_common_js) && invoker.is_common_js) {
4508    extra_args = [ "--commonjs" ]
4509  } else {
4510    extra_args = [ "--module" ]
4511  }
4512  extra_args += [ "--merge-abc" ]
4513
4514  es2abc_gen_newest_abc("es2abc_gen_${_target_name_}_abc") {
4515    extra_visibility = [ ":*" ]  # Only targets in this file can depend on this.
4516    extra_dependencies = _deps_
4517    if (defined(invoker.is_multi_file_tests) && invoker.is_multi_file_tests) {
4518      _test_es2abc_ts_path_ = "."
4519    } else {
4520      _test_es2abc_ts_path_ = _test_ts_path_
4521    }
4522    src_js = rebase_path(_test_es2abc_ts_path_)
4523    dst_file = rebase_path(_test_es2abc_abc_path_)
4524
4525    in_puts = [ _test_ts_path_ ]
4526    out_puts = [ _test_es2abc_abc_path_ ]
4527  }
4528
4529  _script_args_ = rebase_path(_test_es2abc_abc_path_)
4530
4531  action("${_target_name_}PgoExecute") {
4532    testonly = true
4533    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
4534    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
4535
4536    deps = [
4537      ":es2abc_gen_${_target_name_}_abc",
4538      _host_jsvm_target_,
4539    ]
4540    deps += _deps_
4541
4542    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
4543
4544    _aot_run_options_ =
4545        " --asm-interpreter=true" + " --entry-point=${_target_name_}" +
4546        " --enable-pgo-profiler=true" + " --compiler-pgo-profiler-path=" +
4547        rebase_path(_test_aot_arg_) + "/modules.ap"
4548
4549    if (defined(invoker.is_enable_enableArkTools) &&
4550        invoker.is_enable_enableArkTools) {
4551      _aot_run_options_ += " --enable-ark-tools=true"
4552      _aot_run_options_ += " --enable-force-gc=false"
4553    }
4554
4555    if (defined(invoker.log_option)) {
4556      _aot_run_options_ += invoker.log_option
4557    }
4558    _aot_run_options_ += common_options
4559    args = [
4560      "--script-file",
4561      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
4562      "--script-options",
4563      _aot_run_options_,
4564      "--script-args",
4565      _script_args_,
4566      "--expect-output",
4567      "0",
4568      "--env-path",
4569      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
4570          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
4571          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
4572          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
4573          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
4574          rebase_path(_root_out_dir_) +
4575          "/thirdparty/bounds_checking_function:" +
4576          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
4577    ]
4578
4579    inputs = [ _test_es2abc_abc_path_ ]
4580
4581    outputs = [ "$target_out_dir/${_target_name_}/pgo" ]
4582  }
4583
4584  action("${_target_name_}Es2abcAotTypeInferAction") {
4585    testonly = true
4586
4587    _script_args_ = rebase_path(_test_es2abc_abc_path_)
4588    _root_out_dir_ = get_label_info(_host_aot_target_, "root_out_dir")
4589    deps = [
4590      ":es2abc_gen_${_target_name_}_abc",
4591      _host_aot_target_,
4592    ]
4593    deps += _deps_
4594    if (target_cpu == "x64") {
4595      deps += [ ":${_target_name_}Es2abcAotTypeInferActionWithLiteCG" ]
4596    }
4597
4598    # Pgo Execute
4599    deps += [ ":${_target_name_}PgoExecute" ]
4600
4601    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
4602
4603    _aot_compile_options_ = " --compiler-opt-type-lowering=false" +
4604                            " --compiler-opt-loop-peeling=true"
4605
4606    # Pgo Option
4607    _aot_compile_options_ += " --compiler-pgo-profiler-path=" +
4608                             rebase_path(_test_aot_arg_) + "/modules.ap"
4609    _aot_compile_options_ += common_options
4610    args = [
4611      "--script-file",
4612      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_aot_compiler",
4613      "--script-options",
4614      _aot_compile_options_,
4615      "--script-args",
4616      _script_args_,
4617      "--expect-output",
4618      "0",
4619      "--env-path",
4620      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
4621          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
4622          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
4623          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
4624          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
4625          rebase_path(_root_out_dir_) +
4626          "/thirdparty/bounds_checking_function:" +
4627          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
4628    ]
4629
4630    inputs = [ _test_es2abc_abc_path_ ]
4631
4632    outputs = [ "$target_out_dir/${_target_name_}/es2abc/" ]
4633  }
4634
4635  action("${_target_name_}Es2abcAotTypeInferActionWithLiteCG") {
4636    testonly = true
4637
4638    _script_args_ = rebase_path(_test_es2abc_abc_path_)
4639    _root_out_dir_ = get_label_info(_host_aot_target_, "root_out_dir")
4640    deps = [
4641      ":es2abc_gen_${_target_name_}_abc",
4642      _host_aot_target_,
4643    ]
4644    deps += _deps_
4645
4646    # Pgo Execute
4647    deps += [ ":${_target_name_}PgoExecute" ]
4648
4649    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
4650
4651    _aot_compile_options_ =
4652        " --compiler-opt-type-lowering=false" +
4653        " --compiler-opt-loop-peeling=true" + " --compiler-enable-litecg=true"
4654
4655    # Pgo Option
4656    _aot_compile_options_ += " --compiler-pgo-profiler-path=" +
4657                             rebase_path(_test_aot_arg_) + "/modules.ap"
4658    _aot_compile_options_ += common_options
4659    args = [
4660      "--script-file",
4661      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_aot_compiler",
4662      "--script-options",
4663      _aot_compile_options_,
4664      "--script-args",
4665      _script_args_,
4666      "--expect-output",
4667      "0",
4668      "--env-path",
4669      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
4670          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
4671          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
4672          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
4673          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
4674          rebase_path(_root_out_dir_) +
4675          "/thirdparty/bounds_checking_function:" +
4676          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
4677    ]
4678
4679    inputs = [ _test_es2abc_abc_path_ ]
4680
4681    outputs = [ "$target_out_dir/${_target_name_}/es2abc/LiteCG/" ]
4682  }
4683}
4684
4685template("host_quickfix_test_action") {
4686  _target_name_ = "${target_name}"
4687
4688  _test_expect_path_ = "./${_target_name_}/expect_output.txt"
4689  _test_file_name_ = [
4690    "base",
4691    "test",
4692    "retest",
4693    "patch",
4694  ]
4695
4696  if (defined(invoker.extra_patches)) {
4697    _test_file_name_ += invoker.extra_patches
4698  }
4699
4700  if (defined(invoker.entry_point)) {
4701    _script_args_ = invoker.entry_point + " "
4702  }
4703
4704  if (defined(invoker.is_hotpatch) && invoker.is_hotpatch) {
4705    _test_map_path_ = "$target_out_dir/${_target_name_}/base.map"
4706  }
4707
4708  foreach(filename, _test_file_name_) {
4709    merge_file_raw = "//arkcompiler/ets_runtime/test/quickfix/"
4710    if (filename == "test" || filename == "retest") {
4711      merge_file_raw += "${filename}.txt"
4712    } else {
4713      merge_file_raw += "${_target_name_}/${filename}.txt"
4714    }
4715    merge_file = "$target_out_dir/${_target_name_}/${filename}.txt"
4716    merge_file_prefix =
4717        "//arkcompiler/ets_runtime/test/quickfix/${_target_name_}/"
4718
4719    if (defined(invoker.is_gen_js_by_script) && invoker.is_gen_js_by_script) {
4720      action("gen_${_target_name_}_${filename}_js_file_and_merge") {
4721        script = "//arkcompiler/ets_runtime/test/quickfix/generate_js_and_merge_file.py"
4722        args = [
4723          "--input",
4724          rebase_path(merge_file_raw),
4725          "--output",
4726          rebase_path(merge_file),
4727          "--prefix",
4728          rebase_path(merge_file_prefix),
4729        ]
4730        inputs = [ merge_file_raw ]
4731        outputs = [ merge_file ]
4732      }
4733    } else {
4734      action("gen_${_target_name_}_${filename}_merge_file") {
4735        script =
4736            "//arkcompiler/ets_runtime/test/quickfix/generate_merge_file.py"
4737        args = [
4738          "--input",
4739          rebase_path(merge_file_raw),
4740          "--output",
4741          rebase_path(merge_file),
4742          "--prefix",
4743          rebase_path(merge_file_prefix),
4744        ]
4745        inputs = [ merge_file_raw ]
4746        outputs = [ merge_file ]
4747      }
4748    }
4749
4750    abc_path = "$target_out_dir/${_target_name_}/${filename}.abc"
4751
4752    es2abc_gen_newest_abc("gen_${_target_name_}_${filename}_abc") {
4753      extra_visibility =
4754          [ ":*" ]  # Only targets in this file can depend on this.
4755      if (defined(invoker.is_gen_js_by_script) && invoker.is_gen_js_by_script) {
4756        extra_dependencies =
4757            [ ":gen_${_target_name_}_${filename}_js_file_and_merge" ]
4758      } else {
4759        extra_dependencies = [ ":gen_${_target_name_}_${filename}_merge_file" ]
4760      }
4761
4762      if (defined(invoker.is_hotpatch) && filename == "patch") {
4763        extra_dependencies += [ ":gen_${_target_name_}_base_abc" ]
4764      }
4765
4766      src_js = "@" + rebase_path(merge_file)
4767      dst_file = rebase_path(abc_path)
4768      extra_args = [
4769        "--module",
4770        "--merge-abc",
4771      ]
4772
4773      if (defined(invoker.is_hotpatch) && filename == "patch") {
4774        extra_args += [ "--generate-patch" ]
4775      }
4776
4777      if (defined(invoker.is_hotpatch) && filename == "base") {
4778        dump_symbol_table = rebase_path(_test_map_path_)
4779      }
4780
4781      if (defined(invoker.is_hotpatch) && filename == "patch") {
4782        input_symbol_table = rebase_path(_test_map_path_)
4783      }
4784
4785      in_puts = [
4786        _test_expect_path_,
4787        merge_file,
4788      ]
4789
4790      if (defined(invoker.is_hotpatch) && filename == "patch") {
4791        in_puts += [ _test_map_path_ ]
4792      }
4793
4794      out_puts = [ abc_path ]
4795
4796      if (defined(invoker.is_hotpatch) && filename == "base") {
4797        out_puts += [ _test_map_path_ ]
4798      }
4799    }
4800
4801    if (filename != _test_file_name_[0]) {
4802      _script_args_ += ":"
4803    }
4804    _script_args_ += rebase_path(abc_path)
4805  }
4806
4807  action("${_target_name_}QuickfixAction") {
4808    testonly = true
4809
4810    _host_quickfix_target_ = "//arkcompiler/ets_runtime/ecmascript/quick_fix:quick_fix(${host_toolchain})"
4811    _root_out_dir_ = get_label_info(_host_quickfix_target_, "root_out_dir")
4812
4813    deps = [ _host_quickfix_target_ ]
4814    foreach(filename, _test_file_name_) {
4815      deps += [ ":gen_${_target_name_}_${filename}_abc" ]
4816    }
4817
4818    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
4819
4820    quickfix_options = " --merge-abc true "
4821    if (is_mac) {
4822      quickfix_options = " --merge-abc true  --asm-interpreter=false"
4823    }
4824
4825    args = [
4826      "--script-file",
4827      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/quick_fix",
4828      "--script-options",
4829      quickfix_options,
4830      "--script-args",
4831      _script_args_,
4832      "--timeout-limit",
4833      "${_timeout_}",
4834      "--expect-file",
4835      rebase_path(_test_expect_path_),
4836      "--env-path",
4837      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
4838          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
4839          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
4840          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
4841          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
4842          rebase_path(_root_out_dir_) +
4843          "/thirdparty/bounds_checking_function:" +
4844          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
4845    ]
4846
4847    inputs = []
4848
4849    outputs = [ "$target_out_dir/${_target_name_}/" ]
4850  }
4851}
4852
4853template("host_aot_builtin_inlining_test_action") {
4854  host_aot_test_action("${target_name}") {
4855    forward_variables_from(invoker, "*")
4856
4857    is_enable_pgo = true
4858    is_only_typed_path = true
4859    is_enable_opt_inlining = true
4860    is_enable_trace_deopt = true
4861    log_option = " --log-info=trace"
4862    is_enable_inline_trace = true
4863    is_enable_builtins_trace = true
4864    is_enable_enableArkTools = true
4865    gen_expect_output = true
4866    is_test_llvm_only = true
4867    deps = []
4868  }
4869}
4870
4871template("host_jit_js_test_action") {
4872  _target_name_ = "${target_name}"
4873  _deps_ = invoker.deps
4874
4875  _test_ts_path_ = "./${_target_name_}.js"
4876  _test_abc_path_ = "$target_out_dir/${_target_name_}.abc"
4877  _script_args_ = rebase_path(_test_abc_path_)
4878  _test_expect_path_ = "./expect_output.txt"
4879
4880  es2abc_gen_newest_abc("gen_${_target_name_}_abc") {
4881    extra_visibility = [ ":*" ]  # Only targets in this file can depend on this.
4882
4883    if (defined(invoker.run_multi_file_tests) && invoker.run_multi_file_tests) {
4884      src_js = rebase_path("./")
4885    } else {
4886      src_js = rebase_path(_test_ts_path_)
4887    }
4888    dst_file = rebase_path(_test_abc_path_)
4889    extension = "ts"
4890    extra_args = [
4891      "--module",
4892      "--merge-abc",
4893    ]
4894    in_puts = [ _test_ts_path_ ]
4895    out_puts = [ _test_abc_path_ ]
4896  }
4897
4898  action("${_target_name_}JitAction") {
4899    testonly = true
4900    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
4901
4902    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
4903    _host_jsoptimizer_lib_ = "//arkcompiler/ets_runtime/ecmascript/compiler:libark_jsoptimizer(${host_toolchain})"
4904    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
4905    _jit_run_options_ =
4906        " --asm-interpreter=true" + " --compiler-enable-jit=true" +
4907        " --compiler-enable-jit-pgo=true" +
4908        " --compiler-jit-hotness-threshold=5" + " --enable-pgo-profiler=true" +
4909        " --compiler-enable-litecg=true" + " --entry-point=${_target_name_} "
4910    _jit_run_options_ += common_options
4911
4912    if (defined(invoker.enable_osr) && invoker.enable_osr) {
4913      _jit_run_options_ += " --compiler-enable-osr=true "
4914      _jit_run_options_ += " --compiler-osr-hotness-threshold=1 "
4915    }
4916    if (defined(invoker.extra_option)) {
4917      _jit_run_options_ += invoker.extra_option
4918    }
4919
4920    deps = [
4921      ":gen_${_target_name_}_abc",
4922      _host_jsoptimizer_lib_,
4923      _host_jsvm_target_,
4924    ]
4925    deps += _deps_
4926
4927    args = [
4928      "--script-file",
4929      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
4930      "--script-options",
4931      _jit_run_options_,
4932      "--script-args",
4933      _script_args_,
4934      "--expect-file",
4935      rebase_path(_test_expect_path_),
4936      "--env-path",
4937      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
4938          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
4939          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
4940          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
4941          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
4942          rebase_path(_root_out_dir_) +
4943          "/thirdparty/bounds_checking_function:" +
4944          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
4945    ]
4946
4947    inputs = [ _test_abc_path_ ]
4948
4949    outputs = [ "$target_out_dir/${_target_name_}/" ]
4950  }
4951}
4952
4953template("host_jit_test_action") {
4954  _target_name_ = "${target_name}"
4955  _deps_ = invoker.deps
4956
4957  _test_ts_path_ = "./${_target_name_}.ts"
4958  _test_abc_path_ = "$target_out_dir/${_target_name_}.abc"
4959  _script_args_ = rebase_path(_test_abc_path_)
4960  _test_expect_path_ = "./expect_output.txt"
4961
4962  es2abc_gen_newest_abc("gen_${_target_name_}_abc") {
4963    extra_visibility = [ ":*" ]  # Only targets in this file can depend on this.
4964
4965    if (defined(invoker.run_multi_file_tests) && invoker.run_multi_file_tests) {
4966      src_js = rebase_path("./")
4967    } else {
4968      src_js = rebase_path(_test_ts_path_)
4969    }
4970    dst_file = rebase_path(_test_abc_path_)
4971    extension = "ts"
4972    extra_args = [
4973      "--module",
4974      "--merge-abc",
4975    ]
4976    in_puts = [ _test_ts_path_ ]
4977    out_puts = [ _test_abc_path_ ]
4978  }
4979
4980  action("${_target_name_}JitAction") {
4981    testonly = true
4982    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
4983
4984    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
4985    _host_jsoptimizer_lib_ = "//arkcompiler/ets_runtime/ecmascript/compiler:libark_jsoptimizer(${host_toolchain})"
4986    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
4987    _jit_run_options_ =
4988        " --asm-interpreter=true" + " --compiler-enable-jit=true" +
4989        " --compiler-enable-jit-pgo=true" +
4990        " --compiler-jit-hotness-threshold=5" + " --enable-pgo-profiler=true" +
4991        " --compiler-enable-litecg=true" + " --enable-force-gc=false" +
4992        " --entry-point=${_target_name_} "
4993    _jit_run_options_ += common_options
4994
4995    if (defined(invoker.enable_osr) && invoker.enable_osr) {
4996      _jit_run_options_ += " --compiler-enable-osr=true "
4997      _jit_run_options_ += " --compiler-osr-hotness-threshold=1 "
4998    }
4999    if (defined(invoker.extra_option)) {
5000      _jit_run_options_ += invoker.extra_option
5001    }
5002
5003    deps = [
5004      ":gen_${_target_name_}_abc",
5005      _host_jsoptimizer_lib_,
5006      _host_jsvm_target_,
5007    ]
5008    deps += _deps_
5009
5010    args = [
5011      "--script-file",
5012      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
5013      "--script-options",
5014      _jit_run_options_,
5015      "--script-args",
5016      _script_args_,
5017      "--expect-file",
5018      rebase_path(_test_expect_path_),
5019      "--env-path",
5020      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
5021          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
5022          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
5023          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
5024          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
5025          rebase_path(_root_out_dir_) +
5026          "/thirdparty/bounds_checking_function:" +
5027          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
5028    ]
5029
5030    inputs = [ _test_abc_path_ ]
5031
5032    outputs = [ "$target_out_dir/${_target_name_}/" ]
5033  }
5034}
5035
5036template("host_baseline_jit_test_action") {
5037  _target_name_ = "${target_name}"
5038  _deps_ = invoker.deps
5039
5040  _test_ts_path_ = "./${_target_name_}.ts"
5041  _test_abc_path_ = "$target_out_dir/${_target_name_}.abc"
5042  _script_args_ = rebase_path(_test_abc_path_)
5043  _test_expect_path_ = "./expect_output.txt"
5044
5045  es2abc_gen_newest_abc("gen_${_target_name_}_abc") {
5046    extra_visibility = [ ":*" ]  # Only targets in this file can depend on this.
5047
5048    if (defined(invoker.run_multi_file_tests) && invoker.run_multi_file_tests) {
5049      src_js = rebase_path("./")
5050    } else {
5051      src_js = rebase_path(_test_ts_path_)
5052    }
5053    dst_file = rebase_path(_test_abc_path_)
5054    extension = "ts"
5055    extra_args = [
5056      "--module",
5057      "--merge-abc",
5058    ]
5059    in_puts = [ _test_ts_path_ ]
5060    out_puts = [ _test_abc_path_ ]
5061  }
5062
5063  action("${_target_name_}BaselineJitAction") {
5064    testonly = true
5065    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
5066
5067    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
5068    _host_jsoptimizer_lib_ = "//arkcompiler/ets_runtime/ecmascript/compiler:libark_jsoptimizer(${host_toolchain})"
5069    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
5070    _baseline_jit_run_options_ =
5071        " --asm-interpreter=true" + " --enable-force-gc=false" +
5072        " --compiler-enable-baselinejit=true" +
5073        " --entry-point=${_target_name_} "
5074    _baseline_jit_run_options_ += common_options
5075
5076    if (defined(invoker.extra_option)) {
5077      _baseline_jit_run_options_ += invoker.extra_option
5078    }
5079
5080    deps = [
5081      ":gen_${_target_name_}_abc",
5082      _host_jsoptimizer_lib_,
5083      _host_jsvm_target_,
5084    ]
5085    deps += _deps_
5086
5087    args = [
5088      "--script-file",
5089      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
5090      "--script-options",
5091      _baseline_jit_run_options_,
5092      "--script-args",
5093      _script_args_,
5094      "--expect-file",
5095      rebase_path(_test_expect_path_),
5096      "--env-path",
5097      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
5098          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
5099          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
5100          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
5101          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
5102          rebase_path(_root_out_dir_) +
5103          "/thirdparty/bounds_checking_function:" +
5104          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
5105    ]
5106
5107    inputs = [ _test_abc_path_ ]
5108
5109    outputs = [ "$target_out_dir/${_target_name_}/" ]
5110  }
5111}
5112