Mrmaxmeier cedcee01c0
CI: Build fuzzers with shared cargo target dir (#845)
* build fuzzers with shared cargo target dir

* Make external build scripts aware of CARGO_TARGET_DIR

* fix libmozjpeg fuzzer with shared target dir

* fix cargo-make default value for CARGO_TARGET_DIR

* avoid ./ in cargo-make for windows compat

* CI: cargo-hack's --feature-powerset is too powerful

* fuzzer_concolic: support CARGO_TARGET_DIR

* ci: install z3 to avoid building from source

* ci: update actions

* ci: test nightly features with nightly rust

* test_all_fuzzers: try pruning more compilation artifacts

* ci: fix nightly feature check

* ci: apply rust-cache action after checkout (d'oh)

The rust-cache action populates the checkout directory, which is promply
deleted by the checkout action during checkout.. whoops!
2022-10-20 21:38:58 +02:00

82 lines
1.9 KiB
TOML

# Variables
[env]
FUZZER_NAME='libfuzzer_stb_image_sugar'
CARGO_TARGET_DIR = { value = "target", condition = { env_not_set = ["CARGO_TARGET_DIR"] } }
LIBAFL_CC = { source = "${CARGO_MAKE_RUST_TARGET_OS}", default_value = '${CARGO_TARGET_DIR}/release/libafl_cc', mapping = {"windows" = '.\\target\\release\\libafl_cc.exe'} }
LIBAFL_CXX = { source = "${CARGO_MAKE_RUST_TARGET_OS}", default_value = '${CARGO_TARGET_DIR}/release/libafl_cxx', mapping = {"windows" = '.\\target\\release\\libafl_cxx.exe'} }
FUZZER = { source = "${CARGO_MAKE_RUST_TARGET_OS}", default_value = '${CARGO_TARGET_DIR}/release/libfuzzer_stb_image_sugar', mapping = {"windows" = '.\\target\\release\\libfuzzer_stb_image_sugar.exe'} }
# Compilers
[tasks.cxx]
condition = { files_not_exist = ["${LIBAFL_CXX}"] }
command = "cargo"
args = ["build" , "--release"]
[tasks.cc]
condition = { files_not_exist = ["${LIBAFL_CC}"] }
command = "cargo"
args = ["build" , "--release"]
# Build the fuzzer
[tasks.fuzzer]
script_runner="@shell"
script='''
cargo build --release
cp ${FUZZER} .
'''
dependencies = ["cc", "cxx"]
[tasks.run]
linux_alias = "run_unix"
mac_alias = "run_unix"
windows_alias = "run_windows"
[tasks.run_unix]
script_runner = "@shell"
script='''
./${FUZZER_NAME} &
'''
dependencies = [ "fuzzer" ]
[tasks.run_windows]
# Do nothing
script_runner = "@shell"
script='''
echo "Not integrated into cargo-make yet."
'''
dependencies = [ "fuzzer" ]
[tasks.test]
linux_alias = "test_unix"
mac_alias = "test_unix"
windows_alias = "test_windows"
[tasks.test_unix]
script_runner = "@shell"
script='''
rm -rf libafl_unix_shmem_server || true
timeout 11s ./${FUZZER_NAME} 2>/dev/null &
'''
dependencies = [ "fuzzer" ]
[tasks.test_windows]
# Do nothing
script_runner = "@shell"
script='''
echo "Not integrated into cargo-make yet."
'''
dependencies = [ "fuzzer" ]
# Clean up
[tasks.clean]
# Disable default `clean` definition
clear = true
script_runner="@shell"
script='''
rm -f ./${FUZZER_NAME}
cargo clean
'''