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 17test_js_path = "//arkcompiler/ets_runtime/ecmascript/napi/test/js/" 18 19test_js_files = [ 20 "termination_1", 21 "termination_2", 22 "termination_3", 23 "termination", 24] 25 26foreach(file, test_js_files) { 27 es2abc_gen_abc("gen_${file}_abc") { 28 test_js = "${test_js_path}${file}.js" 29 test_abc = "$target_out_dir/${file}.abc" 30 31 # Only targets in this file can depend on this. 32 extra_visibility = [ ":*" ] 33 src_js = rebase_path(test_js) 34 dst_file = rebase_path(test_abc) 35 extra_args = [] 36 extra_args += [ "--module" ] 37 extra_args += [ "--merge-abc" ] 38 in_puts = [ test_js ] 39 out_puts = [ test_abc ] 40 } 41} 42 43module_output_path = "arkcompiler/ets_runtime" 44 45host_unittest_action("Jsnapi_001_Test") { 46 module_out_path = module_output_path 47 48 sources = [ 49 # test file 50 "dfx_jsnapi_tests.cpp", 51 ] 52 53 configs = [ "../../../:ecma_test_config" ] 54 55 deps = [ 56 "$ark_third_party_root/icu/icu4c:shared_icui18n", 57 "$ark_third_party_root/icu/icu4c:shared_icuuc", 58 "../../../:libark_jsruntime_test", 59 sdk_libc_secshared_dep, 60 ] 61 62 foreach(file, test_js_files) { 63 deps += [ ":gen_${file}_abc" ] 64 } 65 66 # hiviewdfx libraries 67 external_deps = hiviewdfx_ext_deps 68 deps += hiviewdfx_deps 69} 70 71host_unittest_action("Jsnapi_002_Test") { 72 module_out_path = module_output_path 73 74 sources = [ 75 # test file 76 "jsnapi_first_tests.cpp", 77 ] 78 79 configs = [ "../../../:ecma_test_config" ] 80 81 deps = [ 82 "$ark_third_party_root/icu/icu4c:shared_icui18n", 83 "$ark_third_party_root/icu/icu4c:shared_icuuc", 84 "../../../:libark_jsruntime_test", 85 sdk_libc_secshared_dep, 86 ] 87 88 foreach(file, test_js_files) { 89 deps += [ ":gen_${file}_abc" ] 90 } 91 92 # hiviewdfx libraries 93 external_deps = hiviewdfx_ext_deps 94 deps += hiviewdfx_deps 95} 96 97host_unittest_action("Jsnapi_003_Test") { 98 module_out_path = module_output_path 99 100 sources = [ 101 # test file 102 "jsnapi_second_tests.cpp", 103 ] 104 105 configs = [ "../../../:ecma_test_config" ] 106 107 deps = [ 108 "$ark_third_party_root/icu/icu4c:shared_icui18n", 109 "$ark_third_party_root/icu/icu4c:shared_icuuc", 110 "../../../:libark_jsruntime_test", 111 sdk_libc_secshared_dep, 112 ] 113 114 foreach(file, test_js_files) { 115 deps += [ ":gen_${file}_abc" ] 116 } 117 118 # hiviewdfx libraries 119 external_deps = hiviewdfx_ext_deps 120 deps += hiviewdfx_deps 121} 122 123host_unittest_action("Jsnapi_004_Test") { 124 module_out_path = module_output_path 125 126 sources = [ 127 # test file 128 "jsnapi_third_tests.cpp", 129 ] 130 131 configs = [ "../../../:ecma_test_config" ] 132 133 deps = [ 134 "$ark_third_party_root/icu/icu4c:shared_icui18n", 135 "$ark_third_party_root/icu/icu4c:shared_icuuc", 136 "../../../:libark_jsruntime_test", 137 sdk_libc_secshared_dep, 138 ] 139 140 foreach(file, test_js_files) { 141 deps += [ ":gen_${file}_abc" ] 142 } 143 144 # hiviewdfx libraries 145 external_deps = hiviewdfx_ext_deps 146 deps += hiviewdfx_deps 147} 148 149host_unittest_action("FFIWorkLoadTest") { 150 module_out_path = module_output_path 151 152 sources = [ 153 # test file 154 "ffi_workload.cpp", 155 ] 156 157 configs = [ "$js_root:ecma_test_config" ] 158 159 deps = [ 160 "$ark_third_party_root/icu/icu4c:shared_icui18n", 161 "$ark_third_party_root/icu/icu4c:shared_icuuc", 162 "$js_root:libark_jsruntime_test", 163 sdk_libc_secshared_dep, 164 ] 165 166 # hiviewdfx libraries 167 external_deps = hiviewdfx_ext_deps 168 deps += hiviewdfx_deps 169} 170 171host_unittest_action("JsnapiSample") { 172 module_out_path = module_output_path 173 174 sources = [ "jsnapi_sample.cpp" ] 175 176 configs = [ 177 "$js_root:ecma_test_config", 178 "$ark_root/assembler:arkassembler_public_config", 179 ] 180 181 deps = [ 182 "$ark_root/assembler:libarkassembler_static", 183 "$ark_third_party_root/icu/icu4c:shared_icui18n", 184 "$ark_third_party_root/icu/icu4c:shared_icuuc", 185 "$js_root:libark_jsruntime_test", 186 sdk_libc_secshared_dep, 187 ] 188 189 # hiviewdfx libraries 190 external_deps = hiviewdfx_ext_deps 191 deps += hiviewdfx_deps 192} 193 194group("unittest") { 195 testonly = true 196 deps = [ 197 ":JsnapiSample", 198 ":Jsnapi_001_Test", 199 ":Jsnapi_002_Test", 200 ":Jsnapi_003_Test", 201 ":Jsnapi_004_Test", 202 ] 203} 204 205group("host_unittest") { 206 testonly = true 207 deps = [ 208 ":Jsnapi_001_TestAction", 209 ":Jsnapi_002_TestAction", 210 ":Jsnapi_003_TestAction", 211 ":Jsnapi_004_TestAction", 212 ] 213 214 if (is_mac) { 215 deps -= [ 216 ":Jsnapi_001_TestAction", 217 ":Jsnapi_002_TestAction", 218 ":Jsnapi_003_TestAction", 219 ":Jsnapi_004_TestAction", 220 ] 221 } 222} 223 224group("workload_test") { 225 testonly = true 226 deps = [ ":FFIWorkLoadTest" ] 227} 228