mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-15 01:07:47 -04:00
Adding unit tests for stream buffer and message buffer (#528)
* Initial commit * Add more stream buffer tests * Adding message buffer tests * Adding tests to cover config assert branches Co-authored-by: alfred gedeon <28123637+alfred2g@users.noreply.github.com>
This commit is contained in:
parent
7020db5403
commit
e39c34ba7e
8 changed files with 2355 additions and 1 deletions
43
FreeRTOS/Test/CMock/stream_buffer/Makefile
Normal file
43
FreeRTOS/Test/CMock/stream_buffer/Makefile
Normal file
|
@ -0,0 +1,43 @@
|
|||
# indent with spaces
|
||||
.RECIPEPREFIX := $(.RECIPEPREFIX) $(.RECIPEPREFIX)
|
||||
|
||||
# Do not move this line below the include
|
||||
MAKEFILE_ABSPATH := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||
include ../makefile.in
|
||||
|
||||
# PROJECT_SRC lists the .c files under test
|
||||
PROJECT_SRC := stream_buffer.c
|
||||
|
||||
# PROJECT_DEPS_SRC list the .c file that are dependencies of PROJECT_SRC files
|
||||
# Files in PROJECT_DEPS_SRC are excluded from coverage measurements
|
||||
PROJECT_DEPS_SRC :=
|
||||
|
||||
# PROJECT_HEADER_DEPS: headers that should be excluded from coverage measurements.
|
||||
PROJECT_HEADER_DEPS := FreeRTOS.h
|
||||
|
||||
# SUITE_UT_SRC: .c files that contain test cases (must end in _utest.c)
|
||||
SUITE_UT_SRC := stream_buffer_utest.c
|
||||
|
||||
# SUITE_SUPPORT_SRC: .c files used for testing that do not contain test cases.
|
||||
# Paths are relative to PROJECT_DIR
|
||||
SUITE_SUPPORT_SRC :=
|
||||
|
||||
# List the headers used by PROJECT_SRC that you would like to mock
|
||||
MOCK_FILES_FP := $(KERNEL_DIR)/include/task.h
|
||||
MOCK_FILES_FP += $(UT_ROOT_DIR)/config/fake_assert.h
|
||||
MOCK_FILES_FP += $(UT_ROOT_DIR)/config/fake_port.h
|
||||
|
||||
# List any addiitonal flags needed by the preprocessor
|
||||
CPPFLAGS += -DportUSING_MPU_WRAPPERS=0
|
||||
|
||||
# List any addiitonal flags needed by the compiler
|
||||
CFLAGS +=
|
||||
|
||||
# Try not to edit beyond this line unless necessary.
|
||||
|
||||
# Project is determined based on path: $(UT_ROOT_DIR)/$(PROJECT)
|
||||
PROJECT := $(lastword $(subst /, ,$(dir $(abspath $(MAKEFILE_ABSPATH)))))
|
||||
|
||||
export
|
||||
|
||||
include ../testdir.mk
|
32
FreeRTOS/Test/CMock/stream_buffer/stream_buffer.yml
Normal file
32
FreeRTOS/Test/CMock/stream_buffer/stream_buffer.yml
Normal file
|
@ -0,0 +1,32 @@
|
|||
:cmock:
|
||||
:mock_prefix: mock_
|
||||
:when_no_prototypes: :warn
|
||||
:treat_externs: :include
|
||||
:enforce_strict_ordering: TRUE
|
||||
:plugins:
|
||||
- :ignore
|
||||
- :ignore_arg
|
||||
- :expect_any_args
|
||||
- :array
|
||||
- :callback
|
||||
- :return_thru_ptr
|
||||
:callback_include_count: true # include a count arg when calling the callback
|
||||
:callback_after_arg_check: false # check arguments before calling the callback
|
||||
:treat_as:
|
||||
uint8: HEX8
|
||||
uint16: HEX16
|
||||
uint32: UINT32
|
||||
int8: INT8
|
||||
bool: UINT8
|
||||
:includes: # This will add these includes to each mock.
|
||||
- <stdbool.h>
|
||||
- "FreeRTOS.h"
|
||||
:treat_externs: :exclude # Now the extern-ed functions will be mocked.
|
||||
:weak: __attribute__((weak))
|
||||
:verbosity: 3
|
||||
:attributes:
|
||||
- PRIVILEGED_FUNCTION
|
||||
:strippables:
|
||||
- PRIVILEGED_FUNCTION
|
||||
- portDONT_DISCARD
|
||||
:treat_externs: :include
|
1407
FreeRTOS/Test/CMock/stream_buffer/stream_buffer_utest.c
Normal file
1407
FreeRTOS/Test/CMock/stream_buffer/stream_buffer_utest.c
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue