diff options
author | Michal Gorny <mgorny@gentoo.org> | 2019-01-14 19:18:34 +0000 |
---|---|---|
committer | Michal Gorny <mgorny@gentoo.org> | 2019-01-14 19:18:34 +0000 |
commit | 3a41962911d388077d5f300a5cae0d4093525678 (patch) | |
tree | d82071d99f946a3bff6575ede5e111478759fc51 | |
parent | 07d40687af305eb476302753ff858e49c9902b95 (diff) | |
download | compiler-rt-3a41962911d388077d5f300a5cae0d4093525678.tar.gz |
[test] Disable sunrpc tests when rpc/xdr.h is missing
Disable tests requiring sunrpc when the relevant headers are missing.
In order to accommodate that, move the header check
from sanitizer_common to base-config-ix, and define the check result
as a global variable there. Use it afterwards both for definition
needed by sanitizer_common, and to control 'sunrpc' test feature.
While at it, remove the append_have_file_definition macro that was used
only once, and no longer fits the split check-definition.
Bug report: https://github.com/google/sanitizers/issues/974
Differential Revision: https://reviews.llvm.org/D47819
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@351109 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | cmake/Modules/CompilerRTUtils.cmake | 8 | ||||
-rw-r--r-- | cmake/base-config-ix.cmake | 6 | ||||
-rw-r--r-- | lib/sanitizer_common/CMakeLists.txt | 6 | ||||
-rw-r--r-- | test/lit.common.cfg | 3 | ||||
-rw-r--r-- | test/lit.common.configured.in | 1 | ||||
-rw-r--r-- | test/msan/Linux/sunrpc.cc | 2 | ||||
-rw-r--r-- | test/msan/Linux/sunrpc_bytes.cc | 2 | ||||
-rw-r--r-- | test/msan/Linux/sunrpc_string.cc | 2 | ||||
-rw-r--r-- | test/tsan/sunrpc.cc | 2 |
9 files changed, 20 insertions, 12 deletions
diff --git a/cmake/Modules/CompilerRTUtils.cmake b/cmake/Modules/CompilerRTUtils.cmake index 518a16a96..5348f2064 100644 --- a/cmake/Modules/CompilerRTUtils.cmake +++ b/cmake/Modules/CompilerRTUtils.cmake @@ -58,14 +58,6 @@ macro(append_rtti_flag polarity list) endif() endmacro() -macro(append_have_file_definition filename varname list) - check_include_file("${filename}" "${varname}") - if (NOT ${varname}) - set("${varname}" 0) - endif() - list(APPEND ${list} "${varname}=${${varname}}") -endmacro() - macro(list_intersect output input1 input2) set(${output}) foreach(it ${${input1}}) diff --git a/cmake/base-config-ix.cmake b/cmake/base-config-ix.cmake index 2a44d830b..6684d7371 100644 --- a/cmake/base-config-ix.cmake +++ b/cmake/base-config-ix.cmake @@ -8,6 +8,12 @@ include(CheckCXXSourceCompiles) check_include_file(unwind.h HAVE_UNWIND_H) +# Used by sanitizer_common and tests. +check_include_file(rpc/xdr.h HAVE_RPC_XDR_H) +if (NOT HAVE_RPC_XDR_H) + set(HAVE_RPC_XDR_H 0) +endif() + # 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 f4e768f1a..f7bf4b009 100644 --- a/lib/sanitizer_common/CMakeLists.txt +++ b/lib/sanitizer_common/CMakeLists.txt @@ -192,10 +192,8 @@ set(SANITIZER_IMPL_HEADERS include_directories(..) -set(SANITIZER_COMMON_DEFINITIONS) - -include(CheckIncludeFile) -append_have_file_definition(rpc/xdr.h HAVE_RPC_XDR_H SANITIZER_COMMON_DEFINITIONS) +set(SANITIZER_COMMON_DEFINITIONS + HAVE_RPC_XDR_H=${HAVE_RPC_XDR_H}) set(SANITIZER_CFLAGS ${SANITIZER_COMMON_CFLAGS}) append_rtti_flag(OFF SANITIZER_CFLAGS) diff --git a/test/lit.common.cfg b/test/lit.common.cfg index cbd908280..163e587a3 100644 --- a/test/lit.common.cfg +++ b/test/lit.common.cfg @@ -359,6 +359,9 @@ if config.lto_supported: if config.use_newpm: config.lto_flags += ["-fexperimental-new-pass-manager"] +if config.have_rpc_xdr_h: + config.available_features.add('sunrpc') + # Ask llvm-config about assertion mode. try: llvm_config_cmd = subprocess.Popen( diff --git a/test/lit.common.configured.in b/test/lit.common.configured.in index 63d55bfde..97c6ed580 100644 --- a/test/lit.common.configured.in +++ b/test/lit.common.configured.in @@ -36,6 +36,7 @@ set_default("use_thinlto", False) set_default("use_lto", config.use_thinlto) set_default("use_newpm", False) set_default("android", @ANDROID_PYBOOL@) +set_default("have_rpc_xdr_h", @HAVE_RPC_XDR_H@) config.available_features.add('target-is-%s' % config.target_arch) if config.enable_per_target_runtime_dir: diff --git a/test/msan/Linux/sunrpc.cc b/test/msan/Linux/sunrpc.cc index c92ad632c..edf49c2a5 100644 --- a/test/msan/Linux/sunrpc.cc +++ b/test/msan/Linux/sunrpc.cc @@ -1,3 +1,5 @@ +// REQUIRES: sunrpc + // RUN: %clangxx_msan -g -O0 -DTYPE=int -DFN=xdr_int %s -o %t && \ // RUN: %run %t 2>&1 // RUN: %clangxx_msan -g -O0 -DTYPE=int -DFN=xdr_int -DUNINIT=1 %s -o %t && \ diff --git a/test/msan/Linux/sunrpc_bytes.cc b/test/msan/Linux/sunrpc_bytes.cc index 477637af2..7eb47e178 100644 --- a/test/msan/Linux/sunrpc_bytes.cc +++ b/test/msan/Linux/sunrpc_bytes.cc @@ -1,3 +1,5 @@ +// REQUIRES: sunrpc + // RUN: %clangxx_msan -g -O0 %s -o %t && \ // RUN: %run %t 2>&1 // RUN: %clangxx_msan -g -O0 -DUNINIT=1 %s -o %t && \ diff --git a/test/msan/Linux/sunrpc_string.cc b/test/msan/Linux/sunrpc_string.cc index 350222f5c..723b85592 100644 --- a/test/msan/Linux/sunrpc_string.cc +++ b/test/msan/Linux/sunrpc_string.cc @@ -1,3 +1,5 @@ +// REQUIRES: sunrpc + // RUN: %clangxx_msan -g -O0 %s -o %t && \ // RUN: %run %t 2>&1 // RUN: %clangxx_msan -g -O0 -DUNINIT=1 %s -o %t && \ diff --git a/test/tsan/sunrpc.cc b/test/tsan/sunrpc.cc index 5cfb5344e..8e32d6d30 100644 --- a/test/tsan/sunrpc.cc +++ b/test/tsan/sunrpc.cc @@ -1,3 +1,5 @@ +// REQUIRES: sunrpc + // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s #include <pthread.h> |