[PATCH] D66984: compiler-rt/builtins: Make check-builtins run tests on macOS.

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 29 17:25:36 PDT 2019


thakis created this revision.
thakis added reviewers: delcypher, kubamracek.
Herald added subscribers: mgorny, dberris.
Herald added a project: LLVM.

https://reviews.llvm.org/D66984

Files:
  compiler-rt/test/builtins/CMakeLists.txt
  compiler-rt/test/builtins/Unit/lit.cfg.py
  compiler-rt/test/builtins/lit.site.cfg.py.in


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")
 
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/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}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66984.218002.patch
Type: text/x-patch
Size: 2299 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190830/c8d60508/attachment.bin>


More information about the llvm-commits mailing list