From ef07357b2fffeba67c05655ace1f32a64ae2fa3c Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Tue, 7 Jun 2016 04:44:39 +0000 Subject: [PATCH] [LibFuzzer] Disable building and running LSan tests on Apple platforms because LSan is not currently supported. Differential Revision: http://reviews.llvm.org/D20947 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271979 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Fuzzer/test/CMakeLists.txt | 10 ++++++++++ lib/Fuzzer/test/fuzzer-leak.test | 1 + lib/Fuzzer/test/lit.cfg | 6 ++++++ lib/Fuzzer/test/lit.site.cfg.in | 1 + 4 files changed, 18 insertions(+) diff --git a/lib/Fuzzer/test/CMakeLists.txt b/lib/Fuzzer/test/CMakeLists.txt index 7beae1da583..14e8f458c0d 100644 --- a/lib/Fuzzer/test/CMakeLists.txt +++ b/lib/Fuzzer/test/CMakeLists.txt @@ -93,6 +93,16 @@ set(Tests TimeoutTest ) +if(APPLE) + # LeakSanitizer is not supported on OSX right now + set(HAS_LSAN 0) + message(WARNING "LeakSanitizer is not supported on Apple platforms." + " Building and running LibFuzzer LeakSanitizer tests is disabled." + ) +else() + set(HAS_LSAN 1) +endif() + foreach(Test ${Tests}) add_libfuzzer_test(${Test} SOURCES ${Test}.cpp) endforeach() diff --git a/lib/Fuzzer/test/fuzzer-leak.test b/lib/Fuzzer/test/fuzzer-leak.test index 6b4b484b0bf..f55ccafeb0e 100644 --- a/lib/Fuzzer/test/fuzzer-leak.test +++ b/lib/Fuzzer/test/fuzzer-leak.test @@ -1,3 +1,4 @@ +REQUIRES: lsan RUN: not LLVMFuzzer-LeakTest -runs=100000 -detect_leaks=1 2>&1 | FileCheck %s --check-prefix=LEAK_DURING LEAK_DURING: ERROR: LeakSanitizer: detected memory leaks LEAK_DURING: Direct leak of 4 byte(s) in 1 object(s) allocated from: diff --git a/lib/Fuzzer/test/lit.cfg b/lib/Fuzzer/test/lit.cfg index 5f52f643f75..e625fbe2286 100644 --- a/lib/Fuzzer/test/lit.cfg +++ b/lib/Fuzzer/test/lit.cfg @@ -19,3 +19,9 @@ if config.has_dfsan: else: lit_config.note('dfsan feature unavailable') +if config.has_lsan: + lit_config.note('lsan feature available') + config.available_features.add('lsan') +else: + lit_config.note('lsan feature unavailable') + diff --git a/lib/Fuzzer/test/lit.site.cfg.in b/lib/Fuzzer/test/lit.site.cfg.in index 48d9b361e18..95ad6d0ab17 100644 --- a/lib/Fuzzer/test/lit.site.cfg.in +++ b/lib/Fuzzer/test/lit.site.cfg.in @@ -1,4 +1,5 @@ config.test_exec_root = "@CMAKE_CURRENT_BINARY_DIR@" config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" config.has_dfsan = True if @HAS_DFSAN@ == 1 else False +config.has_lsan = True if @HAS_LSAN@ == 1 else False lit_config.load_config(config, "@CMAKE_CURRENT_SOURCE_DIR@/lit.cfg")