From 1a323d1fcdb53f24fb03dc21a1068618d6650e73 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Tue, 14 Mar 2017 10:14:17 -0300 Subject: [PATCH] moved unit tests into sub directory --- tests/Makefile.inc | 32 ++++-------------------------- tests/{ => unit}/Makefile.gcov.inc | 2 +- tests/unit/Makefile.inc | 31 +++++++++++++++++++++++++++++ tests/{ => unit}/advio.c | 0 tests/{ => unit}/fpga.c | 0 tests/{ => unit}/hist.c | 0 tests/{ => unit}/list.c | 0 tests/{ => unit}/log.c | 0 tests/{ => unit}/main.c | 0 tests/{ => unit}/memory.c | 0 tests/{ => unit}/pool.c | 0 tests/{ => unit}/queue.c | 0 tests/{ => unit}/timing.c | 0 tests/{ => unit}/utils.c | 0 14 files changed, 36 insertions(+), 29 deletions(-) rename tests/{ => unit}/Makefile.gcov.inc (96%) create mode 100644 tests/unit/Makefile.inc rename tests/{ => unit}/advio.c (100%) rename tests/{ => unit}/fpga.c (100%) rename tests/{ => unit}/hist.c (100%) rename tests/{ => unit}/list.c (100%) rename tests/{ => unit}/log.c (100%) rename tests/{ => unit}/main.c (100%) rename tests/{ => unit}/memory.c (100%) rename tests/{ => unit}/pool.c (100%) rename tests/{ => unit}/queue.c (100%) rename tests/{ => unit}/timing.c (100%) rename tests/{ => unit}/utils.c (100%) diff --git a/tests/Makefile.inc b/tests/Makefile.inc index 277851453..c6a5df1e0 100644 --- a/tests/Makefile.inc +++ b/tests/Makefile.inc @@ -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 \ No newline at end of file +.PHONY: tests run-tests diff --git a/tests/Makefile.gcov.inc b/tests/unit/Makefile.gcov.inc similarity index 96% rename from tests/Makefile.gcov.inc rename to tests/unit/Makefile.gcov.inc index c8833625e..4d1a3e7f1 100644 --- a/tests/Makefile.gcov.inc +++ b/tests/unit/Makefile.gcov.inc @@ -1,4 +1,4 @@ -COVERAGE_TESTS = $(BUILDDIR)/testsuite +COVERAGE_TESTS = $(BUILDDIR)/unit-tests COVERAGE_OBJS = $(LIB_OBJS) $(SRC_OBJS) GCDAS = $(COVERAGE_OBJS:.o=.gcda) diff --git a/tests/unit/Makefile.inc b/tests/unit/Makefile.inc new file mode 100644 index 000000000..165f1e950 --- /dev/null +++ b/tests/unit/Makefile.inc @@ -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 \ No newline at end of file diff --git a/tests/advio.c b/tests/unit/advio.c similarity index 100% rename from tests/advio.c rename to tests/unit/advio.c diff --git a/tests/fpga.c b/tests/unit/fpga.c similarity index 100% rename from tests/fpga.c rename to tests/unit/fpga.c diff --git a/tests/hist.c b/tests/unit/hist.c similarity index 100% rename from tests/hist.c rename to tests/unit/hist.c diff --git a/tests/list.c b/tests/unit/list.c similarity index 100% rename from tests/list.c rename to tests/unit/list.c diff --git a/tests/log.c b/tests/unit/log.c similarity index 100% rename from tests/log.c rename to tests/unit/log.c diff --git a/tests/main.c b/tests/unit/main.c similarity index 100% rename from tests/main.c rename to tests/unit/main.c diff --git a/tests/memory.c b/tests/unit/memory.c similarity index 100% rename from tests/memory.c rename to tests/unit/memory.c diff --git a/tests/pool.c b/tests/unit/pool.c similarity index 100% rename from tests/pool.c rename to tests/unit/pool.c diff --git a/tests/queue.c b/tests/unit/queue.c similarity index 100% rename from tests/queue.c rename to tests/unit/queue.c diff --git a/tests/timing.c b/tests/unit/timing.c similarity index 100% rename from tests/timing.c rename to tests/unit/timing.c diff --git a/tests/utils.c b/tests/unit/utils.c similarity index 100% rename from tests/utils.c rename to tests/unit/utils.c