Update some tests and improve Makefile.

This commit is contained in:
Nicholas Marriott
2026-07-06 10:00:26 +01:00
parent 6a6822b906
commit 501e8da925
6 changed files with 244 additions and 119 deletions

View File

@@ -1,22 +1,30 @@
TESTS!= echo *.sh
LOGDIR=logs
.PHONY: all $(TESTS)
.NOTPARALLEL: all $(TESTS)
.PHONY: all
.NOTPARALLEL: all
all:
@failed=0; failures=; \
@mkdir -p "$(LOGDIR)"; \
rm -f "$(LOGDIR)"/*.log; \
failed=0; failures=; \
for test in $(TESTS); do \
base=$${test##*/}; \
log="$(LOGDIR)/$${base%.sh}.log"; \
rm -f "$$log"; \
printf '%-40s ' "$$test"; \
start=$$(date +%s); \
ASAN_OPTIONS="abort_on_error=1:detect_leaks=0:$$ASAN_OPTIONS"; \
env -i LC_CTYPE=C.UTF-8 ASAN_OPTIONS="$$ASAN_OPTIONS" \
sh "$$test" >/dev/null 2>&1; \
sh -x "$$test" >"$$log" 2>&1; \
if [ $$? -eq 0 ]; then \
end=$$(date +%s); \
rm -f "$$log"; \
echo "PASS ($$((end - start))s)"; \
else \
end=$$(date +%s); \
echo "FAIL ($$((end - start))s)"; \
echo " log: $$log"; \
failed=1; \
failures="$$failures $$test"; \
fi; \
@@ -28,9 +36,7 @@ all:
for test in $$failures; do \
echo " $$test"; \
done; \
else \
rmdir "$(LOGDIR)" 2>/dev/null || true; \
fi; \
exit $$failed
$(TESTS):
sh $@
sleep 1