mbed-os

Fork of mbed-os by erkin yucel

Committer:
elessair
Date:
Sun Oct 23 15:10:02 2016 +0000
Revision:
0:f269e3021894
Initial commit

Who changed what in which revision?

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