aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiva Chandra Reddy <sivachandra@google.com>2020-06-09 16:56:50 -0700
committerSiva Chandra Reddy <sivachandra@google.com>2020-06-09 21:49:50 -0700
commit9894236e705ef784bdac984ef63bb9f865efb27e (patch)
treefc44b799305b2617869e248aaef1890cb9feb71a
parent28415e588f1c501967a9b596e6651787996f93ff (diff)
downloadllvm-9894236e705ef784bdac984ef63bb9f865efb27e.zip
llvm-9894236e705ef784bdac984ef63bb9f865efb27e.tar.gz
llvm-9894236e705ef784bdac984ef63bb9f865efb27e.tar.bz2
[libc] Skip fuzzer as well if its dependent entrypoints are skipped.
Reviewers: asteinhauser Subscribers: mgorny, tschuett, ecnelises, libc-commits Tags: #libc-project Differential Revision: https://reviews.llvm.org/D81519
-rw-r--r--libc/cmake/modules/LLVMLibCTestRules.cmake20
1 files changed, 18 insertions, 2 deletions
diff --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake
index e33f528..a30259c 100644
--- a/libc/cmake/modules/LLVMLibCTestRules.cmake
+++ b/libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -198,6 +198,24 @@ function(add_libc_fuzzer target_name)
endif()
get_fq_target_name(${target_name} fq_target_name)
+ get_fq_deps_list(fq_deps_list ${LIBC_FUZZER_DEPENDS})
+ get_object_files_for_test(
+ link_object_files skipped_entrypoints_list ${fq_deps_list})
+ if(skipped_entrypoints_list)
+ set(msg "Skipping fuzzer target ${fq_target_name} as it has missing deps: "
+ "${skipped_entrypoints_list}.")
+ message(STATUS ${msg})
+ add_custom_target(${fq_target_name})
+
+ # A post build custom command is used to avoid running the command always.
+ add_custom_command(
+ TARGET ${fq_target_name}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E echo ${msg}
+ )
+ return()
+ endif()
+
add_executable(
${fq_target_name}
EXCLUDE_FROM_ALL
@@ -212,8 +230,6 @@ function(add_libc_fuzzer target_name)
${LIBC_BUILD_DIR}/include
)
- get_fq_deps_list(fq_deps_list ${LIBC_FUZZER_DEPENDS})
- get_object_files_for_test(link_object_files ${fq_deps_list})
target_link_libraries(${fq_target_name} PRIVATE ${link_object_files})
set_target_properties(${fq_target_name}