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/ohos.gni") 15import("../../../test_template.gni") 16 17ohos_executable("unittest_ldso_ns_config") { 18 subsystem_name = "musl" 19 part_name = "libc-test" 20 21 sources = [ "unit_test_ldso_ns_config.c" ] 22 23 include_dirs = [ 24 "${musl_src_base}/ldso", 25 "//${test_dir}/src/common", 26 "//${test_dir}/src/functionalext/common", 27 "${musl_src_base}/src/include", 28 "${musl_src_base}/include", 29 "${musl_src_base}/src/internal", 30 ] 31 32 configs = [ "//third_party/musl/libc-test/src/common:config_unittest" ] 33 34 deps = [ "//third_party/musl:create_porting_src" ] 35 36 if (!musl_unit_test_flag) { 37 libs = [ "${musl_lib_dir}/libc.a" ] 38 } else { 39 defines = [ "UNIT_TEST_STATIC" ] 40 } 41} 42 43ohos_executable("unittest_ldso_namesapce") { 44 subsystem_name = "musl" 45 part_name = "libc-test" 46 47 sources = [ 48 "${musl_src_base}/ldso/namespace.c", 49 "unit_test_ldso_namespace.c", 50 "unit_test_mock_molloc.c", 51 "unit_test_mock_strops.c", 52 ] 53 54 include_dirs = [ 55 "${musl_src_base}/ldso", 56 "//${test_dir}/src/common", 57 "//${test_dir}/src/functionalext/common", 58 "${musl_src_base}/src/include", 59 "${musl_src_base}/include", 60 "${musl_src_base}/src/internal", 61 ] 62 63 configs = [ "//third_party/musl/libc-test/src/common:config_unittest" ] 64 65 deps = [ "//third_party/musl:create_porting_src" ] 66 67 if (musl_unit_test_flag) { 68 defines = [ "UNIT_TEST_STATIC" ] 69 } 70} 71 72ohos_executable("unittest_ldso_ld_log") { 73 subsystem_name = "musl" 74 part_name = "libc-test" 75 76 sources = [ 77 "${musl_src_base}/ldso/ld_log.c", 78 "unit_test_ldso_ld_log.c", 79 "unit_test_mock_hilog_adapter.c", 80 ] 81 82 include_dirs = [ 83 "${musl_src_base}/ldso", 84 "//${test_dir}/src/common", 85 "//${test_dir}/src/functionalext/common", 86 "${musl_src_base}/src/include", 87 "${musl_src_base}/include", 88 "${musl_src_base}/src/internal", 89 "//${test_dir}/src/functionalext/unittest", 90 ] 91 92 configs = [ "//third_party/musl/libc-test/src/common:config_unittest" ] 93 94 deps = [ 95 "//base/startup/init/services/param/base:parameterbase", 96 "//third_party/musl:create_porting_src", 97 ] 98 defines = [ "OHOS_ENABLE_PARAMETER" ] 99} 100 101ohos_executable("unittest_ldso_dynlink") { 102 subsystem_name = "musl" 103 part_name = "libc-test" 104 105 sources = [ 106 "unit_test_ldso_dynlink.c", 107 "unit_test_mock_dynlink.c", 108 ] 109 110 include_dirs = [ 111 "${musl_src_base}/ldso", 112 "//${test_dir}/src/common", 113 "//${test_dir}/src/functionalext/common", 114 "${musl_src_base}/src/include", 115 "${musl_src_base}/include", 116 "${musl_src_base}/src/internal", 117 "${musl_src_base}/arch/${musl_arch}", 118 ] 119 120 configs = [ "//third_party/musl/libc-test/src/common:config_unittest" ] 121 122 deps = [ 123 "//base/startup/init/services/param/base:parameterbase", 124 "//third_party/musl:create_porting_src", 125 ] 126 127 if (!musl_unit_test_flag) { 128 libs = [ "${musl_lib_dir}/libc.a" ] 129 } else { 130 defines = [ 131 "UNIT_TEST_STATIC", 132 "OHOS_ENABLE_PARAMETER", 133 ] 134 } 135} 136 137ohos_executable("unittest_hilog_adapter") { 138 subsystem_name = "musl" 139 part_name = "libc-test" 140 141 sources = [ "unit_test_hilog_adapter.c" ] 142 143 include_dirs = [ 144 "//${test_dir}/src/functionalext/common", 145 "//${test_dir}/src/common", 146 "${musl_src_base}/src/internal", 147 ] 148 149 configs = [ "//third_party/musl/libc-test/src/common:config_unittest" ] 150 151 deps = [ "//third_party/musl:create_porting_src" ] 152 153 libs = [ "${musl_lib_dir}/libc.a" ] 154} 155 156ohos_executable("unittest_ldso_strops") { 157 subsystem_name = "musl" 158 part_name = "libc-test" 159 160 sources = [ 161 "${musl_src_base}/ldso/strops.c", 162 "unit_test_ldso_strops.c", 163 "unit_test_mock_molloc.c", 164 ] 165 166 include_dirs = [ 167 "${musl_src_base}/ldso", 168 "//${test_dir}/src/common", 169 "//${test_dir}/src/functionalext/common", 170 "${musl_src_base}/src/include", 171 "${musl_src_base}/include", 172 "${musl_src_base}/src/internal", 173 ] 174 175 configs = [ "//third_party/musl/libc-test/src/common:config_unittest" ] 176 177 deps = [ "//third_party/musl:create_porting_src" ] 178} 179 180ohos_executable("unittest_hilog_vsnprint") { 181 subsystem_name = "musl" 182 part_name = "libc-test" 183 184 sources = [ "unit_test_hilog_vsnprint_f_p.c" ] 185 186 include_dirs = [ 187 "//${test_dir}/src/functionalext/common", 188 "//${test_dir}/src/common", 189 "${musl_src_base}/src/hilog", 190 ] 191 192 configs = [ "//third_party/musl/libc-test/src/common:config_unittest" ] 193 194 deps = [ "//third_party/musl:create_porting_src" ] 195 196 libs = [ "${musl_lib_dir}/libc.a" ] 197} 198 199ohos_executable("unittest_fatal_message") { 200 subsystem_name = "musl" 201 part_name = "libc-test" 202 203 sources = [ 204 "${musl_src_base}/src/info/fatal_message.c", 205 "unit_test_fatal_message.c", 206 "unit_test_mock_fatal_message.c", 207 ] 208 209 include_dirs = [ 210 "${musl_src_base}/src/info", 211 "//${test_dir}/src/common", 212 "//${test_dir}/src/functionalext/common", 213 "${musl_src_base}/src/include", 214 "${musl_src_base}/include", 215 "${musl_src_base}/src/internal", 216 ] 217 218 configs = [ "//third_party/musl/libc-test/src/common:config_unittest" ] 219 220 deps = [ "//third_party/musl:create_porting_src" ] 221} 222 223group("functionalext_unittest_test") { 224 testonly = true 225 deps = [ 226 ":unittest_fatal_message", 227 ":unittest_fatal_message_assert_fail", 228 ":unittest_fatal_message_assert_fail_dialog", 229 ":unittest_hilog_adapter", 230 ":unittest_hilog_vsnprint", 231 ":unittest_ldso_dynlink", 232 ":unittest_ldso_ld_log", 233 ":unittest_ldso_namesapce", 234 ":unittest_ldso_ns_config", 235 ":unittest_ldso_strops", 236 ] 237} 238 239ohos_executable("unittest_fatal_message_assert_fail") { 240 subsystem_name = "musl" 241 part_name = "libc-test" 242 sources = [ 243 "${musl_src_base}/src/info/fatal_message.c", 244 "unit_test_assert_fail.c", 245 ] 246 include_dirs = [ "${musl_src_base}/include" ] 247 configs = [ "//third_party/musl/libc-test/src/common:config_unittest" ] 248 249 deps = [ "//third_party/musl:create_porting_src" ] 250} 251 252ohos_executable("unittest_fatal_message_assert_fail_dialog") { 253 subsystem_name = "musl" 254 part_name = "libc-test" 255 defines = [ "PC_MUSL_ASSERT" ] 256 sources = [ 257 "${musl_src_base}/src/info/fatal_message.c", 258 "unit_test_assert_fail_dialog.c", 259 ] 260 include_dirs = [ "${musl_src_base}/include" ] 261 configs = [ "//third_party/musl/libc-test/src/common:config_unittest" ] 262 263 deps = [ "//third_party/musl:create_porting_src" ] 264} 265