mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-05-05 22:53:52 +00:00
* Add the beginnings of a fuzzing system for CLI11. This commit adds the fuzzing code, a simple test, and two fixes to issues(seg faults) found by the initial round of fuzzing. It also adds a few tests and coverage issues uncovered in the process of developing the fuzz tests. As a side effect adjusts some of the azure tests to specify the vmImage which was being changed on azure. * update license to match rest of code base --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
49 lines
1.8 KiB
CMake
49 lines
1.8 KiB
CMake
# Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner
|
|
# under NSF AWARD 1414736 and by the respective contributors.
|
|
# All rights reserved.
|
|
#
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
if(CMAKE_CXX_STANDARD GREATER 16)
|
|
if(CLI11_FUZZ_TARGET)
|
|
|
|
add_executable(cli11_app_fuzzer cli11_app_fuzz.cpp fuzzApp.cpp fuzzApp.hpp)
|
|
target_link_libraries(cli11_app_fuzzer PUBLIC CLI11)
|
|
set_property(TARGET cli11_app_fuzzer PROPERTY FOLDER "Tests")
|
|
|
|
add_executable(cli11_file_fuzzer cli11_file_fuzz.cpp fuzzApp.cpp fuzzApp.hpp)
|
|
target_link_libraries(cli11_file_fuzzer PUBLIC CLI11)
|
|
set_property(TARGET cli11_file_fuzzer PROPERTY FOLDER "Tests")
|
|
|
|
if(NOT CLI11_FUZZ_ARTIFACT_PATH)
|
|
set(CLI11_FUZZ_ARTIFACT_PATH ${PROJECT_BINARY_DIR}/fuzz)
|
|
endif()
|
|
|
|
if(NOT CLI11_FUZZ_TIME)
|
|
set(CLI11_FUZZ_TIME 360)
|
|
endif()
|
|
add_custom_target(
|
|
QUICK_CLI11_APP_FUZZ
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory corp
|
|
COMMAND
|
|
cli11_app_fuzzer corp -max_total_time=${CLI11_FUZZ_TIME} -max_len=2048
|
|
-dict=${CMAKE_CURRENT_SOURCE_DIR}/fuzz_dictionary1.txt
|
|
-exact_artifact_path=${CLI11_FUZZ_ARTIFACT_PATH}/cli11_app_fail_artifact.txt)
|
|
|
|
add_custom_target(
|
|
QUICK_CLI11_FILE_FUZZ
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory corp
|
|
COMMAND
|
|
cli11_file_fuzzer corp -max_total_time=${CLI11_FUZZ_TIME} -max_len=2048
|
|
-dict=${CMAKE_CURRENT_SOURCE_DIR}/fuzz_dictionary2.txt
|
|
-exact_artifact_path=${CLI11_FUZZ_ARTIFACT_PATH}/cli11_file_fail_artifact.txt)
|
|
|
|
else()
|
|
if(CLI11_BUILD_EXAMPLES)
|
|
add_executable(cli11Fuzz fuzzCommand.cpp fuzzApp.cpp fuzzApp.hpp)
|
|
target_link_libraries(cli11Fuzz PUBLIC CLI11)
|
|
set_property(TARGET cli11Fuzz PROPERTY FOLDER "Examples")
|
|
endif()
|
|
endif()
|
|
endif()
|