• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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]
49
50foreach(file, graph_test_js_files) {
51  es2abc_gen_abc("gen_${file}_abc") {
52    test_js = "${test_js_path}${file}.js"
53    test_abc = "$target_out_dir/${file}.abc"
54
55    src_js = rebase_path(test_js)
56    dst_file = rebase_path(test_abc)
57
58    in_puts = [ test_js ]
59    out_puts = [ test_abc ]
60  }
61}
62
63graph_test_js_files_un_opt = [
64  "branchElimination",
65  "nestedTryCatch",
66]
67
68foreach(file, graph_test_js_files_un_opt) {
69  es2abc_gen_abc("gen_${file}_abc") {
70    test_js = "${test_js_path}${file}.js"
71    test_abc = "$target_out_dir/${file}.abc"
72
73    src_js = rebase_path(test_js)
74    dst_file = rebase_path(test_abc)
75
76    in_puts = [ test_js ]
77    out_puts = [ test_abc ]
78
79    extra_args = [ "--debug" ]
80  }
81}
82
83host_unittest_action("GraphInterfaceTest") {
84  module_out_path = module_output_path
85  sources = [
86    "branch_elimination_new_test.cpp",
87    "compiler_basicblock_test.cpp",
88    "compiler_graph_test.cpp",
89    "compiler_inst_test.cpp",
90    "compiler_optimizations_test.cpp",
91    "compiler_regalloc_test.cpp",
92    "dominators_tree_new_test.cpp",
93    "dump_test.cpp",
94    "graph_checker_test.cpp",
95    "irBuilder_tests.cpp",
96    "linear_order_new_test.cpp",
97    "liveness_analyzer_new_test.cpp",
98    "loop_analyzer_new_test.cpp",
99    "reg_alloc_interference_graph_new_test.cpp",
100  ]
101  configs = compiler_test_configs
102  deps = compiler_test_deps
103
104  external_deps = [ sdk_libc_secshared_dep ]
105
106  test_abc_dir = rebase_path(target_out_dir)
107
108  defines = [ "GRAPH_TEST_ABC_DIR=\"${test_abc_dir}/\"" ]
109
110  foreach(file, graph_test_js_files) {
111    deps += [ ":gen_${file}_abc" ]
112  }
113  foreach(file, graph_test_js_files_un_opt) {
114    deps += [ ":gen_${file}_abc" ]
115  }
116}
117
118host_unittest_action("DrawCfgToolTest") {
119  module_out_path = module_output_path
120  sources = [ "draw_cfg_test.cpp" ]
121  configs = compiler_test_configs
122  deps = compiler_test_deps
123
124  external_deps = [ sdk_libc_secshared_dep ]
125
126  test_abc_dir = rebase_path(target_out_dir)
127  tools_dir = rebase_path("$ark_root/compiler/tools")
128
129  defines = [
130    "DRAW_CFG_TEST_ABC_DIR=\"${test_abc_dir}/\"",
131    "DRAW_CFG_TEST_OUT_DIR=\"${test_abc_dir}/cfg_out/\"",
132    "DRAW_CFG_TEST_TOOLS_DIR=\"${tools_dir}\"",
133  ]
134
135  foreach(file, graph_test_js_files) {
136    deps += [ ":gen_${file}_abc" ]
137  }
138}
139
140group("host_unittest") {
141  testonly = true
142  deps = [ ":GraphInterfaceTestAction" ]
143}
144