[compiler-rt] r351109 - [test] Disable sunrpc tests when rpc/xdr.h is missing

Michal Gorny via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 14 11:18:34 PST 2019


Author: mgorny
Date: Mon Jan 14 11:18:34 2019
New Revision: 351109

URL: http://llvm.org/viewvc/llvm-project?rev=351109&view=rev
Log:
[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

Modified:
    compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake
    compiler-rt/trunk/cmake/base-config-ix.cmake
    compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt
    compiler-rt/trunk/test/lit.common.cfg
    compiler-rt/trunk/test/lit.common.configured.in
    compiler-rt/trunk/test/msan/Linux/sunrpc.cc
    compiler-rt/trunk/test/msan/Linux/sunrpc_bytes.cc
    compiler-rt/trunk/test/msan/Linux/sunrpc_string.cc
    compiler-rt/trunk/test/tsan/sunrpc.cc

Modified: compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake?rev=351109&r1=351108&r2=351109&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake (original)
+++ compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake Mon Jan 14 11:18:34 2019
@@ -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}})

Modified: compiler-rt/trunk/cmake/base-config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/base-config-ix.cmake?rev=351109&r1=351108&r2=351109&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/base-config-ix.cmake (original)
+++ compiler-rt/trunk/cmake/base-config-ix.cmake Mon Jan 14 11:18:34 2019
@@ -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)

Modified: compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt?rev=351109&r1=351108&r2=351109&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt Mon Jan 14 11:18:34 2019
@@ -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)

Modified: compiler-rt/trunk/test/lit.common.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lit.common.cfg?rev=351109&r1=351108&r2=351109&view=diff
==============================================================================
--- compiler-rt/trunk/test/lit.common.cfg (original)
+++ compiler-rt/trunk/test/lit.common.cfg Mon Jan 14 11:18:34 2019
@@ -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(

Modified: compiler-rt/trunk/test/lit.common.configured.in
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lit.common.configured.in?rev=351109&r1=351108&r2=351109&view=diff
==============================================================================
--- compiler-rt/trunk/test/lit.common.configured.in (original)
+++ compiler-rt/trunk/test/lit.common.configured.in Mon Jan 14 11:18:34 2019
@@ -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:

Modified: compiler-rt/trunk/test/msan/Linux/sunrpc.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/msan/Linux/sunrpc.cc?rev=351109&r1=351108&r2=351109&view=diff
==============================================================================
--- compiler-rt/trunk/test/msan/Linux/sunrpc.cc (original)
+++ compiler-rt/trunk/test/msan/Linux/sunrpc.cc Mon Jan 14 11:18:34 2019
@@ -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 && \

Modified: compiler-rt/trunk/test/msan/Linux/sunrpc_bytes.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/msan/Linux/sunrpc_bytes.cc?rev=351109&r1=351108&r2=351109&view=diff
==============================================================================
--- compiler-rt/trunk/test/msan/Linux/sunrpc_bytes.cc (original)
+++ compiler-rt/trunk/test/msan/Linux/sunrpc_bytes.cc Mon Jan 14 11:18:34 2019
@@ -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 && \

Modified: compiler-rt/trunk/test/msan/Linux/sunrpc_string.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/msan/Linux/sunrpc_string.cc?rev=351109&r1=351108&r2=351109&view=diff
==============================================================================
--- compiler-rt/trunk/test/msan/Linux/sunrpc_string.cc (original)
+++ compiler-rt/trunk/test/msan/Linux/sunrpc_string.cc Mon Jan 14 11:18:34 2019
@@ -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 && \

Modified: compiler-rt/trunk/test/tsan/sunrpc.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/sunrpc.cc?rev=351109&r1=351108&r2=351109&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/sunrpc.cc (original)
+++ compiler-rt/trunk/test/tsan/sunrpc.cc Mon Jan 14 11:18:34 2019
@@ -1,3 +1,5 @@
+// REQUIRES: sunrpc
+
 // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
 
 #include <pthread.h>




More information about the llvm-commits mailing list