1add_custom_target(libc-stdlib-tests) 2 3add_libc_test( 4 atof_test 5 SUITE 6 libc-stdlib-tests 7 SRCS 8 atof_test.cpp 9 DEPENDS 10 libc.src.errno.errno 11 libc.src.stdlib.atof 12) 13 14add_header_library( 15 atoi_test_support 16 HDRS 17 AtoiTest.h 18 DEPENDS 19 libc.src.errno.errno 20 libc.src.__support.CPP.limits 21 libc.src.__support.CPP.type_traits 22) 23 24add_libc_test( 25 atoi_test 26 SUITE 27 libc-stdlib-tests 28 SRCS 29 atoi_test.cpp 30 DEPENDS 31 .atoi_test_support 32 libc.src.stdlib.atoi 33) 34 35add_libc_test( 36 atol_test 37 SUITE 38 libc-stdlib-tests 39 SRCS 40 atol_test.cpp 41 DEPENDS 42 .atoi_test_support 43 libc.src.stdlib.atol 44) 45 46add_libc_test( 47 atoll_test 48 SUITE 49 libc-stdlib-tests 50 SRCS 51 atoll_test.cpp 52 DEPENDS 53 .atoi_test_support 54 libc.src.stdlib.atoll 55) 56 57add_fp_unittest( 58 strtod_test 59 SUITE 60 libc-stdlib-tests 61 SRCS 62 strtod_test.cpp 63 DEPENDS 64 libc.src.errno.errno 65 libc.src.stdlib.strtod 66 libc.src.__support.FPUtil.fenv_impl 67) 68 69add_fp_unittest( 70 strtof_test 71 SUITE 72 libc-stdlib-tests 73 SRCS 74 strtof_test.cpp 75 DEPENDS 76 libc.src.errno.errno 77 libc.src.stdlib.strtof 78 libc.src.__support.FPUtil.fenv_impl 79) 80 81add_header_library( 82 strtol_test_support 83 HDRS 84 StrtolTest.h 85 DEPENDS 86 libc.src.__support.CPP.limits 87 libc.src.__support.CPP.type_traits 88 libc.src.errno.errno 89) 90 91add_libc_test( 92 strtoint32_test 93 SUITE 94 libc-stdlib-tests 95 SRCS 96 strtoint32_test.cpp 97 DEPENDS 98 libc.src.__support.str_to_integer 99 libc.src.errno.errno 100 .strtol_test_support 101) 102 103add_libc_test( 104 strtoint64_test 105 SUITE 106 libc-stdlib-tests 107 SRCS 108 strtoint64_test.cpp 109 DEPENDS 110 libc.src.__support.str_to_integer 111 libc.src.errno.errno 112 .strtol_test_support 113) 114 115add_libc_test( 116 strtol_test 117 SUITE 118 libc-stdlib-tests 119 SRCS 120 strtol_test.cpp 121 DEPENDS 122 libc.src.stdlib.strtol 123 .strtol_test_support 124) 125 126add_libc_test( 127 strtold_test 128 SUITE 129 libc-stdlib-tests 130 SRCS 131 strtold_test.cpp 132 DEPENDS 133 libc.src.errno.errno 134 libc.src.__support.uint128 135 libc.src.stdlib.strtold 136) 137 138add_libc_test( 139 strtoll_test 140 SUITE 141 libc-stdlib-tests 142 SRCS 143 strtoll_test.cpp 144 DEPENDS 145 libc.src.stdlib.strtoll 146 .strtol_test_support 147) 148 149add_libc_test( 150 strtoul_test 151 SUITE 152 libc-stdlib-tests 153 SRCS 154 strtoul_test.cpp 155 DEPENDS 156 libc.src.stdlib.strtoul 157 .strtol_test_support 158) 159 160add_libc_test( 161 strtoull_test 162 SUITE 163 libc-stdlib-tests 164 SRCS 165 strtoull_test.cpp 166 DEPENDS 167 libc.src.stdlib.strtoull 168 .strtol_test_support 169) 170 171if(LIBC_CONF_PRINTF_FLOAT_TO_STR_USE_DYADIC_FLOAT) 172 list(APPEND strfrom_test_copts "-DLIBC_COPT_FLOAT_TO_STR_REDUCED_PRECISION") 173endif() 174 175add_header_library( 176 strfrom_test_support 177 HDRS 178 StrfromTest.h 179 DEPENDS 180 libc.src.__support.CPP.type_traits 181 libc.src.__support.FPUtil.fp_bits 182) 183 184add_libc_test( 185 strfromf_test 186 SUITE 187 libc-stdlib-tests 188 SRCS 189 strfromf_test.cpp 190 DEPENDS 191 .strfrom_test_support 192 libc.src.stdlib.strfromf 193 COMPILE_OPTIONS 194 ${strfrom_test_copts} 195) 196 197add_libc_test( 198 strfromd_test 199 SUITE 200 libc-stdlib-tests 201 SRCS 202 strfromd_test.cpp 203 DEPENDS 204 .strfrom_test_support 205 libc.src.stdlib.strfromd 206 COMPILE_OPTIONS 207 ${strfrom_test_copts} 208) 209 210add_libc_test( 211 strfroml_test 212 SUITE 213 libc-stdlib-tests 214 SRCS 215 strfroml_test.cpp 216 DEPENDS 217 .strfrom_test_support 218 libc.src.stdlib.strfroml 219 COMPILE_OPTIONS 220 ${strfrom_test_copts} 221) 222 223add_libc_test( 224 abs_test 225 SUITE 226 libc-stdlib-tests 227 SRCS 228 abs_test.cpp 229 DEPENDS 230 libc.src.stdlib.abs 231) 232 233add_libc_test( 234 labs_test 235 SUITE 236 libc-stdlib-tests 237 SRCS 238 labs_test.cpp 239 DEPENDS 240 libc.src.stdlib.labs 241) 242 243add_libc_test( 244 llabs_test 245 SUITE 246 libc-stdlib-tests 247 SRCS 248 llabs_test.cpp 249 DEPENDS 250 libc.src.stdlib.llabs 251) 252 253add_libc_test( 254 div_test 255 SUITE 256 libc-stdlib-tests 257 SRCS 258 div_test.cpp 259 HDRS 260 DivTest.h 261 DEPENDS 262 libc.hdr.types.div_t 263 libc.src.stdlib.div 264) 265 266add_libc_test( 267 ldiv_test 268 SUITE 269 libc-stdlib-tests 270 SRCS 271 ldiv_test.cpp 272 HDRS 273 DivTest.h 274 DEPENDS 275 libc.hdr.types.ldiv_t 276 libc.src.stdlib.ldiv 277) 278 279add_libc_test( 280 lldiv_test 281 SUITE 282 libc-stdlib-tests 283 SRCS 284 lldiv_test.cpp 285 HDRS 286 DivTest.h 287 DEPENDS 288 libc.hdr.types.lldiv_t 289 libc.src.stdlib.lldiv 290) 291 292add_libc_test( 293 bsearch_test 294 SUITE 295 libc-stdlib-tests 296 SRCS 297 bsearch_test.cpp 298 DEPENDS 299 libc.hdr.types.size_t 300 libc.src.stdlib.bsearch 301) 302 303add_libc_test( 304 heap_sort_test 305 SUITE 306 libc-stdlib-tests 307 SRCS 308 heap_sort_test.cpp 309 HDRS 310 SortingTest.h 311 DEPENDS 312 libc.src.stdlib.qsort 313) 314 315add_libc_test( 316 quick_sort_test 317 SUITE 318 libc-stdlib-tests 319 SRCS 320 quick_sort_test.cpp 321 HDRS 322 SortingTest.h 323 DEPENDS 324 libc.src.stdlib.qsort 325) 326 327add_libc_test( 328 qsort_r_test 329 SUITE 330 libc-stdlib-tests 331 SRCS 332 qsort_r_test.cpp 333 DEPENDS 334 libc.hdr.types.size_t 335 libc.src.stdlib.qsort_r 336) 337 338add_libc_test( 339 rand_test 340 SUITE 341 libc-stdlib-tests 342 SRCS 343 rand_test.cpp 344 DEPENDS 345 libc.src.stdlib.rand 346 libc.src.stdlib.srand 347) 348 349if(LLVM_LIBC_FULL_BUILD) 350 351 add_libc_test( 352 _Exit_test 353 # The EXPECT_EXITS test is only availible for unit tests. 354 UNIT_TEST_ONLY 355 SUITE 356 libc-stdlib-tests 357 SRCS 358 _Exit_test.cpp 359 DEPENDS 360 libc.src.stdlib._Exit 361 libc.src.stdlib.exit 362 ) 363 364 add_libc_test( 365 atexit_test 366 # The EXPECT_EXITS test is only availible for unit tests. 367 UNIT_TEST_ONLY 368 SUITE 369 libc-stdlib-tests 370 SRCS 371 atexit_test.cpp 372 DEPENDS 373 libc.src.stdlib._Exit 374 libc.src.stdlib.exit 375 libc.src.stdlib.atexit 376 libc.src.__support.CPP.array 377 ) 378 379 add_libc_test( 380 at_quick_exit_test 381 # The EXPECT_EXITS test is only availible for unit tests. 382 UNIT_TEST_ONLY 383 SUITE 384 libc-stdlib-tests 385 SRCS 386 at_quick_exit_test.cpp 387 DEPENDS 388 libc.src.stdlib._Exit 389 libc.src.stdlib.quick_exit 390 libc.src.stdlib.at_quick_exit 391 libc.src.__support.CPP.array 392 ) 393 394 add_libc_test( 395 abort_test 396 # The EXPECT_DEATH test is only availible for unit tests. 397 UNIT_TEST_ONLY 398 SUITE 399 libc-stdlib-tests 400 SRCS 401 abort_test.cpp 402 DEPENDS 403 libc.include.signal 404 libc.src.stdlib.abort 405 libc.src.stdlib._Exit 406 libc.src.signal.raise 407 ) 408 409 add_libc_test( 410 quick_exit_test 411 # The EXPECT_EXITS test is only availible for unit tests. 412 UNIT_TEST_ONLY 413 SUITE 414 libc-stdlib-tests 415 SRCS 416 quick_exit_test.cpp 417 DEPENDS 418 libc.include.stdlib 419 libc.src.stdlib.quick_exit 420 ) 421 422 # Only baremetal and GPU has an in-tree 'malloc' implementation. 423 if((LIBC_TARGET_OS_IS_BAREMETAL OR LIBC_TARGET_OS_IS_GPU) AND 424 NOT LIBC_TARGET_ARCHITECTURE_IS_NVPTX) 425 add_libc_test( 426 malloc_test 427 HERMETIC_TEST_ONLY 428 SUITE 429 libc-stdlib-tests 430 SRCS 431 malloc_test.cpp 432 DEPENDS 433 libc.include.stdlib 434 libc.src.stdlib.malloc 435 libc.src.stdlib.free 436 ) 437 endif() 438endif() 439