1b1994897Sopenharmony_ci# Copyright (c) 2023 Huawei Device Co., Ltd. 2b1994897Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 3b1994897Sopenharmony_ci# you may not use this file except in compliance with the License. 4b1994897Sopenharmony_ci# You may obtain a copy of the License at 5b1994897Sopenharmony_ci# 6b1994897Sopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 7b1994897Sopenharmony_ci# 8b1994897Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software 9b1994897Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 10b1994897Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11b1994897Sopenharmony_ci# See the License for the specific language governing permissions and 12b1994897Sopenharmony_ci# limitations under the License. 13b1994897Sopenharmony_ci 14b1994897Sopenharmony_ciimport("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni") 15b1994897Sopenharmony_ciimport("//arkcompiler/runtime_core/ark_config.gni") 16b1994897Sopenharmony_ciimport("$ark_root/tests/test_helper.gni") 17b1994897Sopenharmony_ci 18b1994897Sopenharmony_cicompiler_test_configs = [ 19b1994897Sopenharmony_ci "$ark_root:ark_config", 20b1994897Sopenharmony_ci "$ark_root/assembler:arkassembler_public_config", 21b1994897Sopenharmony_ci "$ark_root/bytecode_optimizer:bytecodeopt_public_config", 22b1994897Sopenharmony_ci "$ark_root/compiler:arkcompiler_public_config", 23b1994897Sopenharmony_ci "$ark_root/libpandabase:arkbase_public_config", 24b1994897Sopenharmony_ci "$ark_root/libpandafile:arkfile_public_config", 25b1994897Sopenharmony_ci sdk_libc_secshared_config, 26b1994897Sopenharmony_ci] 27b1994897Sopenharmony_ci 28b1994897Sopenharmony_cicompiler_test_deps = [ 29b1994897Sopenharmony_ci "$ark_root/assembler:libarkassembler", 30b1994897Sopenharmony_ci "$ark_root/bytecode_optimizer:libarkbytecodeopt", 31b1994897Sopenharmony_ci "$ark_root/compiler:libarkcompiler", 32b1994897Sopenharmony_ci "$ark_root/libpandabase:libarkbase", 33b1994897Sopenharmony_ci "$ark_root/libpandafile:libarkfile", 34b1994897Sopenharmony_ci] 35b1994897Sopenharmony_ci 36b1994897Sopenharmony_citest_js_path = "//arkcompiler/runtime_core/compiler/tests/js/" 37b1994897Sopenharmony_ci 38b1994897Sopenharmony_ci# graph interface unit tests 39b1994897Sopenharmony_cigraph_test_js_files = [ 40b1994897Sopenharmony_ci "cleanUpTest", 41b1994897Sopenharmony_ci "regallocTest", 42b1994897Sopenharmony_ci "regallocTryTest", 43b1994897Sopenharmony_ci "simpleTryCatch", 44b1994897Sopenharmony_ci "moduleTryCatch", 45b1994897Sopenharmony_ci "styleTryCatch", 46b1994897Sopenharmony_ci "dominatorsTryCatch", 47b1994897Sopenharmony_ci "testTryCatch", 48b1994897Sopenharmony_ci "graphTest", 49b1994897Sopenharmony_ci] 50b1994897Sopenharmony_ci 51b1994897Sopenharmony_ciforeach(file, graph_test_js_files) { 52b1994897Sopenharmony_ci es2abc_gen_abc("gen_${file}_abc") { 53b1994897Sopenharmony_ci test_js = "${test_js_path}${file}.js" 54b1994897Sopenharmony_ci test_abc = "$target_out_dir/${file}.abc" 55b1994897Sopenharmony_ci 56b1994897Sopenharmony_ci src_js = rebase_path(test_js) 57b1994897Sopenharmony_ci dst_file = rebase_path(test_abc) 58b1994897Sopenharmony_ci 59b1994897Sopenharmony_ci in_puts = [ test_js ] 60b1994897Sopenharmony_ci out_puts = [ test_abc ] 61b1994897Sopenharmony_ci } 62b1994897Sopenharmony_ci} 63b1994897Sopenharmony_ci 64b1994897Sopenharmony_cigraph_test_js_files_un_opt = [ 65b1994897Sopenharmony_ci "branchElimination", 66b1994897Sopenharmony_ci "nestedTryCatch", 67b1994897Sopenharmony_ci] 68b1994897Sopenharmony_ci 69b1994897Sopenharmony_ciforeach(file, graph_test_js_files_un_opt) { 70b1994897Sopenharmony_ci es2abc_gen_abc("gen_${file}_abc") { 71b1994897Sopenharmony_ci test_js = "${test_js_path}${file}.js" 72b1994897Sopenharmony_ci test_abc = "$target_out_dir/${file}.abc" 73b1994897Sopenharmony_ci 74b1994897Sopenharmony_ci src_js = rebase_path(test_js) 75b1994897Sopenharmony_ci dst_file = rebase_path(test_abc) 76b1994897Sopenharmony_ci 77b1994897Sopenharmony_ci in_puts = [ test_js ] 78b1994897Sopenharmony_ci out_puts = [ test_abc ] 79b1994897Sopenharmony_ci 80b1994897Sopenharmony_ci extra_args = [ "--debug" ] 81b1994897Sopenharmony_ci } 82b1994897Sopenharmony_ci} 83b1994897Sopenharmony_ci 84b1994897Sopenharmony_cihost_unittest_action("GraphInterfaceTest") { 85b1994897Sopenharmony_ci module_out_path = module_output_path 86b1994897Sopenharmony_ci sources = [ 87b1994897Sopenharmony_ci "branch_elimination_new_test.cpp", 88b1994897Sopenharmony_ci "compiler_basicblock_test.cpp", 89b1994897Sopenharmony_ci "compiler_graph_test.cpp", 90b1994897Sopenharmony_ci "compiler_inst_test.cpp", 91b1994897Sopenharmony_ci "compiler_optimizations_test.cpp", 92b1994897Sopenharmony_ci "compiler_regalloc_test.cpp", 93b1994897Sopenharmony_ci "dominators_tree_new_test.cpp", 94b1994897Sopenharmony_ci "dump_test.cpp", 95b1994897Sopenharmony_ci "graph_checker_test.cpp", 96b1994897Sopenharmony_ci "graph_cloner_new_test.cpp", 97b1994897Sopenharmony_ci "irBuilder_tests.cpp", 98b1994897Sopenharmony_ci "linear_order_new_test.cpp", 99b1994897Sopenharmony_ci "liveness_analyzer_new_test.cpp", 100b1994897Sopenharmony_ci "loop_analyzer_new_test.cpp", 101b1994897Sopenharmony_ci "pass_manager_test.cpp", 102b1994897Sopenharmony_ci "reg_alloc_graph_coloring_new_test.cpp", 103b1994897Sopenharmony_ci "reg_alloc_interference_graph_new_test.cpp", 104b1994897Sopenharmony_ci "reg_alloc_resolver_test.cpp", 105b1994897Sopenharmony_ci "spill_fills_resolver_test.cpp", 106b1994897Sopenharmony_ci "split_resolver_new_test.cpp", 107b1994897Sopenharmony_ci ] 108b1994897Sopenharmony_ci configs = compiler_test_configs 109b1994897Sopenharmony_ci deps = compiler_test_deps 110b1994897Sopenharmony_ci 111b1994897Sopenharmony_ci external_deps = [ sdk_libc_secshared_dep ] 112b1994897Sopenharmony_ci 113b1994897Sopenharmony_ci test_abc_dir = rebase_path(target_out_dir) 114b1994897Sopenharmony_ci 115b1994897Sopenharmony_ci defines = [ "GRAPH_TEST_ABC_DIR=\"${test_abc_dir}/\"" ] 116b1994897Sopenharmony_ci 117b1994897Sopenharmony_ci foreach(file, graph_test_js_files) { 118b1994897Sopenharmony_ci deps += [ ":gen_${file}_abc" ] 119b1994897Sopenharmony_ci } 120b1994897Sopenharmony_ci foreach(file, graph_test_js_files_un_opt) { 121b1994897Sopenharmony_ci deps += [ ":gen_${file}_abc" ] 122b1994897Sopenharmony_ci } 123b1994897Sopenharmony_ci} 124b1994897Sopenharmony_ci 125b1994897Sopenharmony_cihost_unittest_action("DrawCfgToolTest") { 126b1994897Sopenharmony_ci module_out_path = module_output_path 127b1994897Sopenharmony_ci sources = [ "draw_cfg_test.cpp" ] 128b1994897Sopenharmony_ci configs = compiler_test_configs 129b1994897Sopenharmony_ci deps = compiler_test_deps 130b1994897Sopenharmony_ci 131b1994897Sopenharmony_ci external_deps = [ sdk_libc_secshared_dep ] 132b1994897Sopenharmony_ci 133b1994897Sopenharmony_ci test_abc_dir = rebase_path(target_out_dir) 134b1994897Sopenharmony_ci tools_dir = rebase_path("$ark_root/compiler/tools") 135b1994897Sopenharmony_ci 136b1994897Sopenharmony_ci defines = [ 137b1994897Sopenharmony_ci "DRAW_CFG_TEST_ABC_DIR=\"${test_abc_dir}/\"", 138b1994897Sopenharmony_ci "DRAW_CFG_TEST_OUT_DIR=\"${test_abc_dir}/cfg_out/\"", 139b1994897Sopenharmony_ci "DRAW_CFG_TEST_TOOLS_DIR=\"${tools_dir}\"", 140b1994897Sopenharmony_ci ] 141b1994897Sopenharmony_ci 142b1994897Sopenharmony_ci foreach(file, graph_test_js_files) { 143b1994897Sopenharmony_ci deps += [ ":gen_${file}_abc" ] 144b1994897Sopenharmony_ci } 145b1994897Sopenharmony_ci} 146b1994897Sopenharmony_ci 147b1994897Sopenharmony_cigroup("host_unittest") { 148b1994897Sopenharmony_ci testonly = true 149b1994897Sopenharmony_ci deps = [ ":GraphInterfaceTestAction" ] 150b1994897Sopenharmony_ci} 151