Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
Diff: features/frameworks/mbed-coap/Makefile.test
- Revision:
- 0:5b88d5760320
- Child:
- 1:9db0e321a9f4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/features/frameworks/mbed-coap/Makefile.test Tue Dec 17 23:23:45 2019 +0000 @@ -0,0 +1,73 @@ +# +# Makefile.test for combined COAP library unit tests +# + + +# List of subdirectories to build +TEST_FOLDER := ./test/ +# List of unit test directories for libraries +UNITTESTS := $(sort $(dir $(wildcard $(TEST_FOLDER)*/unittest/*))) +TESTDIRS := $(UNITTESTS:%=build-%) +CLEANTESTDIRS := $(UNITTESTS:%=clean-%) +COVERAGEFILE := ./lcov/coverage.info + +TEST_MODULES = ./test_modules +TEST_MODULE_MBED_TRACE = $(TEST_MODULES)/mbed-trace +TEST_MODULE_NANOSTACK = $(TEST_MODULES)/nanostack-libservice +TEST_MODULE_RANDLIB = $(TEST_MODULES)/mbed-client-randlib + +.PHONY: clone +clone: + if [ ! -d $(TEST_MODULES) ]; \ + then mkdir $(TEST_MODULES); \ + fi; + + if [ ! -d $(TEST_MODULE_MBED_TRACE) ]; \ + then git clone --depth 1 git@github.com:ARMmbed/mbed-trace.git $(TEST_MODULE_MBED_TRACE); \ + fi; + + if [ ! -d $(TEST_MODULE_NANOSTACK) ]; \ + then git clone --depth 1 git@github.com:ARMmbed/nanostack-libservice.git $(TEST_MODULE_NANOSTACK); \ + fi; + + if [ ! -d $(TEST_MODULE_RANDLIB) ]; \ + then git clone --depth 1 git@github.com:ARMmbed/mbed-client-randlib.git $(TEST_MODULE_RANDLIB); \ + fi; +.PHONY: test +test: $(TESTDIRS) + @rm -rf ./lcov + @rm -rf ./coverage + @mkdir -p lcov + @mkdir -p lcov/results + @mkdir coverage + @find ./test -name '*.xml' | xargs cp -t ./lcov/results/ + @rm -f lcov/index.xml + @./xsl_script.sh + @cp junit_xsl.xslt lcov/. + @xsltproc -o lcov/testresults.html lcov/junit_xsl.xslt lcov/index.xml + @rm -f lcov/junit_xsl.xslt + @rm -f lcov/index.xml + @find ./ -name '*.gcno' | xargs cp --backup=numbered -t ./coverage/ + @find ./ -name '*.gcda' | xargs cp --backup=numbered -t ./coverage/ + @gcovr --object-directory ./coverage --exclude-unreachable-branches -e '.*/builds/.*' -e '.*/test/.*' -e '.*/stubs/.*' -e '.*/mbed-coap/.*' -x -o ./lcov/gcovr.xml + @lcov -d test/. -c -o $(COVERAGEFILE) + @lcov -q -r $(COVERAGEFILE) "/usr*" -o $(COVERAGEFILE) + @lcov -q -r $(COVERAGEFILE) "/test*" -o $(COVERAGEFILE) + @lcov -q -r $(COVERAGEFILE) "/mbed-client-libservice*" -o $(COVERAGEFILE) + @genhtml -q $(COVERAGEFILE) --show-details --output-directory lcov/html + @echo mbed-coap module unit tests built + +$(TESTDIRS): + @make -C $(@:build-%=%) + +$(CLEANDIRS): + @make -C $(@:clean-%=%) clean + +$(CLEANTESTDIRS): + @make -C $(@:clean-%=%) clean + +# Extend default clean rule +clean: clean-extra + +clean-extra: $(CLEANDIRS) \ + $(CLEANTESTDIRS)