2022-11-12 12:46:13 -05:00
|
|
|
.POSIX:
|
|
|
|
|
|
|
|
.PHONY: suite
|
|
|
|
suite:
|
2023-01-16 12:53:48 -05:00
|
|
|
git submodule update --init modules/djot.js
|
|
|
|
for f in $$(find modules/djot.js/test -name '*.test' | xargs basename -a); do \
|
|
|
|
ln -fs ../../modules/djot.js/test/$$f tests/suite/$$f; \
|
2022-11-12 12:46:13 -05:00
|
|
|
done
|
|
|
|
(cd tests/suite && make)
|
|
|
|
cargo test --features suite
|
|
|
|
|
2023-01-30 10:58:46 -05:00
|
|
|
.PHONY: suite_bench
|
|
|
|
suite_bench:
|
|
|
|
git submodule update --init modules/djot.js
|
|
|
|
for f in $$(find modules/djot.js/bench -name '*.dj' | xargs basename -a); do \
|
|
|
|
ln -fs ../../modules/djot.js/bench/$$f tests/bench/$$f; \
|
|
|
|
done
|
|
|
|
(cd tests/bench && make)
|
|
|
|
cargo test --features suite_bench
|
|
|
|
|
2023-01-31 16:51:16 -05:00
|
|
|
.PHONY: bench
|
|
|
|
bench:
|
|
|
|
git submodule update --init modules/djot.js
|
|
|
|
for f in $$(find modules/djot.js/bench -name '*.dj' | xargs basename -a); do \
|
|
|
|
ln -fs ../modules/djot.js/bench/$$f benches/$$f; \
|
|
|
|
done
|
|
|
|
|
2023-02-01 11:44:42 -05:00
|
|
|
AFL_TARGET?=gen
|
|
|
|
AFL_JOBS?=1
|
|
|
|
AFL_TARGET_CRASH?=crashes
|
|
|
|
|
|
|
|
afl:
|
|
|
|
rm -rf tests/afl/out
|
|
|
|
(cd tests/afl && \
|
|
|
|
cargo afl build --release --config profile.release.debug-assertions=true && \
|
|
|
|
(AFL_NO_UI=1 cargo afl fuzz -i in -o out -Mm ../../target/release/${AFL_TARGET} &) && \
|
|
|
|
for i in $$(seq $$((${AFL_JOBS} - 1))); do \
|
|
|
|
AFL_NO_UI=1 cargo afl fuzz -i in -o out -Ss$$i ../../target/release/${AFL_TARGET} & \
|
|
|
|
done; \
|
|
|
|
trap - EXIT;\
|
|
|
|
cat) # keep process alive for trap
|
|
|
|
|
|
|
|
afl_crash:
|
|
|
|
set +e; \
|
|
|
|
for f in $$(find tests/afl/out -path '*/${AFL_TARGET_CRASH}/id*'); do \
|
|
|
|
echo "cat $$f | RUST_BACKTRACE=1 cargo run"; \
|
|
|
|
out=$$(cat $$f | RUST_BACKTRACE=1 cargo run 2>&1); \
|
|
|
|
if [ $$? -ne 0 ]; then \
|
|
|
|
echo; \
|
|
|
|
echo "FAIL"; \
|
|
|
|
echo "$$out"; \
|
|
|
|
echo "cat $$f | RUST_BACKTRACE=1 cargo run"; \
|
|
|
|
exit 1; \
|
|
|
|
fi; \
|
|
|
|
done
|
|
|
|
|
2022-11-12 12:46:13 -05:00
|
|
|
clean:
|
|
|
|
cargo clean
|
|
|
|
git submodule deinit -f --all
|
|
|
|
rm -f tests/suite/*.test
|
|
|
|
(cd tests/suite && make clean)
|
2023-01-30 10:58:46 -05:00
|
|
|
rm -f tests/bench/*.dj
|
|
|
|
(cd tests/bench && make clean)
|
2023-01-31 16:51:16 -05:00
|
|
|
rm -f benches/*.dj
|
2023-02-01 11:44:42 -05:00
|
|
|
rm -rf tests/afl/out
|