summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/xray
diff options
context:
space:
mode:
authorMichal Gorny <mgorny@gentoo.org>2018-12-21 13:37:30 +0000
committerMichal Gorny <mgorny@gentoo.org>2018-12-21 13:37:30 +0000
commit1e8e4fc83492116e2856fc0a2ed1f94cc3570667 (patch)
treecddf13f54e8376b2176e544ab2f8491c58cdc164 /compiler-rt/lib/xray
parentb47bd52a30333e20c564ae72cd7466a0907bc9c5 (diff)
downloadbcm5719-llvm-1e8e4fc83492116e2856fc0a2ed1f94cc3570667.tar.gz
bcm5719-llvm-1e8e4fc83492116e2856fc0a2ed1f94cc3570667.zip
[xray] [tests] Detect and handle missing LLVMTestingSupport gracefully
Add a code to properly test for presence of LLVMTestingSupport library when performing a stand-alone build, and skip tests requiring it when it is not present. Since the library is not installed, llvm-config reported empty --libs for it and the tests failed to link with undefined references. Skipping the two fdr_* test files is better than failing to build, and should be good enough until we find a better solution. NB: both installing LLVMTestingSupport and building it automatically from within compiler-rt sources are non-trivial. The former due to dependency on gtest, the latter due to tight integration with LLVM source tree. Differential Revision: https://reviews.llvm.org/D55891 llvm-svn: 349899
Diffstat (limited to 'compiler-rt/lib/xray')
-rw-r--r--compiler-rt/lib/xray/tests/CMakeLists.txt4
-rw-r--r--compiler-rt/lib/xray/tests/unit/CMakeLists.txt12
2 files changed, 13 insertions, 3 deletions
diff --git a/compiler-rt/lib/xray/tests/CMakeLists.txt b/compiler-rt/lib/xray/tests/CMakeLists.txt
index 16fb129d3b2..89a2b3b01ed 100644
--- a/compiler-rt/lib/xray/tests/CMakeLists.txt
+++ b/compiler-rt/lib/xray/tests/CMakeLists.txt
@@ -60,6 +60,10 @@ if (NOT APPLE)
if (COMPILER_RT_STANDALONE_BUILD)
append_list_if(COMPILER_RT_HAS_LLVMXRAY ${LLVM_XRAY_LDFLAGS} XRAY_UNITTEST_LINK_FLAGS)
append_list_if(COMPILER_RT_HAS_LLVMXRAY ${LLVM_XRAY_LIBLIST} XRAY_UNITTEST_LINK_FLAGS)
+ append_list_if(COMPILER_RT_HAS_LLVMTESTINGSUPPORT
+ ${LLVM_TESTINGSUPPORT_LDFLAGS} XRAY_UNITTEST_LINK_FLAGS)
+ append_list_if(COMPILER_RT_HAS_LLVMTESTINGSUPPORT
+ ${LLVM_TESTINGSUPPORT_LIBLIST} XRAY_UNITTEST_LINK_FLAGS)
else()
# We add the library directories one at a time in our CFLAGS.
foreach (DIR ${LLVM_LIBRARY_DIR})
diff --git a/compiler-rt/lib/xray/tests/unit/CMakeLists.txt b/compiler-rt/lib/xray/tests/unit/CMakeLists.txt
index 42ea43750e3..d10524b8d03 100644
--- a/compiler-rt/lib/xray/tests/unit/CMakeLists.txt
+++ b/compiler-rt/lib/xray/tests/unit/CMakeLists.txt
@@ -1,10 +1,16 @@
-add_xray_unittest(XRayTest SOURCES
+set(TEST_SOURCES
allocator_test.cc
buffer_queue_test.cc
- fdr_controller_test.cc
- fdr_log_writer_test.cc
function_call_trie_test.cc
profile_collector_test.cc
segmented_array_test.cc
test_helpers.cc
xray_unit_test_main.cc)
+
+if (NOT COMPILER_RT_STANDALONE_BUILD OR COMPILER_RT_HAS_LLVMTESTINGSUPPORT)
+ list(APPEND TEST_SOURCES
+ fdr_controller_test.cc
+ fdr_log_writer_test.cc)
+endif()
+
+add_xray_unittest(XRayTest SOURCES ${TEST_SOURCES})
OpenPOWER on IntegriCloud