1# Copyright (c) 2021 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_runtime/js_runtime_config.gni")
15import("//arkcompiler/ets_runtime/test/test_helper.gni")
16
17module_output_path = "arkcompiler/ets_runtime"
18
19host_unittest_action("AssemblerTest") {
20  module_out_path = module_output_path
21
22  sources = [
23    # test file
24    "../assembler/tests/assembler_aarch64_test.cpp",
25    "../assembler/tests/assembler_x64_test.cpp",
26  ]
27
28  deps = [
29    "$ark_root/libpandafile:libarkfile_static",
30    "$js_root:libark_jsruntime_test_set",
31    "$js_root/ecmascript/compiler:libark_jsoptimizer_set",
32    sdk_libc_secshared_dep,
33  ]
34
35  # hiviewdfx libraries
36  external_deps = hiviewdfx_ext_deps
37  deps += hiviewdfx_deps
38}
39
40host_unittest_action("TypedArrayLoweringTest") {
41  module_out_path = module_output_path
42
43  sources = [
44    # test file
45    "typed_array_lowering_test.cpp",
46  ]
47
48  deps = [
49    "$ark_root/libpandafile:libarkfile_static",
50    "$js_root:libark_jsruntime_test_set",
51    "$js_root/ecmascript/compiler:libark_jsoptimizer_set",
52    sdk_libc_secshared_dep,
53  ]
54  external_deps = [ "zlib:libz" ]
55}
56
57host_unittest_action("DeadCodeEliminationTest") {
58  module_out_path = module_output_path
59
60  sources = [
61    # test file
62    "dead_code_elimination_test.cpp",
63  ]
64
65  deps = [
66    "$ark_root/libpandafile:libarkfile_static",
67    "$js_root:libark_jsruntime_test_set",
68    "$js_root/ecmascript/compiler:libark_jsoptimizer_set",
69    sdk_libc_secshared_dep,
70  ]
71}
72
73host_unittest_action("CombinedPassVisitorTest") {
74  module_out_path = module_output_path
75
76  sources = [
77    # test file
78    "combined_pass_visitor_test.cpp",
79  ]
80
81  deps = [
82    "$ark_root/libpandafile:libarkfile_static",
83    "$js_root:libark_jsruntime_test_set",
84    "$js_root/ecmascript/compiler:libark_jsoptimizer_set",
85    sdk_libc_secshared_dep,
86  ]
87}
88
89host_unittest_action("LoopOptimizationTest") {
90  module_out_path = module_output_path
91
92  sources = [
93    # test file
94    "loop_optimization_test.cpp",
95  ]
96
97  deps = [
98    "$ark_root/libpandafile:libarkfile_static",
99    "$js_root:libark_jsruntime_test_set",
100    "$js_root/ecmascript/compiler:libark_jsoptimizer_set",
101    sdk_libc_secshared_dep,
102  ]
103  external_deps = [ "zlib:libz" ]
104}
105
106host_unittest_action("ConstantFoldingTest") {
107  module_out_path = module_output_path
108
109  sources = [
110    # test file
111    "constant_folding_test.cpp",
112  ]
113
114  deps = [
115    "$ark_root/libpandafile:libarkfile_static",
116    "$js_root:libark_jsruntime_test_set",
117    "$js_root/ecmascript/compiler:libark_jsoptimizer_set",
118    sdk_libc_secshared_dep,
119  ]
120  external_deps = [ "zlib:libz" ]
121}
122
123host_unittest_action("GlobalValueNumberingTest") {
124  module_out_path = module_output_path
125
126  sources = [
127    # test file
128    "global_value_numbering_test.cpp",
129    "meta_data_equal_test.cpp",
130  ]
131
132  deps = [
133    "$ark_root/libpandafile:libarkfile_static",
134    "$js_root:libark_jsruntime_test_set",
135    "$js_root/ecmascript/compiler:libark_jsoptimizer_set",
136    sdk_libc_secshared_dep,
137  ]
138  external_deps = [ "zlib:libz" ]
139}
140
141host_unittest_action("InstructionCombineTest") {
142  module_out_path = module_output_path
143
144  sources = [
145    # test file
146    "instruction_combine_test.cpp",
147  ]
148
149  deps = [
150    "$ark_root/libpandafile:libarkfile_static",
151    "$js_root:libark_jsruntime_test_set",
152    "$js_root/ecmascript/compiler:libark_jsoptimizer_set",
153    sdk_libc_secshared_dep,
154  ]
155  external_deps = [ "zlib:libz" ]
156}
157
158host_unittest_action("CreateEmptyFileTest") {
159  module_out_path = module_output_path
160
161  sources = [
162    # test file
163    "create_empty_file_test.cpp",
164  ]
165
166  deps = [
167    "$ark_root/libpandafile:libarkfile_static",
168    "$js_root:libark_jsruntime_test_set",
169    "$js_root/ecmascript/compiler:libark_jsoptimizer_set",
170    sdk_libc_secshared_dep,
171  ]
172  external_deps = [ "zlib:libz" ]
173}
174
175host_unittest_action("AotVersionTest") {
176  module_out_path = module_output_path
177
178  sources = [
179    # test file
180    "aot_version_test.cpp",
181  ]
182
183  deps = [
184    "$ark_root/libpandafile:libarkfile_static",
185    "$js_root:libark_jsruntime_test_set",
186    "$js_root/ecmascript/compiler:libark_jsoptimizer_set",
187    sdk_libc_secshared_dep,
188  ]
189  external_deps = [ "zlib:libz" ]
190}
191
192group("host_unittest") {
193  testonly = true
194
195  # deps file
196  deps = [
197    ":AotVersionTestAction",
198    ":AssemblerTestAction",
199    ":ConstantFoldingTestAction",
200    ":CreateEmptyFileTestAction",
201    ":GlobalValueNumberingTestAction",
202    ":InstructionCombineTestAction",
203    ":LoopOptimizationTestAction",
204    ":TypedArrayLoweringTestAction",
205  ]
206
207  if (is_mac) {
208    deps -= [ ":AssemblerTestAction" ]
209  }
210}
211