1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

moved unit tests into sub directory

This commit is contained in:
Steffen Vogel 2017-03-14 10:14:17 -03:00
parent 27f86f11ed
commit 1a323d1fcd
14 changed files with 36 additions and 29 deletions

View file

@ -1,31 +1,7 @@
TEST_SRCS = $(wildcard tests/*.c)
TEST_OBJS = $(patsubst %.c,$(BUILDDIR)/%.o,$(TEST_SRCS))
-include tests/unit/Makefile.inc
TEST_CFLAGS = $(CFLAGS)
TEST_LDFLAGS = $(LDFLAGS) -Wl,-rpath,'$$ORIGIN'
TEST_LDLIBS = $(LDLIBS) -lcriterion -lvillas -pthread
tests: unit-tests
tests: $(BUILDDIR)/testsuite
run-tests: run-unit-tests
run-tests: tests
$(BUILDDIR)/testsuite
# Compile
$(BUILDDIR)/tests/%.o: tests/%.c | $$(dir $$@)
$(CC) $(TEST_CFLAGS) -c $< -o $@
# Link
$(BUILDDIR)/testsuite: $(TEST_OBJS) | $(LIBS)
$(CC) $(TEST_LDFLAGS) $(TEST_LDLIBS) $^ -o $@
ifdef COVERAGE
-include tests/Makefile.gcov.inc
endif
# Tests are not installed
install-tests:
clean-tests:
rm -rf $(BUILDDIR)/tests $(BUILDDIR)/testsuite
.PHONY: tests install-tests clean-tests run-tests
.PHONY: tests run-tests

View file

@ -1,4 +1,4 @@
COVERAGE_TESTS = $(BUILDDIR)/testsuite
COVERAGE_TESTS = $(BUILDDIR)/unit-tests
COVERAGE_OBJS = $(LIB_OBJS) $(SRC_OBJS)
GCDAS = $(COVERAGE_OBJS:.o=.gcda)

31
tests/unit/Makefile.inc Normal file
View file

@ -0,0 +1,31 @@
TEST_SRCS = $(wildcard tests/unit/*.c)
TEST_OBJS = $(patsubst %.c,$(BUILDDIR)/%.o,$(TEST_SRCS))
TEST_CFLAGS = $(CFLAGS)
TEST_LDFLAGS = $(LDFLAGS) -Wl,-rpath,'$$ORIGIN'
TEST_LDLIBS = $(LDLIBS) -lcriterion -lvillas -pthread
unit-tests: $(BUILDDIR)/unit-tests
run-unit-tests: tests
$(BUILDDIR)/unit-tests
# Compile
$(BUILDDIR)/tests/unit/%.o: tests/unit/%.c | $$(dir $$@)
$(CC) $(TEST_CFLAGS) -c $< -o $@
# Link
$(BUILDDIR)/unit-tests: $(TEST_OBJS) | $(LIBS)
$(CC) $(TEST_LDFLAGS) $(TEST_LDLIBS) $^ -o $@
ifdef COVERAGE
-include tests/Makefile.gcov.inc
endif
# Tests are not installed
install-tests:
clean-tests:
rm -rf $(BUILDDIR)/tests $(BUILDDIR)/testsuite
.PHONY: unit-tests install-unit-tests clean-unit-tests run-unit-tests