3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-04-28 06:43:37 +00:00

Add common.mk

This commit is contained in:
Miodrag Milanovic 2026-03-13 11:00:08 +01:00
parent 144da16583
commit 413b9a4639
3 changed files with 53 additions and 38 deletions

43
tests/common.mk Normal file
View file

@ -0,0 +1,43 @@
all:
ifndef OVERRIDE_MAIN
clean:
@rm -f *.log *.result
endif
define run_test
rc=0; \
$(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 "=========================="