• 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_LITECG = false
20}
21
22if (is_standard_system || ark_standalone_build) {
23  _icu_path_ = "thirdparty/icu"
24} else {
25  _icu_path_ = "global/i18n"
26}
27
28template("host_unittest_action") {
29  _target_name_ = "${target_name}"
30
31  # unittest for phone running
32  ohos_unittest(_target_name_) {
33    resource_config_file =
34        "//arkcompiler/ets_runtime/test/resource/js_runtime/ohos_test.xml"
35    forward_variables_from(invoker, "*")
36  }
37
38  _module_out_path_ = invoker.module_out_path
39
40  # unittest for host running
41  action("${_target_name_}ActionWithoutQemu") {
42    testonly = true
43
44    _host_test_target_ = ":${_target_name_}(${host_toolchain})"
45    _root_out_dir_ = get_label_info(_host_test_target_, "root_out_dir")
46
47    deps = [ _host_test_target_ ]
48
49    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
50
51    args = [
52      "--script-file",
53      rebase_path(_root_out_dir_) +
54          "/tests/unittest/${_module_out_path_}/${_target_name_}",
55      "--expect-output",
56      "0",
57      "--env-path",
58      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
59          rebase_path(_root_out_dir_) + "/test/test:" +
60          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
61          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
62          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
63          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
64          rebase_path(_root_out_dir_) +
65          "/thirdparty/bounds_checking_function:" +
66          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
67      "--timeout-limit",
68      "1200",
69    ]
70
71    inputs = [
72      "$_root_out_dir_/tests/unittest/${_module_out_path_}/${_target_name_}",
73    ]
74    outputs = [ "$target_out_dir/${_target_name_}/" ]
75  }
76  if (ark_standalone_build && host_os == "linux" && target_os == "ohos") {
77    import("$ark_third_party_root/musl/musl_template.gni")
78    import("$build_root/config/qemu/config.gni")
79
80    action("${_target_name_}ActionWithQemu") {
81      testonly = true
82
83      _host_test_target_ = ":${_target_name_}"
84
85      # path of root_out_dir based on root_src_dir
86      _root_out_dir_ = get_label_info(_host_test_target_, "root_out_dir")
87
88      deps = [
89        "$ark_third_party_root/musl:soft_create_linker_for_qemu",
90        _host_test_target_,
91      ]
92
93      script = "${js_root}/script/run_ark_executable.py"
94
95      args = [
96        "--script-file",
97        rebase_path(
98            "$_root_out_dir_/tests/unittest/${_module_out_path_}/${_target_name_}",
99            root_build_dir),
100        "--expect-output",
101        "0",
102        "--clang-lib-path",
103        rebase_path("${clang_base_path}/lib/${musl_arch}-linux-ohos",
104                    root_build_dir),
105        "--qemu-binary-path",
106        "${QEMU_INSTALLATION_PATH}/bin/qemu-${musl_arch}",
107        "--qemu-ld-prefix",
108        rebase_path(musl_linker_so_out_dir, root_build_dir),
109        "--timeout-limit",
110        "1200",
111      ]
112
113      inputs = [
114        "$_root_out_dir_/tests/unittest/${_module_out_path_}/${_target_name_}",
115      ]
116      outputs = [ "$target_out_dir/${_target_name_}WithQemu/" ]
117    }
118  }
119  group("${_target_name_}Action") {
120    testonly = true
121
122    deps = []
123    if (ark_standalone_build && host_os == "linux" && target_os == "ohos" &&
124        run_with_qemu) {
125      deps += [ ":${_target_name_}ActionWithQemu" ]
126    } else {
127      deps += [ ":${_target_name_}ActionWithoutQemu" ]
128    }
129  }
130}
131
132template("host_moduletest_action") {
133  _target_name_ = "${target_name}"
134  _deps_ = invoker.deps
135  _is_module_ = false
136  if (defined(invoker.is_module) && invoker.is_module) {
137    _is_module_ = true
138  }
139  _is_commonjs_ = false
140  if (defined(invoker.is_commonjs) && invoker.is_commonjs) {
141    _is_commonjs_ = true
142  }
143  _is_merge_ = false
144  if (defined(invoker.is_merge) && invoker.is_merge) {
145    _is_merge_ = true
146  }
147  _is_merge_abc_ = false
148  if (defined(invoker.is_merge_abc) && invoker.is_merge_abc) {
149    _is_merge_abc_ = true
150  }
151  _timeout_ = "200"
152  if (defined(invoker.timeout)) {
153    _timeout_ = invoker.timeout
154  }
155
156  _src_dir_ = "."
157  if (defined(invoker.src_dir) && invoker.src_dir != "") {
158    _src_dir_ = invoker.src_dir
159  }
160
161  _src_postfix_ = "js"
162  if (defined(invoker.src_postfix) && invoker.src_postfix != "") {
163    _src_postfix_ = invoker.src_postfix
164  }
165
166  _test_js_path_ = "${_src_dir_}/${_target_name_}.${_src_postfix_}"
167  _test_abc_path_ = "$target_out_dir/${_target_name_}.abc"
168  _test_expect_path_ = "${_src_dir_}/expect_output.txt"
169
170  if (_is_merge_abc_) {
171    merge_file_raw = "./${_target_name_}.txt"
172    merge_file = "$target_out_dir/${_target_name_}.txt"
173    merge_file_prefix =
174        "//arkcompiler/ets_runtime/test/moduletest/${_target_name_}/"
175
176    action("gen_${_target_name_}_merge_file") {
177      script = "../../quickfix/generate_merge_file.py"
178      args = [
179        "--input",
180        rebase_path(merge_file_raw),
181        "--output",
182        rebase_path(merge_file),
183        "--prefix",
184        rebase_path(merge_file_prefix),
185      ]
186
187      inputs = [ merge_file_raw ]
188      outputs = [ merge_file ]
189    }
190  }
191
192  es2abc_gen_abc("gen_${_target_name_}_abc") {
193    extra_visibility = [ ":*" ]  # Only targets in this file can depend on this.
194    extra_dependencies = _deps_
195    src_js = rebase_path(_test_js_path_)
196    dst_file = rebase_path(_test_abc_path_)
197    extra_args = []
198    if (_is_module_) {
199      extra_args += [ "--module" ]
200    }
201    if (_is_commonjs_) {
202      extra_args += [ "--commonjs" ]
203    }
204    if (_is_merge_) {
205      extra_args += [ "--merge-abc" ]
206    }
207    if (_is_merge_abc_) {
208      extra_dependencies = [ ":gen_${_target_name_}_merge_file" ]
209      src_js = "@" + rebase_path(merge_file)
210      in_puts = [
211        _test_expect_path_,
212        merge_file,
213      ]
214    } else {
215      in_puts = [
216        _test_expect_path_,
217        _test_js_path_,
218      ]
219    }
220    out_puts = [ _test_abc_path_ ]
221  }
222
223  _extra_modules_ = []
224  if (defined(invoker.extra_modules)) {
225    foreach(module, invoker.extra_modules) {
226      _extra_modules_ += [ "$target_out_dir/${module}.abc" ]
227    }
228  }
229  if (defined(invoker.entry_point)) {
230    _script_args_ = invoker.entry_point
231    _script_args_ += " " + rebase_path(_test_abc_path_)
232  } else {
233    _script_args_ = rebase_path(_test_abc_path_)
234  }
235  foreach(extra_module, _extra_modules_) {
236    _script_args_ += ":" + rebase_path(extra_module)
237  }
238
239  action("${_target_name_}Action") {
240    testonly = true
241
242    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
243    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
244    deps = [
245      ":gen_${_target_name_}_abc",
246      _host_jsvm_target_,
247    ]
248    deps += _deps_
249
250    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
251
252    js_vm_options = " --asm-interpreter=false"
253    if (defined(invoker.is_set_maxNonmovableSpaceCapacity) &&
254        invoker.is_set_maxNonmovableSpaceCapacity) {
255      js_vm_options += " --max-unmovable-space=524288"  # 0.5M
256    }
257
258    if (defined(invoker.is_enable_enableArkTools) &&
259        invoker.is_enable_enableArkTools) {
260      js_vm_options += " --enable-ark-tools=true"
261      js_vm_options += " --enable-force-gc=false"
262    }
263    args = [
264      "--script-file",
265      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
266      "--script-options",
267      js_vm_options,
268      "--script-args",
269      _script_args_,
270      "--timeout-limit",
271      "${_timeout_}",
272      "--expect-file",
273      rebase_path(_test_expect_path_),
274      "--env-path",
275      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
276          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
277          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
278          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
279          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
280          rebase_path(_root_out_dir_) +
281          "/thirdparty/bounds_checking_function:" +
282          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
283    ]
284
285    inputs = [ _test_abc_path_ ]
286    inputs += _extra_modules_
287
288    outputs = [ "$target_out_dir/${_target_name_}/" ]
289  }
290
291  action("${_target_name_}ContextAction") {
292    testonly = true
293
294    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
295    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
296    deps = [
297      ":gen_${_target_name_}_abc",
298      _host_jsvm_target_,
299    ]
300    deps += _deps_
301
302    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
303
304    js_vm_options = " --asm-interpreter=false"
305    if (defined(invoker.is_set_maxNonmovableSpaceCapacity) &&
306        invoker.is_set_maxNonmovableSpaceCapacity) {
307      js_vm_options += " --max-unmovable-space=524288"  # 0.5M
308    }
309
310    if (defined(invoker.is_enable_enableArkTools) &&
311        invoker.is_enable_enableArkTools) {
312      js_vm_options += " --enable-ark-tools=true"
313      js_vm_options += " --enable-force-gc=false"
314    }
315    js_vm_options += " --enable-context=true"
316
317    args = [
318      "--script-file",
319      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
320      "--script-options",
321      js_vm_options,
322      "--script-args",
323      _script_args_,
324      "--timeout-limit",
325      "${_timeout_}",
326      "--expect-file",
327      rebase_path(_test_expect_path_),
328      "--env-path",
329      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
330          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
331          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
332          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
333          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
334          rebase_path(_root_out_dir_) +
335          "/thirdparty/bounds_checking_function:" +
336          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
337    ]
338
339    inputs = [ _test_abc_path_ ]
340    inputs += _extra_modules_
341
342    outputs = [ "$target_out_dir/${_target_name_}Context/" ]
343  }
344
345  action("${_target_name_}AsmAction") {
346    testonly = true
347
348    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
349    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
350    deps = [
351      ":gen_${_target_name_}_abc",
352      _host_jsvm_target_,
353    ]
354    deps += _deps_
355
356    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
357
358    _asm_run_options_ = " --asm-interpreter=true"
359    if (defined(invoker.is_set_maxNonmovableSpaceCapacity) &&
360        invoker.is_set_maxNonmovableSpaceCapacity) {
361      _asm_run_options_ += " --max-unmovable-space=524288"  # 0.5M
362    }
363
364    if (defined(invoker.is_set_elemens_kind) && invoker.is_set_elemens_kind) {
365      _asm_run_options_ += " --enable-elements-kind=true"
366    }
367
368    if (defined(invoker.is_enable_enableArkTools) &&
369        invoker.is_enable_enableArkTools) {
370      _asm_run_options_ += " --enable-ark-tools=true"
371      _asm_run_options_ += " --enable-force-gc=false"
372    }
373    _asm_run_options_ += " --enable-context=true"
374
375    args = [
376      "--script-file",
377      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
378      "--script-options",
379      _asm_run_options_,
380      "--script-args",
381      _script_args_,
382      "--timeout-limit",
383      "${_timeout_}",
384      "--expect-file",
385      rebase_path(_test_expect_path_),
386      "--env-path",
387      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
388          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
389          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
390          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
391          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
392          rebase_path(_root_out_dir_) +
393          "/thirdparty/bounds_checking_function:" +
394          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
395    ]
396
397    inputs = [ _test_abc_path_ ]
398    inputs += _extra_modules_
399
400    outputs = [ "$target_out_dir/${_target_name_}Asm/" ]
401  }
402
403  action("${_target_name_}AsmContextAction") {
404    testonly = true
405
406    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
407    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
408    deps = [
409      ":gen_${_target_name_}_abc",
410      _host_jsvm_target_,
411    ]
412    deps += _deps_
413
414    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
415
416    _asm_run_options_ = " --asm-interpreter=true"
417    if (defined(invoker.is_set_maxNonmovableSpaceCapacity) &&
418        invoker.is_set_maxNonmovableSpaceCapacity) {
419      _asm_run_options_ += " --max-unmovable-space=524288"  # 0.5M
420    }
421
422    if (defined(invoker.is_set_elemens_kind) && invoker.is_set_elemens_kind) {
423      _asm_run_options_ += " --enable-elements-kind=true"
424    }
425
426    if (defined(invoker.is_enable_enableArkTools) &&
427        invoker.is_enable_enableArkTools) {
428      _asm_run_options_ += " --enable-ark-tools=true"
429      _asm_run_options_ += " --enable-force-gc=false"
430    }
431    args = [
432      "--script-file",
433      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
434      "--script-options",
435      _asm_run_options_,
436      "--script-args",
437      _script_args_,
438      "--timeout-limit",
439      "${_timeout_}",
440      "--expect-file",
441      rebase_path(_test_expect_path_),
442      "--env-path",
443      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
444          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
445          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
446          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
447          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
448          rebase_path(_root_out_dir_) +
449          "/thirdparty/bounds_checking_function:" +
450          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
451    ]
452
453    inputs = [ _test_abc_path_ ]
454    inputs += _extra_modules_
455
456    outputs = [ "$target_out_dir/${_target_name_}AsmContext/" ]
457  }
458
459  action("${_target_name_}AsmSingleStepAction") {
460    testonly = true
461
462    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
463    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
464    deps = [
465      ":gen_${_target_name_}_abc",
466      _host_jsvm_target_,
467    ]
468    deps += _deps_
469
470    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
471
472    # 214: all bytecodes
473    _asm_run_options_ =
474        " --asm-interpreter=true --asm-opcode-disable-range=0,214"
475    if (defined(invoker.is_set_maxNonmovableSpaceCapacity) &&
476        invoker.is_set_maxNonmovableSpaceCapacity) {
477      _asm_run_options_ += " --max-unmovable-space=524288"  # 0.5M
478    }
479
480    if (defined(invoker.is_enable_enableArkTools) &&
481        invoker.is_enable_enableArkTools) {
482      _asm_run_options_ += " --enable-ark-tools=true"
483      _asm_run_options_ += " --enable-force-gc=false"
484    }
485    args = [
486      "--script-file",
487      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
488      "--script-options",
489      _asm_run_options_,
490      "--script-args",
491      _script_args_,
492      "--expect-file",
493      rebase_path(_test_expect_path_),
494      "--env-path",
495      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
496          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
497          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
498          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
499          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
500          rebase_path(_root_out_dir_) +
501          "/thirdparty/bounds_checking_function:" +
502          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
503    ]
504
505    inputs = [ _test_abc_path_ ]
506    inputs += _extra_modules_
507
508    outputs = [ "$target_out_dir/${_target_name_}AsmSingleStep/" ]
509  }
510
511  action("${_target_name_}AsmSingleStepContextAction") {
512    testonly = true
513
514    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
515    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
516    deps = [
517      ":gen_${_target_name_}_abc",
518      _host_jsvm_target_,
519    ]
520    deps += _deps_
521
522    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
523
524    # 214: all bytecodes
525    _asm_run_options_ =
526        " --asm-interpreter=true --asm-opcode-disable-range=0,214"
527    if (defined(invoker.is_set_maxNonmovableSpaceCapacity) &&
528        invoker.is_set_maxNonmovableSpaceCapacity) {
529      _asm_run_options_ += " --max-unmovable-space=524288"  # 0.5M
530    }
531
532    if (defined(invoker.is_enable_enableArkTools) &&
533        invoker.is_enable_enableArkTools) {
534      _asm_run_options_ += " --enable-ark-tools=true"
535      _asm_run_options_ += " --enable-force-gc=false"
536    }
537    _asm_run_options_ += " --enable-context=true"
538
539    args = [
540      "--script-file",
541      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
542      "--script-options",
543      _asm_run_options_,
544      "--script-args",
545      _script_args_,
546      "--expect-file",
547      rebase_path(_test_expect_path_),
548      "--env-path",
549      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
550          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
551          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
552          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
553          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
554          rebase_path(_root_out_dir_) +
555          "/thirdparty/bounds_checking_function:" +
556          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
557    ]
558
559    inputs = [ _test_abc_path_ ]
560    inputs += _extra_modules_
561
562    outputs = [ "$target_out_dir/${_target_name_}AsmSingleStepContext/" ]
563  }
564}
565
566template("host_aot_js_test_action") {
567  _target_name_ = "${target_name}"
568  _deps_ = invoker.deps
569
570  _test_ts_path_ = "./${_target_name_}.js"
571  _test_abc_path_ = "$target_out_dir/${_target_name_}.abc"
572  _test_aot_path_ = "$target_out_dir/${_target_name_}.an"
573  _test_aot_snapshot_path_ = "$target_out_dir/${_target_name_}.ai"
574  _test_aot_arg_ = "$target_out_dir/${_target_name_}"
575  _test_aot_log_level = "info"
576  _test_expect_path_ = "./expect_output.txt"
577  _test_pgo_expect_path_ = "./pgo_expect_output.txt"
578
579  if (defined(invoker.is_common_js) && invoker.is_common_js) {
580    extra_args = [ "--commonjs" ]
581  } else {
582    extra_args = [ "--module" ]
583  }
584  extra_args += [ "--merge-abc" ]
585
586  es2abc_gen_abc("gen_${_target_name_}_abc") {
587    extra_visibility = [ ":*" ]  # Only targets in this file can depend on this.
588    extra_dependencies = _deps_
589    if (defined(invoker.run_multi_file_tests) && invoker.run_multi_file_tests) {
590      src_js = rebase_path("./")
591    } else {
592      src_js = rebase_path(_test_ts_path_)
593    }
594    dst_file = rebase_path(_test_abc_path_)
595
596    in_puts = [
597      _test_ts_path_,
598      _test_expect_path_,
599    ]
600    out_puts = [ _test_abc_path_ ]
601  }
602
603  _script_args_ = rebase_path(_test_abc_path_)
604
605  action("${_target_name_}PgoExecute") {
606    testonly = true
607    _host_jsvm_target_ =
608        "$js_root/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
609    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
610
611    deps = [
612      ":gen_${_target_name_}_abc",
613      _host_jsvm_target_,
614    ]
615    deps += _deps_
616
617    script = "$js_root/script/run_ark_executable.py"
618
619    _aot_run_options_ =
620        " --asm-interpreter=true" + " --entry-point=${_target_name_}" +
621        " --enable-pgo-profiler=true" + " --compiler-pgo-profiler-path=" +
622        rebase_path(_test_aot_arg_) + "/modules.ap"
623
624    if (defined(invoker.is_enable_enableArkTools) &&
625        invoker.is_enable_enableArkTools) {
626      _aot_run_options_ += " --enable-ark-tools=true"
627      _aot_run_options_ += " --enable-force-gc=false"
628    }
629
630    if (defined(invoker.disable_force_gc) && invoker.disable_force_gc) {
631      _aot_run_options_ += " --enable-force-gc=false"
632    }
633
634    if (defined(invoker.log_option)) {
635      _aot_run_options_ += invoker.log_option
636    }
637
638    args = [
639      "--script-file",
640      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
641      "--script-options",
642      _aot_run_options_,
643      "--script-args",
644      _script_args_,
645      "--expect-file",
646      rebase_path(_test_pgo_expect_path_),
647      "--env-path",
648      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
649          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
650          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
651          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
652          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
653          rebase_path(_root_out_dir_) +
654          "/thirdparty/bounds_checking_function:" +
655          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
656    ]
657
658    inputs = [ _test_abc_path_ ]
659
660    outputs = [ "$target_out_dir/${_target_name_}/pgo" ]
661  }
662
663  action("${_target_name_}AotCompileAction") {
664    testonly = true
665
666    _host_aot_target_ = "//arkcompiler/ets_runtime/ecmascript/compiler:ark_aot_compiler(${host_toolchain})"
667    _root_out_dir_ = get_label_info(_host_aot_target_, "root_out_dir")
668    deps = [
669      ":gen_${_target_name_}_abc",
670      _host_aot_target_,
671    ]
672    deps += _deps_
673
674    if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
675      deps += [ ":${_target_name_}PgoExecute" ]
676    }
677
678    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
679
680    _aot_compile_options_ = " --aot-file=" + rebase_path(_test_aot_arg_) +
681                            " --log-level=" + _test_aot_log_level + " --log-components=compiler --compiler-opt-type-lowering=false --compiler-opt-inlining=false" + " --compiler-opt-loop-peeling=false"
682
683    if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
684      _aot_compile_options_ += " --compiler-pgo-profiler-path=" +
685                               rebase_path(_test_aot_arg_) + "/modules.ap"
686    }
687
688    if (defined(invoker.is_enable_trace_deopt) &&
689        invoker.is_enable_trace_deopt) {
690      _aot_compile_options_ += " --compiler-trace-deopt=true"
691    }
692
693    if (defined(invoker.is_enable_opt_inlining) &&
694        invoker.is_enable_opt_inlining) {
695      _aot_compile_options_ +=
696          " --compiler-opt-inlining=true --compiler-opt-type-lowering=true"
697    }
698
699    if (defined(invoker.is_enable_typed_op_profiler) &&
700        invoker.is_enable_typed_op_profiler) {
701      _aot_compile_options_ += " --compiler-typed-op-profiler=true "
702    }
703
704    if (defined(invoker.is_enable_lowering_builtin) &&
705        invoker.is_enable_lowering_builtin) {
706      _aot_compile_options_ += " --compiler-enable-lowering-builtin=true"
707    }
708
709    if (defined(invoker.is_enable_native_inline) &&
710        invoker.is_enable_native_inline) {
711      _aot_compile_options_ += " --compiler-enable-native-inline"
712    }
713
714    if (defined(invoker.is_enable_opt_loop_peeling) &&
715        invoker.is_enable_opt_loop_peeling) {
716      _aot_compile_options_ += " --compiler-opt-loop-peeling=true"
717    }
718
719    if (defined(invoker.is_enable_inline_trace) &&
720        invoker.is_enable_inline_trace) {
721      _aot_compile_options_ += " --compiler-trace-inline=true"
722    }
723
724    if (defined(invoker.userDefinedMethodsInModule) &&
725        invoker.userDefinedMethodsInModule) {
726      _aot_compile_options_ += " --compiler-module-methods=2"
727    }
728
729    if (TEST_LITECG) {
730      _aot_compile_options_ += " --compiler-enable-litecg=true"
731    }
732
733    args = [
734      "--script-file",
735      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_aot_compiler",
736      "--script-options",
737      _aot_compile_options_,
738      "--script-args",
739      _script_args_,
740      "--expect-sub-output",
741      "ts aot compile success",
742      "--env-path",
743      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
744          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
745          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
746          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
747          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
748          rebase_path(_root_out_dir_) +
749          "/thirdparty/bounds_checking_function:" +
750          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
751    ]
752
753    inputs = [ _test_abc_path_ ]
754
755    outputs = [
756      _test_aot_path_,
757      _test_aot_snapshot_path_,
758    ]
759  }
760
761  action("${_target_name_}AotAction") {
762    testonly = true
763
764    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
765    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
766
767    deps = [
768      ":${_target_name_}AotCompileAction",
769      ":gen_${_target_name_}_abc",
770      _host_jsvm_target_,
771    ]
772    deps += _deps_
773
774    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
775
776    _aot_run_options_ =
777        " --aot-file=" + rebase_path(_test_aot_arg_) +
778        " --asm-interpreter=true" + " --entry-point=${_target_name_}"
779
780    if (defined(invoker.is_enable_enableArkTools) &&
781        invoker.is_enable_enableArkTools) {
782      _aot_run_options_ += " --enable-ark-tools=true"
783      _aot_run_options_ += " --enable-force-gc=false"
784    }
785
786    if (defined(invoker.log_option)) {
787      _aot_run_options_ += invoker.log_option
788    }
789
790    if (defined(invoker.is_enable_typed_op_profiler) &&
791        invoker.is_enable_typed_op_profiler) {
792      _aot_run_options_ += " --compiler-typed-op-profiler=ture"
793    }
794
795    if (defined(invoker.is_enable_lowering_builtin) &&
796        invoker.is_enable_lowering_builtin) {
797      _aot_run_options_ += " --compiler-enable-lowering-builtin=true"
798    }
799
800    _icu_data_path_options_ =
801        " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
802    _aot_run_options_ += _icu_data_path_options_
803
804    if (defined(invoker.log_option)) {
805      _aot_run_options_ += invoker.log_option
806    }
807
808    args = [
809      "--script-file",
810      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
811      "--script-options",
812      _aot_run_options_,
813      "--script-args",
814      _script_args_,
815      "--expect-file",
816      rebase_path(_test_expect_path_),
817      "--env-path",
818      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
819          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
820          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
821          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
822          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
823          rebase_path(_root_out_dir_) +
824          "/thirdparty/bounds_checking_function:" +
825          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
826    ]
827
828    inputs = [ _test_abc_path_ ]
829
830    outputs = [ "$target_out_dir/${_target_name_}/" ]
831  }
832
833  action("${_target_name_}AotContextAction") {
834    testonly = true
835
836    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
837    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
838
839    deps = [
840      ":${_target_name_}AotCompileAction",
841      ":gen_${_target_name_}_abc",
842      _host_jsvm_target_,
843    ]
844    deps += _deps_
845
846    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
847
848    _aot_run_options_ =
849        " --aot-file=" + rebase_path(_test_aot_arg_) +
850        " --asm-interpreter=true" + " --entry-point=${_target_name_}"
851
852    if (defined(invoker.is_enable_enableArkTools) &&
853        invoker.is_enable_enableArkTools) {
854      _aot_run_options_ += " --enable-ark-tools=true"
855      _aot_run_options_ += " --enable-force-gc=false"
856    }
857
858    if (defined(invoker.disable_force_gc) && invoker.disable_force_gc) {
859      _aot_run_options_ += " --enable-force-gc=false"
860    }
861
862    if (defined(invoker.log_option)) {
863      _aot_run_options_ += invoker.log_option
864    }
865
866    if (defined(invoker.is_enable_typed_op_profiler) &&
867        invoker.is_enable_typed_op_profiler) {
868      _aot_run_options_ += " --compiler-typed-op-profiler=ture"
869    }
870
871    if (defined(invoker.is_enable_lowering_builtin) &&
872        invoker.is_enable_lowering_builtin) {
873      _aot_run_options_ += " --compiler-enable-lowering-builtin=true"
874    }
875
876    _icu_data_path_options_ =
877        " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
878    _aot_run_options_ += _icu_data_path_options_
879    _aot_run_options_ += " --enable-context=true"
880
881    args = [
882      "--script-file",
883      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
884      "--script-options",
885      _aot_run_options_,
886      "--script-args",
887      _script_args_,
888      "--expect-file",
889      rebase_path(_test_expect_path_),
890      "--env-path",
891      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
892          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
893          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
894          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
895          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
896          rebase_path(_root_out_dir_) +
897          "/thirdparty/bounds_checking_function:" +
898          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
899    ]
900
901    inputs = [ _test_abc_path_ ]
902
903    outputs = [ "$target_out_dir/${_target_name_}Context/" ]
904  }
905}
906
907template("host_aot_test_action") {
908  _target_name_ = "${target_name}"
909  _deps_ = invoker.deps
910
911  _src_dir_ = "."
912  if (defined(invoker.src_dir) && invoker.src_dir != "") {
913    _src_dir_ = invoker.src_dir
914  }
915
916  _test_ts_path_ = "${_src_dir_}/${_target_name_}.ts"
917  _test_abc_path_ = "$target_out_dir/${_target_name_}.abc"
918  _test_aot_path_ = "$target_out_dir/${_target_name_}.an"
919  _test_aot_snapshot_path_ = "$target_out_dir/${_target_name_}.ai"
920  _test_aot_arg_ = "$target_out_dir/${_target_name_}"
921  _test_aot_path_slowpath_ = "$target_out_dir/slowpath/${_target_name_}.an"
922  _test_aot_snapshot_path_slowpath_ =
923      "$target_out_dir/slowpath/${_target_name_}.ai"
924  _test_aot_arg_slowpath_ = "$target_out_dir/slowpath/${_target_name_}"
925  _test_aot_log_level = "info"
926  _test_expect_path_ = "${_src_dir_}/expect_output.txt"
927  _test_pgo_expect_path_ = "${_src_dir_}/pgo_expect_output.txt"
928  if (defined(invoker.use_one_expect_path) && invoker.use_one_expect_path) {
929    _test_pgo_expect_path_ = _test_expect_path_
930  }
931
932  es2abc_gen_abc("gen_${_target_name_}_abc") {
933    extra_visibility = [ ":*" ]  # Only targets in this file can depend on this.
934    extra_dependencies = _deps_
935    if (defined(invoker.run_multi_file_tests) && invoker.run_multi_file_tests) {
936      src_js = rebase_path("./")
937    } else {
938      src_js = rebase_path(_test_ts_path_)
939    }
940    dst_file = rebase_path(_test_abc_path_)
941    extension = "ts"
942    extra_args = [
943      "--merge-abc",
944      "--type-extractor",
945    ]
946
947    if (!(defined(invoker.without_module) && invoker.without_module)) {
948      extra_args += [ "--module" ]
949    }
950
951    if (defined(invoker.is_debug_abc) && invoker.is_debug_abc) {
952      extra_args += [ "--debug" ]
953    }
954
955    in_puts = [
956      _test_ts_path_,
957      _test_expect_path_,
958    ]
959    out_puts = [ _test_abc_path_ ]
960  }
961
962  _script_args_ = rebase_path(_test_abc_path_)
963
964  action("${_target_name_}PgoExecute") {
965    testonly = true
966    _host_jsvm_target_ =
967        "$js_root/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
968    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
969
970    deps = [
971      ":gen_${_target_name_}_abc",
972      _host_jsvm_target_,
973    ]
974    deps += _deps_
975
976    script = "$js_root/script/run_ark_executable.py"
977
978    _aot_run_options_ =
979        " --asm-interpreter=true" + " --entry-point=${_target_name_}" +
980        " --enable-pgo-profiler=true" + " --compiler-pgo-profiler-path=" +
981        rebase_path(_test_aot_arg_) + "/modules.ap"
982
983    if (defined(invoker.is_enable_enableArkTools) &&
984        invoker.is_enable_enableArkTools) {
985      _aot_run_options_ += " --enable-ark-tools=true"
986      _aot_run_options_ += " --enable-force-gc=false"
987    }
988    if (defined(invoker.log_option)) {
989      _aot_run_options_ += invoker.log_option
990    }
991
992    args = [
993      "--script-file",
994      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
995      "--script-options",
996      _aot_run_options_,
997      "--script-args",
998      _script_args_,
999      "--expect-file",
1000      rebase_path(_test_pgo_expect_path_),
1001      "--env-path",
1002      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
1003          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
1004          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
1005          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
1006          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
1007          rebase_path(_root_out_dir_) +
1008          "/thirdparty/bounds_checking_function:" +
1009          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
1010    ]
1011
1012    inputs = [ _test_abc_path_ ]
1013
1014    outputs = [ "$target_out_dir/${_target_name_}/pgo" ]
1015  }
1016
1017  action("${_target_name_}AotCompileAction") {
1018    testonly = true
1019
1020    _host_aot_target_ = "//arkcompiler/ets_runtime/ecmascript/compiler:ark_aot_compiler(${host_toolchain})"
1021    _root_out_dir_ = get_label_info(_host_aot_target_, "root_out_dir")
1022    deps = [
1023      ":gen_${_target_name_}_abc",
1024      _host_aot_target_,
1025    ]
1026    deps += _deps_
1027
1028    if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
1029      deps += [ ":${_target_name_}PgoExecute" ]
1030    }
1031
1032    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
1033
1034    _aot_compile_options_ =
1035        " --aot-file=" + rebase_path(_test_aot_arg_) + " --log-level=" +
1036        _test_aot_log_level + " --log-components=compiler" +
1037        " --compiler-opt-inlining=false" + " --compiler-opt-loop-peeling=false"
1038
1039    if (defined(invoker.is_enable_pgo) && invoker.is_enable_pgo) {
1040      _aot_compile_options_ += " --compiler-pgo-profiler-path=" +
1041                               rebase_path(_test_aot_arg_) + "/modules.ap"
1042    }
1043    if (defined(invoker.is_enable_trace_deopt) &&
1044        invoker.is_enable_trace_deopt) {
1045      _aot_compile_options_ += " --compiler-trace-deopt=true"
1046    }
1047    if (defined(invoker.is_enable_builtins_dts) &&
1048        invoker.is_enable_builtins_dts) {
1049      deps += [ "//arkcompiler/ets_runtime:es2abc_gen_builtins_d_abc" ]
1050      _aot_compile_options_ += " --builtins-dts=" + rebase_path(root_out_dir) + "/obj/arkcompiler/ets_runtime/lib_ark_builtins/es2abc/lib_ark_builtins.d.abc"
1051    }
1052    if (defined(invoker.is_enable_opt_inlining) &&
1053        invoker.is_enable_opt_inlining) {
1054      _aot_compile_options_ +=
1055          " --compiler-opt-inlining=true --compiler-opt-type-lowering=true"
1056    }
1057
1058    if (defined(invoker.is_enable_typed_op_profiler) &&
1059        invoker.is_enable_typed_op_profiler) {
1060      _aot_compile_options_ += " --compiler-typed-op-profiler=true "
1061    }
1062
1063    if (defined(invoker.is_enable_lowering_builtin) &&
1064        invoker.is_enable_lowering_builtin) {
1065      _aot_compile_options_ += " --compiler-enable-lowering-builtin=true"
1066    }
1067
1068    if (defined(invoker.is_enable_native_inline) &&
1069        invoker.is_enable_native_inline) {
1070      _aot_compile_options_ += " --compiler-enable-native-inline"
1071    }
1072
1073    if (defined(invoker.is_enable_opt_loop_peeling) &&
1074        invoker.is_enable_opt_loop_peeling) {
1075      _aot_compile_options_ += " --compiler-opt-loop-peeling=true"
1076    }
1077
1078    if (defined(invoker.is_enable_inline_trace) &&
1079        invoker.is_enable_inline_trace) {
1080      _aot_compile_options_ += " --compiler-trace-inline=true"
1081    }
1082
1083    if (defined(invoker.userDefinedMethodsInModule) &&
1084        invoker.userDefinedMethodsInModule) {
1085      _aot_compile_options_ += " --compiler-module-methods=2"
1086    }
1087
1088    if (TEST_LITECG) {
1089      _aot_compile_options_ += " --compiler-enable-litecg=true"
1090    }
1091
1092    args = [
1093      "--script-file",
1094      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_aot_compiler",
1095      "--script-options",
1096      _aot_compile_options_,
1097      "--script-args",
1098      _script_args_,
1099      "--expect-sub-output",
1100      "ts aot compile success",
1101      "--env-path",
1102      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
1103          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
1104          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
1105          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
1106          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
1107          rebase_path(_root_out_dir_) +
1108          "/thirdparty/bounds_checking_function:" +
1109          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
1110    ]
1111
1112    inputs = [ _test_abc_path_ ]
1113
1114    outputs = [
1115      _test_aot_path_,
1116      _test_aot_snapshot_path_,
1117    ]
1118  }
1119
1120  action("${_target_name_}AotCompileActionSlowPath") {
1121    testonly = true
1122    _host_aot_target_ =
1123        "$js_root/ecmascript/compiler:ark_aot_compiler(${host_toolchain})"
1124    _root_out_dir_ = get_label_info(_host_aot_target_, "root_out_dir")
1125    deps = [
1126      ":gen_${_target_name_}_abc",
1127      _host_aot_target_,
1128    ]
1129    deps += _deps_
1130
1131    script = "$js_root/script/run_ark_executable.py"
1132
1133    _aot_compile_options_ =
1134        " --aot-file=" + rebase_path(_test_aot_arg_slowpath_) +
1135        " --log-level=" + _test_aot_log_level + " --log-components=compiler" +
1136        " --compiler-opt-type-lowering=false" +
1137        " --compiler-opt-inlining=false" + " --compiler-opt-loop-peeling=false"
1138    if (defined(invoker.is_enable_trace_deopt) &&
1139        invoker.is_enable_trace_deopt) {
1140      _aot_compile_options_ += " --compiler-trace-deopt=true"
1141    }
1142
1143    if (defined(invoker.is_enable_builtins_dts) &&
1144        invoker.is_enable_builtins_dts) {
1145      deps += [ "//arkcompiler/ets_runtime:es2abc_gen_builtins_d_abc" ]
1146      _aot_compile_options_ += " --builtins-dts=" + rebase_path(root_out_dir) + "/obj/arkcompiler/ets_runtime/lib_ark_builtins/es2abc/lib_ark_builtins.d.abc"
1147    }
1148
1149    if (defined(invoker.is_enable_opt_inlining) &&
1150        invoker.is_enable_opt_inlining) {
1151      _aot_compile_options_ +=
1152          " --compiler-opt-inlining=true --compiler-opt-type-lowering=true"
1153    }
1154
1155    if (defined(invoker.is_enable_native_inline) &&
1156        invoker.is_enable_native_inline) {
1157      _aot_compile_options_ += " --compiler-enable-native-inline"
1158    }
1159
1160    if (defined(invoker.is_enable_opt_loop_peeling) &&
1161        invoker.is_enable_opt_loop_peeling) {
1162      _aot_compile_options_ += " --compiler-opt-loop-peeling=true"
1163    }
1164
1165    if (defined(invoker.is_enable_inline_trace) &&
1166        invoker.is_enable_inline_trace) {
1167      _aot_compile_options_ += " --compiler-trace-inline=true"
1168    }
1169
1170    if (defined(invoker.userDefinedMethodsInModule) &&
1171        invoker.userDefinedMethodsInModule) {
1172      _aot_compile_options_ += " --compiler-module-methods=2"
1173    }
1174
1175    if (TEST_LITECG) {
1176      _aot_compile_options_ += " --compiler-enable-litecg=true"
1177    }
1178
1179    args = [
1180      "--script-file",
1181      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_aot_compiler",
1182      "--script-options",
1183      _aot_compile_options_,
1184      "--script-args",
1185      _script_args_,
1186      "--expect-sub-output",
1187      "ts aot compile success",
1188      "--env-path",
1189      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
1190          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
1191          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
1192          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
1193          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
1194          rebase_path(_root_out_dir_) +
1195          "/thirdparty/bounds_checking_function:" +
1196          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
1197    ]
1198
1199    inputs = [ _test_abc_path_ ]
1200
1201    outputs = [
1202      _test_aot_path_slowpath_,
1203      _test_aot_snapshot_path_slowpath_,
1204    ]
1205  }
1206
1207  action("${_target_name_}AotAction") {
1208    testonly = true
1209    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
1210    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
1211
1212    deps = [
1213      ":${_target_name_}AotCompileAction",
1214      ":gen_${_target_name_}_abc",
1215      _host_jsvm_target_,
1216    ]
1217    if (!defined(invoker.is_only_typed_path) || !invoker.is_only_typed_path) {
1218      deps += [ ":${_target_name_}AotActionSlowPath" ]
1219    }
1220    deps += _deps_
1221
1222    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
1223
1224    _aot_run_options_ =
1225        " --aot-file=" + rebase_path(_test_aot_arg_) +
1226        " --asm-interpreter=true" + " --entry-point=${_target_name_}"
1227
1228    _icu_data_path_options_ =
1229        " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
1230    _aot_run_options_ += _icu_data_path_options_
1231
1232    if (defined(invoker.is_enable_enableArkTools) &&
1233        invoker.is_enable_enableArkTools) {
1234      _aot_run_options_ += " --enable-ark-tools=true"
1235      _aot_run_options_ += " --enable-force-gc=false"
1236    }
1237
1238    if (defined(invoker.log_option)) {
1239      _aot_run_options_ += invoker.log_option
1240    }
1241
1242    if (defined(invoker.is_enable_typed_op_profiler) &&
1243        invoker.is_enable_typed_op_profiler) {
1244      _aot_run_options_ += " --compiler-typed-op-profiler=ture"
1245    }
1246
1247    if (defined(invoker.is_enable_lowering_builtin) &&
1248        invoker.is_enable_lowering_builtin) {
1249      _aot_run_options_ += " --compiler-enable-lowering-builtin=true"
1250    }
1251
1252    if (defined(invoker.is_enable_trace_deopt) &&
1253        invoker.is_enable_trace_deopt) {
1254      _aot_run_options_ += " --compiler-trace-deopt=true"
1255    }
1256
1257    args = [
1258      "--script-file",
1259      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
1260      "--script-options",
1261      _aot_run_options_,
1262      "--script-args",
1263      _script_args_,
1264      "--expect-file",
1265      rebase_path(_test_expect_path_),
1266      "--env-path",
1267      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
1268          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
1269          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
1270          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
1271          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
1272          rebase_path(_root_out_dir_) +
1273          "/thirdparty/bounds_checking_function:" +
1274          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
1275    ]
1276
1277    inputs = [ _test_abc_path_ ]
1278
1279    outputs = [ "$target_out_dir/${_target_name_}/" ]
1280  }
1281
1282  action("${_target_name_}AotContextAction") {
1283    testonly = true
1284    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
1285    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
1286
1287    deps = [
1288      ":${_target_name_}AotCompileAction",
1289      ":gen_${_target_name_}_abc",
1290      _host_jsvm_target_,
1291    ]
1292    if (!defined(invoker.is_only_typed_path) || !invoker.is_only_typed_path) {
1293      deps += [ ":${_target_name_}AotActionSlowPath" ]
1294    }
1295    deps += _deps_
1296
1297    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
1298
1299    _aot_run_options_ =
1300        " --aot-file=" + rebase_path(_test_aot_arg_) +
1301        " --asm-interpreter=true" + " --entry-point=${_target_name_}"
1302
1303    _icu_data_path_options_ =
1304        " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
1305    _aot_run_options_ += _icu_data_path_options_
1306
1307    if (defined(invoker.is_enable_enableArkTools) &&
1308        invoker.is_enable_enableArkTools) {
1309      _aot_run_options_ += " --enable-ark-tools=true"
1310      _aot_run_options_ += " --enable-force-gc=false"
1311    }
1312    if (defined(invoker.log_option)) {
1313      _aot_run_options_ += invoker.log_option
1314    }
1315    _aot_run_options_ += " --enable-context=true"
1316
1317    if (defined(invoker.is_enable_typed_op_profiler) &&
1318        invoker.is_enable_typed_op_profiler) {
1319      _aot_run_options_ += " --compiler-typed-op-profiler=ture"
1320    }
1321
1322    if (defined(invoker.is_enable_lowering_builtin) &&
1323        invoker.is_enable_lowering_builtin) {
1324      _aot_run_options_ += " --compiler-enable-lowering-builtin=true"
1325    }
1326
1327    if (defined(invoker.is_enable_trace_deopt) &&
1328        invoker.is_enable_trace_deopt) {
1329      _aot_run_options_ += " --compiler-trace-deopt=true"
1330    }
1331
1332    args = [
1333      "--script-file",
1334      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
1335      "--script-options",
1336      _aot_run_options_,
1337      "--script-args",
1338      _script_args_,
1339      "--expect-file",
1340      rebase_path(_test_expect_path_),
1341      "--env-path",
1342      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
1343          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
1344          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
1345          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
1346          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
1347          rebase_path(_root_out_dir_) +
1348          "/thirdparty/bounds_checking_function:" +
1349          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
1350    ]
1351
1352    inputs = [ _test_abc_path_ ]
1353
1354    outputs = [ "$target_out_dir/${_target_name_}Context/" ]
1355  }
1356
1357  action("${_target_name_}AotActionSlowPath") {
1358    testonly = true
1359    _host_jsvm_target_ =
1360        "$js_root/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
1361    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
1362
1363    deps = [
1364      ":${_target_name_}AotCompileActionSlowPath",
1365      ":gen_${_target_name_}_abc",
1366      _host_jsvm_target_,
1367    ]
1368    deps += _deps_
1369
1370    script = "$js_root/script/run_ark_executable.py"
1371
1372    _aot_run_options_ =
1373        " --aot-file=" + rebase_path(_test_aot_arg_slowpath_) +
1374        " --asm-interpreter=true" + " --entry-point=${_target_name_}"
1375
1376    _icu_data_path_options_ =
1377        " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data")
1378    _aot_run_options_ += _icu_data_path_options_
1379
1380    if (defined(invoker.is_enable_enableArkTools) &&
1381        invoker.is_enable_enableArkTools) {
1382      _aot_run_options_ += " --enable-ark-tools=true"
1383      _aot_run_options_ += " --enable-force-gc=false"
1384    }
1385    if (defined(invoker.log_option)) {
1386      _aot_run_options_ += invoker.log_option
1387    }
1388
1389    args = [
1390      "--script-file",
1391      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
1392      "--script-options",
1393      _aot_run_options_,
1394      "--script-args",
1395      _script_args_,
1396      "--expect-file",
1397      rebase_path(_test_expect_path_),
1398      "--env-path",
1399      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
1400          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
1401          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
1402          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
1403          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
1404          rebase_path(_root_out_dir_) +
1405          "/thirdparty/bounds_checking_function:" +
1406          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
1407    ]
1408
1409    inputs = [ _test_abc_path_ ]
1410
1411    outputs = [ "$target_out_dir/${_target_name_}/SlowPath" ]
1412  }
1413}
1414
1415template("host_typeinfer_test_action") {
1416  _target_name_ = "${target_name}"
1417  _deps_ = invoker.deps
1418
1419  _host_aot_target_ =
1420      "$js_root/ecmascript/compiler:ark_aot_compiler(${host_toolchain})"
1421
1422  _test_ts_path_ = "./${_target_name_}.ts"
1423  _test_es2abc_abc_path_ = "$target_out_dir/es2abc/${_target_name_}.abc"
1424
1425  es2abc_gen_abc("es2abc_gen_${_target_name_}_abc") {
1426    extra_visibility = [ ":*" ]  # Only targets in this file can depend on this.
1427    extra_dependencies = _deps_
1428    if (defined(invoker.is_multi_file_tests) && invoker.is_multi_file_tests) {
1429      _test_es2abc_ts_path_ = "."
1430    } else {
1431      _test_es2abc_ts_path_ = _test_ts_path_
1432    }
1433    src_js = rebase_path(_test_es2abc_ts_path_)
1434    dst_file = rebase_path(_test_es2abc_abc_path_)
1435    extension = "ts"
1436    extra_args = [
1437      "--module",
1438      "--merge-abc",
1439      "--type-extractor",
1440    ]
1441
1442    in_puts = [ _test_ts_path_ ]
1443    out_puts = [ _test_es2abc_abc_path_ ]
1444  }
1445
1446  action("${_target_name_}Es2abcAotTypeInferAction") {
1447    testonly = true
1448
1449    _script_args_ = rebase_path(_test_es2abc_abc_path_)
1450    _root_out_dir_ = get_label_info(_host_aot_target_, "root_out_dir")
1451    deps = [
1452      ":es2abc_gen_${_target_name_}_abc",
1453      _host_aot_target_,
1454    ]
1455    deps += _deps_
1456
1457    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
1458
1459    _aot_compile_options_ = " --compiler-assert-types=true" +
1460                            " --compiler-opt-type-lowering=false" +
1461                            " --compiler-opt-loop-peeling=false"
1462
1463    if (defined(invoker.is_enable_builtins_dts) &&
1464        invoker.is_enable_builtins_dts) {
1465      deps += [ "//arkcompiler/ets_runtime:es2abc_gen_builtins_d_abc" ]
1466      _aot_compile_options_ += " --builtins-dts=" + rebase_path(root_out_dir) + "/obj/arkcompiler/ets_runtime/lib_ark_builtins/es2abc/lib_ark_builtins.d.abc"
1467    }
1468
1469    if (defined(invoker.is_enable_global_typeinfer) &&
1470        invoker.is_enable_global_typeinfer) {
1471      _aot_compile_options_ += " --compiler-opt-global-typeinfer=true"
1472    }
1473
1474    if (TEST_LITECG) {
1475      _aot_compile_options_ += " --compiler-enable-litecg=true"
1476    }
1477
1478    args = [
1479      "--script-file",
1480      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_aot_compiler",
1481      "--script-options",
1482      _aot_compile_options_,
1483      "--script-args",
1484      _script_args_,
1485      "--expect-output",
1486      "0",
1487      "--env-path",
1488      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
1489          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
1490          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
1491          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
1492          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
1493          rebase_path(_root_out_dir_) +
1494          "/thirdparty/bounds_checking_function:" +
1495          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
1496    ]
1497
1498    inputs = [ _test_es2abc_abc_path_ ]
1499
1500    outputs = [ "$target_out_dir/${_target_name_}/es2abc/" ]
1501  }
1502}
1503
1504template("host_pgotypeinfer_test_action") {
1505  _target_name_ = "${target_name}"
1506  _deps_ = invoker.deps
1507
1508  _test_ts_path_ = "./${_target_name_}.js"
1509  _test_aot_arg_ = "$target_out_dir/${_target_name_}"
1510
1511  _host_aot_target_ =
1512      "$js_root/ecmascript/compiler:ark_aot_compiler(${host_toolchain})"
1513
1514  _test_es2abc_abc_path_ = "$target_out_dir/es2abc/${_target_name_}.abc"
1515
1516  if (defined(invoker.is_common_js) && invoker.is_common_js) {
1517    extra_args = [ "--commonjs" ]
1518  } else {
1519    extra_args = [ "--module" ]
1520  }
1521  extra_args += [ "--merge-abc" ]
1522
1523  es2abc_gen_abc("es2abc_gen_${_target_name_}_abc") {
1524    extra_visibility = [ ":*" ]  # Only targets in this file can depend on this.
1525    extra_dependencies = _deps_
1526    if (defined(invoker.is_multi_file_tests) && invoker.is_multi_file_tests) {
1527      _test_es2abc_ts_path_ = "."
1528    } else {
1529      _test_es2abc_ts_path_ = _test_ts_path_
1530    }
1531    src_js = rebase_path(_test_es2abc_ts_path_)
1532    dst_file = rebase_path(_test_es2abc_abc_path_)
1533
1534    in_puts = [ _test_ts_path_ ]
1535    out_puts = [ _test_es2abc_abc_path_ ]
1536  }
1537
1538  _script_args_ = rebase_path(_test_es2abc_abc_path_)
1539
1540  action("${_target_name_}PgoExecute") {
1541    testonly = true
1542    _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})"
1543    _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir")
1544
1545    deps = [
1546      ":es2abc_gen_${_target_name_}_abc",
1547      _host_jsvm_target_,
1548    ]
1549    deps += _deps_
1550
1551    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
1552
1553    _aot_run_options_ =
1554        " --asm-interpreter=true" + " --entry-point=${_target_name_}" +
1555        " --enable-pgo-profiler=true" + " --compiler-pgo-profiler-path=" +
1556        rebase_path(_test_aot_arg_) + "/modules.ap"
1557
1558    if (defined(invoker.is_enable_enableArkTools) &&
1559        invoker.is_enable_enableArkTools) {
1560      _aot_run_options_ += " --enable-ark-tools=true"
1561      _aot_run_options_ += " --enable-force-gc=false"
1562    }
1563
1564    if (defined(invoker.log_option)) {
1565      _aot_run_options_ += invoker.log_option
1566    }
1567
1568    args = [
1569      "--script-file",
1570      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm",
1571      "--script-options",
1572      _aot_run_options_,
1573      "--script-args",
1574      _script_args_,
1575      "--expect-output",
1576      "0",
1577      "--env-path",
1578      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
1579          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
1580          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
1581          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
1582          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
1583          rebase_path(_root_out_dir_) +
1584          "/thirdparty/bounds_checking_function:" +
1585          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
1586    ]
1587
1588    inputs = [ _test_es2abc_abc_path_ ]
1589
1590    outputs = [ "$target_out_dir/${_target_name_}/pgo" ]
1591  }
1592
1593  action("${_target_name_}Es2abcAotTypeInferAction") {
1594    testonly = true
1595
1596    _script_args_ = rebase_path(_test_es2abc_abc_path_)
1597    _root_out_dir_ = get_label_info(_host_aot_target_, "root_out_dir")
1598    deps = [
1599      ":es2abc_gen_${_target_name_}_abc",
1600      _host_aot_target_,
1601    ]
1602    deps += _deps_
1603
1604    # Pgo Execute
1605    deps += [ ":${_target_name_}PgoExecute" ]
1606
1607    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
1608
1609    _aot_compile_options_ = " --compiler-assert-types=true" +
1610                            " --compiler-opt-type-lowering=false" +
1611                            " --compiler-opt-loop-peeling=false"
1612
1613    # Pgo Option
1614    _aot_compile_options_ += " --compiler-pgo-profiler-path=" +
1615                             rebase_path(_test_aot_arg_) + "/modules.ap"
1616
1617    if (defined(invoker.is_enable_builtins_dts) &&
1618        invoker.is_enable_builtins_dts) {
1619      deps += [ "//arkcompiler/ets_runtime:es2abc_gen_builtins_d_abc" ]
1620      _aot_compile_options_ += " --builtins-dts=" + rebase_path(root_out_dir) + "/obj/arkcompiler/ets_runtime/lib_ark_builtins/es2abc/lib_ark_builtins.d.abc"
1621    }
1622
1623    if (defined(invoker.is_enable_global_typeinfer) &&
1624        invoker.is_enable_global_typeinfer) {
1625      _aot_compile_options_ += " --compiler-opt-global-typeinfer=true"
1626    }
1627
1628    args = [
1629      "--script-file",
1630      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_aot_compiler",
1631      "--script-options",
1632      _aot_compile_options_,
1633      "--script-args",
1634      _script_args_,
1635      "--expect-output",
1636      "0",
1637      "--env-path",
1638      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
1639          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
1640          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
1641          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
1642          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
1643          rebase_path(_root_out_dir_) +
1644          "/thirdparty/bounds_checking_function:" +
1645          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
1646    ]
1647
1648    inputs = [ _test_es2abc_abc_path_ ]
1649
1650    outputs = [ "$target_out_dir/${_target_name_}/es2abc/" ]
1651  }
1652}
1653
1654template("host_quickfix_test_action") {
1655  _target_name_ = "${target_name}"
1656
1657  _test_expect_path_ = "./${_target_name_}/expect_output.txt"
1658  _test_file_name_ = [
1659    "base",
1660    "test",
1661    "retest",
1662    "patch",
1663  ]
1664
1665  if (defined(invoker.extra_patches)) {
1666    _test_file_name_ += invoker.extra_patches
1667  }
1668
1669  if (defined(invoker.entry_point)) {
1670    _script_args_ = invoker.entry_point + " "
1671  }
1672
1673  if (defined(invoker.is_hotpatch) && invoker.is_hotpatch) {
1674    _test_map_path_ = "$target_out_dir/${_target_name_}/base.map"
1675  }
1676
1677  foreach(filename, _test_file_name_) {
1678    merge_file_raw = "//arkcompiler/ets_runtime/test/quickfix/"
1679    if (filename == "test" || filename == "retest") {
1680      merge_file_raw += "${filename}.txt"
1681    } else {
1682      merge_file_raw += "${_target_name_}/${filename}.txt"
1683    }
1684
1685    merge_file = "$target_out_dir/${_target_name_}/${filename}.txt"
1686    merge_file_prefix =
1687        "//arkcompiler/ets_runtime/test/quickfix/${_target_name_}/"
1688
1689    action("gen_${_target_name_}_${filename}_merge_file") {
1690      script = "//arkcompiler/ets_runtime/test/quickfix/generate_merge_file.py"
1691      args = [
1692        "--input",
1693        rebase_path(merge_file_raw),
1694        "--output",
1695        rebase_path(merge_file),
1696        "--prefix",
1697        rebase_path(merge_file_prefix),
1698      ]
1699
1700      inputs = [ merge_file_raw ]
1701      outputs = [ merge_file ]
1702    }
1703
1704    abc_path = "$target_out_dir/${_target_name_}/${filename}.abc"
1705
1706    es2abc_gen_abc("gen_${_target_name_}_${filename}_abc") {
1707      extra_visibility =
1708          [ ":*" ]  # Only targets in this file can depend on this.
1709      extra_dependencies = [ ":gen_${_target_name_}_${filename}_merge_file" ]
1710
1711      if (defined(invoker.is_hotpatch) && filename == "patch") {
1712        extra_dependencies += [ ":gen_${_target_name_}_base_abc" ]
1713      }
1714
1715      src_js = "@" + rebase_path(merge_file)
1716      dst_file = rebase_path(abc_path)
1717      extra_args = [
1718        "--module",
1719        "--merge-abc",
1720      ]
1721
1722      if (defined(invoker.is_hotpatch) && filename == "patch") {
1723        extra_args += [ "--generate-patch" ]
1724      }
1725
1726      if (defined(invoker.is_hotpatch) && filename == "base") {
1727        dump_symbol_table = rebase_path(_test_map_path_)
1728      }
1729
1730      if (defined(invoker.is_hotpatch) && filename == "patch") {
1731        input_symbol_table = rebase_path(_test_map_path_)
1732      }
1733
1734      in_puts = [
1735        _test_expect_path_,
1736        merge_file,
1737      ]
1738
1739      if (defined(invoker.is_hotpatch) && filename == "patch") {
1740        in_puts += [ _test_map_path_ ]
1741      }
1742
1743      out_puts = [ abc_path ]
1744
1745      if (defined(invoker.is_hotpatch) && filename == "base") {
1746        out_puts += [ _test_map_path_ ]
1747      }
1748    }
1749
1750    if (filename != _test_file_name_[0]) {
1751      _script_args_ += ":"
1752    }
1753    _script_args_ += rebase_path(abc_path)
1754  }
1755
1756  action("${_target_name_}QuickfixAction") {
1757    testonly = true
1758
1759    _host_quickfix_target_ = "//arkcompiler/ets_runtime/ecmascript/quick_fix:quick_fix(${host_toolchain})"
1760    _root_out_dir_ = get_label_info(_host_quickfix_target_, "root_out_dir")
1761
1762    deps = [ _host_quickfix_target_ ]
1763    foreach(filename, _test_file_name_) {
1764      deps += [ ":gen_${_target_name_}_${filename}_abc" ]
1765    }
1766
1767    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
1768
1769    quickfix_options = " --merge-abc true "
1770    if (is_mac) {
1771      quickfix_options = " --merge-abc true  --asm-interpreter=false"
1772    }
1773
1774    args = [
1775      "--script-file",
1776      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/quick_fix",
1777      "--script-options",
1778      quickfix_options,
1779      "--script-args",
1780      _script_args_,
1781      "--timeout-limit",
1782      "500",
1783      "--expect-file",
1784      rebase_path(_test_expect_path_),
1785      "--env-path",
1786      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
1787          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
1788          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
1789          rebase_path(_root_out_dir_) + "/resourceschedule/frame_aware_sched:" +
1790          rebase_path(_root_out_dir_) + "/hiviewdfx/hilog:" +
1791          rebase_path(_root_out_dir_) +
1792          "/thirdparty/bounds_checking_function:" +
1793          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
1794    ]
1795
1796    inputs = []
1797
1798    outputs = [ "$target_out_dir/${_target_name_}/" ]
1799  }
1800}
1801