Add test coverate for RT tests

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@15349 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
akscram 2022-01-13 08:28:21 +00:00
parent fd36069ca6
commit 71ea0d8a36
38 changed files with 957 additions and 2 deletions

43
test/rt/variant/cfg.mk Normal file
View File

@ -0,0 +1,43 @@
##############################################################################
# Options for test configurations
#
DEFS_CFG1 =
DEFS_CFG2 = -DCH_CFG_OPTIMIZE_SPEED=FALSE
DEFS_CFG3 = -DCH_CFG_TIME_QUANTUM=0
DEFS_CFG4 = -DCH_CFG_USE_REGISTRY=FALSE -DCH_CFG_USE_DYNAMIC=FALSE
DEFS_CFG5 = -DCH_CFG_USE_TM=FALSE
DEFS_CFG6 = -DCH_CFG_USE_SEMAPHORES=FALSE -DCH_CFG_USE_MAILBOXES=FALSE -DCH_CFG_USE_OBJ_FIFOS=FALSE -DCH_CFG_USE_OBJ_CACHES=FALSE -DCH_CFG_USE_JOBS=FALSE
DEFS_CFG7 = -DCH_CFG_USE_SEMAPHORES_PRIORITY=TRUE
DEFS_CFG8 = -DCH_CFG_USE_MUTEXES=FALSE -DCH_CFG_USE_CONDVARS=FALSE
DEFS_CFG9 = -DCH_CFG_USE_MUTEXES_RECURSIVE=TRUE
DEFS_CFG10 = -DCH_CFG_USE_CONDVARS=FALSE
DEFS_CFG11 = -DCH_CFG_USE_CONDVARS_TIMEOUT=FALSE
DEFS_CFG12 = -DCH_CFG_USE_EVENTS=FALSE
DEFS_CFG13 = -DCH_CFG_USE_EVENTS_TIMEOUT=FALSE
DEFS_CFG14 = -DCH_CFG_USE_MESSAGES=FALSE -DCH_CFG_USE_DELEGATES=FALSE
DEFS_CFG15 = -DCH_CFG_USE_MESSAGES_PRIORITY=TRUE
DEFS_CFG16 = -DCH_CFG_USE_MAILBOXES=FALSE -DCH_CFG_USE_OBJ_FIFOS=FALSE -DCH_CFG_USE_JOBS=FALSE
DEFS_CFG17 = -DCH_CFG_USE_MEMCORE=FALSE -DCH_CFG_USE_MEMPOOLS=FALSE -DCH_CFG_USE_HEAP=FALSE -DCH_CFG_USE_DYNAMIC=FALSE -DCH_CFG_USE_OBJ_FIFOS=FALSE -DCH_CFG_USE_JOBS=FALSE -DCH_CFG_USE_FACTORY=FALSE
DEFS_CFG18 = -DCH_CFG_USE_MEMPOOLS=FALSE -DCH_CFG_USE_HEAP=FALSE -DCH_CFG_USE_DYNAMIC=FALSE -DCH_CFG_USE_OBJ_FIFOS=FALSE -DCH_CFG_USE_JOBS=FALSE -DCH_CFG_USE_FACTORY=FALSE
DEFS_CFG19 = -DCH_CFG_USE_MEMPOOLS=FALSE -DCH_CFG_USE_OBJ_FIFOS=FALSE -DCH_CFG_USE_JOBS=FALSE -DCH_CFG_USE_FACTORY=FALSE
DEFS_CFG20 = -DCH_CFG_USE_HEAP=FALSE -DCH_CFG_USE_FACTORY=FALSE
DEFS_CFG21 = -DCH_CFG_USE_DYNAMIC=FALSE
DEFS_CFG22 = -DCH_DBG_STATISTICS=TRUE
DEFS_CFG23 = -DCH_DBG_SYSTEM_STATE_CHECK=TRUE
DEFS_CFG24 = -DCH_DBG_ENABLE_CHECKS=TRUE
DEFS_CFG25 = -DCH_DBG_ENABLE_ASSERTS=TRUE
DEFS_CFG26 = -DCH_DBG_TRACE_MASK=CH_DBG_TRACE_MASK_ALL
#DEFS_CFG27 = -DCH_DBG_ENABLE_STACK_CHECK=TRUE
DEFS_CFG28 = -DCH_DBG_FILL_THREADS=TRUE
DEFS_CFG29 = -DCH_DBG_THREADS_PROFILING=FALSE
DEFS_CFG30 = -DCH_DBG_SYSTEM_STATE_CHECK=TRUE -DCH_DBG_ENABLE_CHECKS=TRUE -DCH_DBG_ENABLE_ASSERTS=TRUE -DCH_DBG_TRACE_MASK=CH_DBG_TRACE_MASK_ALL -DCH_DBG_FILL_THREADS=TRUE
DEFS_CFG31 = -DCH_CFG_ST_RESOLUTION=16
DEFS_CFG32 = -DCH_CFG_ST_RESOLUTION=16 -DCH_CFG_INTERVALS_SIZE=64
DEFS_CFG33 = -DCH_CFG_INTERVALS_SIZE=64
DEFS_CFG34 = -DCH_CFG_USE_OBJ_FIFOS=FALSE
DEFS_CFG35 = -DCH_CFG_USE_FACTORY=FALSE
#
# Options for test configurations
##############################################################################

181
test/rt/variant/common.mk Normal file
View File

@ -0,0 +1,181 @@
##############################################################################
# Build global options
# NOTE: Can be overridden externally.
#
# Compiler options here.
ifeq ($(USE_OPT),)
USE_OPT = $(XOPT) -m32
endif
# C specific options here (added to USE_OPT).
ifeq ($(USE_COPT),)
USE_COPT =
endif
# C++ specific options here (added to USE_OPT).
ifeq ($(USE_CPPOPT),)
USE_CPPOPT = -fno-rtti
endif
# Enable this if you want the linker to remove unused code and data.
ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
# Linker extra options here.
ifeq ($(USE_LDOPT),)
USE_LDOPT =
endif
# Enable this if you want link time optimizations (LTO).
ifeq ($(USE_LTO),)
USE_LTO = no
endif
# Enable this if you want to see the full log while compiling.
ifeq ($(USE_VERBOSE_COMPILE),)
USE_VERBOSE_COMPILE = no
endif
# If enabled, this option makes the build process faster by not compiling
# modules not used in the current configuration.
ifeq ($(USE_SMART_BUILD),)
USE_SMART_BUILD = no
endif
#
# Build global options
##############################################################################
##############################################################################
# Architecture or project specific options
#
XDEFS = $(DEFS_$(CFG))
XOPT = -O0 -fomit-frame-pointer -fprofile-arcs -ftest-coverage
#
# Architecture or project specific options
##############################################################################
##############################################################################
# Project, sources and paths
#
# Define project name here
PROJECT = ch
# Imported source files and paths
BUILDDIR := ./build
DEPDIR := ./.dep
CONFDIR := $(CHIBIOS)/test/rt/testbuild
# Licensing files.
include $(CHIBIOS)/os/license/license.mk
# Startup files.
# HAL-OSAL files (optional).
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS)/os/hal/boards/simulator/board.mk
include $(CHIBIOS)/os/hal/ports/simulator/posix/platform.mk
include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk
# RTOS files (optional).
include $(CHIBIOS)/os/rt/rt.mk
include $(CHIBIOS)/os/common/ports/SIMIA32/compilers/GCC/port.mk
# Other files (optional).
include $(CHIBIOS)/os/test/test.mk
include $(CHIBIOS)/test/rt/rt_test.mk
include $(CHIBIOS)/test/oslib/oslib_test.mk
#include $(CHIBIOS)/os/hal/lib/streams/streams.mk
#include $(CHIBIOS)/os/various/shell/shell.mk
# C sources here.
CSRC = $(ALLCSRC) \
$(TESTSRC) \
$(CONFDIR)/main.c
# C++ sources here.
CPPSRC = $(ALLCPPSRC)
# List ASM source files here.
ASMSRC = $(ALLASMSRC)
ASMXSRC = $(ALLXASMSRC)
INCDIR = $(CONFDIR) $(ALLINC) $(TESTINC)
# GCOV files.
GCOVSRC = $(KERNSRC)
#
# Project, sources and paths
##############################################################################
##############################################################################
# Start of user section
#
# List all user C define here, like -D_DEBUG=1
UDEFS = -DSIMULATOR -DTEST_CFG_SIZE_REPORT=0 -DTEST_DELAY_BETWEEN_TESTS=0 $(XDEFS)
# Define ASM defines here
UADEFS =
# List all user directories here
UINCDIR =
# List the user directory to look for the libraries here
ULIBDIR =
# List all user libraries here
ULIBS =
#
# End of user defines
##############################################################################
##############################################################################
# Compiler settings
#
TRGT =
CC = $(TRGT)gcc
CPPC = $(TRGT)g++
# Enable loading with g++ only if you need C++ runtime support.
# NOTE: You can use C++ even without C++ support if you are careful. C++
# runtime support makes code size explode.
LD = $(TRGT)gcc
#LD = $(TRGT)g++
CP = $(TRGT)objcopy
AS = $(TRGT)gcc -x assembler-with-cpp
AR = $(TRGT)ar
OD = $(TRGT)objdump
SZ = $(TRGT)size
HEX = $(CP) -O ihex
BIN = $(CP) -O binary
COV = gcov
# Define C warning options here
CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes -Wcast-align=strict
# Define C++ warning options here
CPPWARN = -Wall -Wextra -Wundef
#
# Compiler settings
##############################################################################
##############################################################################
# Rules
#
RULESPATH = $(CHIBIOS)/os/common/startup/SIMIA32/compilers/GCC
include $(RULESPATH)/rules.mk
.PHONY: test
test:
$(BUILDDIR)/$(PROJECT) | tee $(BUILDDIR)/test
@[ $$(grep -c "Final result: SUCCESS" $(BUILDDIR)/test) -eq 2 ] || exit 1
#
# Rules
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG1
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG10
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG11
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG12
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG13
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG14
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG15
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG16
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG17
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG18
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG19
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG2
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG20
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG21
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG22
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG23
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG24
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG25
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG26
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG28
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG29
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG3
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG30
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG31
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG32
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG33
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG34
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG35
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG4
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG5
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG6
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG7
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG8
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -0,0 +1,21 @@
##############################################################################
# Project options
#
CFG := CFG9
CHIBIOS = ../../../../..
#
# Project options
##############################################################################
##############################################################################
# Common options
#
include $(CHIBIOS)/test/rt/variant/cfg.mk
include $(CHIBIOS)/test/rt/variant/common.mk
#
# Common options
##############################################################################

View File

@ -4,8 +4,9 @@
ROOT := $(realpath ../..)
# Directories to store results of tests and docs
TEST_RESULTS := $(ROOT)/test_results
COVERAGE_RESULTS := $(ROOT)/coverage_results
DOC_RESULTS := $(ROOT)/doc_results
TEST_RESULTS := $(ROOT)/test_results
# Directory with auxiliary scripts
WORKFLOWS := $(ROOT)/tools/workflows
@ -47,7 +48,7 @@ else
makefile_venv :=
endif
.PHONY : all makefiles external docs info lint clean venv
.PHONY : all makefiles external docs info lint coverage clean venv
.PHONY : $(makefiles) $(linters) $(docs)
# Build makefile based projects
@ -121,9 +122,17 @@ $(venv_activate) :
-r $(WORKFLOWS)/requirements.txt \
-c $(WORKFLOWS)/constraints.txt
# Generate test coverage report
coverage :
@mkdir -p $(COVERAGE_RESULTS)
gcovr -r $(ROOT) \
--use-gcov-files --gcov-ignore-parse-errors \
--xml-pretty --xml $(COVERAGE_RESULTS)/coverage.xml
# Clean up results of tests and docs
clean :
rm -rf $(TEST_RESULTS)
rm -rf $(COVERAGE_RESULTS)
rm -rf $(DOC_RESULTS)
rm -rf $(external)
rm -rf $(venv)

View File

@ -7,5 +7,13 @@ demos/various/RT-ARMCM4-MAKELIB/Makefile:
- lib
- clean
# This makefile is intended to be run manually to test all STM32WLxx related
# testhal projects. So, there is no need to test its targets in CI.
testhal/STM32/STM32WLxx/Makefile: []
# Build different RT configuration variants and generate gcov files.
test/rt/variant/make:
- all
- test
- gcov
- clean