From ecc9c9e049aa51e148fff01f882fe6ecea8cd0e2 Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Wed, 21 Jul 2021 20:37:21 +0000 Subject: [PATCH] Partial #791, Addition unit test branch coverage --- .../portable/src/coveragetest-bsd-select.c | 44 ++++++++++++++- .../portable/src/coveragetest-posix-dirs.c | 9 ++++ .../portable/src/coveragetest-posix-files.c | 23 ++++++-- .../portable/src/coveragetest-posix-io.c | 40 ++++++++++++++ .../shared/src/coveragetest-binsem.c | 30 +++++------ .../shared/src/coveragetest-countsem.c | 26 +++++---- .../shared/src/coveragetest-dir.c | 31 +++++------ .../shared/src/coveragetest-file.c | 54 +++++++++---------- .../shared/src/coveragetest-filesys.c | 14 +++-- .../shared/src/coveragetest-module.c | 6 +-- 10 files changed, 184 insertions(+), 93 deletions(-) diff --git a/src/unit-test-coverage/portable/src/coveragetest-bsd-select.c b/src/unit-test-coverage/portable/src/coveragetest-bsd-select.c index eb88520c4..abd97645a 100644 --- a/src/unit-test-coverage/portable/src/coveragetest-bsd-select.c +++ b/src/unit-test-coverage/portable/src/coveragetest-bsd-select.c @@ -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); @@ -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; @@ -107,6 +129,7 @@ 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); @@ -114,12 +137,22 @@ void Test_OS_SelectMultiple_Impl(void) 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 */ @@ -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 --------------------------------------*/ diff --git a/src/unit-test-coverage/portable/src/coveragetest-posix-dirs.c b/src/unit-test-coverage/portable/src/coveragetest-posix-dirs.c index d3149bc60..afc7b0e5b 100644 --- a/src/unit-test-coverage/portable/src/coveragetest-posix-dirs.c +++ b/src/unit-test-coverage/portable/src/coveragetest-posix-dirs.c @@ -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) diff --git a/src/unit-test-coverage/portable/src/coveragetest-posix-files.c b/src/unit-test-coverage/portable/src/coveragetest-posix-files.c index 75d0c1e14..ec22b57f2 100644 --- a/src/unit-test-coverage/portable/src/coveragetest-posix-files.c +++ b/src/unit-test-coverage/portable/src/coveragetest-posix-files.c @@ -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) @@ -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); @@ -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 */ diff --git a/src/unit-test-coverage/portable/src/coveragetest-posix-io.c b/src/unit-test-coverage/portable/src/coveragetest-posix-io.c index a4cca4fd0..0619d1534 100644 --- a/src/unit-test-coverage/portable/src/coveragetest-posix-io.c +++ b/src/unit-test-coverage/portable/src/coveragetest-posix-io.c @@ -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) { /* @@ -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) @@ -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 --------------------------------------*/ diff --git a/src/unit-test-coverage/shared/src/coveragetest-binsem.c b/src/unit-test-coverage/shared/src/coveragetest-binsem.c index e56b8731e..fba1a268a 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-binsem.c +++ b/src/unit-test-coverage/shared/src/coveragetest-binsem.c @@ -29,8 +29,6 @@ #include "OCS_string.h" -#define UT_ERR_UNIQUE 0xDEADBEEF - /* ********************************************************************************** ** PUBLIC API FUNCTIONS @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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 diff --git a/src/unit-test-coverage/shared/src/coveragetest-countsem.c b/src/unit-test-coverage/shared/src/coveragetest-countsem.c index d8dd30fb6..04926af0f 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-countsem.c +++ b/src/unit-test-coverage/shared/src/coveragetest-countsem.c @@ -29,8 +29,6 @@ #include "OCS_string.h" -#define UT_ERR_UNIQUE 0xDEADBEEF - /* ********************************************************************************** ** PUBLIC API FUNCTIONS @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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 diff --git a/src/unit-test-coverage/shared/src/coveragetest-dir.c b/src/unit-test-coverage/shared/src/coveragetest-dir.c index 71c2e41b9..2ab4b6f79 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-dir.c +++ b/src/unit-test-coverage/shared/src/coveragetest-dir.c @@ -27,8 +27,6 @@ #include "os-shared-coveragetest.h" #include "os-shared-dir.h" -#define UT_ERR_UNIQUE 0xDEADBEEF - /* ********************************************************************************** ** PUBLIC API FUNCTIONS @@ -52,8 +50,8 @@ void Test_OS_mkdir(void) */ OSAPI_TEST_FUNCTION_RC(OS_mkdir("Dir", OS_READ_WRITE), OS_SUCCESS); - UT_SetDefaultReturnValue(UT_KEY(OS_TranslatePath), UT_ERR_UNIQUE); - OSAPI_TEST_FUNCTION_RC(OS_mkdir("Dir", OS_READ_WRITE), UT_ERR_UNIQUE); + UT_SetDefaultReturnValue(UT_KEY(OS_TranslatePath), OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_mkdir("Dir", OS_READ_WRITE), OS_ERROR); } void Test_OS_DirectoryOpen(void) @@ -63,17 +61,16 @@ void Test_OS_DirectoryOpen(void) * int32 OS_DirectoryOpen(uint32 *dir_id, const char *path) */ osal_id_t objid; - uint32 unique1 = UT_ERR_UNIQUE + 1; OSAPI_TEST_FUNCTION_RC(OS_DirectoryOpen(&objid, "Dir"), OS_SUCCESS); OSAPI_TEST_OBJID(objid, !=, OS_OBJECT_ID_UNDEFINED); /* Branch coverage for errors */ - UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdAllocateNew), UT_ERR_UNIQUE); - OSAPI_TEST_FUNCTION_RC(OS_DirectoryOpen(&objid, "Dir"), UT_ERR_UNIQUE); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdAllocateNew), OS_ERR_NO_FREE_IDS); + OSAPI_TEST_FUNCTION_RC(OS_DirectoryOpen(&objid, "Dir"), OS_ERR_NO_FREE_IDS); - UT_SetDefaultReturnValue(UT_KEY(OS_TranslatePath), unique1); - OSAPI_TEST_FUNCTION_RC(OS_DirectoryOpen(&objid, "Dir"), unique1); + UT_SetDefaultReturnValue(UT_KEY(OS_TranslatePath), OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_DirectoryOpen(&objid, "Dir"), OS_ERROR); /* * Note that the second arg (path) is validated by a separate unit (OS_TranslatePath), @@ -91,8 +88,8 @@ void Test_OS_DirectoryClose(void) OSAPI_TEST_FUNCTION_RC(OS_DirectoryClose(UT_OBJID_1), OS_SUCCESS); /* Branch coverage for errors */ - UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), UT_ERR_UNIQUE); - OSAPI_TEST_FUNCTION_RC(OS_DirectoryClose(UT_OBJID_1), UT_ERR_UNIQUE); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), OS_ERR_INVALID_ID); + OSAPI_TEST_FUNCTION_RC(OS_DirectoryClose(UT_OBJID_1), OS_ERR_INVALID_ID); } void Test_OS_DirectoryRead(void) @@ -106,8 +103,8 @@ void Test_OS_DirectoryRead(void) OSAPI_TEST_FUNCTION_RC(OS_DirectoryRead(UT_OBJID_1, &dirent), OS_SUCCESS); /* Branch coverage for errors */ - UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), UT_ERR_UNIQUE); - OSAPI_TEST_FUNCTION_RC(OS_DirectoryRead(UT_OBJID_1, &dirent), UT_ERR_UNIQUE); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), OS_ERR_INVALID_ID); + OSAPI_TEST_FUNCTION_RC(OS_DirectoryRead(UT_OBJID_1, &dirent), OS_ERR_INVALID_ID); OSAPI_TEST_FUNCTION_RC(OS_DirectoryRead(UT_OBJID_1, NULL), OS_INVALID_POINTER); } @@ -121,8 +118,8 @@ void Test_OS_DirectoryRewind(void) OSAPI_TEST_FUNCTION_RC(OS_DirectoryRewind(UT_OBJID_1), OS_SUCCESS); /* Branch coverage for errors */ - UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), UT_ERR_UNIQUE); - OSAPI_TEST_FUNCTION_RC(OS_DirectoryRewind(UT_OBJID_1), UT_ERR_UNIQUE); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), OS_ERR_INVALID_ID); + OSAPI_TEST_FUNCTION_RC(OS_DirectoryRewind(UT_OBJID_1), OS_ERR_INVALID_ID); } void Test_OS_rmdir(void) @@ -133,8 +130,8 @@ void Test_OS_rmdir(void) */ OSAPI_TEST_FUNCTION_RC(OS_rmdir("Dir"), OS_SUCCESS); - UT_SetDefaultReturnValue(UT_KEY(OS_TranslatePath), UT_ERR_UNIQUE); - OSAPI_TEST_FUNCTION_RC(OS_rmdir("Dir"), UT_ERR_UNIQUE); + UT_SetDefaultReturnValue(UT_KEY(OS_TranslatePath), OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_rmdir("Dir"), OS_ERROR); } /* Osapi_Test_Setup diff --git a/src/unit-test-coverage/shared/src/coveragetest-file.c b/src/unit-test-coverage/shared/src/coveragetest-file.c index b1303f432..251324fed 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-file.c +++ b/src/unit-test-coverage/shared/src/coveragetest-file.c @@ -30,8 +30,6 @@ #include "OCS_string.h" -#define UT_ERR_UNIQUE 0xDEADBEEF - /* ********************************************************************************** ** PUBLIC API FUNCTIONS @@ -76,8 +74,8 @@ void Test_OS_OpenCreate(void) actual = OS_OpenCreate(&filedes, "/cf/file", OS_FILE_FLAG_NONE, 9999); UtAssert_True(actual == expected, "OS_OpenCreate() (%ld) == OS_ERROR (bad flags)", (long)actual); - UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdAllocateNew), UT_ERR_UNIQUE); - OSAPI_TEST_FUNCTION_RC(OS_OpenCreate(&filedes, "/cf/file", OS_FILE_FLAG_NONE, OS_READ_WRITE), UT_ERR_UNIQUE); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdAllocateNew), OS_ERR_NO_FREE_IDS); + OSAPI_TEST_FUNCTION_RC(OS_OpenCreate(&filedes, "/cf/file", OS_FILE_FLAG_NONE, OS_READ_WRITE), OS_ERR_NO_FREE_IDS); /* Test failure to convert path */ UT_SetDefaultReturnValue(UT_KEY(OS_TranslatePath), OS_ERROR); @@ -95,8 +93,8 @@ void Test_OS_close(void) */ OSAPI_TEST_FUNCTION_RC(OS_close(UT_OBJID_1), OS_SUCCESS); - UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), UT_ERR_UNIQUE); - OSAPI_TEST_FUNCTION_RC(OS_close(UT_OBJID_1), UT_ERR_UNIQUE); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), OS_ERR_INVALID_ID); + OSAPI_TEST_FUNCTION_RC(OS_close(UT_OBJID_1), OS_ERR_INVALID_ID); } void Test_OS_TimedRead(void) @@ -115,8 +113,8 @@ void Test_OS_TimedRead(void) UtAssert_True(actual == expected, "OS_TimedRead() (%ld) == %ld", (long)actual, (long)expected); UtAssert_True(memcmp(Buf, SrcBuf, actual) == 0, "buffer content match"); - UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), UT_ERR_UNIQUE); - OSAPI_TEST_FUNCTION_RC(OS_TimedRead(UT_OBJID_1, Buf, sizeof(Buf), 10), UT_ERR_UNIQUE); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), OS_ERR_INVALID_ID); + OSAPI_TEST_FUNCTION_RC(OS_TimedRead(UT_OBJID_1, Buf, sizeof(Buf), 10), OS_ERR_INVALID_ID); OSAPI_TEST_FUNCTION_RC(OS_TimedRead(UT_OBJID_1, NULL, sizeof(Buf), 10), OS_INVALID_POINTER); OSAPI_TEST_FUNCTION_RC(OS_TimedRead(UT_OBJID_1, Buf, OSAL_SIZE_C(0), 10), OS_ERR_INVALID_SIZE); @@ -140,8 +138,8 @@ void Test_OS_TimedWrite(void) UtAssert_True(actual == expected, "OS_TimedWrite() (%ld) == %ld", (long)actual, (long)expected); UtAssert_True(memcmp(Buf, DstBuf, actual) == 0, "buffer content match"); - UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), UT_ERR_UNIQUE); - OSAPI_TEST_FUNCTION_RC(OS_TimedWrite(UT_OBJID_1, Buf, sizeof(Buf), 10), UT_ERR_UNIQUE); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), OS_ERR_INVALID_ID); + OSAPI_TEST_FUNCTION_RC(OS_TimedWrite(UT_OBJID_1, Buf, sizeof(Buf), 10), OS_ERR_INVALID_ID); OSAPI_TEST_FUNCTION_RC(OS_TimedWrite(UT_OBJID_1, NULL, sizeof(Buf), 10), OS_INVALID_POINTER); OSAPI_TEST_FUNCTION_RC(OS_TimedWrite(UT_OBJID_1, Buf, OSAL_SIZE_C(0), 10), OS_ERR_INVALID_SIZE); @@ -191,8 +189,8 @@ void Test_OS_chmod(void) */ OSAPI_TEST_FUNCTION_RC(OS_chmod("/cf/file", 0), OS_SUCCESS); - UT_SetDefaultReturnValue(UT_KEY(OS_TranslatePath), UT_ERR_UNIQUE); - OSAPI_TEST_FUNCTION_RC(OS_chmod("/cf/file", 0), UT_ERR_UNIQUE); + UT_SetDefaultReturnValue(UT_KEY(OS_TranslatePath), OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_chmod("/cf/file", 0), OS_ERROR); } void Test_OS_stat(void) @@ -205,8 +203,8 @@ void Test_OS_stat(void) OSAPI_TEST_FUNCTION_RC(OS_stat("/cf/file", &statbuf), OS_SUCCESS); - UT_SetDefaultReturnValue(UT_KEY(OS_TranslatePath), UT_ERR_UNIQUE); - OSAPI_TEST_FUNCTION_RC(OS_stat("/cf/file", &statbuf), UT_ERR_UNIQUE); + UT_SetDefaultReturnValue(UT_KEY(OS_TranslatePath), OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_stat("/cf/file", &statbuf), OS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_stat("/cf/file", NULL), OS_INVALID_POINTER); } @@ -219,8 +217,8 @@ void Test_OS_lseek(void) */ OSAPI_TEST_FUNCTION_RC(OS_lseek(UT_OBJID_1, 0, 0), OS_SUCCESS); - UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), UT_ERR_UNIQUE); - OSAPI_TEST_FUNCTION_RC(OS_lseek(UT_OBJID_1, 0, 0), UT_ERR_UNIQUE); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), OS_ERR_INVALID_ID); + OSAPI_TEST_FUNCTION_RC(OS_lseek(UT_OBJID_1, 0, 0), OS_ERR_INVALID_ID); } void Test_OS_remove(void) @@ -231,8 +229,8 @@ void Test_OS_remove(void) */ OSAPI_TEST_FUNCTION_RC(OS_remove("/cf/file"), OS_SUCCESS); - UT_SetDefaultReturnValue(UT_KEY(OS_TranslatePath), UT_ERR_UNIQUE); - OSAPI_TEST_FUNCTION_RC(OS_remove("/cf/file"), UT_ERR_UNIQUE); + UT_SetDefaultReturnValue(UT_KEY(OS_TranslatePath), OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_remove("/cf/file"), OS_ERROR); } void Test_OS_rename(void) @@ -248,10 +246,10 @@ void Test_OS_rename(void) UtAssert_True(strcmp(OS_stream_table[1].stream_name, "/cf/file2") == 0, "OS_stream_table[1].stream_name (%s) == /cf/file2", OS_stream_table[1].stream_name); - UT_SetDeferredRetcode(UT_KEY(OS_TranslatePath), 2, UT_ERR_UNIQUE); - OSAPI_TEST_FUNCTION_RC(OS_rename("/cf/file1", "/cf/file2"), UT_ERR_UNIQUE); - UT_SetDeferredRetcode(UT_KEY(OS_TranslatePath), 1, UT_ERR_UNIQUE); - OSAPI_TEST_FUNCTION_RC(OS_rename("/cf/file1", "/cf/file2"), UT_ERR_UNIQUE); + UT_SetDeferredRetcode(UT_KEY(OS_TranslatePath), 2, OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_rename("/cf/file1", "/cf/file2"), OS_ERROR); + UT_SetDeferredRetcode(UT_KEY(OS_TranslatePath), 1, OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_rename("/cf/file1", "/cf/file2"), OS_ERROR); } void Test_OS_cp(void) @@ -296,8 +294,8 @@ void Test_OS_mv(void) OSAPI_TEST_FUNCTION_RC(OS_mv("/cf/file1", "/cf/file2"), OS_SUCCESS); /* Fail the OS_cp/OS_OpenCreate */ - UT_SetDefaultReturnValue(UT_KEY(OS_TranslatePath), UT_ERR_UNIQUE); - OSAPI_TEST_FUNCTION_RC(OS_mv("/cf/file1", "/cf/file2"), UT_ERR_UNIQUE); + UT_SetDefaultReturnValue(UT_KEY(OS_TranslatePath), OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_mv("/cf/file1", "/cf/file2"), OS_ERROR); } void Test_OS_FDGetInfo(void) @@ -314,8 +312,8 @@ void Test_OS_FDGetInfo(void) OSAPI_TEST_FUNCTION_RC(OS_FDGetInfo(UT_OBJID_1, NULL), OS_INVALID_POINTER); - UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), UT_ERR_UNIQUE); - OSAPI_TEST_FUNCTION_RC(OS_FDGetInfo(UT_OBJID_1, &file_prop), UT_ERR_UNIQUE); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), OS_ERR_INVALID_ID); + OSAPI_TEST_FUNCTION_RC(OS_FDGetInfo(UT_OBJID_1, &file_prop), OS_ERR_INVALID_ID); } void Test_OS_FileOpenCheck(void) @@ -348,8 +346,8 @@ void Test_OS_CloseFileByName(void) strncpy(OS_stream_table[3].stream_name, "/cf/file", sizeof(OS_stream_table[3].stream_name)); strncpy(OS_stream_table[4].stream_name, "/cf/file", sizeof(OS_stream_table[4].stream_name)); strncpy(OS_stream_table[5].stream_name, "/cf/file", sizeof(OS_stream_table[5].stream_name)); - UT_SetDeferredRetcode(UT_KEY(OS_ObjectIdIteratorProcessEntry), 3, UT_ERR_UNIQUE); - OSAPI_TEST_FUNCTION_RC(OS_CloseFileByName("/cf/file"), UT_ERR_UNIQUE); + UT_SetDeferredRetcode(UT_KEY(OS_ObjectIdIteratorProcessEntry), 3, OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_CloseFileByName("/cf/file"), OS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_CloseFileByName(NULL), OS_INVALID_POINTER); } diff --git a/src/unit-test-coverage/shared/src/coveragetest-filesys.c b/src/unit-test-coverage/shared/src/coveragetest-filesys.c index 84e2f74f6..55b6218a1 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-filesys.c +++ b/src/unit-test-coverage/shared/src/coveragetest-filesys.c @@ -29,8 +29,6 @@ #include "OCS_string.h" -#define UT_ERR_UNIQUE 0xDEADBEEF - /* ********************************************************************************** ** PUBLIC API FUNCTIONS @@ -73,12 +71,12 @@ void Test_OS_FileSysAddFixedMap(void) UT_ResetState(UT_KEY(OCS_memchr)); UT_ResetState(UT_KEY(OCS_strrchr)); - UT_SetDeferredRetcode(UT_KEY(OS_ObjectIdAllocateNew), 1, UT_ERR_UNIQUE); - OSAPI_TEST_FUNCTION_RC(OS_FileSysAddFixedMap(&id, "/phys", "/virt"), UT_ERR_UNIQUE); - UT_SetDeferredRetcode(UT_KEY(OS_FileSysStartVolume_Impl), 1, UT_ERR_UNIQUE + 1); - OSAPI_TEST_FUNCTION_RC(OS_FileSysAddFixedMap(&id, "/phys", "/virt"), UT_ERR_UNIQUE + 1); - UT_SetDeferredRetcode(UT_KEY(OS_FileSysMountVolume_Impl), 1, UT_ERR_UNIQUE + 2); - OSAPI_TEST_FUNCTION_RC(OS_FileSysAddFixedMap(&id, "/phys", "/virt"), UT_ERR_UNIQUE + 2); + UT_SetDeferredRetcode(UT_KEY(OS_ObjectIdAllocateNew), 1, OS_ERR_NO_FREE_IDS); + OSAPI_TEST_FUNCTION_RC(OS_FileSysAddFixedMap(&id, "/phys", "/virt"), OS_ERR_NO_FREE_IDS); + UT_SetDeferredRetcode(UT_KEY(OS_FileSysStartVolume_Impl), 1, OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_FileSysAddFixedMap(&id, "/phys", "/virt"), OS_ERROR); + UT_SetDeferredRetcode(UT_KEY(OS_FileSysMountVolume_Impl), 1, OS_ERROR - 1); + OSAPI_TEST_FUNCTION_RC(OS_FileSysAddFixedMap(&id, "/phys", "/virt"), OS_ERROR - 1); OSAPI_TEST_FUNCTION_RC(OS_FileSysAddFixedMap(&id, "/phys", "/virt"), OS_SUCCESS); OSAPI_TEST_FUNCTION_RC(OS_FileSysAddFixedMap(&id, "/phys", "/virt"), OS_SUCCESS); diff --git a/src/unit-test-coverage/shared/src/coveragetest-module.c b/src/unit-test-coverage/shared/src/coveragetest-module.c index 195ea4e1b..4eace72c0 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-module.c +++ b/src/unit-test-coverage/shared/src/coveragetest-module.c @@ -31,8 +31,6 @@ #include "OCS_string.h" -#define UT_ERR_UNIQUE 0xDEADBEEF - /* A dummy function for the static symbol lookup test. Not called */ void Test_DummyFunc(void) {} @@ -98,8 +96,8 @@ void Test_OS_ModuleLoad(void) UT_SetDefaultReturnValue(UT_KEY(OS_TranslatePath), OS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_ModuleLoad(&objid, "UT", "FileBad", OS_MODULE_FLAG_GLOBAL_SYMBOLS), OS_ERROR); - UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdAllocateNew), UT_ERR_UNIQUE); - OSAPI_TEST_FUNCTION_RC(OS_ModuleLoad(&objid, "UT", "FileBad", OS_MODULE_FLAG_GLOBAL_SYMBOLS), UT_ERR_UNIQUE); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdAllocateNew), OS_ERR_NO_FREE_IDS); + OSAPI_TEST_FUNCTION_RC(OS_ModuleLoad(&objid, "UT", "FileBad", OS_MODULE_FLAG_GLOBAL_SYMBOLS), OS_ERR_NO_FREE_IDS); } void Test_OS_ModuleUnload(void)