From 4fc99ef388e2f110759dc774428fd194b65614c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Wed, 6 Jun 2018 12:45:55 +0200 Subject: [PATCH 8/8] [test] Support using libtirpc on Linux Add compiler flags necessary for using libtirpc on Linux (RPC headers split out of glibc). The flags are obtained via pkg-config. This fixes test failures due to tests being unable to find includes. --- cmake/base-config-ix.cmake | 4 ++++ lib/sanitizer_common/CMakeLists.txt | 2 -- test/msan/lit.cfg | 3 ++- test/msan/lit.site.cfg.in | 1 + test/tsan/lit.cfg | 3 ++- test/tsan/lit.site.cfg.in | 1 + 6 files changed, 10 insertions(+), 4 deletions(-) diff --git a/cmake/base-config-ix.cmake b/cmake/base-config-ix.cmake index b208f0852..46b88f72b 100644 --- a/cmake/base-config-ix.cmake +++ b/cmake/base-config-ix.cmake @@ -8,6 +8,10 @@ include(CheckCXXSourceCompiles) check_include_file(unwind.h HAVE_UNWIND_H) +# used in sanitizer_common and tests +include(FindPkgConfig) +pkg_check_modules(TIRPC libtirpc) + # Top level target used to build all compiler-rt libraries. add_custom_target(compiler-rt ALL) add_custom_target(install-compiler-rt) diff --git a/lib/sanitizer_common/CMakeLists.txt b/lib/sanitizer_common/CMakeLists.txt index 4071bc0e8..08d1781a6 100644 --- a/lib/sanitizer_common/CMakeLists.txt +++ b/lib/sanitizer_common/CMakeLists.txt @@ -151,8 +151,6 @@ include_directories(..) set(SANITIZER_COMMON_DEFINITIONS) -include(FindPkgConfig) -pkg_check_modules(TIRPC libtirpc) if (TIRPC_FOUND) include_directories(${TIRPC_INCLUDE_DIRS}) set(CMAKE_REQUIRED_INCLUDES ${TIRPC_INCLUDE_DIRS}) diff --git a/test/msan/lit.cfg b/test/msan/lit.cfg index cac260999..fe8525047 100644 --- a/test/msan/lit.cfg +++ b/test/msan/lit.cfg @@ -14,7 +14,8 @@ clang_msan_cflags = (["-fsanitize=memory", "-fno-omit-frame-pointer", "-fno-optimize-sibling-calls"] + [config.target_cflags] + - config.debug_info_flags) + config.debug_info_flags + + [config.rpc_cflags]) # Some Msan tests leverage backtrace() which requires libexecinfo on FreeBSD. if config.host_os == 'FreeBSD': clang_msan_cflags += ["-lexecinfo"] diff --git a/test/msan/lit.site.cfg.in b/test/msan/lit.site.cfg.in index f744d71fd..35634d324 100644 --- a/test/msan/lit.site.cfg.in +++ b/test/msan/lit.site.cfg.in @@ -6,6 +6,7 @@ config.target_cflags = "@MSAN_TEST_TARGET_CFLAGS@" config.target_arch = "@MSAN_TEST_TARGET_ARCH@" config.use_lld = @MSAN_TEST_USE_LLD@ config.use_thinlto = @MSAN_TEST_USE_THINLTO@ +config.rpc_cflags = "@TIRPC_CFLAGS@" # Load common config for all compiler-rt lit tests. lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured") diff --git a/test/tsan/lit.cfg b/test/tsan/lit.cfg index fdbafefbc..82fd2f79d 100644 --- a/test/tsan/lit.cfg +++ b/test/tsan/lit.cfg @@ -49,7 +49,8 @@ clang_tsan_cflags = (["-fsanitize=thread", [config.target_cflags] + config.debug_info_flags + extra_cflags + - ["-I%s" % tsan_incdir]) + ["-I%s" % tsan_incdir] + + [config.rpc_cflags]) clang_tsan_cxxflags = config.cxx_mode_flags + clang_tsan_cflags + ["-std=c++11"] + ["-I%s" % tsan_incdir] # Add additional flags if we're using instrumented libc++. # Instrumented libcxx currently not supported on Darwin. diff --git a/test/tsan/lit.site.cfg.in b/test/tsan/lit.site.cfg.in index a215e664a..142d61bf2 100644 --- a/test/tsan/lit.site.cfg.in +++ b/test/tsan/lit.site.cfg.in @@ -7,6 +7,7 @@ config.ios = @TSAN_TEST_IOS_PYBOOL@ config.iossim = @TSAN_TEST_IOSSIM_PYBOOL@ config.target_cflags = "@TSAN_TEST_TARGET_CFLAGS@" config.target_arch = "@TSAN_TEST_TARGET_ARCH@" +config.rpc_cflags = "@TIRPC_CFLAGS@" # Load common config for all compiler-rt lit tests. lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured") -- 2.18.0