• 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("//build/config/components/ets_frontend/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]
26
27compiler_test_deps = [
28  "$ark_root/assembler:libarkassembler",
29  "$ark_root/bytecode_optimizer:libarkbytecodeopt",
30  "$ark_root/compiler:libarkcompiler",
31  "$ark_root/libpandabase:libarkbase",
32  "$ark_root/libpandafile:libarkfile",
33]
34
35test_js_path = "//arkcompiler/runtime_core/compiler/tests/js/"
36
37# graph interface unit tests
38graph_test_js_files = [
39  "cleanUpTest",
40  "regallocTest",
41  "regallocTryTest",
42  "simpleTryCatch",
43  "moduleTryCatch",
44  "styleTryCatch",
45  "dominatorsTryCatch",
46  "testTryCatch",
47  "graphTest",
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    "graph_cloner_new_test.cpp",
96    "irBuilder_tests.cpp",
97    "linear_order_new_test.cpp",
98    "liveness_analyzer_new_test.cpp",
99    "loop_analyzer_new_test.cpp",
100    "pass_manager_test.cpp",
101    "reg_alloc_graph_coloring_new_test.cpp",
102    "reg_alloc_interference_graph_new_test.cpp",
103    "reg_alloc_resolver_test.cpp",
104    "spill_fills_resolver_test.cpp",
105    "split_resolver_new_test.cpp",
106  ]
107  configs = compiler_test_configs
108  deps = compiler_test_deps
109
110  external_deps = [ sdk_libc_secshared_dep ]
111
112  test_abc_dir = rebase_path(target_out_dir)
113
114  defines = [ "GRAPH_TEST_ABC_DIR=\"${test_abc_dir}/\"" ]
115
116  foreach(file, graph_test_js_files) {
117    deps += [ ":gen_${file}_abc" ]
118  }
119  foreach(file, graph_test_js_files_un_opt) {
120    deps += [ ":gen_${file}_abc" ]
121  }
122}
123
124host_unittest_action("DrawCfgToolTest") {
125  module_out_path = module_output_path
126  sources = [ "draw_cfg_test.cpp" ]
127  configs = compiler_test_configs
128  deps = compiler_test_deps
129
130  external_deps = [ sdk_libc_secshared_dep ]
131
132  test_abc_dir = rebase_path(target_out_dir)
133  tools_dir = rebase_path("$ark_root/compiler/tools")
134
135  defines = [
136    "DRAW_CFG_TEST_ABC_DIR=\"${test_abc_dir}/\"",
137    "DRAW_CFG_TEST_OUT_DIR=\"${test_abc_dir}/cfg_out/\"",
138    "DRAW_CFG_TEST_TOOLS_DIR=\"${tools_dir}\"",
139  ]
140
141  foreach(file, graph_test_js_files) {
142    deps += [ ":gen_${file}_abc" ]
143  }
144}
145
146group("host_unittest") {
147  testonly = true
148  deps = [ ":GraphInterfaceTestAction" ]
149}
150