-
Notifications
You must be signed in to change notification settings - Fork 0
/
Justfile
52 lines (42 loc) · 1.99 KB
/
Justfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
[private]
default:
@just --list --justfile {{justfile()}}
set shell := ["bash", "-c"]
set windows-shell := ["pwsh.exe", "-NoLogo", "-Command"]
set ignore-comments := true
# Runs onboarding steps, installing dependencies and setting up the environment.
onboard: install-pre-commit install-afl
pre-commit install --hook-type pre-push --hook-type pre-commit --hook-type commit-msg
cargo install cargo-tarpaulin
# Installs pre-commit, the program.
[unix]
install-pre-commit:
# From Debian 12, `pip install` globally is an error ("This environment is externally managed.")
command -v pre-commit > /dev/null || { pip install pre-commit || sudo apt-get update && sudo apt-get install --yes pre-commit; }
# Runs benchmarks.
[unix]
bench: install-gnuplot install-image-magick
cd {{ justfile_directory() }} && cargo bench
convert {{ justfile_directory() }}/target/criterion/lookup/report/violin.svg assets/benchmark.png
# Runs fuzz testing.
[unix]
fuzz: install-afl
cd {{ justfile_directory() }} && cargo afl build --package afl-target
# Kill any running fuzzers, they like to get stuck.
cd {{ justfile_directory() }} && kill -9 $(lsof -t 'fuzz/out'/*) || true
cd {{ justfile_directory() }} && cargo afl fuzz -i fuzz/in -o fuzz/out target/debug/afl-target
# Provisions AFL (https://rust-fuzz.github.io/book/afl/setup.html#tools).
[unix]
install-afl:
command -v gcc > /dev/null || { sudo apt-get update && sudo apt-get install --yes gcc; }
command -v make > /dev/null || { sudo apt-get update && sudo apt-get install --yes make; }
command -v lsof > /dev/null || { sudo apt-get update && sudo apt-get install --yes lsof; }
command -v cargo-afl > /dev/null || { cargo install afl; }
# Install gnuplot.
[unix]
install-gnuplot:
command -v gnuplot > /dev/null || { sudo apt-get update && sudo apt-get install --yes gnuplot; }
# Install ImageMagick.
[unix]
install-image-magick:
command -v convert > /dev/null || { sudo apt-get update && sudo apt-get install --yes imagemagick; }