FRDM K64F Metronome

Committer:
ram54288
Date:
Sun May 14 18:37:05 2017 +0000
Revision:
0:dbad57390bd1
Initial commit

Who changed what in which revision?

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