1# Copyright (c) 2024 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni") 15import("//arkcompiler/runtime_core/ark_config.gni") 16import("$ark_root/tests/test_helper.gni") 17 18abc2prog_test_configs = [ 19 "$ark_root:ark_config", 20 "$ark_root/assembler:arkassembler_public_config", 21 "$ark_root/libpandabase:arkbase_public_config", 22 "$ark_root/libpandafile:arkfile_public_config", 23 sdk_libc_secshared_config, 24] 25 26abc2prog_test_deps = [ 27 "$ark_root/abc2program:abc2program", 28 "$ark_root/assembler:libarkassembler_static", 29 "$ark_root/libpandabase:libarkbase_static", 30 "$ark_root/libpandafile:libarkfile_static", 31] 32 33test_ts_dir = "//arkcompiler/runtime_core/abc2program/tests/ts/" 34 35abc2prog_test_ts_files = [ "HelloWorld" ] 36 37foreach(file, abc2prog_test_ts_files) { 38 es2abc_gen_abc("gen_${file}_abc") { 39 test_ts = "${test_ts_dir}${file}.ts" 40 test_abc = "$target_out_dir/${file}.abc" 41 42 src_js = rebase_path(test_ts) 43 dst_file = rebase_path(test_abc) 44 extra_args = [ "--module" ] 45 in_puts = [ test_ts ] 46 out_puts = [ test_abc ] 47 } 48} 49 50abc2prog_debug_test_ts_files = [ "HelloWorld" ] 51 52foreach(file, abc2prog_debug_test_ts_files) { 53 es2abc_gen_abc("gen_${file}_debug_abc") { 54 test_ts = "${test_ts_dir}${file}.ts" 55 test_abc = "$target_out_dir/${file}Debug.abc" 56 57 src_js = rebase_path(test_ts) 58 dst_file = rebase_path(test_abc) 59 extra_args = [ 60 "--debug", 61 "--module", 62 ] 63 in_puts = [ test_ts ] 64 out_puts = [ test_abc ] 65 } 66} 67 68abc2prog_include_dirs = [ 69 "$ark_root/abc2program", 70 "$ark_root/assembler", 71 "$target_gen_dir", 72 "$target_gen_dir/../", 73 "$target_gen_dir/../../assembler", 74] 75 76script_sources = [ 77 "cpp_sources/abc2program_test_utils.cpp", 78 "cpp_sources/hello_world_test.cpp", 79] 80 81host_unittest_action("Abc2ProgScriptTest") { 82 module_out_path = module_output_path 83 sources = script_sources 84 include_dirs = abc2prog_include_dirs 85 configs = abc2prog_test_configs 86 deps = abc2prog_test_deps 87 test_abc_dir = rebase_path(target_out_dir) 88 test_abc_dump_dir = rebase_path(test_ts_dir) 89 defines = [ 90 "GRAPH_TEST_ABC_DIR=\"${test_abc_dir}/\"", 91 "GRAPH_TEST_ABC_DUMP_DIR=\"${test_abc_dump_dir}/\"", 92 ] 93 94 foreach(file, abc2prog_test_ts_files) { 95 deps += [ ":gen_${file}_abc" ] 96 } 97 foreach(file, abc2prog_debug_test_ts_files) { 98 deps += [ ":gen_${file}_debug_abc" ] 99 } 100} 101 102group("host_unittest") { 103 testonly = true 104 deps = [ ":Abc2ProgScriptTestAction" ] 105} 106