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