cassanova updated this revision to Diff 439454. cassanova retitled this revision from "[lldb/Fuzzer] Have target fuzzer write artifacts to specific directory" to "[lldb/Fuzzer] Have fuzzers write artifacts to specific directory". cassanova edited the summary of this revision. cassanova added a comment.
Removed the chain of shell commands in the target fuzzer's CMakeLists file and added a pre build command that creates the necessary directory and changes the working directory in the target to this directory. Also implemented these changes to the command interpreter fuzzer's CMakeLists file and added it to this diff. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D128450/new/ https://reviews.llvm.org/D128450 Files: lldb/tools/lldb-fuzzer/lldb-commandinterpreter-fuzzer/CMakeLists.txt lldb/tools/lldb-fuzzer/lldb-target-fuzzer/CMakeLists.txt Index: lldb/tools/lldb-fuzzer/lldb-target-fuzzer/CMakeLists.txt =================================================================== --- lldb/tools/lldb-fuzzer/lldb-target-fuzzer/CMakeLists.txt +++ lldb/tools/lldb-fuzzer/lldb-target-fuzzer/CMakeLists.txt @@ -15,9 +15,14 @@ lldbFuzzerUtils ) + add_custom_command(TARGET lldb-target-fuzzer PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/fuzzer-artifacts/target-artifacts + ) + add_custom_target(fuzz-lldb-target COMMENT "Running the LLDB target fuzzer..." - COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && $<TARGET_FILE:lldb-target-fuzzer> + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/fuzzer-artifacts/target-artifacts + COMMAND $<TARGET_FILE:lldb-target-fuzzer> -artifact_prefix=target- USES_TERMINAL ) endif() Index: lldb/tools/lldb-fuzzer/lldb-commandinterpreter-fuzzer/CMakeLists.txt =================================================================== --- lldb/tools/lldb-fuzzer/lldb-commandinterpreter-fuzzer/CMakeLists.txt +++ lldb/tools/lldb-fuzzer/lldb-commandinterpreter-fuzzer/CMakeLists.txt @@ -14,15 +14,19 @@ liblldb ) - # This will create a directory specifically for the fuzzer's artifacts, go to that - # directory and run the fuzzer from there. When the fuzzer exits the input - # artifact that caused it to exit will be written to a directory within the - # build directory + # A directory in the build directory is created to hold the fuzzer's + # artifacts as a pre-build command for the command interpreter's executable + # target. When the fuzzer exits the input artifact that caused it to exit + # will be written to this directory. + + add_custom_command(TARGET lldb-commandinterpreter-fuzzer PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/fuzzer-artifacts/commandinterpreter-artifacts + ) + add_custom_target(fuzz-lldb-commandinterpreter COMMENT "Running the LLDB command interpreter fuzzer..." - COMMAND mkdir -p ${CMAKE_BINARY_DIR}/fuzzer-artifacts/commandinterpreter-artifacts && - cd ${CMAKE_BINARY_DIR}/fuzzer-artifacts/commandinterpreter-artifacts - && $<TARGET_FILE:lldb-commandinterpreter-fuzzer> -dict=${CMAKE_CURRENT_SOURCE_DIR}/inputdictionary.txt -only_ascii=1 -artifact_prefix=commandinterpreter- + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/fuzzer-artifacts/commandinterpreter-artifacts + COMMAND $<TARGET_FILE:lldb-commandinterpreter-fuzzer> -dict=${CMAKE_CURRENT_SOURCE_DIR}/inputdictionary.txt -only_ascii=1 -artifact_prefix=commandinterpreter- USES_TERMINAL ) endif()
Index: lldb/tools/lldb-fuzzer/lldb-target-fuzzer/CMakeLists.txt =================================================================== --- lldb/tools/lldb-fuzzer/lldb-target-fuzzer/CMakeLists.txt +++ lldb/tools/lldb-fuzzer/lldb-target-fuzzer/CMakeLists.txt @@ -15,9 +15,14 @@ lldbFuzzerUtils ) + add_custom_command(TARGET lldb-target-fuzzer PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/fuzzer-artifacts/target-artifacts + ) + add_custom_target(fuzz-lldb-target COMMENT "Running the LLDB target fuzzer..." - COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && $<TARGET_FILE:lldb-target-fuzzer> + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/fuzzer-artifacts/target-artifacts + COMMAND $<TARGET_FILE:lldb-target-fuzzer> -artifact_prefix=target- USES_TERMINAL ) endif() Index: lldb/tools/lldb-fuzzer/lldb-commandinterpreter-fuzzer/CMakeLists.txt =================================================================== --- lldb/tools/lldb-fuzzer/lldb-commandinterpreter-fuzzer/CMakeLists.txt +++ lldb/tools/lldb-fuzzer/lldb-commandinterpreter-fuzzer/CMakeLists.txt @@ -14,15 +14,19 @@ liblldb ) - # This will create a directory specifically for the fuzzer's artifacts, go to that - # directory and run the fuzzer from there. When the fuzzer exits the input - # artifact that caused it to exit will be written to a directory within the - # build directory + # A directory in the build directory is created to hold the fuzzer's + # artifacts as a pre-build command for the command interpreter's executable + # target. When the fuzzer exits the input artifact that caused it to exit + # will be written to this directory. + + add_custom_command(TARGET lldb-commandinterpreter-fuzzer PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/fuzzer-artifacts/commandinterpreter-artifacts + ) + add_custom_target(fuzz-lldb-commandinterpreter COMMENT "Running the LLDB command interpreter fuzzer..." - COMMAND mkdir -p ${CMAKE_BINARY_DIR}/fuzzer-artifacts/commandinterpreter-artifacts && - cd ${CMAKE_BINARY_DIR}/fuzzer-artifacts/commandinterpreter-artifacts - && $<TARGET_FILE:lldb-commandinterpreter-fuzzer> -dict=${CMAKE_CURRENT_SOURCE_DIR}/inputdictionary.txt -only_ascii=1 -artifact_prefix=commandinterpreter- + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/fuzzer-artifacts/commandinterpreter-artifacts + COMMAND $<TARGET_FILE:lldb-commandinterpreter-fuzzer> -dict=${CMAKE_CURRENT_SOURCE_DIR}/inputdictionary.txt -only_ascii=1 -artifact_prefix=commandinterpreter- USES_TERMINAL ) endif()
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits