96 lines
2.2 KiB
TOML
96 lines
2.2 KiB
TOML
[env]
|
|
PROFILE = { value = "release", condition = { env_not_set = ["PROFILE"] } }
|
|
PROFILE_DIR = { source = "${PROFILE}", default_value = "release", mapping = { "release" = "release", "dev" = "debug" }, condition = { env_not_set = [
|
|
"PROFILE_DIR",
|
|
] } }
|
|
CARGO_TARGET_DIR = { value = "target", condition = { env_not_set = [
|
|
"CARGO_TARGET_DIR",
|
|
] } }
|
|
|
|
[tasks.unsupported]
|
|
script_runner = "@shell"
|
|
script = '''
|
|
echo "Cargo-make not integrated yet on this"
|
|
'''
|
|
|
|
# Harness
|
|
[tasks.harness]
|
|
linux_alias = "harness_linux"
|
|
mac_alias = "unsupported"
|
|
windows_alias = "harness_windows"
|
|
|
|
[tasks.harness_linux]
|
|
script = '''
|
|
clang test/test.cpp -o test.exe
|
|
'''
|
|
|
|
[tasks.harness_windows]
|
|
script = '''
|
|
cl test\test.cpp -o test.exe
|
|
'''
|
|
|
|
# Fuzzer
|
|
[tasks.fuzzer]
|
|
linux_alias = "fuzzer_linux"
|
|
mac_alias = "unsupported"
|
|
windows_alias = "fuzzer_windows"
|
|
|
|
[tasks.fuzzer_linux]
|
|
dependencies = ["harness"]
|
|
command = "cargo"
|
|
args = ["build", "--profile", "${PROFILE}"]
|
|
|
|
[tasks.fuzzer_windows]
|
|
dependencies = ["harness"]
|
|
command = "cargo"
|
|
args = ["build", "--profile", "${PROFILE}"]
|
|
|
|
# Run the fuzzer
|
|
[tasks.run]
|
|
linux_alias = "run_linux"
|
|
mac_alias = "unsupported"
|
|
windows_alias = "run_windows"
|
|
|
|
[tasks.run_linux]
|
|
dependencies = ["harness", "fuzzer"]
|
|
command = "cargo"
|
|
args = ["run", "--profile", "${PROFILE}"]
|
|
|
|
[tasks.run_windows]
|
|
dependencies = ["harness", "fuzzer"]
|
|
command = "cargo"
|
|
args = ["run", "--profile", "${PROFILE}"]
|
|
|
|
|
|
# Run the fuzzer
|
|
[tasks.test]
|
|
linux_alias = "test_linux"
|
|
mac_alias = "unsupported"
|
|
windows_alias = "test_windows"
|
|
|
|
[tasks.test_linux]
|
|
script_runner = "@shell"
|
|
script = '''
|
|
cp ${CARGO_TARGET_DIR}/${PROFILE_DIR}/tinyinst_simple .
|
|
echo running tests
|
|
timeout 5s ./tinyinst_simple || true
|
|
# corpus_discovered folder exists and is not empty
|
|
if [ -d "corpus_discovered" ] && [ -n "$(ls -A corpus_discovered)" ]; then
|
|
echo "Fuzzer works!"
|
|
else
|
|
exit 1
|
|
fi
|
|
'''
|
|
dependencies = ["harness", "fuzzer"]
|
|
|
|
[tasks.test_windows]
|
|
script_runner = "@shell"
|
|
script = '''
|
|
copy .\target\${PROFILE_DIR}\tinyinst_simple.exe .
|
|
start "" "tinyinst_simple.exe"
|
|
#ping is for timeout
|
|
ping -n 10 127.0.0.1>NUL && taskkill /im tinyinst_simple.exe /F
|
|
>nul 2>nul dir /a-d "corpus_discovered\*" && (echo Files exist) || (exit /b 1337)
|
|
'''
|
|
dependencies = ["harness", "fuzzer"]
|