Skip to content

Commit d4debca

Browse files
authored
Merge pull request #1281 from bratpiorka/rrudnick_fuzz_warn
update doc and fail if fuzz tests reqs are not met
2 parents fc7b481 + c02da92 commit d4debca

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

CMakeLists.txt

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ umf_option(UMF_BUILD_BENCHMARKS "Build UMF benchmarks" OFF)
7171
umf_option(UMF_BUILD_BENCHMARKS_MT "Build UMF multithreaded benchmarks" OFF)
7272
umf_option(UMF_BUILD_EXAMPLES "Build UMF examples" ON)
7373
umf_option(UMF_BUILD_GPU_EXAMPLES "Build UMF GPU examples" OFF)
74-
umf_option(UMF_BUILD_FUZZTESTS "Build UMF fuzz tests" OFF)
74+
umf_option(UMF_BUILD_FUZZTESTS
75+
"Build UMF fuzz tests (supported only on Linux with Clang)" OFF)
7576
umf_option(
7677
UMF_DISABLE_HWLOC
7778
"Disable hwloc and UMF features requiring it (OS provider, memtargets, topology discovery)"
@@ -579,12 +580,19 @@ if(UMF_USE_MSAN)
579580
"prevent reporting false-positives")
580581
add_sanitizer_flag(memory)
581582
endif()
583+
582584
# Fuzzer instrumentation for the whole library
583-
if(UMF_BUILD_FUZZTESTS
584-
AND CMAKE_CXX_COMPILER_ID MATCHES "Clang"
585-
AND LINUX)
586-
add_compile_options("-fsanitize=fuzzer-no-link")
587-
add_link_options("-fsanitize=fuzzer-no-link")
585+
if(UMF_BUILD_FUZZTESTS)
586+
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND LINUX)
587+
add_compile_options("-fsanitize=fuzzer-no-link")
588+
add_link_options("-fsanitize=fuzzer-no-link")
589+
else()
590+
message(
591+
FATAL_ERROR
592+
"UMF_BUILD_FUZZTESTS option is set, but fuzz tests are supported only on Linux with Clang"
593+
)
594+
set(UMF_BUILD_FUZZTESTS OFF)
595+
endif()
588596
endif()
589597

590598
# A header-only lib to specify include directories in transitive dependencies

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ List of options provided by CMake:
111111
| UMF_BUILD_GPU_TESTS | Build UMF GPU tests | ON/OFF | OFF |
112112
| UMF_BUILD_BENCHMARKS | Build UMF benchmarks | ON/OFF | OFF |
113113
| UMF_BUILD_EXAMPLES | Build UMF examples | ON/OFF | ON |
114-
| UMF_BUILD_FUZZTESTS | Build UMF fuzz tests | ON/OFF | OFF |
114+
| UMF_BUILD_FUZZTESTS | Build UMF fuzz tests (supported only on Linux with Clang) | ON/OFF | OFF |
115115
| UMF_BUILD_GPU_EXAMPLES | Build UMF GPU examples | ON/OFF | OFF |
116116
| UMF_DEVELOPER_MODE | Enable additional developer checks | ON/OFF | OFF |
117117
| UMF_FORMAT_CODE_STYLE | Add clang, cmake, and black -format-check and -format-apply targets to make | ON/OFF | OFF |

test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ if(LINUX AND (NOT UMF_DISABLE_HWLOC)) # OS-specific functions are implemented
391391
LIBS ${UMF_UTILS_FOR_TEST})
392392
endif()
393393

394-
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND UMF_BUILD_FUZZTESTS)
394+
if(UMF_BUILD_FUZZTESTS)
395395
add_subdirectory(fuzz)
396396
endif()
397397
else()

0 commit comments

Comments
 (0)