diff --git a/modules/sb/ut-coverage/sb_UT.c b/modules/sb/ut-coverage/sb_UT.c index fa002161b..b31faa4e5 100644 --- a/modules/sb/ut-coverage/sb_UT.c +++ b/modules/sb/ut-coverage/sb_UT.c @@ -1646,6 +1646,7 @@ void Test_CreatePipe_API(void) SB_UT_ADD_SUBTEST(Test_CreatePipe_MaxPipes); SB_UT_ADD_SUBTEST(Test_CreatePipe_SamePipeName); SB_UT_ADD_SUBTEST(Test_CreatePipe_EmptyPipeName); + SB_UT_ADD_SUBTEST(Test_CreatePipe_PipeName_NullPtr); } /* @@ -1804,9 +1805,9 @@ void Test_CreatePipe_SamePipeName(void) */ void Test_CreatePipe_EmptyPipeName(void) { - CFE_SB_PipeId_t PipeId = SB_UT_PIPEID_0; - uint16 PipeDepth = 1; - char PipeName[] = ""; + CFE_SB_PipeId_t PipeId = SB_UT_PIPEID_0; + uint16 PipeDepth = 1; + char PipeName[] = ""; /* Call to CFE_SB_CreatePipe with empty PipeName should fail */ UtAssert_INT32_EQ(CFE_SB_CreatePipe(&PipeId, PipeDepth, PipeName), CFE_SB_BAD_ARGUMENT); @@ -1815,6 +1816,27 @@ void Test_CreatePipe_EmptyPipeName(void) } /* + +** Test create pipe response to a null pipe name pointer. +*/ +void Test_CreatePipe_PipeName_NullPtr(void) +{ + CFE_SB_PipeId_t PipeId = SB_UT_PIPEID_0; + uint16 PipeDepth = 1; + + /* To fail the pipe create, force the OS_QueueCreate call to return some + * type of error code. + */ + UT_SetDeferredRetcode(UT_KEY(OS_QueueCreate), 1, OS_ERR_NO_FREE_IDS); + + /* Call to CFE_SB_CreatePipe with empty PipeName should fail */ + UtAssert_INT32_EQ(CFE_SB_CreatePipe(&PipeId, PipeDepth, NULL), CFE_SB_PIPE_CR_ERR); + + UtAssert_INT32_EQ(CFE_SB_Global.HKTlmMsg.Payload.CreatePipeErrorCounter, 1); +} + +/* + ** Function for calling SB delete pipe API test functions */ void Test_DeletePipe_API(void) diff --git a/modules/sb/ut-coverage/sb_UT.h b/modules/sb/ut-coverage/sb_UT.h index 6a4f59270..45e15fcf3 100644 --- a/modules/sb/ut-coverage/sb_UT.h +++ b/modules/sb/ut-coverage/sb_UT.h @@ -1198,6 +1198,21 @@ void Test_CreatePipe_InvalPipeDepth(void); ******************************************************************************/ void Test_CreatePipe_EmptyPipeName(void); +/*****************************************************************************/ +/** +** \brief Test create pipe response to a NULL pipe name +** +** \par Description +** This function tests the create pipe response to a null pipe name pointer. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \returns +** This function does not return a value. +******************************************************************************/ +void Test_CreatePipe_PipeName_NullPtr(void); + /*****************************************************************************/ /** ** \brief Test create pipe response to a pipe name longer than allowed