diff options
author | Stewart Smith <stewart@linux.vnet.ibm.com> | 2014-12-18 18:21:29 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2014-12-18 18:21:29 +1100 |
commit | c652989453649b8d27f85dcfb882efcec8dbf64d (patch) | |
tree | d6e881c2017b4355ffd08cc0c85ca7f7c2395fd7 /ccan/Makefile.check | |
parent | 1f91d6796676dc75188011f6ef4d09fc8dd81a29 (diff) | |
download | blackbird-skiboot-c652989453649b8d27f85dcfb882efcec8dbf64d.tar.gz blackbird-skiboot-c652989453649b8d27f85dcfb882efcec8dbf64d.zip |
Run the CCAN unit tests and add to coverage-report
With some fun Makefile rules, we can pick up all CCAN unit tests.
We exclude the unit test source files from the lcov report itself.
Add skeleton ccan config.h and tap.h that are enough for us to build
and run the test suite. Currently, the minimalist versions should
be fine (and we don't need CCAN configurator).
Also includes -Werror fixes for ccan tests.
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'ccan/Makefile.check')
-rw-r--r-- | ccan/Makefile.check | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/ccan/Makefile.check b/ccan/Makefile.check new file mode 100644 index 00000000..767b3381 --- /dev/null +++ b/ccan/Makefile.check @@ -0,0 +1,43 @@ +CCAN_TEST_SRC := $(wildcard ccan/*/test/run*.c) + +LCOV_EXCLUDE += $(CCAN_TEST_SRC) ccan/list/test/helper.c + +CCAN_TEST := $(CCAN_TEST_SRC:%.c=%) + + +.PHONY: $(CCAN_TEST:%=%-gcov-run) ccan-check + +ccan-check: $(CCAN_TEST:%=%-check) + +check: ccan-check $(CCAN_TEST:%=%-gcov-run) + +.PHONY: ccan-coverage + +coverage: ccan-coverage + +ccan-coverage: $(CCAN_TEST:%=%-gcov-run) + +$(CCAN_TEST:%=%-gcov-run) : %-run: % + $(eval LCOV_DIRS += -d $(dir $<) ) + $(call Q, TEST-COVERAGE , (cd $(dir $<); GCOV_PREFIX_STRIP=`(c=0; while [ "\`pwd\`" != '/' ]; do cd ..; c=\`expr 1 + $$c\`; done; echo $$c)` ./$(notdir $<) ), $< ) + +$(CCAN_TEST:%=%-check) : %-check: % + $(call Q, RUN-TEST , $(VALGRIND) $<, $<) + +$(CCAN_TEST) : % : %.c + $(call Q, HOSTCC ,$(HOSTCC) $(HOSTCFLAGS) -O0 -g -I . -Iccan/ -o $@ $<,$<) + +$(CCAN_TEST:%=%-gcov): %-gcov : %.c + $(call Q, HOSTCC , (cd $(dir $<); $(HOSTCC) $(HOSTCFLAGS) -fprofile-arcs -ftest-coverage -O0 -g -I $(shell pwd) -I$(shell pwd)/./ccan/ -pg -o $(notdir $@) $(notdir $<) ), $<) + +-include $(wildcard ccan/*/test/*.d) + +clean: ccan-test-clean + +ccan-test-clean: + $(RM) -f $(CCAN_TEST) \ + $(CCAN_TEST:%=%-gcov) \ + $(CCAN_TEST:%=%.d) \ + $(CCAN_TEST:%=%.o) \ + $(CCAN_TEST:%=%-gcov.gcda) \ + $(CCAN_TEST:%=%-gcov.gcno)
\ No newline at end of file |