178d7d62cSJoseph Huberadd_custom_target(libc-support-tests) 27e075ad0SGuillaume Chatelet 3c2843267SJoseph Huberif(NOT LIBC_TARGET_OS_IS_GPU) 478d7d62cSJoseph Huber add_libc_test( 5f77ade0aSPiJoules block_test 6f77ade0aSPiJoules SUITE 7f77ade0aSPiJoules libc-support-tests 8f77ade0aSPiJoules SRCS 9f77ade0aSPiJoules block_test.cpp 10f77ade0aSPiJoules DEPENDS 11f77ade0aSPiJoules libc.src.__support.CPP.array 123eebeb7eSPiJoules libc.src.__support.CPP.bit 13f77ade0aSPiJoules libc.src.__support.CPP.span 14f77ade0aSPiJoules libc.src.__support.block 15f77ade0aSPiJoules libc.src.string.memcpy 16f77ade0aSPiJoules ) 17f77ade0aSPiJoules 18f77ade0aSPiJoules add_libc_test( 19f77ade0aSPiJoules freelist_test 20f77ade0aSPiJoules SUITE 21f77ade0aSPiJoules libc-support-tests 22f77ade0aSPiJoules SRCS 23f77ade0aSPiJoules freelist_test.cpp 24f77ade0aSPiJoules DEPENDS 25f77ade0aSPiJoules libc.src.__support.CPP.array 26f77ade0aSPiJoules libc.src.__support.CPP.span 27385961d7SDaniel Thornburgh libc.src.__support.block 28f77ade0aSPiJoules libc.src.__support.freelist 29f77ade0aSPiJoules ) 30385961d7SDaniel Thornburgh 31385961d7SDaniel Thornburgh add_libc_test( 32385961d7SDaniel Thornburgh freetrie_test 33385961d7SDaniel Thornburgh SUITE 34385961d7SDaniel Thornburgh libc-support-tests 35385961d7SDaniel Thornburgh SRCS 36385961d7SDaniel Thornburgh freetrie_test.cpp 37385961d7SDaniel Thornburgh DEPENDS 38385961d7SDaniel Thornburgh libc.src.__support.CPP.optional 39385961d7SDaniel Thornburgh libc.src.__support.block 40385961d7SDaniel Thornburgh libc.src.__support.freetrie 41385961d7SDaniel Thornburgh ) 42385961d7SDaniel Thornburgh 43385961d7SDaniel Thornburgh add_libc_test( 44385961d7SDaniel Thornburgh freestore_test 45385961d7SDaniel Thornburgh SUITE 46385961d7SDaniel Thornburgh libc-support-tests 47385961d7SDaniel Thornburgh SRCS 48385961d7SDaniel Thornburgh freestore_test.cpp 49385961d7SDaniel Thornburgh DEPENDS 50385961d7SDaniel Thornburgh libc.src.__support.CPP.optional 51385961d7SDaniel Thornburgh libc.src.__support.block 52385961d7SDaniel Thornburgh libc.src.__support.freelist 53385961d7SDaniel Thornburgh libc.src.__support.freestore 54385961d7SDaniel Thornburgh libc.src.__support.freetrie 55385961d7SDaniel Thornburgh ) 56dc27ff10SJoseph Huberendif() 57f77ade0aSPiJoules 58*51a09194SPetr Hosek# TODO: FreeListHeap uses the _end symbol which conflicts with the _end symbol 59*51a09194SPetr Hosek# defined by GPU start.cpp files so for now we exclude this test on GPU. 60*51a09194SPetr Hosekif(LLVM_LIBC_FULL_BUILD AND NOT LIBC_TARGET_OS_IS_GPU) 61f77ade0aSPiJoules add_libc_test( 62f77ade0aSPiJoules freelist_heap_test 63f77ade0aSPiJoules SUITE 64f77ade0aSPiJoules libc-support-tests 65f77ade0aSPiJoules SRCS 660c10bdc0SDaniel Thornburgh fake_heap.s 67f77ade0aSPiJoules freelist_heap_test.cpp 68f77ade0aSPiJoules DEPENDS 69f77ade0aSPiJoules libc.src.__support.CPP.span 70f77ade0aSPiJoules libc.src.__support.freelist_heap 71f77ade0aSPiJoules libc.src.string.memcmp 72f77ade0aSPiJoules libc.src.string.memcpy 73f77ade0aSPiJoules ) 74f77ade0aSPiJoulesendif() 75f77ade0aSPiJoules 76f77ade0aSPiJoulesadd_libc_test( 77f00567ecSGuillaume Chatelet blockstore_test 78f00567ecSGuillaume Chatelet SUITE 7978d7d62cSJoseph Huber libc-support-tests 80f00567ecSGuillaume Chatelet SRCS 81f00567ecSGuillaume Chatelet blockstore_test.cpp 82f00567ecSGuillaume Chatelet DEPENDS 83f00567ecSGuillaume Chatelet libc.src.__support.blockstore 84f00567ecSGuillaume Chatelet) 85f00567ecSGuillaume Chatelet 8678d7d62cSJoseph Huberadd_libc_test( 8795b680e4SDaniel Thornburgh endian_internal_test 887e075ad0SGuillaume Chatelet SUITE 8978d7d62cSJoseph Huber libc-support-tests 907e075ad0SGuillaume Chatelet SRCS 9195b680e4SDaniel Thornburgh endian_internal_test.cpp 927e075ad0SGuillaume Chatelet DEPENDS 937e075ad0SGuillaume Chatelet libc.src.__support.common 947e075ad0SGuillaume Chatelet) 956f80339bSMichael Jones 96c4448793SGuillaume Chateletadd_libc_test( 97c4448793SGuillaume Chatelet math_extras_test 98c4448793SGuillaume Chatelet SUITE 99c4448793SGuillaume Chatelet libc-support-tests 100c4448793SGuillaume Chatelet SRCS 101c4448793SGuillaume Chatelet math_extras_test.cpp 102c4448793SGuillaume Chatelet DEPENDS 103c103d573SGuillaume Chatelet libc.src.__support.integer_literals 104c4448793SGuillaume Chatelet libc.src.__support.math_extras 105c103d573SGuillaume Chatelet libc.src.__support.uint128 106c4448793SGuillaume Chatelet) 107c4448793SGuillaume Chatelet 10878d7d62cSJoseph Huberadd_libc_test( 1096f80339bSMichael Jones high_precision_decimal_test 1106f80339bSMichael Jones SUITE 11178d7d62cSJoseph Huber libc-support-tests 1126f80339bSMichael Jones SRCS 1136f80339bSMichael Jones high_precision_decimal_test.cpp 1146f80339bSMichael Jones DEPENDS 1156f80339bSMichael Jones libc.src.__support.high_precision_decimal 1169d239b37SGuillaume Chatelet libc.src.__support.uint128 1176f80339bSMichael Jones) 11887c01607SMichael Jones 11978d7d62cSJoseph Huberadd_libc_test( 12087c01607SMichael Jones str_to_float_test 12187c01607SMichael Jones SUITE 12278d7d62cSJoseph Huber libc-support-tests 12387c01607SMichael Jones SRCS 12487c01607SMichael Jones str_to_float_test.cpp 125b4fa7f4cSGuillaume Chatelet str_to_double_test.cpp 126b4fa7f4cSGuillaume Chatelet str_to_long_double_test.cpp 12787c01607SMichael Jones DEPENDS 128a80a01fcSGuillaume Chatelet libc.src.__support.integer_literals 12931d797f4SMichael Jones libc.src.__support.str_to_float 1309d239b37SGuillaume Chatelet libc.src.__support.uint128 13130d89423SSiva Chandra Reddy libc.src.errno.errno 13287c01607SMichael Jones) 13387c01607SMichael Jones 134d34b3c9cSMichael Jones 135d34b3c9cSMichael Jonesadd_libc_test( 136d34b3c9cSMichael Jones str_to_integer_test 137d34b3c9cSMichael Jones SUITE 138d34b3c9cSMichael Jones libc-support-tests 139d34b3c9cSMichael Jones SRCS 140d34b3c9cSMichael Jones str_to_integer_test.cpp 141d34b3c9cSMichael Jones DEPENDS 142d34b3c9cSMichael Jones libc.src.__support.integer_literals 143d34b3c9cSMichael Jones libc.src.__support.str_to_integer 144d34b3c9cSMichael Jones libc.src.errno.errno 145d34b3c9cSMichael Jones) 146d34b3c9cSMichael Jones 14778d7d62cSJoseph Huberadd_libc_test( 1487c666c14SSiva Chandra Reddy integer_to_string_test 1497c666c14SSiva Chandra Reddy SUITE 15078d7d62cSJoseph Huber libc-support-tests 1517c666c14SSiva Chandra Reddy SRCS 1527c666c14SSiva Chandra Reddy integer_to_string_test.cpp 1537c666c14SSiva Chandra Reddy DEPENDS 15409efe848SGuillaume Chatelet libc.src.__support.big_int 155bae47d48SNick Desaulniers libc.src.__support.CPP.limits 156a1d4c693SGuillaume Chatelet libc.src.__support.CPP.string_view 157a80a01fcSGuillaume Chatelet libc.src.__support.integer_literals 158a80a01fcSGuillaume Chatelet libc.src.__support.integer_to_string 159625d6928SSiva Chandra Reddy libc.src.__support.uint128 1607c666c14SSiva Chandra Reddy) 1617c666c14SSiva Chandra Reddy 16278d7d62cSJoseph Huberadd_libc_test( 1635561ab34SMichael Jones arg_list_test 1645561ab34SMichael Jones SUITE 16578d7d62cSJoseph Huber libc-support-tests 1665561ab34SMichael Jones SRCS 1675561ab34SMichael Jones arg_list_test.cpp 1685561ab34SMichael Jones DEPENDS 1695561ab34SMichael Jones libc.src.__support.arg_list 170ded08015SSirui Mu libc.src.__support.macros.properties.os 1715561ab34SMichael Jones) 1725561ab34SMichael Jones 173ded08015SSirui Mu# TODO: clang-cl generates calls into runtime library functions to 174ded08015SSirui Mu# handle 128-bit integer arithmetics and conversions which are not yet 175ded08015SSirui Mu# available on Windows. Re-enable 128-bit integer support on Windows once 176ded08015SSirui Mu# these functions are ready. 177ded08015SSirui Muif(NOT LIBC_TARGET_ARCHITECTURE_IS_NVPTX AND NOT LIBC_TARGET_OS_IS_WINDOWS) 17878d7d62cSJoseph Huber add_libc_test( 179fc7087b7SGuillaume Chatelet big_int_test 1801170951cSMichael Jones SUITE 18178d7d62cSJoseph Huber libc-support-tests 1821170951cSMichael Jones SRCS 183fc7087b7SGuillaume Chatelet big_int_test.cpp 1841170951cSMichael Jones DEPENDS 18509efe848SGuillaume Chatelet libc.src.__support.big_int 18605420a17SGuillaume Chatelet libc.src.__support.CPP.optional 18723c397c7SGuillaume Chatelet libc.src.__support.macros.properties.types 1881170951cSMichael Jones ) 1894b5c21aaSJoseph Huberendif() 1901170951cSMichael Jones 19178d7d62cSJoseph Huberadd_libc_test( 19203232350SGuillaume Chatelet integer_literals_test 19303232350SGuillaume Chatelet SUITE 19403232350SGuillaume Chatelet libc-support-tests 19503232350SGuillaume Chatelet SRCS 19603232350SGuillaume Chatelet integer_literals_test.cpp 19703232350SGuillaume Chatelet DEPENDS 19803232350SGuillaume Chatelet libc.src.__support.CPP.optional 19923c397c7SGuillaume Chatelet libc.src.__support.integer_literals 20023c397c7SGuillaume Chatelet libc.src.__support.macros.properties.types 20103232350SGuillaume Chatelet) 20203232350SGuillaume Chatelet 20303232350SGuillaume Chateletadd_libc_test( 204daa44a23SSiva Chandra Reddy fixedvector_test 205daa44a23SSiva Chandra Reddy SUITE 20678d7d62cSJoseph Huber libc-support-tests 207daa44a23SSiva Chandra Reddy SRCS 208daa44a23SSiva Chandra Reddy fixedvector_test.cpp 209daa44a23SSiva Chandra Reddy DEPENDS 210649edb8eSPiJoules libc.src.__support.CPP.array 211daa44a23SSiva Chandra Reddy libc.src.__support.fixedvector 212daa44a23SSiva Chandra Reddy) 213daa44a23SSiva Chandra Reddy 21478d7d62cSJoseph Huberadd_libc_test( 215176c853dSMichael Jones char_vector_test 216176c853dSMichael Jones SUITE 21778d7d62cSJoseph Huber libc-support-tests 218176c853dSMichael Jones SRCS 219176c853dSMichael Jones char_vector_test.cpp 220176c853dSMichael Jones DEPENDS 221176c853dSMichael Jones libc.src.__support.char_vector 222176c853dSMichael Jones) 223176c853dSMichael Jones 22481e3e7e5SSchrodinger ZHU Yifanadd_libc_test( 22581e3e7e5SSchrodinger ZHU Yifan hash_test 22681e3e7e5SSchrodinger ZHU Yifan SUITE 22781e3e7e5SSchrodinger ZHU Yifan libc-support-tests 22881e3e7e5SSchrodinger ZHU Yifan SRCS 22981e3e7e5SSchrodinger ZHU Yifan hash_test.cpp 23081e3e7e5SSchrodinger ZHU Yifan DEPENDS 23181e3e7e5SSchrodinger ZHU Yifan libc.src.__support.hash 23281e3e7e5SSchrodinger ZHU Yifan libc.src.__support.CPP.new 23381e3e7e5SSchrodinger ZHU Yifan libc.src.stdlib.rand 23481e3e7e5SSchrodinger ZHU Yifan libc.src.stdlib.srand 23581e3e7e5SSchrodinger ZHU Yifan libc.src.string.memset 2362d2893d7SSchrodinger ZHU Yifan COMPILE_OPTIONS 2372d2893d7SSchrodinger ZHU Yifan -O3 23881e3e7e5SSchrodinger ZHU Yifan UNIT_TEST_ONLY 23981e3e7e5SSchrodinger ZHU Yifan # Aligned Allocation is not supported in hermetic builds. 24081e3e7e5SSchrodinger ZHU Yifan) 24181e3e7e5SSchrodinger ZHU Yifan 24281e3e7e5SSchrodinger ZHU Yifanadd_libc_test( 24381e3e7e5SSchrodinger ZHU Yifan memory_size_test 24481e3e7e5SSchrodinger ZHU Yifan SUITE 24581e3e7e5SSchrodinger ZHU Yifan libc-support-tests 24681e3e7e5SSchrodinger ZHU Yifan SRCS 24781e3e7e5SSchrodinger ZHU Yifan memory_size_test.cpp 24881e3e7e5SSchrodinger ZHU Yifan DEPENDS 24981e3e7e5SSchrodinger ZHU Yifan libc.src.__support.memory_size 25081e3e7e5SSchrodinger ZHU Yifan) 25181e3e7e5SSchrodinger ZHU Yifan 25247b7c91aSJoseph Huber# FIXME: We shouldn't have regular executables created because we could be 25347b7c91aSJoseph Huber# cross-compiling the tests and running through an emulator. 25447b7c91aSJoseph Huberif(NOT LIBC_TARGET_OS_IS_GPU) 25587c01607SMichael Jones add_executable( 25687c01607SMichael Jones libc_str_to_float_comparison_test 25787c01607SMichael Jones str_to_float_comparison_test.cpp 25887c01607SMichael Jones ) 25987c01607SMichael Jones 26087c01607SMichael Jones target_link_libraries(libc_str_to_float_comparison_test 26187c01607SMichael Jones PRIVATE 262f1190bc0SMichael Jones "${LIBC_TARGET}" 26387c01607SMichael Jones ) 26487c01607SMichael Jones 265f14334ffSMichael Jones add_executable( 266f14334ffSMichael Jones libc_system_str_to_float_comparison_test 267f14334ffSMichael Jones str_to_float_comparison_test.cpp 268f14334ffSMichael Jones ) 269f14334ffSMichael Jones 27087c01607SMichael Jones set(float_test_file ${CMAKE_CURRENT_SOURCE_DIR}/str_to_float_comparison_data.txt) 27187c01607SMichael Jones 27287c01607SMichael Jones add_custom_command(TARGET libc_str_to_float_comparison_test 27387c01607SMichael Jones POST_BUILD 2742307d270SMikhail R. Gadelha COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:libc_str_to_float_comparison_test> ${float_test_file} 27587c01607SMichael Jones DEPENDS ${float_test_file} 27687c01607SMichael Jones COMMENT "Test the strtof and strtod implementations against precomputed results." 27787c01607SMichael Jones VERBATIM) 27847b7c91aSJoseph Huberendif() 2793cc2161cSSiva Chandra Reddy 2802a7ed8fcSSiva Chandra Reddyadd_subdirectory(CPP) 2814ef02da0SSiva Chandra Reddyadd_subdirectory(File) 28285c66f5dSJon Chesterfieldadd_subdirectory(RPC) 2833cc2161cSSiva Chandra Reddyadd_subdirectory(OSUtil) 284d6802581STue Lyadd_subdirectory(FPUtil) 2855b079af1SMichael Jonesadd_subdirectory(fixed_point) 28681e3e7e5SSchrodinger ZHU Yifanadd_subdirectory(HashTable) 287b342d18aSSchrodinger ZHU Yifanadd_subdirectory(time) 288142afde0SSchrodinger ZHU Yifanadd_subdirectory(threads) 289