Skip to content

Commit

Permalink
factorize tests summary
Browse files Browse the repository at this point in the history
  • Loading branch information
Keryan-dev committed Jul 18, 2024
1 parent a1c9c34 commit bb9af6e
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -188,21 +188,25 @@ test: tests
bench:
@$(DUNE) exec --display=quiet $(DUNE_PROFILE_ARG) --root . $(DUNE_ARGS) -- ./tests/bench/bench.exe

define tests-summary =
ret=$$?; \
echo "### TESTS RESULT SUMMARY ###"; \
for t in _build/default/tests/reftests/*.test; do \
printf "%-30s" $$(basename $$t .test); \
if [ ! -e $${t%.test}.out ]; \
then printf '\033[33m[SKIP]\033[m\n'; \
elif diff -q --strip-trailing-cr $$t $${t%.test}.out >/dev/null; \
then printf '\033[32m[ OK ]\033[m\n'; \
else printf '\033[31m[FAIL]\033[m\n'; \
fi; \
done; \
test $$ret -eq 0
endef

.PHONY: tests
tests: $(DUNE_DEP) src/client/no-git-version
@$(DUNE) runtest $(DUNE_PROFILE_ARG) --root . $(DUNE_ARGS) src/ tests/ --no-buffer; \
ret=$$?; \
echo "### TESTS RESULT SUMMARY ###"; \
for t in _build/default/tests/reftests/*.test; do \
printf "%-30s" $$(basename $$t .test); \
if [ ! -e $${t%.test}.out ]; \
then printf '\033[33m[SKIP]\033[m\n'; \
elif diff -q --strip-trailing-cr $$t $${t%.test}.out >/dev/null; \
then printf '\033[32m[ OK ]\033[m\n'; \
else printf '\033[31m[FAIL]\033[m\n'; \
fi; \
done; \
test $$ret -eq 0
$(tests-summary)

.PHONY: crowbar
# only run the quickcheck-style tests, not very covering
Expand Down Expand Up @@ -233,7 +237,8 @@ reftest-runner: $(DUNE_DEP) src/client/no-git-version
$(DUNE) build $(DUNE_ARGS) $(DUNE_PROFILE_ARG) --root . tests/reftests/run.exe

reftests: $(DUNE_DEP) src/client/no-git-version
$(DUNE) build $(DUNE_ARGS) $(DUNE_PROFILE_ARG) --root . @reftest
@$(DUNE) build $(DUNE_ARGS) $(DUNE_PROFILE_ARG) --root . @reftest; \
$(tests-summary)

reftest-%: $(DUNE_DEP) src/client/no-git-version
$(DUNE) build $(DUNE_ARGS) $(DUNE_PROFILE_ARG) --root . @reftest-$* --force
Expand Down

0 comments on commit bb9af6e

Please sign in to comment.