BBR 1 Ebene

mbed-os/features/cellular/Makefile.test

Committer:
borlanic
Date:
2018-05-14
Revision:
0:fbdae7e6d805

File content as of revision 0:fbdae7e6d805:

#
# 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)