# Copyright (c) 2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni") import("//arkcompiler/ets_runtime/js_runtime_config.gni") import("$build_root/test.gni") if (!ark_standalone_build) { import("//arkcompiler/ets_frontend/ts2panda/ts2abc_config.gni") } if (is_standard_system || ark_standalone_build) { _icu_path_ = "thirdparty/icu" } else { _icu_path_ = "global/i18n" } template("host_unittest_action") { _target_name_ = "${target_name}" # unittest for phone running ohos_unittest(_target_name_) { resource_config_file = "//arkcompiler/ets_runtime/test/resource/js_runtime/ohos_test.xml" forward_variables_from(invoker, "*") } if (ark_standalone_build) { _module_out_path_ = "" } else { _module_out_path_ = invoker.module_out_path } # unittest for host running action("${_target_name_}Action") { testonly = true _host_test_target_ = ":${_target_name_}(${host_toolchain})" _root_out_dir_ = get_label_info(_host_test_target_, "root_out_dir") deps = [ _host_test_target_ ] script = "//arkcompiler/ets_runtime/script/run_ark_executable.py" args = [ "--script-file", rebase_path(_root_out_dir_) + "/tests/unittest/${_module_out_path_}/${_target_name_}", "--expect-output", "0", "--env-path", rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" + rebase_path(_root_out_dir_) + "/test/test:" + rebase_path(_root_out_dir_) + "/${_icu_path_}:" + rebase_path(_root_out_dir_) + "/thirdparty/zlib:" + rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"), "--timeout-limit", "1200", ] inputs = [ "$_root_out_dir_/tests/unittest/${_module_out_path_}/${_target_name_}", ] outputs = [ "$target_out_dir/${_target_name_}/" ] } } template("host_moduletest_action") { _target_name_ = "${target_name}" _deps_ = invoker.deps _is_module_ = false if (defined(invoker.is_module) && invoker.is_module) { _is_module_ = true } _is_commonjs_ = false if (defined(invoker.is_commonjs) && invoker.is_commonjs) { _is_commonjs_ = true } _is_merge_ = false if (defined(invoker.is_merge) && invoker.is_merge) { _is_merge_ = true } _is_json_ = false if (defined(invoker.is_json) && invoker.is_json) { _is_json_ = true } _timeout_ = "120" if (defined(invoker.timeout)) { _timeout_ = invoker.timeout } _test_js_path_ = "./${_target_name_}.js" _test_abc_path_ = "$target_out_dir/${_target_name_}.abc" _test_expect_path_ = "./expect_output.txt" if (_is_json_) { merge_file_raw = "./${_target_name_}.txt" merge_file = "$target_out_dir/${_target_name_}.txt" merge_file_prefix = "//arkcompiler/ets_runtime/test/moduletest/${_target_name_}/" action("gen_${_target_name_}_merge_file") { script = "../../quickfix/generate_merge_file.py" args = [ "--input", rebase_path(merge_file_raw), "--output", rebase_path(merge_file), "--prefix", rebase_path(merge_file_prefix), ] inputs = [ merge_file_raw ] outputs = [ merge_file ] } } es2abc_gen_abc("gen_${_target_name_}_abc") { extra_visibility = [ ":*" ] # Only targets in this file can depend on this. extra_dependencies = _deps_ src_js = rebase_path(_test_js_path_) dst_file = rebase_path(_test_abc_path_) extra_args = [] if (_is_module_) { extra_args += [ "--module" ] } if (_is_commonjs_) { extra_args += [ "--commonjs" ] } if (_is_merge_) { extra_args += [ "--merge-abc" ] } if (_is_json_) { extra_dependencies = [ ":gen_${_target_name_}_merge_file" ] src_js = "@" + rebase_path(merge_file) in_puts = [ _test_expect_path_, merge_file, ] } else { in_puts = [ _test_expect_path_, _test_js_path_, ] } out_puts = [ _test_abc_path_ ] } _extra_modules_ = [] if (defined(invoker.extra_modules)) { foreach(module, invoker.extra_modules) { _extra_modules_ += [ "$target_out_dir/${module}.abc" ] } } if (defined(invoker.entry_point)) { _script_args_ = invoker.entry_point _script_args_ += " " + rebase_path(_test_abc_path_) } else { _script_args_ = rebase_path(_test_abc_path_) } foreach(extra_module, _extra_modules_) { _script_args_ += ":" + rebase_path(extra_module) } action("${_target_name_}Action") { testonly = true _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})" _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir") deps = [ ":gen_${_target_name_}_abc", _host_jsvm_target_, ] deps += _deps_ script = "//arkcompiler/ets_runtime/script/run_ark_executable.py" js_vm_options = " --asm-interpreter=false" if (defined(invoker.is_set_maxNonmovableSpaceCapacity) && invoker.is_set_maxNonmovableSpaceCapacity) { js_vm_options += " --maxNonmovableSpaceCapacity=524288" # 0.5M } if (defined(invoker.is_enable_enableArkTools) && invoker.is_enable_enableArkTools) { js_vm_options += " --enable-ark-tools=true" js_vm_options += " --enable-force-gc=false" } args = [ "--script-file", rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm", "--script-options", js_vm_options, "--script-args", _script_args_, "--timeout-limit", "${_timeout_}", "--expect-file", rebase_path(_test_expect_path_), "--env-path", rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" + rebase_path(_root_out_dir_) + "/${_icu_path_}:" + rebase_path(_root_out_dir_) + "/thirdparty/zlib:" + rebase_path(_root_out_dir_) + rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"), ] inputs = [ _test_abc_path_ ] inputs += _extra_modules_ outputs = [ "$target_out_dir/${_target_name_}/" ] } action("${_target_name_}AsmAction") { testonly = true _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})" _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir") deps = [ ":gen_${_target_name_}_abc", _host_jsvm_target_, ] deps += _deps_ script = "//arkcompiler/ets_runtime/script/run_ark_executable.py" _asm_run_options_ = " --asm-interpreter=true" if (defined(invoker.is_set_maxNonmovableSpaceCapacity) && invoker.is_set_maxNonmovableSpaceCapacity) { _asm_run_options_ += " --maxNonmovableSpaceCapacity=524288" # 0.5M } if (defined(invoker.is_enable_enableArkTools) && invoker.is_enable_enableArkTools) { _asm_run_options_ += " --enable-ark-tools=true" _asm_run_options_ += " --enable-force-gc=false" } args = [ "--script-file", rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm", "--script-options", _asm_run_options_, "--script-args", _script_args_, "--timeout-limit", "${_timeout_}", "--expect-file", rebase_path(_test_expect_path_), "--env-path", rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" + rebase_path(_root_out_dir_) + "/${_icu_path_}:" + rebase_path(_root_out_dir_) + "/thirdparty/zlib:" + rebase_path(_root_out_dir_) + rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"), ] inputs = [ _test_abc_path_ ] inputs += _extra_modules_ outputs = [ "$target_out_dir/${_target_name_}Asm/" ] } action("${_target_name_}AsmSingleStepAction") { testonly = true _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})" _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir") deps = [ ":gen_${_target_name_}_abc", _host_jsvm_target_, ] deps += _deps_ script = "//arkcompiler/ets_runtime/script/run_ark_executable.py" # 214: all bytecodes _asm_run_options_ = " --asm-interpreter=true --asm-opcode-disable-range=0,214" if (defined(invoker.is_set_maxNonmovableSpaceCapacity) && invoker.is_set_maxNonmovableSpaceCapacity) { _asm_run_options_ += " --maxNonmovableSpaceCapacity=524288" # 0.5M } if (defined(invoker.is_enable_enableArkTools) && invoker.is_enable_enableArkTools) { _asm_run_options_ += " --enable-ark-tools=true" _asm_run_options_ += " --enable-force-gc=false" } args = [ "--script-file", rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm", "--script-options", _asm_run_options_, "--script-args", _script_args_, "--expect-file", rebase_path(_test_expect_path_), "--env-path", rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" + rebase_path(_root_out_dir_) + "/${_icu_path_}:" + rebase_path(_root_out_dir_) + "/thirdparty/zlib:" + rebase_path(_root_out_dir_) + rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"), ] inputs = [ _test_abc_path_ ] inputs += _extra_modules_ outputs = [ "$target_out_dir/${_target_name_}AsmSingleStep/" ] } } if (!ark_standalone_build) { template("host_aot_js_test_action") { _target_name_ = "${target_name}" _deps_ = invoker.deps _test_ts_path_ = "./${_target_name_}.js" _test_abc_path_ = "$target_out_dir/${_target_name_}.abc" _test_aot_path_ = "$target_out_dir/${_target_name_}.an" _test_aot_snapshot_path_ = "$target_out_dir/${_target_name_}.ai" _test_aot_arg_ = "$target_out_dir/${_target_name_}" _test_aot_log_level = "info" _test_expect_path_ = "./expect_output.txt" ts2abc_gen_abc("gen_${_target_name_}_abc") { extra_visibility = [ ":*" ] # Only targets in this file can depend on this. extra_dependencies = _deps_ src_js = rebase_path(_test_ts_path_) dst_file = rebase_path(_test_abc_path_) extra_args = [ "--merge-abc", "--module", ] in_puts = [ _test_ts_path_, _test_expect_path_, ] out_puts = [ _test_abc_path_ ] } _script_args_ = rebase_path(_test_abc_path_) action("${_target_name_}AotCompileAction") { testonly = true _host_aot_target_ = "//arkcompiler/ets_runtime/ecmascript/compiler:ark_aot_compiler(${host_toolchain})" _root_out_dir_ = get_label_info(_host_aot_target_, "root_out_dir") deps = [ ":gen_${_target_name_}_abc", _host_aot_target_, ] deps += _deps_ script = "//arkcompiler/ets_runtime/script/run_ark_executable.py" _aot_compile_options_ = " --aot-file=" + rebase_path(_test_aot_arg_) + " --log-level=" + _test_aot_log_level + " --log-components=all" if (defined(invoker.is_disable_type_lowering) && invoker.is_disable_type_lowering) { _aot_compile_options_ += " --enable-type-lowering=false" } args = [ "--script-file", rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_aot_compiler", "--script-options", _aot_compile_options_, "--script-args", _script_args_, "--expect-sub-output", "ts aot compile success", "--env-path", rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" + rebase_path(_root_out_dir_) + "/${_icu_path_}:" + rebase_path(_root_out_dir_) + "/thirdparty/zlib:" + rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"), ] inputs = [ _test_abc_path_ ] outputs = [ _test_aot_path_, _test_aot_snapshot_path_, ] } action("${_target_name_}AotAction") { testonly = true _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})" _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir") deps = [ ":${_target_name_}AotCompileAction", ":gen_${_target_name_}_abc", _host_jsvm_target_, ] deps += _deps_ script = "//arkcompiler/ets_runtime/script/run_ark_executable.py" _aot_run_options_ = " --aot-file=" + rebase_path(_test_aot_arg_) + " --asm-interpreter=true" + " --entry-point=${_target_name_}" if (defined(invoker.is_enable_enableArkTools) && invoker.is_enable_enableArkTools) { _aot_run_options_ += " --enable-ark-tools=true" _aot_run_options_ += " --enable-force-gc=false" } _icu_data_path_options_ = " --icu-data-path=" + rebase_path("//third_party/icu/ohos_icu4j/data") _aot_run_options_ += _icu_data_path_options_ args = [ "--script-file", rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm", "--script-options", _aot_run_options_, "--script-args", _script_args_, "--expect-file", rebase_path(_test_expect_path_), "--env-path", rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" + rebase_path(_root_out_dir_) + "/${_icu_path_}:" + rebase_path(_root_out_dir_) + "/thirdparty/zlib:" + rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"), ] inputs = [ _test_abc_path_ ] outputs = [ "$target_out_dir/${_target_name_}/" ] } } template("host_aot_test_action") { _target_name_ = "${target_name}" _deps_ = invoker.deps _test_ts_path_ = "./${_target_name_}.ts" _test_abc_path_ = "$target_out_dir/${_target_name_}.abc" _test_aot_path_ = "$target_out_dir/${_target_name_}.an" _test_aot_snapshot_path_ = "$target_out_dir/${_target_name_}.ai" _test_aot_arg_ = "$target_out_dir/${_target_name_}" _test_aot_log_level = "info" _test_expect_path_ = "./expect_output.txt" ts2abc_gen_abc("gen_${_target_name_}_abc") { extra_visibility = [ ":*" ] # Only targets in this file can depend on this. extra_dependencies = _deps_ src_js = rebase_path(_test_ts_path_) dst_file = rebase_path(_test_abc_path_) extra_args = [ "--merge-abc", "--module", ] in_puts = [ _test_ts_path_, _test_expect_path_, ] out_puts = [ _test_abc_path_ ] } _script_args_ = rebase_path(_test_abc_path_) _builtins_dts_path_ = "//arkcompiler/ets_runtime/ecmascript/ts_types/lib_ark_builtins.d.ts" _builtins_d_abc_path_ = "$target_out_dir/lib_ark_builtins.d.abc" ts2abc_gen_abc("gen_builtins_d_abc") { extra_visibility = [ ":*" ] # Only targets in this file can depend on this. # extra_dependencies = _deps_ src_js = rebase_path(_builtins_dts_path_) dst_file = rebase_path(_builtins_d_abc_path_) extra_args = [ "--merge-abc", "--q", "--b", ] in_puts = [ _builtins_dts_path_ ] out_puts = [ _builtins_d_abc_path_ ] } action("${_target_name_}AotCompileAction") { testonly = true _host_aot_target_ = "//arkcompiler/ets_runtime/ecmascript/compiler:ark_aot_compiler(${host_toolchain})" _root_out_dir_ = get_label_info(_host_aot_target_, "root_out_dir") deps = [ ":gen_${_target_name_}_abc", _host_aot_target_, ] deps += _deps_ script = "//arkcompiler/ets_runtime/script/run_ark_executable.py" _aot_compile_options_ = " --aot-file=" + rebase_path(_test_aot_arg_) + " --log-level=" + _test_aot_log_level + " --log-components=all" if (defined(invoker.is_disable_type_lowering) && invoker.is_disable_type_lowering) { _aot_compile_options_ += " --enable-type-lowering=false" } if (defined(invoker.is_enable_builtins_dts) && invoker.is_enable_builtins_dts) { deps += [ ":gen_builtins_d_abc" ] _aot_compile_options_ += " --builtins-dts=" + rebase_path(_builtins_d_abc_path_) } args = [ "--script-file", rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_aot_compiler", "--script-options", _aot_compile_options_, "--script-args", _script_args_, "--expect-sub-output", "ts aot compile success", "--env-path", rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" + rebase_path(_root_out_dir_) + "/${_icu_path_}:" + rebase_path(_root_out_dir_) + "/thirdparty/zlib:" + rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"), ] inputs = [ _test_abc_path_ ] outputs = [ _test_aot_path_, _test_aot_snapshot_path_, ] } action("${_target_name_}AotAction") { testonly = true _host_jsvm_target_ = "//arkcompiler/ets_runtime/ecmascript/js_vm:ark_js_vm(${host_toolchain})" _root_out_dir_ = get_label_info(_host_jsvm_target_, "root_out_dir") deps = [ ":${_target_name_}AotCompileAction", ":gen_${_target_name_}_abc", _host_jsvm_target_, ] deps += _deps_ script = "//arkcompiler/ets_runtime/script/run_ark_executable.py" _aot_run_options_ = " --aot-file=" + rebase_path(_test_aot_arg_) + " --asm-interpreter=true" + " --entry-point=${_target_name_}" if (defined(invoker.is_enable_enableArkTools) && invoker.is_enable_enableArkTools) { _aot_run_options_ += " --enable-ark-tools=true" _aot_run_options_ += " --enable-force-gc=false" } if (defined(invoker.log_option)) { _aot_run_options_ += invoker.log_option } args = [ "--script-file", rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_js_vm", "--script-options", _aot_run_options_, "--script-args", _script_args_, "--expect-file", rebase_path(_test_expect_path_), "--env-path", rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" + rebase_path(_root_out_dir_) + "/${_icu_path_}:" + rebase_path(_root_out_dir_) + "/thirdparty/zlib:" + rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"), ] inputs = [ _test_abc_path_ ] outputs = [ "$target_out_dir/${_target_name_}/" ] } } template("host_typeinfer_test_action") { _target_name_ = "${target_name}" _deps_ = invoker.deps _test_ts_path_ = "./${_target_name_}.ts" _test_abc_path_ = "$target_out_dir/${_target_name_}.abc" ts2abc_gen_abc("gen_${_target_name_}_abc") { extra_visibility = [ ":*" ] # Only targets in this file can depend on this. extra_dependencies = _deps_ src_js = rebase_path(_test_ts_path_) dst_file = rebase_path(_test_abc_path_) extra_args = [ "--merge-abc", "--module", ] in_puts = [ _test_ts_path_ ] out_puts = [ _test_abc_path_ ] } _script_args_ = rebase_path(_test_abc_path_) _builtins_dts_path_ = "//arkcompiler/ets_runtime/ecmascript/ts_types/lib_ark_builtins.d.ts" _builtins_d_abc_path_ = "$target_out_dir/lib_ark_builtins.d.abc" ts2abc_gen_abc("gen_builtins_d_abc") { extra_visibility = [ ":*" ] # Only targets in this file can depend on this. # extra_dependencies = _deps_ src_js = rebase_path(_builtins_dts_path_) dst_file = rebase_path(_builtins_d_abc_path_) extra_args = [ "--merge-abc", "--q", "--b", ] in_puts = [ _builtins_dts_path_ ] out_puts = [ _builtins_d_abc_path_ ] } action("${_target_name_}AotTypeInferAction") { testonly = true _host_aot_target_ = "//arkcompiler/ets_runtime/ecmascript/compiler:ark_aot_compiler(${host_toolchain})" _root_out_dir_ = get_label_info(_host_aot_target_, "root_out_dir") deps = [ ":gen_${_target_name_}_abc", _host_aot_target_, ] deps += _deps_ script = "//arkcompiler/ets_runtime/script/run_ark_executable.py" _aot_compile_options_ = " --assert-types=true" if (defined(invoker.is_enable_builtins_dts) && invoker.is_enable_builtins_dts) { deps += [ ":gen_builtins_d_abc" ] _aot_compile_options_ += " --builtins-dts=" + rebase_path(_builtins_d_abc_path_) } if (defined(invoker.is_disable_type_lowering) && invoker.is_disable_type_lowering) { _aot_compile_options_ += " --enable-type-lowering=false" } args = [ "--script-file", rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/ark_aot_compiler", "--script-options", _aot_compile_options_, "--script-args", _script_args_, "--expect-output", "0", "--env-path", rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" + rebase_path(_root_out_dir_) + "/${_icu_path_}:" + rebase_path(_root_out_dir_) + "/thirdparty/zlib:" + rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"), ] inputs = [ _test_abc_path_ ] outputs = [ "$target_out_dir/${_target_name_}/" ] } } } template("host_quickfix_test_action") { _target_name_ = "${target_name}" _extra_patches_ = invoker.extra_patches _test_js_path_ = [ "./${_target_name_}/base.js", "./${_target_name_}/module.js", "./${_target_name_}/patch/base.js", "./${_target_name_}/patch/module.js", "./${_target_name_}/test.js", ] foreach(patch, _extra_patches_) { _test_js_path_ += [ "./${_target_name_}/${patch}/base.js", "./${_target_name_}/${patch}/module.js", ] } _base_merge_file_raw_ = "//arkcompiler/ets_runtime/test/quickfix/base.txt" _test_merge_file_raw_ = "//arkcompiler/ets_runtime/test/quickfix/test.txt" _retest_merge_file_raw_ = "//arkcompiler/ets_runtime/test/quickfix/retest.txt" _base_merge_file_ = "$target_out_dir/${_target_name_}/base.txt" _test_merge_file_ = "$target_out_dir/${_target_name_}/test.txt" _retest_merge_file_ = "$target_out_dir/${_target_name_}/retest.txt" _patch_merge_file_ = "$target_out_dir/${_target_name_}/patch.txt" _base_abc_path_ = "$target_out_dir/${_target_name_}/merge.abc" _test_abc_path_ = "$target_out_dir/${_target_name_}/test.abc" _retest_abc_path_ = "$target_out_dir/${_target_name_}/retest.abc" _patch_abc_path_ = "$target_out_dir/${_target_name_}/patch/merge.abc" _test_expect_path_ = "./${_target_name_}/expect_output.txt" action("gen_${_target_name_}_base_merge_file") { script = "//arkcompiler/ets_runtime/test/quickfix/generate_merge_file.py" args = [ "--input", rebase_path(_base_merge_file_raw_), "--output", rebase_path(_base_merge_file_), "--prefix", rebase_path("//arkcompiler/ets_runtime/test/quickfix/${_target_name_}/"), ] inputs = [ _base_merge_file_raw_ ] outputs = [ _base_merge_file_ ] } action("gen_${_target_name_}_test_merge_file") { script = "//arkcompiler/ets_runtime/test/quickfix/generate_merge_file.py" args = [ "--input", rebase_path(_test_merge_file_raw_), "--output", rebase_path(_test_merge_file_), "--prefix", rebase_path("//arkcompiler/ets_runtime/test/quickfix/${_target_name_}/"), ] inputs = [ _test_merge_file_raw_ ] outputs = [ _test_merge_file_ ] } action("gen_${_target_name_}_retest_merge_file") { script = "//arkcompiler/ets_runtime/test/quickfix/generate_merge_file.py" args = [ "--input", rebase_path(_retest_merge_file_raw_), "--output", rebase_path(_retest_merge_file_), "--prefix", rebase_path("//arkcompiler/ets_runtime/test/quickfix/${_target_name_}/"), ] inputs = [ _retest_merge_file_raw_ ] outputs = [ _retest_merge_file_ ] } action("gen_${_target_name_}_patch_merge_file") { script = "//arkcompiler/ets_runtime/test/quickfix/generate_merge_file.py" args = [ "--input", rebase_path(_base_merge_file_raw_), "--output", rebase_path(_patch_merge_file_), "--prefix", rebase_path( "//arkcompiler/ets_runtime/test/quickfix/${_target_name_}/patch/"), ] inputs = [ _base_merge_file_raw_ ] outputs = [ _patch_merge_file_ ] } es2abc_gen_abc("gen_${_target_name_}_base_abc") { extra_visibility = [ ":*" ] # Only targets in this file can depend on this. extra_dependencies = [ ":gen_${_target_name_}_base_merge_file" ] src_js = "@" + rebase_path(_base_merge_file_) dst_file = rebase_path(_base_abc_path_) extra_args = [] extra_args += [ "--module" ] extra_args += [ "--merge-abc" ] in_puts = [ _test_expect_path_ ] in_puts += _test_js_path_ out_puts = [ _base_abc_path_ ] } es2abc_gen_abc("gen_${_target_name_}_test_abc") { extra_visibility = [ ":*" ] # Only targets in this file can depend on this. extra_dependencies = [ ":gen_${_target_name_}_test_merge_file" ] src_js = "@" + rebase_path(_test_merge_file_) dst_file = rebase_path(_test_abc_path_) extra_args = [] extra_args += [ "--module" ] extra_args += [ "--merge-abc" ] in_puts = [ _test_expect_path_ ] in_puts += _test_js_path_ out_puts = [ _test_abc_path_ ] } es2abc_gen_abc("gen_${_target_name_}_retest_abc") { extra_visibility = [ ":*" ] # Only targets in this file can depend on this. extra_dependencies = [ ":gen_${_target_name_}_retest_merge_file" ] src_js = "@" + rebase_path(_retest_merge_file_) dst_file = rebase_path(_retest_abc_path_) extra_args = [] extra_args += [ "--module" ] extra_args += [ "--merge-abc" ] in_puts = [ _test_expect_path_ ] in_puts += _test_js_path_ out_puts = [ _retest_abc_path_ ] } es2abc_gen_abc("gen_${_target_name_}_patch_abc") { extra_visibility = [ ":*" ] # Only targets in this file can depend on this. extra_dependencies = [ ":gen_${_target_name_}_patch_merge_file" ] src_js = "@" + rebase_path(_patch_merge_file_) dst_file = rebase_path(_patch_abc_path_) extra_args = [] extra_args += [ "--module" ] extra_args += [ "--merge-abc" ] in_puts = [ _test_expect_path_ ] in_puts += _test_js_path_ out_puts = [ _patch_abc_path_ ] } if (defined(invoker.entry_point)) { _script_args_ = invoker.entry_point + " " } _script_args_ += rebase_path(_base_abc_path_) + ":" + rebase_path(_test_abc_path_) + ":" + rebase_path(_retest_abc_path_) + ":" + rebase_path(_patch_abc_path_) foreach(patch, _extra_patches_) { _merge_file_ = "$target_out_dir/${_target_name_}/${patch}.txt" _abc_file_ = "$target_out_dir/${_target_name_}/${patch}/merge.abc" action("gen_${_target_name_}_${patch}_merge_file") { script = "//arkcompiler/ets_runtime/test/quickfix/generate_merge_file.py" args = [ "--input", rebase_path(_base_merge_file_raw_), "--output", rebase_path(_merge_file_), "--prefix", rebase_path( "//arkcompiler/ets_runtime/test/quickfix/${_target_name_}/${patch}/"), ] inputs = [ _base_merge_file_raw_ ] outputs = [ _merge_file_ ] } es2abc_gen_abc("gen_${_target_name_}_${patch}_abc") { extra_visibility = [ ":*" ] # Only targets in this file can depend on this. extra_dependencies = [ ":gen_${_target_name_}_${patch}_merge_file" ] src_js = "@" + rebase_path(_merge_file_) dst_file = rebase_path(_abc_file_) extra_args = [] extra_args += [ "--module" ] extra_args += [ "--merge-abc" ] in_puts = [ _test_expect_path_ ] in_puts += _test_js_path_ out_puts = [ _abc_file_ ] } _script_args_ += ":" + rebase_path(_abc_file_) } action("${_target_name_}QuickfixAction") { testonly = true _host_quickfix_target_ = "//arkcompiler/ets_runtime/ecmascript/quick_fix:quick_fix(${host_toolchain})" _root_out_dir_ = get_label_info(_host_quickfix_target_, "root_out_dir") deps = [ ":gen_${_target_name_}_base_abc", ":gen_${_target_name_}_patch_abc", ":gen_${_target_name_}_retest_abc", ":gen_${_target_name_}_test_abc", _host_quickfix_target_, ] foreach(patch, _extra_patches_) { deps += [ ":gen_${_target_name_}_${patch}_abc" ] } script = "//arkcompiler/ets_runtime/script/run_ark_executable.py" quickfix_options = " --merge-abc true " args = [ "--script-file", rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime/quick_fix", "--script-options", quickfix_options, "--script-args", _script_args_, "--timeout-limit", "120", "--expect-file", rebase_path(_test_expect_path_), "--env-path", rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" + rebase_path(_root_out_dir_) + "/${_icu_path_}:" + rebase_path(_root_out_dir_) + "/thirdparty/zlib:" + rebase_path(_root_out_dir_) + rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"), ] inputs = [ _base_abc_path_, _test_abc_path_, _retest_abc_path_, _patch_abc_path_, ] outputs = [ "$target_out_dir/${_target_name_}/" ] } }