1# Copyright (c) 2024 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 = "ets_runtime" 18 19test_js_path = "//arkcompiler/ets_runtime/ecmascript/compiler/aot_file/tests/aot_file_test_case/" 20 21test_js_files = [ 22 "file_size_test", 23 "file_size_worker", 24 "file_bind_panda_file_test", 25 "get_an_index_test", 26] 27 28foreach(file, test_js_files) { 29 es2abc_gen_abc("gen_${file}_abc") { 30 test_js = "${test_js_path}${file}.js" 31 test_abc = "$target_out_dir/${file}.abc" 32 extra_visibility = [ ":*" ] 33 src_js = rebase_path(test_js) 34 dst_file = rebase_path(test_abc) 35 extra_args = [ 36 "--module", 37 "--merge-abc", 38 ] 39 in_puts = [ test_js ] 40 out_puts = [ test_abc ] 41 } 42} 43 44host_unittest_action("AOTFileTest") { 45 module_out_path = module_output_path 46 47 sources = [ "aot_file_test.cpp" ] 48 49 configs = [ 50 "../../../../:asm_interp_enable_config", 51 "../../../../:ecma_test_config", 52 ] 53 54 deps = [ 55 "../../:libark_jsoptimizer_set", 56 "../../../../:libark_jsruntime_test", 57 ] 58 59 external_deps = [ 60 "icu:shared_icui18n", 61 "icu:shared_icuuc", 62 "runtime_core:libarkassembler_static", 63 ] 64 65 foreach(file, test_js_files) { 66 deps += [ ":gen_${file}_abc" ] 67 } 68 69 if (is_ohos && is_standard_system) { 70 test_abc_dir = "/data/test" 71 } else { 72 test_abc_dir = rebase_path(target_out_dir) 73 } 74 defines = [ "TARGET_ABC_PATH=\"${test_abc_dir}/\"" ] 75 external_deps += hiviewdfx_ext_deps 76 deps += hiviewdfx_deps 77} 78 79host_unittest_action("AOTChecksumTest") { 80 module_out_path = module_output_path 81 82 sources = [ "aot_checksum_test.cpp" ] 83 84 configs = [ 85 "../../../../:asm_interp_enable_config", 86 "../../../../:ecma_test_config", 87 ] 88 89 deps = [ 90 "../../:libark_jsoptimizer_set", 91 "../../../../:libark_jsruntime_test", 92 ] 93 94 external_deps = [ 95 "icu:shared_icui18n", 96 "icu:shared_icuuc", 97 "runtime_core:libarkassembler_static", 98 ] 99 100 external_deps += hiviewdfx_ext_deps 101 deps += hiviewdfx_deps 102} 103 104host_unittest_action("BinaryBufferParserTest") { 105 module_out_path = module_output_path 106 107 sources = [ "binary_buffer_parser_test.cpp" ] 108 109 configs = [ 110 "../../../../:asm_interp_enable_config", 111 "../../../../:ecma_test_config", 112 ] 113 114 deps = [ 115 "../../:libark_jsoptimizer_set", 116 "../../../../:libark_jsruntime_test", 117 ] 118 119 external_deps = [ 120 "icu:shared_icui18n", 121 "icu:shared_icuuc", 122 "runtime_core:libarkassembler_static", 123 ] 124 125 external_deps += hiviewdfx_ext_deps 126 deps += hiviewdfx_deps 127} 128 129host_unittest_action("AnFileInfoTest") { 130 module_out_path = module_output_path 131 132 sources = [ "an_file_info_test.cpp" ] 133 134 configs = [ 135 "../../../../:asm_interp_enable_config", 136 "../../../../:ecma_test_config", 137 ] 138 139 deps = [ 140 "../../:libark_jsoptimizer_set", 141 "../../../../:libark_jsruntime_test", 142 ] 143 144 external_deps = [ 145 "icu:shared_icui18n", 146 "icu:shared_icuuc", 147 "runtime_core:libarkassembler_static", 148 ] 149 150 external_deps += hiviewdfx_ext_deps 151 deps += hiviewdfx_deps 152} 153 154group("unittest") { 155 testonly = true 156 deps = [] 157 deps += [ 158 ":AOTChecksumTest", 159 ":AOTFileTest", 160 ":BinaryBufferParserTest", 161 ":AnFileInfoTest", 162 ] 163 164 # CMC-GC UT FIX LATER 165 if (ets_runtime_enable_cmc_gc) { 166 deps -= [ ":AOTFileTest" ] 167 } 168} 169 170group("host_unittest") { 171 testonly = true 172 deps = [ 173 ":AOTChecksumTestAction", 174 ":AOTFileTestAction", 175 ] 176 177 if (is_mac) { 178 deps -= [ 179 ":AOTChecksumTestAction", 180 ":AOTFileTestAction", 181 ] 182 } else if (ets_runtime_enable_cmc_gc) { 183 # CMC-GC UT FIX LATER 184 deps -= [ ":AOTFileTestAction" ] 185 } 186} 187