Addison Crump fd364d15fe
cargo-fuzz testing (#2081)
* Build cargo-fuzz end to end

* Workaroudn failing CI

* Fix toml

* Build

* Exclude from workspace

* Fix version

* Fix workspace

* Fix workspace

* FIx workspace

* Fix path

* Set path correctly

* Install llvm-tools

* Test with distro llvm installed

* Use build

* complete

* remove from includes

* add back fuzzer tests, format

* add test for whether all fuzzers are actually tested in pipeline

* whoops

* I hate CI I hate CI I hate CI

* revert removal of llvm

* sh compatibility

* sigh

---------

Co-authored-by: Max Ammann <max@maxammann.org>
2024-04-19 23:55:28 +02:00

45 lines
951 B
TOML

[env]
[tasks.unsupported]
script_runner = "@shell"
script = '''
echo "Cargo-make not integrated yet on this"
'''
[tasks.install_llvm_tools]
command = "rustup"
args = ["toolchain", "install", "nightly", "--component", "llvm-tools-preview"]
[tasks.install_cargo_fuzz]
command = "cargo"
args = ["install", "cargo-fuzz"]
# Fuzzer
[tasks.build]
command = "cargo"
args = ["+nightly", "fuzz", "build", "fuzz_target_1"]
dependencies = ["install_cargo_fuzz", "install_llvm_tools"]
[tasks.test]
linux_alias = "test_unix"
mac_alias = "unsupported"
windows_alias = "unsupported"
[tasks.test_unix]
script = '''
timeout 30s cargo +nightly fuzz run fuzz_target_1 2>&1 | tee fuzz_stdout.log || true
if grep -qa "objectives: 1" fuzz_stdout.log; then
echo "Fuzzer is working"
else
echo "Fuzzer does not generate any testcases or any crashes"
exit 1
fi
'''
dependencies = ["build"]
# Clean
[tasks.clean]
command = "rm "
args = ["-rf", "fuzz/target"]