Skip to content

Commit

Permalink
Partial #791, Addition unit test branch coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
skliper committed Jul 21, 2021
1 parent 002ff71 commit ecc9c9e
Show file tree
Hide file tree
Showing 10 changed files with 184 additions and 93 deletions.
44 changes: 43 additions & 1 deletion src/unit-test-coverage/portable/src/coveragetest-bsd-select.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,22 @@ void Test_OS_SelectSingle_Impl(void)
OSAPI_TEST_FUNCTION_RC(OS_SelectSingle_Impl, (&token, &SelectFlags, 0), OS_ERR_OPERATION_NOT_SUPPORTED);
UT_PortablePosixIOTest_Set_Selectable(UT_INDEX_0, true);
OSAPI_TEST_FUNCTION_RC(OS_SelectSingle_Impl, (&token, &SelectFlags, 0), OS_SUCCESS);

/* Cover FD_ISSET true branches and pend */
UT_SetDeferredRetcode(UT_KEY(OCS_FD_ISSET), 1, true);
UT_SetDeferredRetcode(UT_KEY(OCS_FD_ISSET), 1, true);
SelectFlags = OS_STREAM_STATE_READABLE | OS_STREAM_STATE_WRITABLE;
OSAPI_TEST_FUNCTION_RC(OS_SelectSingle_Impl, (&token, &SelectFlags, -1), OS_SUCCESS);

/* No flags and non-read/write flag branches */
SelectFlags = 0;
OSAPI_TEST_FUNCTION_RC(OS_SelectSingle_Impl, (&token, &SelectFlags, 0), OS_SUCCESS);
SelectFlags = OS_STREAM_STATE_BOUND;
OSAPI_TEST_FUNCTION_RC(OS_SelectSingle_Impl, (&token, &SelectFlags, 0), OS_SUCCESS);

/* try a case where select() needs to be repeated to achieve the desired wait time */
UT_ResetState(UT_KEY(OCS_clock_gettime));
UT_ResetState(UT_KEY(OCS_select));
UT_SetDefaultReturnValue(UT_KEY(OCS_select), -1);
OCS_errno = OCS_EINTR;
UT_SetDeferredRetcode(UT_KEY(OCS_select), 2, 0);
Expand All @@ -66,10 +76,22 @@ void Test_OS_SelectSingle_Impl(void)
latertime2.tv_sec = 2;
latertime2.tv_nsec = 200000000;
UT_SetDataBuffer(UT_KEY(OCS_clock_gettime), &nowtime, sizeof(nowtime), false);
UT_SetDataBuffer(UT_KEY(OCS_clock_gettime), &latertime, sizeof(latertime), false);
UT_SetDataBuffer(UT_KEY(OCS_clock_gettime), &latertime2, sizeof(latertime2), false);
OSAPI_TEST_FUNCTION_RC(OS_SelectSingle_Impl, (&token, &SelectFlags, 1200), OS_ERROR_TIMEOUT);
UtAssert_STUB_COUNT(OCS_clock_gettime, 3);
UtAssert_STUB_COUNT(OCS_select, 2);

/* Repeaded select with alternate branches */
OCS_errno = OCS_EAGAIN;
SelectFlags = OS_STREAM_STATE_READABLE | OS_STREAM_STATE_WRITABLE;
latertime2.tv_nsec = 300000000;
UT_SetDataBuffer(UT_KEY(OCS_clock_gettime), &nowtime, sizeof(nowtime), false);
UT_SetDataBuffer(UT_KEY(OCS_clock_gettime), &latertime, sizeof(latertime), false);
UT_SetDataBuffer(UT_KEY(OCS_clock_gettime), &latertime2, sizeof(latertime2), false);
OSAPI_TEST_FUNCTION_RC(OS_SelectSingle_Impl, (&token, &SelectFlags, 1200), OS_ERROR_TIMEOUT);
UtAssert_STUB_COUNT(OCS_clock_gettime, 6);
UtAssert_STUB_COUNT(OCS_select, 3);

UT_SetDefaultReturnValue(UT_KEY(OCS_select), 0);
SelectFlags = OS_STREAM_STATE_READABLE | OS_STREAM_STATE_WRITABLE;
Expand Down Expand Up @@ -107,19 +129,30 @@ void Test_OS_SelectMultiple_Impl(void)
*/
OS_FdSet ReadSet;
OS_FdSet WriteSet;
int i;

UT_PortablePosixIOTest_Set_FD(UT_INDEX_0, 0);
UT_PortablePosixIOTest_Set_Selectable(UT_INDEX_0, true);

memset(&ReadSet, 0, sizeof(ReadSet));
memset(&WriteSet, 0, sizeof(WriteSet));
WriteSet.object_ids[0] = 1;
OSAPI_TEST_FUNCTION_RC(OS_SelectMultiple_Impl, (NULL, &WriteSet, 0), OS_SUCCESS);
ReadSet.object_ids[0] = 1;
OSAPI_TEST_FUNCTION_RC(OS_SelectMultiple_Impl, (&ReadSet, NULL, 0), OS_SUCCESS);

/* Branches for processing the set */
UT_SetDeferredRetcode(UT_KEY(OCS_FD_ISSET), 1, true);
WriteSet.object_ids[0] = 0x0D;
UT_PortablePosixIOTest_Set_FD(OSAL_INDEX_C(2), -1);
UT_PortablePosixIOTest_Set_FD(OSAL_INDEX_C(3), 0);
UT_PortablePosixIOTest_Set_Selectable(OSAL_INDEX_C(3), true);
OSAPI_TEST_FUNCTION_RC(OS_SelectMultiple_Impl, (&ReadSet, &WriteSet, 0), OS_SUCCESS);

memset(&ReadSet, 0, sizeof(ReadSet));
memset(&WriteSet, 0, sizeof(WriteSet));
ReadSet.object_ids[0] = 1;
UT_SetDefaultReturnValue(UT_KEY(OCS_select), 0);
UT_SetDeferredRetcode(UT_KEY(OCS_select), 1, 0);
OSAPI_TEST_FUNCTION_RC(OS_SelectMultiple_Impl, (&ReadSet, &WriteSet, 1), OS_ERROR_TIMEOUT);

/* Test where the FD set is empty */
Expand All @@ -146,6 +179,15 @@ void Test_OS_SelectMultiple_Impl(void)
memset(&WriteSet, 0xff, sizeof(WriteSet));
OSAPI_TEST_FUNCTION_RC(OS_SelectMultiple_Impl, (&ReadSet, &WriteSet, 0), OS_ERR_OPERATION_NOT_SUPPORTED);

/*
* Cover OS_FdSet_ConvertOut_Impl for id < OS_MAX_NUM_OPEN_FILES, requires no errors from in conversion
* NOTE - coverage only possible if OS_MAX_NUM_OPEN_FILES is not a multiple of 8 (exact fit)
*/
for (i = 1; i < OS_MAX_NUM_OPEN_FILES; i++)
{
UT_PortablePosixIOTest_Set_FD(OSAL_INDEX_C(i), -1);
}
OSAPI_TEST_FUNCTION_RC(OS_SelectMultiple_Impl, (&ReadSet, &WriteSet, 0), OS_SUCCESS);
} /* end OS_SelectMultiple_Impl */

/* ------------------- End of test cases --------------------------------------*/
Expand Down
9 changes: 9 additions & 0 deletions src/unit-test-coverage/portable/src/coveragetest-posix-dirs.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ void Test_OS_DirCreate_Impl(void)
UT_SetDataBuffer(UT_KEY(OCS_stat), &statbuf, sizeof(statbuf), false);
UT_SetDefaultReturnValue(UT_KEY(OCS_mkdir), -1);
OSAPI_TEST_FUNCTION_RC(OS_DirCreate_Impl, ("dir", 0), OS_SUCCESS);

/* EEXIST but not a dir */
statbuf.st_mode = 0;
UT_SetDataBuffer(UT_KEY(OCS_stat), &statbuf, sizeof(statbuf), false);
OSAPI_TEST_FUNCTION_RC(OS_DirCreate_Impl, ("dir", 0), OS_ERROR);

/* stat failure */
UT_SetDefaultReturnValue(UT_KEY(OCS_stat), -1);
OSAPI_TEST_FUNCTION_RC(OS_DirCreate_Impl, ("dir", 0), OS_ERROR);
}

void Test_OS_DirOpen_Impl(void)
Expand Down
23 changes: 18 additions & 5 deletions src/unit-test-coverage/portable/src/coveragetest-posix-files.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ void Test_OS_FileStat_Impl(void)
UtAssert_True(OS_FILESTAT_ISDIR(FileStats), "Directory Bit set");
UtAssert_True(OS_FILESTAT_SIZE(FileStats) == 1234, "Size match");
UtAssert_True(OS_FILESTAT_TIME(FileStats) == 5678, "Time match (seconds)");

/* Repeat without matching uid/gid */
RefStat.st_uid = ~RefStat.st_uid;
RefStat.st_gid = ~RefStat.st_gid;
UT_SetDataBuffer(UT_KEY(OCS_stat), &RefStat, sizeof(RefStat), false);
OSAPI_TEST_FUNCTION_RC(OS_FileStat_Impl, ("local", &FileStats), OS_SUCCESS);
}

void Test_OS_FileChmod_Impl(void)
Expand All @@ -105,15 +111,18 @@ void Test_OS_FileChmod_Impl(void)
*/
struct OCS_stat RefStat;

/* failure mode 0 (open) */
UT_SetDefaultReturnValue(UT_KEY(OCS_open), -1);
/* Read only fail, write succeeds */
UT_SetDeferredRetcode(UT_KEY(OCS_open), 1, -1);
OSAPI_TEST_FUNCTION_RC(OS_FileChmod_Impl, ("local", OS_READ_WRITE), OS_SUCCESS);

/* Both opens fail */
UT_SetDeferredRetcode(UT_KEY(OCS_open), 1, -1);
UT_SetDeferredRetcode(UT_KEY(OCS_open), 1, -1);
OSAPI_TEST_FUNCTION_RC(OS_FileChmod_Impl, ("local", OS_READ_WRITE), OS_ERROR);
UT_ClearDefaultReturnValue(UT_KEY(OCS_open));

/* failure mode 1 (fstat) */
UT_SetDefaultReturnValue(UT_KEY(OCS_fstat), -1);
UT_SetDeferredRetcode(UT_KEY(OCS_fstat), 1, -1);
OSAPI_TEST_FUNCTION_RC(OS_FileChmod_Impl, ("local", OS_READ_WRITE), OS_ERROR);
UT_ClearDefaultReturnValue(UT_KEY(OCS_fstat));

/* failure mode 2 (fchmod) */
UT_SetDefaultReturnValue(UT_KEY(OCS_fchmod), -1);
Expand All @@ -122,6 +131,10 @@ void Test_OS_FileChmod_Impl(void)
/* non implemented error, e.g. such as DOS Filesystem with no perms */
OCS_errno = OCS_ENOTSUP;
OSAPI_TEST_FUNCTION_RC(OS_FileChmod_Impl, ("local", OS_READ_WRITE), OS_ERR_NOT_IMPLEMENTED);
OCS_errno = OCS_ENOSYS;
OSAPI_TEST_FUNCTION_RC(OS_FileChmod_Impl, ("local", OS_READ_WRITE), OS_ERR_NOT_IMPLEMENTED);
OCS_errno = OCS_EROFS;
OSAPI_TEST_FUNCTION_RC(OS_FileChmod_Impl, ("local", OS_READ_WRITE), OS_ERR_NOT_IMPLEMENTED);
UT_ClearDefaultReturnValue(UT_KEY(OCS_fchmod));

/* all permission bits with uid/gid match */
Expand Down
40 changes: 40 additions & 0 deletions src/unit-test-coverage/portable/src/coveragetest-posix-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,22 @@
#include "OCS_fcntl.h"
#include "OCS_errno.h"

/* OS_SelectSingle_Impl hook to clear SelectFlags */
static int32 UT_Hook_OS_SelectSingle_Impl(void *UserObj, int32 StubRetcode, uint32 CallCount,
const UT_StubContext_t *Context)
{
uint32 *SelectFlags;

SelectFlags = UT_Hook_GetArgValueByName(Context, "SelectFlags", uint32 *);

if (SelectFlags != NULL)
{
*SelectFlags = 0;
}

return 0;
}

void Test_OS_GenericClose_Impl(void)
{
/*
Expand Down Expand Up @@ -111,9 +127,21 @@ void Test_OS_GenericRead_Impl(void)
OSAPI_TEST_FUNCTION_RC(OS_GenericRead_Impl, (&token, DestData, sizeof(DestData), 0), sizeof(DestData));
UtAssert_True(UT_GetStubCount(UT_KEY(OS_SelectSingle_Impl)) == 1, "OS_SelectSingle() called");

/* Read 0 bytes */
OSAPI_TEST_FUNCTION_RC(OS_GenericRead_Impl, (&token, DestData, 0, 0), OS_SUCCESS);

/* read() failure */
UT_SetDefaultReturnValue(UT_KEY(OCS_read), -1);
OSAPI_TEST_FUNCTION_RC(OS_GenericRead_Impl, (&token, DestData, sizeof(DestData), 0), OS_ERROR);

/* Fail select */
UT_SetDeferredRetcode(UT_KEY(OS_SelectSingle_Impl), 1, OS_ERROR_TIMEOUT);
OSAPI_TEST_FUNCTION_RC(OS_GenericRead_Impl, (&token, DestData, sizeof(DestData), 0), OS_ERROR_TIMEOUT);

/* Not readable */
UT_SetHookFunction(UT_KEY(OS_SelectSingle_Impl), UT_Hook_OS_SelectSingle_Impl, NULL);
OSAPI_TEST_FUNCTION_RC(OS_GenericRead_Impl, (&token, DestData, sizeof(DestData), 0), OS_SUCCESS);
UT_SetHookFunction(UT_KEY(OS_SelectSingle_Impl), NULL, NULL);
}

void Test_OS_GenericWrite_Impl(void)
Expand All @@ -140,9 +168,21 @@ void Test_OS_GenericWrite_Impl(void)
OSAPI_TEST_FUNCTION_RC(OS_GenericWrite_Impl, (&token, SrcData, sizeof(SrcData), 0), sizeof(SrcData));
UtAssert_True(UT_GetStubCount(UT_KEY(OS_SelectSingle_Impl)) == 1, "OS_SelectSingle() called");

/* Fail select */
UT_SetDeferredRetcode(UT_KEY(OS_SelectSingle_Impl), 1, OS_ERROR_TIMEOUT);
OSAPI_TEST_FUNCTION_RC(OS_GenericWrite_Impl, (&token, SrcData, sizeof(SrcData), 0), OS_ERROR_TIMEOUT);

/* Write 0 bytes */
OSAPI_TEST_FUNCTION_RC(OS_GenericWrite_Impl, (&token, SrcData, 0, 0), OS_SUCCESS);

/* write() failure */
UT_SetDefaultReturnValue(UT_KEY(OCS_write), -1);
OSAPI_TEST_FUNCTION_RC(OS_GenericWrite_Impl, (&token, DestData, sizeof(DestData), 0), OS_ERROR);

/* Not writeable */
UT_SetHookFunction(UT_KEY(OS_SelectSingle_Impl), UT_Hook_OS_SelectSingle_Impl, NULL);
OSAPI_TEST_FUNCTION_RC(OS_GenericWrite_Impl, (&token, SrcData, sizeof(SrcData), 0), OS_SUCCESS);
UT_SetHookFunction(UT_KEY(OS_SelectSingle_Impl), NULL, NULL);
}

/* ------------------- End of test cases --------------------------------------*/
Expand Down
30 changes: 14 additions & 16 deletions src/unit-test-coverage/shared/src/coveragetest-binsem.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@

#include "OCS_string.h"

#define UT_ERR_UNIQUE 0xDEADBEEF

/*
**********************************************************************************
** PUBLIC API FUNCTIONS
Expand Down Expand Up @@ -63,8 +61,8 @@ void Test_OS_BinSemCreate(void)
UT_SetDeferredRetcode(UT_KEY(OCS_memchr), 1, OS_ERROR);
OSAPI_TEST_FUNCTION_RC(OS_BinSemCreate(&objid, "UT", 0, 0), OS_ERR_NAME_TOO_LONG);

UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdAllocateNew), UT_ERR_UNIQUE);
OSAPI_TEST_FUNCTION_RC(OS_BinSemCreate(&objid, "UT", 0, 0), UT_ERR_UNIQUE);
UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdAllocateNew), OS_ERR_NO_FREE_IDS);
OSAPI_TEST_FUNCTION_RC(OS_BinSemCreate(&objid, "UT", 0, 0), OS_ERR_NO_FREE_IDS);
}

void Test_OS_BinSemDelete(void)
Expand All @@ -75,8 +73,8 @@ void Test_OS_BinSemDelete(void)
*/
OSAPI_TEST_FUNCTION_RC(OS_BinSemDelete(UT_OBJID_1), OS_SUCCESS);

UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), UT_ERR_UNIQUE);
OSAPI_TEST_FUNCTION_RC(OS_BinSemDelete(UT_OBJID_1), UT_ERR_UNIQUE);
UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), OS_ERR_INVALID_ID);
OSAPI_TEST_FUNCTION_RC(OS_BinSemDelete(UT_OBJID_1), OS_ERR_INVALID_ID);
}

void Test_OS_BinSemGive(void)
Expand All @@ -87,8 +85,8 @@ void Test_OS_BinSemGive(void)
*/
OSAPI_TEST_FUNCTION_RC(OS_BinSemGive(UT_OBJID_1), OS_SUCCESS);

UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), UT_ERR_UNIQUE);
OSAPI_TEST_FUNCTION_RC(OS_BinSemGive(UT_OBJID_1), UT_ERR_UNIQUE);
UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), OS_ERR_INVALID_ID);
OSAPI_TEST_FUNCTION_RC(OS_BinSemGive(UT_OBJID_1), OS_ERR_INVALID_ID);
}

void Test_OS_BinSemTake(void)
Expand All @@ -99,8 +97,8 @@ void Test_OS_BinSemTake(void)
*/
OSAPI_TEST_FUNCTION_RC(OS_BinSemTake(UT_OBJID_1), OS_SUCCESS);

UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), UT_ERR_UNIQUE);
OSAPI_TEST_FUNCTION_RC(OS_BinSemTake(UT_OBJID_1), UT_ERR_UNIQUE);
UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), OS_ERR_INVALID_ID);
OSAPI_TEST_FUNCTION_RC(OS_BinSemTake(UT_OBJID_1), OS_ERR_INVALID_ID);
}

void Test_OS_BinSemFlush(void)
Expand All @@ -111,8 +109,8 @@ void Test_OS_BinSemFlush(void)
*/
OSAPI_TEST_FUNCTION_RC(OS_BinSemFlush(UT_OBJID_1), OS_SUCCESS);

UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), UT_ERR_UNIQUE);
OSAPI_TEST_FUNCTION_RC(OS_BinSemFlush(UT_OBJID_1), UT_ERR_UNIQUE);
UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), OS_ERR_INVALID_ID);
OSAPI_TEST_FUNCTION_RC(OS_BinSemFlush(UT_OBJID_1), OS_ERR_INVALID_ID);
}

void Test_OS_BinSemTimedWait(void)
Expand All @@ -123,8 +121,8 @@ void Test_OS_BinSemTimedWait(void)
*/
OSAPI_TEST_FUNCTION_RC(OS_BinSemTimedWait(UT_OBJID_1, 1), OS_SUCCESS);

UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), UT_ERR_UNIQUE);
OSAPI_TEST_FUNCTION_RC(OS_BinSemTimedWait(UT_OBJID_1, 1), UT_ERR_UNIQUE);
UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), OS_ERR_INVALID_ID);
OSAPI_TEST_FUNCTION_RC(OS_BinSemTimedWait(UT_OBJID_1, 1), OS_ERR_INVALID_ID);
}

void Test_OS_BinSemGetIdByName(void)
Expand Down Expand Up @@ -171,8 +169,8 @@ void Test_OS_BinSemGetInfo(void)

OSAPI_TEST_FUNCTION_RC(OS_BinSemGetInfo(UT_OBJID_1, NULL), OS_INVALID_POINTER);

UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), UT_ERR_UNIQUE);
OSAPI_TEST_FUNCTION_RC(OS_BinSemGetInfo(UT_OBJID_1, &prop), UT_ERR_UNIQUE);
UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), OS_ERR_INVALID_ID);
OSAPI_TEST_FUNCTION_RC(OS_BinSemGetInfo(UT_OBJID_1, &prop), OS_ERR_INVALID_ID);
}

/* Osapi_Test_Setup
Expand Down
26 changes: 12 additions & 14 deletions src/unit-test-coverage/shared/src/coveragetest-countsem.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@

#include "OCS_string.h"

#define UT_ERR_UNIQUE 0xDEADBEEF

/*
**********************************************************************************
** PUBLIC API FUNCTIONS
Expand Down Expand Up @@ -63,8 +61,8 @@ void Test_OS_CountSemCreate(void)
UT_SetDeferredRetcode(UT_KEY(OCS_memchr), 1, OS_ERROR);
OSAPI_TEST_FUNCTION_RC(OS_CountSemCreate(&objid, "UT", 0, 0), OS_ERR_NAME_TOO_LONG);

UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdAllocateNew), UT_ERR_UNIQUE);
OSAPI_TEST_FUNCTION_RC(OS_CountSemCreate(&objid, "UT", 0, 0), UT_ERR_UNIQUE);
UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdAllocateNew), OS_ERR_NO_FREE_IDS);
OSAPI_TEST_FUNCTION_RC(OS_CountSemCreate(&objid, "UT", 0, 0), OS_ERR_NO_FREE_IDS);
}

void Test_OS_CountSemDelete(void)
Expand All @@ -75,8 +73,8 @@ void Test_OS_CountSemDelete(void)
*/
OSAPI_TEST_FUNCTION_RC(OS_CountSemDelete(UT_OBJID_1), OS_SUCCESS);

UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), UT_ERR_UNIQUE);
OSAPI_TEST_FUNCTION_RC(OS_CountSemDelete(UT_OBJID_1), UT_ERR_UNIQUE);
UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), OS_ERR_INVALID_ID);
OSAPI_TEST_FUNCTION_RC(OS_CountSemDelete(UT_OBJID_1), OS_ERR_INVALID_ID);
}

void Test_OS_CountSemGive(void)
Expand All @@ -87,8 +85,8 @@ void Test_OS_CountSemGive(void)
*/
OSAPI_TEST_FUNCTION_RC(OS_CountSemGive(UT_OBJID_1), OS_SUCCESS);

UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), UT_ERR_UNIQUE);
OSAPI_TEST_FUNCTION_RC(OS_CountSemGive(UT_OBJID_1), UT_ERR_UNIQUE);
UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), OS_ERR_INVALID_ID);
OSAPI_TEST_FUNCTION_RC(OS_CountSemGive(UT_OBJID_1), OS_ERR_INVALID_ID);
}

void Test_OS_CountSemTake(void)
Expand All @@ -99,8 +97,8 @@ void Test_OS_CountSemTake(void)
*/
OSAPI_TEST_FUNCTION_RC(OS_CountSemTake(UT_OBJID_1), OS_SUCCESS);

UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), UT_ERR_UNIQUE);
OSAPI_TEST_FUNCTION_RC(OS_CountSemTake(UT_OBJID_1), UT_ERR_UNIQUE);
UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), OS_ERR_INVALID_ID);
OSAPI_TEST_FUNCTION_RC(OS_CountSemTake(UT_OBJID_1), OS_ERR_INVALID_ID);
}

void Test_OS_CountSemTimedWait(void)
Expand All @@ -111,8 +109,8 @@ void Test_OS_CountSemTimedWait(void)
*/
OSAPI_TEST_FUNCTION_RC(OS_CountSemTimedWait(UT_OBJID_1, 1), OS_SUCCESS);

UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), UT_ERR_UNIQUE);
OSAPI_TEST_FUNCTION_RC(OS_CountSemTimedWait(UT_OBJID_1, 1), UT_ERR_UNIQUE);
UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), OS_ERR_INVALID_ID);
OSAPI_TEST_FUNCTION_RC(OS_CountSemTimedWait(UT_OBJID_1, 1), OS_ERR_INVALID_ID);
}

void Test_OS_CountSemGetIdByName(void)
Expand Down Expand Up @@ -159,8 +157,8 @@ void Test_OS_CountSemGetInfo(void)

OSAPI_TEST_FUNCTION_RC(OS_CountSemGetInfo(UT_OBJID_1, NULL), OS_INVALID_POINTER);

UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), UT_ERR_UNIQUE);
OSAPI_TEST_FUNCTION_RC(OS_CountSemGetInfo(UT_OBJID_1, &prop), UT_ERR_UNIQUE);
UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), OS_ERR_INVALID_ID);
OSAPI_TEST_FUNCTION_RC(OS_CountSemGetInfo(UT_OBJID_1, &prop), OS_ERR_INVALID_ID);
}

/* Osapi_Test_Setup
Expand Down
Loading

0 comments on commit ecc9c9e

Please sign in to comment.