1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-01 04:10:18 +02:00

Allow test suite to test multiple targets.

* tests/Makefile: Allow for testing multiple targets.
This commit is contained in:
Andy Wingo 2019-04-05 16:07:01 +02:00
parent 4e1876f294
commit e6ac66a348

View file

@ -1,24 +1,29 @@
TESTS=$(sort $(basename $(wildcard *.c)))
TARGETS=native
CC = gcc
CFLAGS = -Wall -O0 -g
all: $(addprefix test-,$(TESTS))
all: $(foreach TARGET,$(TARGETS),$(addprefix test-$(TARGET)-,$(TESTS)))
check: all
check: $(addprefix test-$(TARGET),$(TARGETS))
test-%: $(addprefix test-%-,$(TESTS))
@echo "Running unit tests..."
@set -e; for test in $(TESTS); do \
@set -e; for test in $?; do \
echo "Testing: $$test"; \
./test-$$test; \
./$$test; \
done
@echo "Success."
.PHONY: test check
lightening.o: ../lightening.h ../lightening/*.c
$(CC) $(CFLAGS) $(CPPFLAGS) -I.. -o lightening.o -c ../lightening/lightening.c
test-%: %.c lightening.o test.h
test-native-%: %.c lightening.o test.h
$(CC) $(CFLAGS) $(CPPFLAGS) -I.. -o $@ lightening.o $<
clean:
rm -f $(addprefix test-,$(TESTS))
rm -f $(foreach TARGET,$(TARGETS),$(addprefix test-$(TARGET)-,$(TESTS)))
rm -f lightening.o