BBR 1 Ebene

Revision:
0:fbdae7e6d805
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os/features/cellular/Makefile.test	Mon May 14 11:29:06 2018 +0000
@@ -0,0 +1,56 @@
+#
+# Makefile.test for CIot library unit tests
+#
+
+
+# List of subdirectories to build
+TEST_FOLDER_NAME := UNITTESTS
+TEST_FOLDER := ./UNITTESTS/
+# List of unit test directories for libraries
+UNITTESTS := $(sort $(dir $(wildcard $(TEST_FOLDER)*)))
+TESTDIRS := $(UNITTESTS:%=build-%)
+CLEANTESTDIRS := $(UNITTESTS:%=clean-%)
+COVERAGEFILE := ./lcov/coverage.info
+
+.PHONY: test
+test: $(TESTDIRS)
+	@rm -rf ./lcov
+	@rm -rf ./coverage
+	@mkdir -p lcov
+	@mkdir -p lcov/results
+	@mkdir coverage
+	@find $(TEST_FOLDER) -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_FOLDER_NAME)/.*' -e '.*/yotta_modules/.*' -e '.*/stubs/.*' -e '.*/mbed-coap/.*' -x -o ./lcov/gcovr.xml
+	@lcov -d $(TEST_FOLDER_NAME)/. -c -o $(COVERAGEFILE)
+	@lcov -q -r $(COVERAGEFILE) "/usr*" -o $(COVERAGEFILE)
+	@lcov -q -r $(COVERAGEFILE) "/$(TEST_FOLDER_NAME)*" -o $(COVERAGEFILE)
+	@lcov -q -r $(COVERAGEFILE) "/mbed-client-libservice*" -o $(COVERAGEFILE)
+	@lcov -q -r $(COVERAGEFILE) "/mbed-client*" -o $(COVERAGEFILE)
+	@lcov -q -r $(COVERAGEFILE) "/mbed-os/events*" -o $(COVERAGEFILE)
+	@lcov -q -r $(COVERAGEFILE) "/mbed-os/features/netsocket*" -o $(COVERAGEFILE)
+	@lcov -q -r $(COVERAGEFILE) "/mbed-os/platform*" -o $(COVERAGEFILE)
+	@genhtml -q $(COVERAGEFILE) --output-directory lcov/html
+	@echo mbed-ciot 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)