mirror of https://github.com/ARMmbed/mbed-os.git
66 lines
2.2 KiB
Makefile
66 lines
2.2 KiB
Makefile
# Copyright (c) 2015-2017, Arm Limited and affiliates.
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
#
|
|
# Makefile.test for COAP service 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
|
|
|
|
.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 '.*/yotta_modules/.*' -e '.*/stub/.*' -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)
|
|
@lcov -q -r $(COVERAGEFILE) "/libService*" -o $(COVERAGEFILE)
|
|
@genhtml -q $(COVERAGEFILE) --show-details --output-directory lcov/html
|
|
@echo coap-service 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)
|