Test: Mask unit test warning (#592)

* Test: Mask unit test warning

* Fix Unit Test Bug

* Unit Test: Add setters and getters for xMaskAssertAndAbort

* Fix Warning

* Update Makefile
This commit is contained in:
alfred gedeon 2021-05-27 16:26:31 -07:00 committed by GitHub
parent 459a6cbb4c
commit 5136a30399
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 6 deletions

View file

@ -35,7 +35,8 @@ MOCK_FILES_FP += $(PROJECT_DIR)/list_macros.h
CPPFLAGS += -DportUSING_MPU_WRAPPERS=0 CPPFLAGS += -DportUSING_MPU_WRAPPERS=0
# List any addiitonal flags needed by the compiler # List any addiitonal flags needed by the compiler
CFLAGS += -include list_macros.h CFLAGS += -include list_macros.h
CFLAGS += -Wno-incompatible-pointer-types
# Try not to edit beyond this line unless necessary. # Try not to edit beyond this line unless necessary.

View file

@ -54,7 +54,16 @@ static size_t uxLastMallocSize = 0;
static void * pLastFreedAddress = 0; static void * pLastFreedAddress = 0;
static uint32_t ulNumMallocCalls = 0; static uint32_t ulNumMallocCalls = 0;
/* ========================== CALLBACK FUNCTIONS =========================== */ /* =========================== HELPER FUNCTIONS =========================== */
void setxMaskAssertAndAbort( bool mask )
{
xMaskAssertAndAbort = mask;
}
bool getxMaskAssertAndAbort( )
{
return xMaskAssertAndAbort;
}
/* ========================== CALLBACK FUNCTIONS ========================== */
void * pvPortMalloc( size_t xSize ) void * pvPortMalloc( size_t xSize )
{ {

View file

@ -68,8 +68,10 @@
#define TICKS_TO_WAIT 10 #define TICKS_TO_WAIT 10
#define NUM_CALLS_TO_INTERCEPT TICKS_TO_WAIT / 2 #define NUM_CALLS_TO_INTERCEPT TICKS_TO_WAIT / 2
/* =========================== FUNCTION PROTOTYPES ======================== */
void setxMaskAssertAndAbort( bool mask );
bool getxMaskAssertAndAbort( );
/* ============================ GLOBAL VARIABLES =========================== */ /* ============================ GLOBAL VARIABLES =========================== */
bool xMaskAssertAndAbort;
/* ================================= MACROS ================================ */ /* ================================= MACROS ================================ */
@ -82,7 +84,7 @@ bool xMaskAssertAndAbort;
#define EXPECT_ASSERT_BREAK( call ) \ #define EXPECT_ASSERT_BREAK( call ) \
do \ do \
{ \ { \
xMaskAssertAndAbort = true; \ setxMaskAssertAndAbort( true ); \
CEXCEPTION_T e = CEXCEPTION_NONE; \ CEXCEPTION_T e = CEXCEPTION_NONE; \
Try \ Try \
{ \ { \

View file

@ -175,7 +175,7 @@ void test_vQueueAddToRegistry_twice( void )
const char * pcFakeString1 = ( char * ) ( BaseType_t ) getNextMonotonicTestValue(); const char * pcFakeString1 = ( char * ) ( BaseType_t ) getNextMonotonicTestValue();
const char * pcFakeString2 = ( char * ) ( BaseType_t ) getNextMonotonicTestValue(); const char * pcFakeString2 = ( char * ) ( BaseType_t ) getNextMonotonicTestValue();
/* Add an item to the registry **/ /* Add an item to the registry */
vQueueAddToRegistry( xFakeHandle, pcFakeString1 ); vQueueAddToRegistry( xFakeHandle, pcFakeString1 );
TEST_ASSERT_TRUE( helper_find_in_queue_registry( xFakeHandle, pcFakeString1 ) ); TEST_ASSERT_TRUE( helper_find_in_queue_registry( xFakeHandle, pcFakeString1 ) );

View file

@ -131,7 +131,7 @@ $(PROJ_DIR)/%.i : $(KERNEL_DIR)/%.c
# compile the project objects with coverage instrumented # compile the project objects with coverage instrumented
$(PROJ_DIR)/%.o : $(PROJ_DIR)/%.i $(PROJ_DIR)/%.o : $(PROJ_DIR)/%.i
$(CC) -c $< $(CPPFLAGS) $(INCLUDE_DIR) $(GCC_COV_OPTS) -o $@ $(CC) -c $< $(CPPFLAGS) $(CFLAGS) $(INCLUDE_DIR) $(GCC_COV_OPTS) -o $@
# Build mock objects # Build mock objects
$(SCRATCH_DIR)/mock_%.o : $(MOCKS_DIR)/mock_%.c $(SCRATCH_DIR)/mock_%.o : $(MOCKS_DIR)/mock_%.c