# Copyright (c) 2023 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("//build/config/components/ets_frontend/es2abc_config.gni") import("//arkcompiler/runtime_core/ark_config.gni") import("$ark_root/tests/test_helper.gni") compiler_test_configs = [ "$ark_root:ark_config", "$ark_root/assembler:arkassembler_public_config", "$ark_root/bytecode_optimizer:bytecodeopt_public_config", "$ark_root/compiler:arkcompiler_public_config", "$ark_root/libpandabase:arkbase_public_config", "$ark_root/libpandafile:arkfile_public_config", ] compiler_test_deps = [ "$ark_root/assembler:libarkassembler", "$ark_root/bytecode_optimizer:libarkbytecodeopt", "$ark_root/compiler:libarkcompiler", "$ark_root/libpandabase:libarkbase", "$ark_root/libpandafile:libarkfile", ] test_js_path = "//arkcompiler/runtime_core/compiler/tests/js/" # graph interface unit tests graph_test_js_files = [ "cleanUpTest", "regallocTest", "regallocTryTest", "simpleTryCatch", "moduleTryCatch", "styleTryCatch", "dominatorsTryCatch", "testTryCatch", "graphTest", ] foreach(file, graph_test_js_files) { es2abc_gen_abc("gen_${file}_abc") { test_js = "${test_js_path}${file}.js" test_abc = "$target_out_dir/${file}.abc" src_js = rebase_path(test_js) dst_file = rebase_path(test_abc) in_puts = [ test_js ] out_puts = [ test_abc ] } } graph_test_js_files_un_opt = [ "branchElimination", "nestedTryCatch", ] foreach(file, graph_test_js_files_un_opt) { es2abc_gen_abc("gen_${file}_abc") { test_js = "${test_js_path}${file}.js" test_abc = "$target_out_dir/${file}.abc" src_js = rebase_path(test_js) dst_file = rebase_path(test_abc) in_puts = [ test_js ] out_puts = [ test_abc ] extra_args = [ "--debug" ] } } host_unittest_action("GraphInterfaceTest") { module_out_path = module_output_path sources = [ "branch_elimination_new_test.cpp", "compiler_basicblock_test.cpp", "compiler_graph_test.cpp", "compiler_inst_test.cpp", "compiler_optimizations_test.cpp", "compiler_regalloc_test.cpp", "dominators_tree_new_test.cpp", "dump_test.cpp", "graph_checker_test.cpp", "graph_cloner_new_test.cpp", "irBuilder_tests.cpp", "linear_order_new_test.cpp", "liveness_analyzer_new_test.cpp", "loop_analyzer_new_test.cpp", "pass_manager_test.cpp", "reg_alloc_graph_coloring_new_test.cpp", "reg_alloc_interference_graph_new_test.cpp", "reg_alloc_resolver_test.cpp", "spill_fills_resolver_test.cpp", "split_resolver_new_test.cpp", ] configs = compiler_test_configs deps = compiler_test_deps external_deps = [ sdk_libc_secshared_dep ] test_abc_dir = rebase_path(target_out_dir) defines = [ "GRAPH_TEST_ABC_DIR=\"${test_abc_dir}/\"" ] foreach(file, graph_test_js_files) { deps += [ ":gen_${file}_abc" ] } foreach(file, graph_test_js_files_un_opt) { deps += [ ":gen_${file}_abc" ] } } host_unittest_action("DrawCfgToolTest") { module_out_path = module_output_path sources = [ "draw_cfg_test.cpp" ] configs = compiler_test_configs deps = compiler_test_deps external_deps = [ sdk_libc_secshared_dep ] test_abc_dir = rebase_path(target_out_dir) tools_dir = rebase_path("$ark_root/compiler/tools") defines = [ "DRAW_CFG_TEST_ABC_DIR=\"${test_abc_dir}/\"", "DRAW_CFG_TEST_OUT_DIR=\"${test_abc_dir}/cfg_out/\"", "DRAW_CFG_TEST_TOOLS_DIR=\"${tools_dir}\"", ] foreach(file, graph_test_js_files) { deps += [ ":gen_${file}_abc" ] } } group("host_unittest") { testonly = true deps = [ ":GraphInterfaceTestAction" ] }