Index: compiler-rt/test/builtins/CMakeLists.txt =================================================================== --- compiler-rt/test/builtins/CMakeLists.txt +++ compiler-rt/test/builtins/CMakeLists.txt @@ -25,10 +25,14 @@ endif() pythonize_bool(BUILTINS_IS_MSVC) -#TODO: Add support for Apple. -if (NOT APPLE) -foreach(arch ${BUILTIN_SUPPORTED_ARCH}) +set(BUILTIN_TEST_ARCH ${BUILTIN_SUPPORTED_ARCH}) +if(APPLE) + darwin_filter_host_archs(BUILTIN_SUPPORTED_ARCH BUILTIN_TEST_ARCH) +endif() + +foreach(arch ${BUILTIN_TEST_ARCH}) set(BUILTINS_TEST_TARGET_ARCH ${arch}) + set(BUILTINS_TEST_APPLE_PLATFORM "osx") string(TOLOWER "-${arch}-${OS_NAME}" BUILTINS_TEST_CONFIG_SUFFIX) get_test_cc_for_arch(${arch} BUILTINS_TEST_TARGET_CC BUILTINS_TEST_TARGET_CFLAGS) if (${arch} STREQUAL "armhf") @@ -49,7 +53,8 @@ ) list(APPEND BUILTINS_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/Unit/${CONFIG_NAME}) endforeach() -endif() + +# TODO: Add support for running tests on iOS and iOS simulator. add_lit_testsuite(check-builtins "Running the Builtins tests" ${BUILTINS_TESTSUITES} Index: compiler-rt/test/builtins/Unit/lit.cfg.py =================================================================== --- compiler-rt/test/builtins/Unit/lit.cfg.py +++ compiler-rt/test/builtins/Unit/lit.cfg.py @@ -29,6 +29,9 @@ base_lib = os.path.join(config.compiler_rt_libdir, "clang_rt.builtins%s.lib " % config.target_suffix) config.substitutions.append( ("%librt ", base_lib) ) +elif config.host_os == 'Darwin': + base_lib = os.path.join(config.compiler_rt_libdir, "libclang_rt.osx.a ") + config.substitutions.append( ("%librt ", base_lib + ' -lSystem ') ) else: base_lib = os.path.join(config.compiler_rt_libdir, "libclang_rt.builtins%s.a" % config.target_suffix) Index: compiler-rt/test/builtins/lit.site.cfg.py.in =================================================================== --- compiler-rt/test/builtins/lit.site.cfg.py.in +++ compiler-rt/test/builtins/lit.site.cfg.py.in @@ -1,5 +1,7 @@ @LIT_SITE_CFG_IN_HEADER@ +config.apple_platform = "@BUILTINS_TEST_APPLE_PLATFORM@" + # Load common config for all compiler-rt lit tests. lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured")