FRDM K64F Metronome

Committer:
ram54288
Date:
Sun May 14 18:35:07 2017 +0000
Revision:
0:a2cb7295a1f7
Initial commit

Who changed what in which revision?

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