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

2019-01-14 Thread Michał Górny via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rCRT351109: [test] Disable sunrpc tests when rpc/xdr.h is 
missing (authored by mgorny, committed by ).

Repository:
  rCRT Compiler Runtime

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D47819/new/

https://reviews.llvm.org/D47819

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

Index: cmake/base-config-ix.cmake
===
--- cmake/base-config-ix.cmake
+++ cmake/base-config-ix.cmake
@@ -8,6 +8,12 @@
 
 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)
Index: cmake/Modules/CompilerRTUtils.cmake
===
--- cmake/Modules/CompilerRTUtils.cmake
+++ cmake/Modules/CompilerRTUtils.cmake
@@ -58,14 +58,6 @@
   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}})
Index: test/lit.common.configured.in
===
--- test/lit.common.configured.in
+++ test/lit.common.configured.in
@@ -36,6 +36,7 @@
 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:
Index: test/tsan/sunrpc.cc
===
--- test/tsan/sunrpc.cc
+++ test/tsan/sunrpc.cc
@@ -1,3 +1,5 @@
+// REQUIRES: sunrpc
+
 // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
 
 #include 
Index: test/msan/Linux/sunrpc_bytes.cc
===
--- test/msan/Linux/sunrpc_bytes.cc
+++ 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 && \
Index: test/msan/Linux/sunrpc.cc
===
--- test/msan/Linux/sunrpc.cc
+++ 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 && \
Index: test/msan/Linux/sunrpc_string.cc
===
--- test/msan/Linux/sunrpc_string.cc
+++ 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 && \
Index: test/lit.common.cfg
===
--- test/lit.common.cfg
+++ test/lit.common.cfg
@@ -359,6 +359,9 @@
   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(
Index: lib/sanitizer_common/CMakeLists.txt
===
--- lib/sanitizer_common/CMakeLists.txt
+++ lib/sanitizer_common/CMakeLists.txt
@@ -192,10 +192,8 @@
 
 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)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2019-01-14 Thread Peter Wu via Phabricator via cfe-commits
Lekensteyn accepted this revision.
Lekensteyn added a comment.
This revision is now accepted and ready to land.

In D47819#1356498 , @mgorny wrote:

>   PASS: MemorySanitizer-X86_64 :: Linux/sunrpc_bytes.cc (2932 of 6195)
>   PASS: MemorySanitizer-X86_64 :: Linux/sunrpc_string.cc (2935 of 6195)
>   PASS: MemorySanitizer-X86_64 :: Linux/sunrpc.cc (2974 of 6195)
>   PASS: ThreadSanitizer-x86_64 :: sunrpc.cc (5110 of 6195)
>
>
> So yep, it works. Tested both ways now.


Thanks for testing! It looks good to me.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D47819/new/

https://reviews.llvm.org/D47819



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2019-01-14 Thread Michał Górny via Phabricator via cfe-commits
mgorny added a comment.

  PASS: MemorySanitizer-X86_64 :: Linux/sunrpc_bytes.cc (2932 of 6195)
  PASS: MemorySanitizer-X86_64 :: Linux/sunrpc_string.cc (2935 of 6195)
  PASS: MemorySanitizer-X86_64 :: Linux/sunrpc.cc (2974 of 6195)
  PASS: ThreadSanitizer-x86_64 :: sunrpc.cc (5110 of 6195)

So yep, it works. Tested both ways now.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D47819/new/

https://reviews.llvm.org/D47819



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2019-01-14 Thread Michał Górny via Phabricator via cfe-commits
mgorny marked 2 inline comments as done.
mgorny added a comment.

In D47819#1356347 , @Lekensteyn wrote:

> The direction of this patch looks reasonable to me. Is it worth mentioning 
> the issue (https://github.com/google/sanitizers/issues/974) in the commit 
> message?


Yes, makes sense. I'll add it when committing.

> What environment have you tested this in, could you verify that the tests are 
> indeed skipped on a system without these headers, and passed otherwise?

I have only tests without those headers. I'll try to rebuild glibc with them 
enabled if it's still supported but it'd be preferable if somebody else tested 
it on 'natural' environment.




Comment at: lib/sanitizer_common/CMakeLists.txt:195
+set(SANITIZER_COMMON_DEFINITIONS
+  HAVE_RPC_XDR_H=${HAVE_RPC_XDR_H})
 

Lekensteyn wrote:
> The old code defined HAVE_xxx to 0 or 1, but in general wouldn't it be 
> preferable to define it to 1 if available, and not define it at all if 
> unavailable? This would match most other HAVE_xxx checks.
> 
> In order to make the lit config work in this case, you have to use something 
> like `pythonize_bool(HAVE_RPC_XDR_H)`.
Well, I suppose I could do that but given that the old code did it like this, 
the 0/1 definition seems to be a common practice in compiler-rt, and there is 
no apparent benefit from doing it the other way, I don't think it a good thing 
to do.



Comment at: test/lit.common.configured.in:39
 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)

Lekensteyn wrote:
> This becomes 0 or 1 instead of True or False, not sure if that will cause 
> issues later.
It shouldn't. 0/1 evaluates the same in boolean context, and other LLVM tests 
are relying on 0/1 being passed to lit already.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D47819/new/

https://reviews.llvm.org/D47819



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2019-01-14 Thread Peter Wu via Phabricator via cfe-commits
Lekensteyn added a comment.

The direction of this patch looks reasonable to me. Is it worth mentioning the 
issue (https://github.com/google/sanitizers/issues/974) in the commit message?

What environment have you tested this in, could you verify that the tests are 
indeed skipped on a system without these headers, and passed otherwise?




Comment at: lib/sanitizer_common/CMakeLists.txt:195
+set(SANITIZER_COMMON_DEFINITIONS
+  HAVE_RPC_XDR_H=${HAVE_RPC_XDR_H})
 

The old code defined HAVE_xxx to 0 or 1, but in general wouldn't it be 
preferable to define it to 1 if available, and not define it at all if 
unavailable? This would match most other HAVE_xxx checks.

In order to make the lit config work in this case, you have to use something 
like `pythonize_bool(HAVE_RPC_XDR_H)`.



Comment at: test/lit.common.configured.in:39
 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)

This becomes 0 or 1 instead of True or False, not sure if that will cause 
issues later.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D47819/new/

https://reviews.llvm.org/D47819



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2019-01-14 Thread Michał Górny via Phabricator via cfe-commits
mgorny added a comment.

Ping. I'd really like to merge this before the branch.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D47819/new/

https://reviews.llvm.org/D47819



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2019-01-10 Thread Michał Górny via Phabricator via cfe-commits
mgorny updated this revision to Diff 181133.
mgorny retitled this revision from "[compiler-rt] [test] Support using libtirpc 
on Linux" to "[compiler-rt] [test] Disable sunrpc tests when rpc/xdr.h is 
missing".
mgorny edited the summary of this revision.
mgorny added a reviewer: vitalybuka.
mgorny added a comment.

Following the changes to D47817 , updated this 
one to disable relevant tests when sunrpc headers are not available.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D47819/new/

https://reviews.llvm.org/D47819

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

Index: test/tsan/sunrpc.cc
===
--- test/tsan/sunrpc.cc
+++ test/tsan/sunrpc.cc
@@ -1,3 +1,5 @@
+// REQUIRES: sunrpc
+
 // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
 
 #include 
Index: test/msan/Linux/sunrpc_string.cc
===
--- test/msan/Linux/sunrpc_string.cc
+++ 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 && \
Index: test/msan/Linux/sunrpc_bytes.cc
===
--- test/msan/Linux/sunrpc_bytes.cc
+++ 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 && \
Index: test/msan/Linux/sunrpc.cc
===
--- test/msan/Linux/sunrpc.cc
+++ 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 && \
Index: test/lit.common.configured.in
===
--- test/lit.common.configured.in
+++ test/lit.common.configured.in
@@ -36,6 +36,7 @@
 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:
Index: test/lit.common.cfg
===
--- test/lit.common.cfg
+++ test/lit.common.cfg
@@ -359,6 +359,9 @@
   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(
Index: lib/sanitizer_common/CMakeLists.txt
===
--- lib/sanitizer_common/CMakeLists.txt
+++ lib/sanitizer_common/CMakeLists.txt
@@ -191,10 +191,8 @@
 
 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)
Index: cmake/base-config-ix.cmake
===
--- cmake/base-config-ix.cmake
+++ cmake/base-config-ix.cmake
@@ -8,6 +8,12 @@
 
 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)
Index: cmake/Modules/CompilerRTUtils.cmake
===
--- cmake/Modules/CompilerRTUtils.cmake
+++ cmake/Modules/CompilerRTUtils.cmake
@@ -58,14 +58,6 @@
   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}})
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits