Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
81 lines (66 loc) · 1.9 KB
/
Copy pathMakefile
File metadata and controls
81 lines (66 loc) · 1.9 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
PYTHON = uv run -- python
RUST_HOST_TARGET ?= $(shell rustc -vV | sed -n 's/^host: //p')
FUZZ_TARGET ?= validate_qir
FUZZ_RUN_ARGS ?= -max_total_time=30
# Keep this list in sync with `.github/workflows/robustness.yml` `jobs.fuzz-targets`.
FUZZ_ALL_TARGETS := declared_qis_calls entry_contracts get_entry_attributes mutated_fixture_bitcode mutated_fixture_contracts parse_wasm_functions qir_ll_to_bc qir_to_qis result_index_contracts validate_fixture_with_wasm validate_qir
.PHONY: compile
# Usage:
# make compile FILE=tests/data/adaptive.ll
compile:
cargo run -- $(FILE)
.PHONY: lint
lint:
uvx prek run --all-files
uvx ty check
.PHONY: test
test:
cargo nextest run --all-targets --all-features
$(PYTHON) tests/test_main.py
.PHONY: audit
audit:
cargo audit
.PHONY: mutants
mutants:
NEXTEST_PROFILE=mutants cargo mutants --package qir-qis --all-features --test-tool nextest --minimum-test-timeout 60
.PHONY: fuzz
fuzz:
cargo +nightly fuzz run --target $(RUST_HOST_TARGET) $(FUZZ_TARGET) -- $(FUZZ_RUN_ARGS)
.PHONY: fuzz-all
fuzz-all:
@for target in $(FUZZ_ALL_TARGETS); do \
cargo +nightly fuzz check --target $(RUST_HOST_TARGET) "$$target" || exit 1; \
cargo +nightly fuzz run --target $(RUST_HOST_TARGET) "$$target" -- -max_total_time=15 || exit 1; \
done
.PHONY: sim
# make sim FILE=tests/data/adaptive.ll
sim:
$(PYTHON) main.py $(FILE)
.PHONY: dis
dis:
llvm-dis $(FILE)
.PHONY: stubs
stubs:
cargo run --bin stub_gen
uvx prek run --files qir_qis.pyi || true
uvx ruff check qir_qis.pyi --fix
find_files = \
@find tests/data/ \
\( -path 'tests/data/bad' \
\) -prune -false \
-o -name '*.ll' -print
.PHONY: all_files
all_files:
$(find_files) | \
while read file; do \
$(MAKE) $(TARGET) FILE="$$file" || exit 1; \
done
.PHONY: allsim
allsim:
uv sync
rm -f tests/data/**/*.qis.ll
$(MAKE) TARGET=sim all_files
.PHONY: allcompile
allcompile:
rm -f tests/data/**/*.qis.ll
$(MAKE) TARGET=compile all_files