1# Copyright (c) 2023 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 18compiler_test_configs = [ 19 "$ark_root:ark_config", 20 "$ark_root/assembler:arkassembler_public_config", 21 "$ark_root/bytecode_optimizer:bytecodeopt_public_config", 22 "$ark_root/compiler:arkcompiler_public_config", 23 "$ark_root/libpandabase:arkbase_public_config", 24 "$ark_root/libpandafile:arkfile_public_config", 25 sdk_libc_secshared_config, 26] 27 28compiler_test_deps = [ 29 "$ark_root/assembler:libarkassembler", 30 "$ark_root/bytecode_optimizer:libarkbytecodeopt", 31 "$ark_root/compiler:libarkcompiler", 32 "$ark_root/libpandabase:libarkbase", 33 "$ark_root/libpandafile:libarkfile", 34] 35 36test_js_path = "//arkcompiler/runtime_core/compiler/tests/js/" 37 38# graph interface unit tests 39graph_test_js_files = [ 40 "cleanUpTest", 41 "regallocTest", 42 "regallocTryTest", 43 "simpleTryCatch", 44 "moduleTryCatch", 45 "styleTryCatch", 46 "dominatorsTryCatch", 47 "testTryCatch", 48 "graphTest", 49] 50 51foreach(file, graph_test_js_files) { 52 es2abc_gen_abc("gen_${file}_abc") { 53 test_js = "${test_js_path}${file}.js" 54 test_abc = "$target_out_dir/${file}.abc" 55 56 src_js = rebase_path(test_js) 57 dst_file = rebase_path(test_abc) 58 59 in_puts = [ test_js ] 60 out_puts = [ test_abc ] 61 } 62} 63 64graph_test_js_files_un_opt = [ 65 "branchElimination", 66 "nestedTryCatch", 67] 68 69foreach(file, graph_test_js_files_un_opt) { 70 es2abc_gen_abc("gen_${file}_abc") { 71 test_js = "${test_js_path}${file}.js" 72 test_abc = "$target_out_dir/${file}.abc" 73 74 src_js = rebase_path(test_js) 75 dst_file = rebase_path(test_abc) 76 77 in_puts = [ test_js ] 78 out_puts = [ test_abc ] 79 80 extra_args = [ "--debug" ] 81 } 82} 83 84host_unittest_action("GraphInterfaceTest") { 85 module_out_path = module_output_path 86 sources = [ 87 "branch_elimination_new_test.cpp", 88 "compiler_basicblock_test.cpp", 89 "compiler_graph_test.cpp", 90 "compiler_inst_test.cpp", 91 "compiler_optimizations_test.cpp", 92 "compiler_regalloc_test.cpp", 93 "dominators_tree_new_test.cpp", 94 "dump_test.cpp", 95 "graph_checker_test.cpp", 96 "graph_cloner_new_test.cpp", 97 "irBuilder_tests.cpp", 98 "linear_order_new_test.cpp", 99 "liveness_analyzer_new_test.cpp", 100 "loop_analyzer_new_test.cpp", 101 "pass_manager_test.cpp", 102 "reg_alloc_graph_coloring_new_test.cpp", 103 "reg_alloc_interference_graph_new_test.cpp", 104 "reg_alloc_resolver_test.cpp", 105 "spill_fills_resolver_test.cpp", 106 "split_resolver_new_test.cpp", 107 ] 108 configs = compiler_test_configs 109 deps = compiler_test_deps 110 111 external_deps = [ sdk_libc_secshared_dep ] 112 113 test_abc_dir = rebase_path(target_out_dir) 114 115 defines = [ "GRAPH_TEST_ABC_DIR=\"${test_abc_dir}/\"" ] 116 117 foreach(file, graph_test_js_files) { 118 deps += [ ":gen_${file}_abc" ] 119 } 120 foreach(file, graph_test_js_files_un_opt) { 121 deps += [ ":gen_${file}_abc" ] 122 } 123} 124 125host_unittest_action("DrawCfgToolTest") { 126 module_out_path = module_output_path 127 sources = [ "draw_cfg_test.cpp" ] 128 configs = compiler_test_configs 129 deps = compiler_test_deps 130 131 external_deps = [ sdk_libc_secshared_dep ] 132 133 test_abc_dir = rebase_path(target_out_dir) 134 tools_dir = rebase_path("$ark_root/compiler/tools") 135 136 defines = [ 137 "DRAW_CFG_TEST_ABC_DIR=\"${test_abc_dir}/\"", 138 "DRAW_CFG_TEST_OUT_DIR=\"${test_abc_dir}/cfg_out/\"", 139 "DRAW_CFG_TEST_TOOLS_DIR=\"${tools_dir}\"", 140 ] 141 142 foreach(file, graph_test_js_files) { 143 deps += [ ":gen_${file}_abc" ] 144 } 145} 146 147group("host_unittest") { 148 testonly = true 149 deps = [ ":GraphInterfaceTestAction" ] 150} 151