Preliminary main mbed library for nexpaq development

Committer:
nexpaq
Date:
Fri Nov 04 20:27:58 2016 +0000
Revision:
0:6c56fb4bc5f0
Moving to library for sharing updates

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nexpaq 0:6c56fb4bc5f0 1 #
nexpaq 0:6c56fb4bc5f0 2 # Makefile.test for combined NSDL+COAP library unit tests
nexpaq 0:6c56fb4bc5f0 3 #
nexpaq 0:6c56fb4bc5f0 4
nexpaq 0:6c56fb4bc5f0 5
nexpaq 0:6c56fb4bc5f0 6 # List of subdirectories to build
nexpaq 0:6c56fb4bc5f0 7 TEST_FOLDER := ./test/
nexpaq 0:6c56fb4bc5f0 8 # List of unit test directories for libraries
nexpaq 0:6c56fb4bc5f0 9 UNITTESTS := $(sort $(dir $(wildcard $(TEST_FOLDER)*/unittest/*)))
nexpaq 0:6c56fb4bc5f0 10 TESTDIRS := $(UNITTESTS:%=build-%)
nexpaq 0:6c56fb4bc5f0 11 CLEANTESTDIRS := $(UNITTESTS:%=clean-%)
nexpaq 0:6c56fb4bc5f0 12 COVERAGEFILE := ./lcov/coverage.info
nexpaq 0:6c56fb4bc5f0 13
nexpaq 0:6c56fb4bc5f0 14 .PHONY: test
nexpaq 0:6c56fb4bc5f0 15 test: $(TESTDIRS)
nexpaq 0:6c56fb4bc5f0 16 @rm -rf ./lcov
nexpaq 0:6c56fb4bc5f0 17 @rm -rf ./coverage
nexpaq 0:6c56fb4bc5f0 18 @mkdir -p lcov
nexpaq 0:6c56fb4bc5f0 19 @mkdir -p lcov/results
nexpaq 0:6c56fb4bc5f0 20 @mkdir coverage
nexpaq 0:6c56fb4bc5f0 21 @find ./test -name '*.xml' | xargs cp -t ./lcov/results/
nexpaq 0:6c56fb4bc5f0 22 @rm -f lcov/index.xml
nexpaq 0:6c56fb4bc5f0 23 @./xsl_script.sh
nexpaq 0:6c56fb4bc5f0 24 @cp junit_xsl.xslt lcov/.
nexpaq 0:6c56fb4bc5f0 25 @xsltproc -o lcov/testresults.html lcov/junit_xsl.xslt lcov/index.xml
nexpaq 0:6c56fb4bc5f0 26 @rm -f lcov/junit_xsl.xslt
nexpaq 0:6c56fb4bc5f0 27 @rm -f lcov/index.xml
nexpaq 0:6c56fb4bc5f0 28 @find ./ -name '*.gcno' | xargs cp --backup=numbered -t ./coverage/
nexpaq 0:6c56fb4bc5f0 29 @find ./ -name '*.gcda' | xargs cp --backup=numbered -t ./coverage/
nexpaq 0:6c56fb4bc5f0 30 @gcovr --object-directory ./coverage --exclude-unreachable-branches -e '.*/builds/.*' -e '.*/test/.*' -e '.*/yotta_modules/.*' -e '.*/stubs/.*' -e '.*/mbed-client-c/.*' -x -o ./lcov/gcovr.xml
nexpaq 0:6c56fb4bc5f0 31 @lcov -d test/. -c -o $(COVERAGEFILE)
nexpaq 0:6c56fb4bc5f0 32 @lcov -q -r $(COVERAGEFILE) "/usr*" -o $(COVERAGEFILE)
nexpaq 0:6c56fb4bc5f0 33 @lcov -q -r $(COVERAGEFILE) "/test*" -o $(COVERAGEFILE)
nexpaq 0:6c56fb4bc5f0 34 @lcov -q -r $(COVERAGEFILE) "/mbed-client-libservice*" -o $(COVERAGEFILE)
nexpaq 0:6c56fb4bc5f0 35 @genhtml -q $(COVERAGEFILE) --show-details --output-directory lcov/html
nexpaq 0:6c56fb4bc5f0 36 @echo mbed-client-c module unit tests built
nexpaq 0:6c56fb4bc5f0 37
nexpaq 0:6c56fb4bc5f0 38 $(TESTDIRS):
nexpaq 0:6c56fb4bc5f0 39 @make -C $(@:build-%=%)
nexpaq 0:6c56fb4bc5f0 40
nexpaq 0:6c56fb4bc5f0 41 $(CLEANDIRS):
nexpaq 0:6c56fb4bc5f0 42 @make -C $(@:clean-%=%) clean
nexpaq 0:6c56fb4bc5f0 43
nexpaq 0:6c56fb4bc5f0 44 $(CLEANTESTDIRS):
nexpaq 0:6c56fb4bc5f0 45 @make -C $(@:clean-%=%) clean
nexpaq 0:6c56fb4bc5f0 46
nexpaq 0:6c56fb4bc5f0 47 # Extend default clean rule
nexpaq 0:6c56fb4bc5f0 48 clean: clean-extra
nexpaq 0:6c56fb4bc5f0 49
nexpaq 0:6c56fb4bc5f0 50 clean-extra: $(CLEANDIRS) \
nexpaq 0:6c56fb4bc5f0 51 $(CLEANTESTDIRS)