# Copyright (c) 2024 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/runtime_core/ark_config.gni") import("$ark_root/tests/test_helper.gni") abc2prog_test_configs = [ "$ark_root:ark_config", "$ark_root/assembler:arkassembler_public_config", "$ark_root/libpandabase:arkbase_public_config", "$ark_root/libpandafile:arkfile_public_config", sdk_libc_secshared_config, ] abc2prog_test_deps = [ "$ark_root/abc2program:abc2program", "$ark_root/assembler:libarkassembler_static", "$ark_root/libpandabase:libarkbase_static", "$ark_root/libpandafile:libarkfile_static", ] test_ts_dir = "//arkcompiler/runtime_core/abc2program/tests/ts/" abc2prog_test_ts_files = [ "HelloWorld" ] foreach(file, abc2prog_test_ts_files) { es2abc_gen_abc("gen_${file}_abc") { test_ts = "${test_ts_dir}${file}.ts" test_abc = "$target_out_dir/${file}.abc" src_js = rebase_path(test_ts) dst_file = rebase_path(test_abc) extra_args = [ "--module" ] in_puts = [ test_ts ] out_puts = [ test_abc ] } } abc2prog_debug_test_ts_files = [ "HelloWorld" ] foreach(file, abc2prog_debug_test_ts_files) { es2abc_gen_abc("gen_${file}_debug_abc") { test_ts = "${test_ts_dir}${file}.ts" test_abc = "$target_out_dir/${file}Debug.abc" src_js = rebase_path(test_ts) dst_file = rebase_path(test_abc) extra_args = [ "--debug", "--module", ] in_puts = [ test_ts ] out_puts = [ test_abc ] } } abc2prog_include_dirs = [ "$ark_root/abc2program", "$ark_root/assembler", "$target_gen_dir", "$target_gen_dir/../", "$target_gen_dir/../../assembler", ] script_sources = [ "cpp_sources/abc2program_test_utils.cpp", "cpp_sources/hello_world_test.cpp", ] host_unittest_action("Abc2ProgScriptTest") { module_out_path = module_output_path sources = script_sources include_dirs = abc2prog_include_dirs configs = abc2prog_test_configs deps = abc2prog_test_deps test_abc_dir = rebase_path(target_out_dir) test_abc_dump_dir = rebase_path(test_ts_dir) defines = [ "GRAPH_TEST_ABC_DIR=\"${test_abc_dir}/\"", "GRAPH_TEST_ABC_DUMP_DIR=\"${test_abc_dump_dir}/\"", ] foreach(file, abc2prog_test_ts_files) { deps += [ ":gen_${file}_abc" ] } foreach(file, abc2prog_debug_test_ts_files) { deps += [ ":gen_${file}_debug_abc" ] } } group("host_unittest") { testonly = true deps = [ ":Abc2ProgScriptTestAction" ] }