diff options
author | Fred Sundvik <fsundvik@gmail.com> | 2016-02-14 01:58:26 +0200 |
---|---|---|
committer | Fred Sundvik <fsundvik@gmail.com> | 2016-02-14 01:58:26 +0200 |
commit | 3eaddd65141f880ddc7d23fc05cafb01ca5477ac (patch) | |
tree | 4215bd2c78ca746a3c8b625a157471d74353c6b5 | |
parent | 3c6b93a491ab6ea280c30be26980e2ca91ba5c4c (diff) |
Use cgreen test runner instead of executables
-rw-r--r-- | tests/Makefile | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/tests/Makefile b/tests/Makefile index 239e9f6093..3f89cba471 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,40 +1,30 @@ CC = gcc CFLAGS = INCLUDES = -I. -LDFLAGS = -L$(BUILDDIR)/cgreen/build-c/src +LDFLAGS = -L$(BUILDDIR)/cgreen/build-c/src -shared LDLIBS = -lcgreen -UNITOBJ = $(BUILDDIR)/testserial/unitobj -DEPDIR = $(BUILDDIR)/testserial/unit.d -UNITEXE = $(BUILDDIR)/testserial/unitexe +UNITOBJ = $(BUILDDIR)/serialtest/unitobj +DEPDIR = $(BUILDDIR)/serialtest/unit.d +UNITTESTS = $(BUILDDIR)/serialtest/unittests DEPFLAGS = -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td -EXT = +EXT = .so UNAME := $(shell uname) -ifneq (, $(findstring mingw, $(UNAME))) - EXT += exe +ifneq (, $(findstring MINGW, $(UNAME))) + EXT = .dll endif -ifneq (, $(findstring cygwin, $(UNAME))) - EXT += exe +ifneq (, $(findstring CYGWIN, $(UNAME))) + EXT = .dll endif SRC = $(wildcard *.c) -EXE = $(patsubst %.c, $(UNITEXE)/%$(EXT), $(SRC)) +TESTFILES = $(patsubst %.c, $(UNITTESTS)/%$(EXT), $(SRC)) $(shell mkdir -p $(DEPDIR) >/dev/null) -test: $(EXE) - @for f in $^; do \ - echo "++++++++++++++++++"; \ - echo "Running unit tests"; \ - echo $$(basename $$f); \ - echo "++++++++++++++++++"; \ - echo ""; \ - $$f || exit 1; \ - echo ""; \ - echo "******************"; \ - echo ""; \ - done +test: $(TESTFILES) + @$(BUILDDIR)/cgreen/build-c/tools/cgreen-runner --color $(TESTFILES) -$(UNITEXE)/%$(EXT): $(UNITOBJ)/%.o - mkdir -p $(UNITEXE) +$(UNITTESTS)/%$(EXT): $(UNITOBJ)/%.o + mkdir -p $(UNITTESTS) $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS) $(UNITOBJ)/%.o : %.c |