3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-03-23 04:49:15 +00:00
yosys/tests/common.mk
2026-03-18 08:46:34 +01:00

44 lines
984 B
Makefile

all:
ifndef OVERRIDE_MAIN
clean:
@rm -f *.log *.result
endif
define run_test
@set -e; \
rc=0; \
( set -e; $(2) ) || rc=$$?; \
if [ $$rc -eq 0 ]; then \
echo "PASS $1"; \
echo PASS > $1.result; \
else \
echo "FAIL $1"; \
echo FAIL > $1.result; \
fi
endef
.PHONY: summary
summary:
@pass=$$(find . -type f -name '*.result' -exec grep '^PASS$$' {} + | wc -l); \
fail=$$(find . -type f -name '*.result' -exec grep '^FAIL$$' {} + | wc -l); \
total=$$((pass + fail)); \
echo "=========================="; \
echo "Tests: $$total"; \
echo "Passed: $$pass"; \
echo "Failed: $$fail"; \
echo "=========================="; \
if [ $$fail -ne 0 ]; then \
echo; \
$(MAKE) --no-print-directory report; \
fi; \
test $$fail -eq 0
.PHONY: report
report:
@echo "=========================="
@echo "Failing tests:"
@find . -name '*.result' -type f -exec grep -H '^FAIL$$' {} + \
| cut -d: -f1 \
| sed 's|^\./||; s|\.result$$||'
@echo "=========================="