This makes the LLDB fuzzers write their fuzzer artifacts to their own directory in the build directory. It also adds an artifact prefix to the target fuzzer to make it easier to tell which fuzzer wrote the artifact.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Instead of bundling together multiple shell commands into a single one, you should break them down so CMake can have the build system (e.g. ninja) schedule the different parts of it.
To create the directory, you can either create a separate target and make the fuzz-lldb-target depend on it:
add_custom_target(foo ALL COMMAND ${CMAKE_COMMAND} -E make_directory ${directory})
But even better would. be to make it a pre-build command for the fuzz-lldb-target:
add_custom_command(TARGET fuzz-lldb-target PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory ${directory})
Then you can avoid the cd by using the WORKING_DIRECTORY in add_custom_target.
This is a lot cleaner than chaining shell commands, I just implemented the second solution on my end. To clarify, it would create the directory before running the fuzz-lldb-target and within the fuzz-lldb-target we would just change the working directory to the one that the pre-build command created?
@cassanova You probably also want to implement this for the command-interpreter-fuzzer target
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.