Use cgreen test runner instead of executables

example_keyboards
Fred Sundvik 9 years ago
parent 3c6b93a491
commit 3eaddd6514

@ -1,40 +1,30 @@
CC = gcc CC = gcc
CFLAGS = CFLAGS =
INCLUDES = -I. INCLUDES = -I.
LDFLAGS = -L$(BUILDDIR)/cgreen/build-c/src LDFLAGS = -L$(BUILDDIR)/cgreen/build-c/src -shared
LDLIBS = -lcgreen LDLIBS = -lcgreen
UNITOBJ = $(BUILDDIR)/testserial/unitobj UNITOBJ = $(BUILDDIR)/serialtest/unitobj
DEPDIR = $(BUILDDIR)/testserial/unit.d DEPDIR = $(BUILDDIR)/serialtest/unit.d
UNITEXE = $(BUILDDIR)/testserial/unitexe UNITTESTS = $(BUILDDIR)/serialtest/unittests
DEPFLAGS = -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td DEPFLAGS = -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td
EXT = EXT = .so
UNAME := $(shell uname) UNAME := $(shell uname)
ifneq (, $(findstring mingw, $(UNAME))) ifneq (, $(findstring MINGW, $(UNAME)))
EXT += exe EXT = .dll
endif endif
ifneq (, $(findstring cygwin, $(UNAME))) ifneq (, $(findstring CYGWIN, $(UNAME)))
EXT += exe EXT = .dll
endif endif
SRC = $(wildcard *.c) SRC = $(wildcard *.c)
EXE = $(patsubst %.c, $(UNITEXE)/%$(EXT), $(SRC)) TESTFILES = $(patsubst %.c, $(UNITTESTS)/%$(EXT), $(SRC))
$(shell mkdir -p $(DEPDIR) >/dev/null) $(shell mkdir -p $(DEPDIR) >/dev/null)
test: $(EXE) test: $(TESTFILES)
@for f in $^; do \ @$(BUILDDIR)/cgreen/build-c/tools/cgreen-runner --color $(TESTFILES)
echo "++++++++++++++++++"; \
echo "Running unit tests"; \
echo $$(basename $$f); \
echo "++++++++++++++++++"; \
echo ""; \
$$f || exit 1; \
echo ""; \
echo "******************"; \
echo ""; \
done
$(UNITEXE)/%$(EXT): $(UNITOBJ)/%.o $(UNITTESTS)/%$(EXT): $(UNITOBJ)/%.o
mkdir -p $(UNITEXE) mkdir -p $(UNITTESTS)
$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS) $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
$(UNITOBJ)/%.o : %.c $(UNITOBJ)/%.o : %.c

Loading…
Cancel
Save