WorksButNotTested 1355bd5294
Improve CI (#3258)
* Improve CI

* Fix markup errors

* Remove unnecessary matrix parameters

* Rename matrix jobs to tidy up the UI

* Allow the docker cache to be updated

* Fix cache name

* Share some caches

* Rename tools
2025-05-22 16:08:35 +02:00

60 lines
1.5 KiB
Makefile

FUZZER_NAME := 'libfuzzer_stb_image'
PROJECT_DIR := absolute_path(".")
CARGO_TARGET_DIR := env("CARGO_TARGET_DIR", "target")
PROFILE := env("PROFILE", "dev")
PROFILE_DIR := if PROFILE == "release" { "release" } else if PROFILE == "dev" { "debug" } else { "debug" }
EXTENSION := if os() == "windows" {".exe"} else { "" }
LIBAFL_CC := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cc" + EXTENSION
LIBAFL_CXX := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cxx" + EXTENSION
FUZZER := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / FUZZER_NAME + EXTENSION
set windows-shell := ['cmd.exe', '/c']
set unstable
alias cc := cxx
cxx:
cargo build --profile {{PROFILE}}
fuzzer: cxx
#!/bin/bash
cargo build --profile {{PROFILE}}
{{LIBAFL_CC}} -o ./{{FUZZER_NAME}} harness.cc
[linux]
[macos]
run: fuzzer
#!/bin/bash
./{{FUZZER_NAME}} &
./{{FUZZER_NAME}}
sleep 0.2
[windows]
run: fuzzer
echo "Not integrated into just yet."
[linux]
[macos]
test: fuzzer
#!/bin/bash
rm -rf libafl_unix_shmem_server || true
(timeout 31s ./{{FUZZER_NAME}} | tee fuzz_stdout.log 2>/dev/null || true) &
sleep 0.2
timeout 30s ./{{FUZZER_NAME}} >/dev/null 2>/dev/null || true
if grep -qa "corpus: 30" fuzz_stdout.log; then
echo "Fuzzer is working"
else
echo "Fuzzer does not generate any testcases or any crashes"
exit 1
fi
[windows]
[script("cmd.exe", "/c")]
test:
cargo build --release
clean:
#!/bin/bash
rm -f {{FUZZER_NAME}}
cargo clean