1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-05-02 21:53:51 +00:00
CLI11/fuzz/CMakeLists.txt
Philip Top f7600953d4
add a round trip test to the fuzzer (#1060)
This is the next phase of the fuzzer. It runs a round trip and makes
sure that the config files generated by the app will load into the same
results, to test full round trip on the config files.

Issues fixed
- fix a bug in the string escape code caught by initial round trip tests
- resolve inconsistencies in handling of {} for empty vector indication
between config and cli parsing

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-09-23 06:13:47 -07:00

52 lines
1.9 KiB
CMake

# Copyright (c) 2017-2024, 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_APP)
set(CLI11_FUZZ_TIME_APP 600)
endif()
if(NOT CLI11_FUZZ_TIME_FILE)
set(CLI11_FUZZ_TIME_FILE 240)
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_APP} -max_len=2148
-dict=${CMAKE_CURRENT_SOURCE_DIR}/fuzz_dictionary1.txt
-exact_artifact_path=${CLI11_FUZZ_ARTIFACT_PATH}/cli11_app_roundtrip_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_FILE} -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()