2016-11-25 23:37:43 +00:00
|
|
|
|
# Run program $1 as part of ‘make installcheck’.
|
2014-02-04 10:02:49 +00:00
|
|
|
|
define run-install-test
|
2013-12-10 14:54:34 +00:00
|
|
|
|
|
|
|
|
|
installcheck: $1
|
|
|
|
|
|
2014-02-01 11:20:06 +00:00
|
|
|
|
_installcheck-list += $1
|
2013-12-10 14:54:34 +00:00
|
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
|
2017-10-03 04:54:00 +00:00
|
|
|
|
# Color code from https://unix.stackexchange.com/a/10065
|
2014-02-01 14:33:27 +00:00
|
|
|
|
installcheck:
|
2017-10-03 04:54:00 +00:00
|
|
|
|
@total=0; failed=0; \
|
|
|
|
|
red=""; \
|
|
|
|
|
green=""; \
|
2017-11-07 11:06:58 +00:00
|
|
|
|
yellow=""; \
|
2017-10-03 04:54:00 +00:00
|
|
|
|
normal=""; \
|
|
|
|
|
if [ -t 1 ]; then \
|
2017-11-07 11:06:58 +00:00
|
|
|
|
red="[31;1m"; \
|
|
|
|
|
green="[32;1m"; \
|
|
|
|
|
yellow="[33;1m"; \
|
|
|
|
|
normal="[m"; \
|
2017-10-03 04:54:00 +00:00
|
|
|
|
fi; \
|
|
|
|
|
for i in $(_installcheck-list); do \
|
2013-12-10 14:54:34 +00:00
|
|
|
|
total=$$((total + 1)); \
|
2017-10-06 11:04:12 +00:00
|
|
|
|
printf "running test $$i..."; \
|
2017-10-03 04:54:00 +00:00
|
|
|
|
log="$$(cd $$(dirname $$i) && $(tests-environment) $$(basename $$i) 2>&1)"; \
|
2017-11-07 11:06:58 +00:00
|
|
|
|
status=$$?; \
|
|
|
|
|
if [ $$status -eq 0 ]; then \
|
2017-10-09 13:03:15 +00:00
|
|
|
|
echo " [$${green}PASS$$normal]"; \
|
2017-11-07 11:06:58 +00:00
|
|
|
|
elif [ $$status -eq 99 ]; then \
|
|
|
|
|
echo " [$${yellow}SKIP$$normal]"; \
|
2013-12-10 14:54:34 +00:00
|
|
|
|
else \
|
2017-10-09 13:03:15 +00:00
|
|
|
|
echo " [$${red}FAIL$$normal]"; \
|
2017-10-03 04:54:00 +00:00
|
|
|
|
echo "$$log" | sed 's/^/ /'; \
|
2013-12-10 14:54:34 +00:00
|
|
|
|
failed=$$((failed + 1)); \
|
|
|
|
|
fi; \
|
|
|
|
|
done; \
|
|
|
|
|
if [ "$$failed" != 0 ]; then \
|
2017-10-03 04:54:00 +00:00
|
|
|
|
echo "$${red}$$failed out of $$total tests failed $$normal"; \
|
2013-12-10 14:54:34 +00:00
|
|
|
|
exit 1; \
|
2017-10-03 04:54:00 +00:00
|
|
|
|
else \
|
2018-01-16 17:50:38 +00:00
|
|
|
|
echo "$${green}All tests succeeded$$normal"; \
|
2013-12-10 14:54:34 +00:00
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
.PHONY: check installcheck
|