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 17config("include_llvm_config") { 18 if (compile_llvm_online) { 19 include_dirs = [ 20 "//third_party/third_party_llvm-project/build/include", 21 "//third_party/third_party_llvm-project/llvm/include/", 22 ] 23 } else { 24 include_dirs = [ 25 "//prebuilts/ark_tools/ark_js_prebuilts/llvm_prebuilts/llvm/include", 26 "//prebuilts/ark_tools/ark_js_prebuilts/llvm_prebuilts/build/include", 27 ] 28 } 29 cflags_cc = [ "-DARK_GC_SUPPORT" ] 30} 31 32module_output_path = "arkcompiler/ets_runtime" 33 34host_unittest_action("StubTest") { 35 module_out_path = module_output_path 36 37 sources = [ 38 # test file 39 "stub_tests.cpp", 40 ] 41 configs = [ 42 ":include_llvm_config", 43 "//arkcompiler/ets_runtime:ecma_test_config", 44 "//arkcompiler/ets_runtime:ark_jsruntime_compiler_config", 45 "//arkcompiler/ets_runtime:ark_jsruntime_public_config", 46 ] 47 48 if (compile_llvm_online) { 49 lib_dirs = [ "//third_party/third_party_llvm-project/build/lib" ] 50 } else { 51 lib_dirs = 52 [ "//prebuilts/ark_tools/ark_js_prebuilts/llvm_prebuilts/build/lib" ] 53 } 54 55 libs = [ 56 "stdc++", 57 "z", 58 "LLVMTarget", 59 "LLVMObject", 60 "LLVMMC", 61 "LLVMSupport", 62 "LLVMCore", 63 "LLVMExecutionEngine", 64 "LLVMInterpreter", 65 "LLVMMCJIT", 66 "LLVMExegesis", 67 "LLVMRuntimeDyld", 68 "LLVMInstCombine", 69 "LLVMAnalysis", 70 "LLVMScalarOpts", 71 "LLVMBinaryFormat", 72 "LLVMDebugInfoDWARF", 73 "LLVMRemarks", 74 "LLVMTextAPI", 75 "LLVMScalarOpts", 76 "LLVMTransformUtils", 77 "LLVMBitReader", 78 "LLVMAsmPrinter", 79 "LLVMProfileData", 80 "LLVMBitstreamReader", 81 "LLVMSelectionDAG", 82 "LLVMGlobalISel", 83 "LLVMLTO", 84 "LLVMCFGuard", 85 "LLVMVectorize", 86 "LLVMDemangle", 87 "LLVMipo", 88 "LLVMInstrumentation", 89 "LLVMDebugInfoCodeView", 90 "LLVMAggressiveInstCombine", 91 "LLVMAsmParser", 92 "LLVMMCParser", 93 "LLVMMIRParser", 94 "LLVMX86Info", 95 "LLVMAArch64Info", 96 "LLVMARMDesc", 97 "LLVMAArch64Desc", 98 "LLVMX86Desc", 99 "LLVMX86Disassembler", 100 "LLVMARMDisassembler", 101 "LLVMAArch64Disassembler", 102 "LLVMMCDisassembler", 103 "LLVMAArch64CodeGen", 104 "LLVMARMCodeGen", 105 "LLVMCodeGen", 106 "LLVMX86CodeGen", 107 "LLVMX86AsmParser", 108 "LLVMTransformUtils", 109 "LLVMAArch64Utils", 110 "LLVMARMUtils", 111 "LLVMIRReader", 112 ] 113 114 deps = [ 115 "//arkcompiler/ets_runtime/ecmascript/compiler:libark_jsoptimizer_test", 116 sdk_libc_secshared_dep, 117 ] 118} 119 120host_unittest_action("AssemblerTest") { 121 module_out_path = module_output_path 122 123 sources = [ 124 # test file 125 "../assembler/tests/assembler_aarch64_test.cpp", 126 "../assembler/tests/assembler_x64_test.cpp", 127 ] 128 configs = [ 129 ":include_llvm_config", 130 "//arkcompiler/ets_runtime:ecma_test_config", 131 "//arkcompiler/ets_runtime:ark_jsruntime_compiler_config", 132 "//arkcompiler/ets_runtime:ark_jsruntime_public_config", 133 ] 134 135 if (compile_llvm_online) { 136 lib_dirs = [ "//third_party/third_party_llvm-project/build/lib" ] 137 } else { 138 lib_dirs = 139 [ "//prebuilts/ark_tools/ark_js_prebuilts/llvm_prebuilts/build/lib" ] 140 } 141 142 libs = [ 143 "stdc++", 144 "z", 145 "LLVMTarget", 146 "LLVMObject", 147 "LLVMMC", 148 "LLVMSupport", 149 "LLVMCore", 150 "LLVMExecutionEngine", 151 "LLVMInterpreter", 152 "LLVMMCJIT", 153 "LLVMExegesis", 154 "LLVMRuntimeDyld", 155 "LLVMInstCombine", 156 "LLVMAnalysis", 157 "LLVMScalarOpts", 158 "LLVMBinaryFormat", 159 "LLVMDebugInfoDWARF", 160 "LLVMRemarks", 161 "LLVMTextAPI", 162 "LLVMScalarOpts", 163 "LLVMTransformUtils", 164 "LLVMBitReader", 165 "LLVMAsmPrinter", 166 "LLVMProfileData", 167 "LLVMBitstreamReader", 168 "LLVMSelectionDAG", 169 "LLVMGlobalISel", 170 "LLVMLTO", 171 "LLVMCFGuard", 172 "LLVMVectorize", 173 "LLVMDemangle", 174 "LLVMipo", 175 "LLVMInstrumentation", 176 "LLVMDebugInfoCodeView", 177 "LLVMAggressiveInstCombine", 178 "LLVMAsmParser", 179 "LLVMMCParser", 180 "LLVMMIRParser", 181 "LLVMX86Info", 182 "LLVMAArch64Info", 183 "LLVMARMDesc", 184 "LLVMAArch64Desc", 185 "LLVMX86Desc", 186 "LLVMX86Disassembler", 187 "LLVMARMDisassembler", 188 "LLVMAArch64Disassembler", 189 "LLVMMCDisassembler", 190 "LLVMAArch64CodeGen", 191 "LLVMARMCodeGen", 192 "LLVMCodeGen", 193 "LLVMX86CodeGen", 194 "LLVMX86AsmParser", 195 "LLVMTransformUtils", 196 "LLVMAArch64Utils", 197 "LLVMARMUtils", 198 "LLVMIRReader", 199 ] 200 201 deps = [ 202 "//arkcompiler/ets_runtime/ecmascript/compiler:libark_jsoptimizer_test", 203 sdk_libc_secshared_dep, 204 ] 205} 206 207host_unittest_action("CircuitOptimizerTest") { 208 module_out_path = module_output_path 209 210 sources = [ 211 # test file 212 "../ts_type_lowering.cpp", 213 "../type_lowering.cpp", 214 "circuit_optimizer_tests.cpp", 215 "lowering_relate_gate_test.cpp", 216 ] 217 218 configs = [ 219 ":include_llvm_config", 220 "//arkcompiler/ets_runtime:ecma_test_config", 221 "//arkcompiler/ets_runtime:ark_jsruntime_compiler_config", 222 "//arkcompiler/ets_runtime:ark_jsruntime_public_config", 223 ] 224 225 if (compile_llvm_online) { 226 lib_dirs = [ "//third_party/third_party_llvm-project/build/lib" ] 227 } else { 228 lib_dirs = 229 [ "//prebuilts/ark_tools/ark_js_prebuilts/llvm_prebuilts/build/lib" ] 230 } 231 232 libs = [ 233 "LLVMTarget", 234 "LLVMObject", 235 "LLVMMC", 236 "LLVMSupport", 237 "LLVMCore", 238 "LLVMExecutionEngine", 239 "LLVMInterpreter", 240 "LLVMMCJIT", 241 "LLVMExegesis", 242 "LLVMRuntimeDyld", 243 "LLVMInstCombine", 244 "LLVMAnalysis", 245 "LLVMScalarOpts", 246 "LLVMBinaryFormat", 247 "LLVMDebugInfoDWARF", 248 "LLVMRemarks", 249 "LLVMTextAPI", 250 "LLVMScalarOpts", 251 "LLVMTransformUtils", 252 "LLVMBitReader", 253 "LLVMAsmPrinter", 254 "LLVMProfileData", 255 "LLVMBitstreamReader", 256 "LLVMSelectionDAG", 257 "LLVMGlobalISel", 258 "LLVMLTO", 259 "LLVMCFGuard", 260 "LLVMVectorize", 261 "LLVMDemangle", 262 "LLVMipo", 263 "LLVMInstrumentation", 264 "LLVMDebugInfoCodeView", 265 "LLVMAggressiveInstCombine", 266 "LLVMAsmParser", 267 "LLVMMCParser", 268 "LLVMMIRParser", 269 "LLVMX86Info", 270 "LLVMAArch64Info", 271 "LLVMARMDesc", 272 "LLVMAArch64Desc", 273 "LLVMX86Desc", 274 "LLVMX86Disassembler", 275 "LLVMARMDisassembler", 276 "LLVMAArch64Disassembler", 277 "LLVMMCDisassembler", 278 "LLVMAArch64CodeGen", 279 "LLVMARMCodeGen", 280 "LLVMCodeGen", 281 "LLVMX86CodeGen", 282 "LLVMX86AsmParser", 283 "LLVMTransformUtils", 284 "LLVMAArch64Utils", 285 "LLVMARMUtils", 286 "LLVMIRReader", 287 ] 288 289 deps = [ 290 "//arkcompiler/ets_runtime/ecmascript/compiler:libark_jsoptimizer_test", 291 sdk_libc_secshared_dep, 292 ] 293} 294 295group("host_unittest") { 296 testonly = true 297 298 # deps file 299 deps = [ 300 ":AssemblerTestAction", 301 ":CircuitOptimizerTestAction", 302 ":StubTestAction", 303 ] 304} 305