From 5bbf0419008b8c9d05e6d0eda15ddf17dfe500bd Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Thu, 7 Jan 2021 15:30:35 -0500 Subject: [PATCH 01/21] Fix #746, Add UtDebug message from OS_printf stub --- src/ut-stubs/osapi-utstub-printf.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ut-stubs/osapi-utstub-printf.c b/src/ut-stubs/osapi-utstub-printf.c index afe5d8db2..19b4b4a9c 100644 --- a/src/ut-stubs/osapi-utstub-printf.c +++ b/src/ut-stubs/osapi-utstub-printf.c @@ -63,9 +63,13 @@ void OS_printf(const char *string, ...) int32 status; size_t length = strlen(string); va_list va; + char str[128]; va_start(va, string); + vsnprintf(str, sizeof(str), string, va); + UtDebug("OS_printf: %s", str); + status = UT_DefaultStubImplWithArgs(__func__, UT_KEY(OS_printf), 0, va); if (status >= 0) From 4b65be018e9b95c1fae6f11b4eb8a940eae31d9f Mon Sep 17 00:00:00 2001 From: Alex Campbell Date: Tue, 5 Jan 2021 14:15:52 -0500 Subject: [PATCH 02/21] Fix #692, Resolve typos in unit test assert OR statements --- src/tests/network-api-test/network-api-test.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/tests/network-api-test/network-api-test.c b/src/tests/network-api-test/network-api-test.c index 019bbdb9b..58da01a02 100644 --- a/src/tests/network-api-test/network-api-test.c +++ b/src/tests/network-api-test/network-api-test.c @@ -113,7 +113,8 @@ void TestDatagramNetworkApi_Setup(void) /* OS_SocketOpen */ actual = OS_SocketOpen(&socket_id, OS_SocketDomain_INET6, OS_SocketType_DATAGRAM); - UtAssert_True(actual == OS_SUCCESS || OS_ERR_NOT_IMPLEMENTED, "OS_SocketOpen() (%ld) Passed", (long)actual); + UtAssert_True(actual == OS_SUCCESS || actual == OS_ERR_NOT_IMPLEMENTED, + "OS_SocketOpen() (%ld) Passed", (long)actual); OS_close(socket_id); expected = OS_INVALID_POINTER; @@ -126,12 +127,12 @@ void TestDatagramNetworkApi_Setup(void) /* OS_SocketAddrInit */ actual = OS_SocketAddrInit(&addr, OS_SocketDomain_INET6); - UtAssert_True(actual == OS_SUCCESS || OS_ERR_NOT_IMPLEMENTED, "OS_SocketAddrInit() (%ld) == OS_SUCCESS", - (long)actual); + UtAssert_True(actual == OS_SUCCESS || actual == OS_ERR_NOT_IMPLEMENTED, + "OS_SocketAddrInit() (%ld) == OS_SUCCESS", (long)actual); actual = OS_SocketAddrInit(NULL, OS_SocketDomain_INET6); - UtAssert_True(actual == OS_INVALID_POINTER || OS_ERR_NOT_IMPLEMENTED, - "OS_SocketAddrInit() (%ld) == OS_INVALID_POINTER", (long)actual); + UtAssert_True(actual == OS_INVALID_POINTER || actual == OS_ERR_NOT_IMPLEMENTED, + "OS_SocketAddrInit() (%ld) == OS_INVALID_POINTER", (long)actual); expected = OS_ERR_NOT_IMPLEMENTED; actual = OS_SocketAddrInit(&addr, OS_SocketDomain_INVALID); From 62eb12d58421a6110b2915eca0e97c1bfada95bf Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Mon, 11 Jan 2021 14:55:13 -0500 Subject: [PATCH 03/21] Fix #577, Document nested tests not supported --- ut_assert/inc/uttest.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ut_assert/inc/uttest.h b/ut_assert/inc/uttest.h index b5bc71adb..d79ac8bee 100644 --- a/ut_assert/inc/uttest.h +++ b/ut_assert/inc/uttest.h @@ -43,6 +43,11 @@ * * Called by the user to register a new test case with the library. * + * Note: Nested addition of tests is not supported. Calling + * UtTest_Add from within a test function added using UtTest_Add + * will not cause the nested test to execute, and will be + * silently ignored. + * * \param Test Main test function to call. * \param Setup Setup function, called before the test function * \param Teardown Cleanup function, called after the test function From c968de0a2268b91c37c48f72d10d98c099dc7b84 Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Mon, 11 Jan 2021 17:03:58 -0500 Subject: [PATCH 04/21] Fix #753, Remove UT_CheckForOpenSockets --- src/ut-stubs/utstub-helpers.c | 23 ----------------------- src/ut-stubs/utstub-helpers.h | 6 ------ 2 files changed, 29 deletions(-) diff --git a/src/ut-stubs/utstub-helpers.c b/src/ut-stubs/utstub-helpers.c index 22abd573e..9d5c1824c 100644 --- a/src/ut-stubs/utstub-helpers.c +++ b/src/ut-stubs/utstub-helpers.c @@ -184,26 +184,3 @@ void UT_ObjIdDecompose(osal_id_t id, uint32 *indx, UT_ObjType_t *objtype) *indx = idv & 0xFFFFUL; *objtype = (idv >> 16) ^ 0x4000UL; } - -/* -** Report and close any sockets found open -** Moved here temporarily to ensure full compatibility with CFE implementation -** -** NOTE - this historically only checked for queues that were created but not -** cleaned up. Although the current impl could check for anything, only queues -** are done for now. -*/ -void UT_CheckForOpenSockets(void) -{ - UT_ObjTypeState_t *StatePtr; - uint32 i; - - StatePtr = &UT_ObjState[UT_OBJTYPE_QUEUE]; - for (i = 0; i <= StatePtr->LastIssueNumber; ++i) - { - if ((StatePtr->ValidBits[i >> 3] & (1 << (i & 0x07))) != 0) - { - UtAssert_Failed("UT_Queue %d left open.\n", (int)i); - } - } -} diff --git a/src/ut-stubs/utstub-helpers.h b/src/ut-stubs/utstub-helpers.h index bb7775e9c..6450aaeb5 100644 --- a/src/ut-stubs/utstub-helpers.h +++ b/src/ut-stubs/utstub-helpers.h @@ -107,12 +107,6 @@ osal_id_t UT_AllocStubObjId(UT_ObjType_t ObjType); */ void UT_DeleteStubObjId(UT_ObjType_t ObjType, osal_id_t ObjId); -/* - * Helper function - Report any queue objects found open - * (for compatibility with CFE tests, only checks queues) - */ -void UT_CheckForOpenSockets(void); - /* * Helper function - Clear all OSAL UT stub objects * Resets the stub object table back to its initial/empty state From e9638478b851ae083adac888f4df8665c9bf0fc6 Mon Sep 17 00:00:00 2001 From: Alex Campbell Date: Thu, 17 Dec 2020 12:52:33 -0500 Subject: [PATCH 05/21] Fix #229, add mqueue functional test --- .../queue-test.c} | 96 ++++++++++++++++--- 1 file changed, 82 insertions(+), 14 deletions(-) rename src/tests/{queue-timeout-test/queue-timeout-test.c => queue-test/queue-test.c} (65%) diff --git a/src/tests/queue-timeout-test/queue-timeout-test.c b/src/tests/queue-test/queue-test.c similarity index 65% rename from src/tests/queue-timeout-test/queue-timeout-test.c rename to src/tests/queue-test/queue-test.c index e8271b51c..657dc658a 100644 --- a/src/tests/queue-timeout-test/queue-timeout-test.c +++ b/src/tests/queue-test/queue-test.c @@ -64,8 +64,9 @@ void TimerFunction(osal_id_t timer_id) void task_1(void) { int32 status; - uint32 data_received; size_t data_size; + char data_received[4] = {0}; + char expected[4] = "xyz"; OS_printf("Starting task 1\n"); @@ -83,7 +84,8 @@ void task_1(void) if (status == OS_SUCCESS) { ++task_1_messages; - OS_printf("TASK 1: Recieved a message on the queue\n"); + UtAssert_True(strcmp(data_received, expected) == 0, "TASK 1: data_received (%s) == expected (%s)", + data_received, expected); } else if (status == OS_QUEUE_TIMEOUT) { @@ -108,6 +110,8 @@ void QueueTimeoutCheck(void) UtAssert_True(status == OS_SUCCESS, "Timer delete Rc=%d", (int)status); status = OS_TaskDelete(task_1_id); UtAssert_True(status == OS_SUCCESS, "Task 1 delete Rc=%d", (int)status); + status = OS_QueueDelete(msgq_id); + UtAssert_True(status == OS_SUCCESS, "Queue 1 delete Rc=%d", (int)status); /* None of the tasks should have any failures in their own counters */ UtAssert_True(task_1_failures == 0, "Task 1 failures = %u", (unsigned int)task_1_failures); @@ -127,28 +131,76 @@ void QueueTimeoutCheck(void) (unsigned int)limit); } -void UtTest_Setup(void) +void QueueTimeoutSetup(void) { - if (OS_API_Init() != OS_SUCCESS) + int32 status; + uint32 accuracy; + + task_1_failures = 0; + task_1_messages = 0; + task_1_timeouts = 0; + + status = OS_QueueCreate(&msgq_id, "MsgQ", OSAL_BLOCKCOUNT_C(MSGQ_DEPTH), OSAL_SIZE_C(MSGQ_SIZE), 0); + UtAssert_True(status == OS_SUCCESS, "MsgQ create Id=%lx Rc=%d", OS_ObjectIdToInteger(msgq_id), (int)status); + + /* + ** Create the "consumer" task. + */ + status = OS_TaskCreate(&task_1_id, "Task 1", task_1, OSAL_STACKPTR_C(task_1_stack), sizeof(task_1_stack), + OSAL_PRIORITY_C(TASK_1_PRIORITY), 0); + UtAssert_True(status == OS_SUCCESS, "Task 1 create Id=%lx Rc=%d", OS_ObjectIdToInteger(task_1_id), (int)status); + + /* + ** Create a timer + */ + status = OS_TimerCreate(&timer_id, "Timer 1", &accuracy, &(TimerFunction)); + UtAssert_True(status == OS_SUCCESS, "Timer 1 create Id=%lx Rc=%d", OS_ObjectIdToInteger(timer_id), (int)status); + UtPrintf("Timer Accuracy = %u microseconds \n", (unsigned int)accuracy); + + /* + ** Start the timer + */ + status = OS_TimerSet(timer_id, timer_start, timer_interval); + UtAssert_True(status == OS_SUCCESS, "Timer 1 set Rc=%d", (int)status); + + /* allow some time for task to run and accrue queue timeouts */ + while (timer_counter < 100) { - UtAssert_Abort("OS_API_Init() failed"); + OS_TaskDelay(100); } +} - /* - * Register the test setup and check routines in UT assert - */ - UtTest_Add(QueueTimeoutCheck, QueueTimeoutSetup, NULL, "QueueTimeoutTest"); +void QueueMessageCheck(void) +{ + int32 status; + + OS_printf("Delay for half a second before checking\n"); + OS_TaskDelay(500); + + status = OS_TimerDelete(timer_id); + UtAssert_True(status == OS_SUCCESS, "Timer delete Rc=%d", (int)status); + status = OS_TaskDelete(task_1_id); + UtAssert_True(status == OS_SUCCESS, "Task 1 delete Rc=%d", (int)status); + status = OS_QueueDelete(msgq_id); + UtAssert_True(status == OS_SUCCESS, "Queue 1 delete Rc=%d", (int)status); + + /* None of the tasks should have any failures in their own counters */ + UtAssert_True(task_1_failures == 0, "Task 1 failures = %u", (unsigned int)task_1_failures); + UtAssert_True(task_1_messages == 10, "Task 1 messages = %u", (unsigned int)task_1_messages); + UtAssert_True(task_1_timeouts == 0, "Task 1 timeouts = %u", (unsigned int)task_1_timeouts); } -void QueueTimeoutSetup(void) +void QueueMessageSetup(void) { int32 status; uint32 accuracy; - task_1_failures = 0; task_1_messages = 0; task_1_timeouts = 0; + int i; + const char Data[4] = "xyz"; + status = OS_QueueCreate(&msgq_id, "MsgQ", OSAL_BLOCKCOUNT_C(MSGQ_DEPTH), OSAL_SIZE_C(MSGQ_SIZE), 0); UtAssert_True(status == OS_SUCCESS, "MsgQ create Id=%lx Rc=%d", OS_ObjectIdToInteger(msgq_id), (int)status); @@ -172,9 +224,25 @@ void QueueTimeoutSetup(void) status = OS_TimerSet(timer_id, timer_start, timer_interval); UtAssert_True(status == OS_SUCCESS, "Timer 1 set Rc=%d", (int)status); - /* allow some time for task to run and accrue queue timeouts */ - while (timer_counter < 100) + /* Put 10 messages onto the que with some time inbetween to not overfill the que*/ + for (i = 0; i < 10; i++) { - OS_TaskDelay(100); + OS_TaskDelay(200); + status = OS_QueuePut(msgq_id, Data, sizeof(Data), 0); + UtAssert_True(status == OS_SUCCESS, "OS Queue Put Rc=%d", (int)status); } } + +void UtTest_Setup(void) +{ + if (OS_API_Init() != OS_SUCCESS) + { + UtAssert_Abort("OS_API_Init() failed"); + } + + /* + * Register the test setup and check routines in UT assert + */ + UtTest_Add(QueueTimeoutCheck, QueueTimeoutSetup, NULL, "QueueTimeoutTest"); + UtTest_Add(QueueMessageCheck, QueueMessageSetup, NULL, "QueueMessageCheck"); +} From df458a3bab1a8268f72e909ec60715626cdba07b Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Wed, 13 Jan 2021 09:33:15 -0500 Subject: [PATCH 06/21] Fix #757, Readd extern C in osapi.h to support C++ use --- src/os/inc/osapi.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/os/inc/osapi.h b/src/os/inc/osapi.h index 96b62a0bb..2d6e11a4b 100644 --- a/src/os/inc/osapi.h +++ b/src/os/inc/osapi.h @@ -30,6 +30,11 @@ #ifndef OSAPI_H #define OSAPI_H +#ifdef __cplusplus +extern "C" +{ +#endif + /* * Note - the "osapi-os-filesys.h" file previously included these system headers * plus a couple others. Some existing code used stdio/stdlib functions but did From a92873480f3e4d84fed66bb8bff5f2723211f72f Mon Sep 17 00:00:00 2001 From: Alex Campbell Date: Mon, 11 Jan 2021 14:46:10 -0500 Subject: [PATCH 07/21] Fix #692, display message when not implemented error occurs --- src/tests/network-api-test/network-api-test.c | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/src/tests/network-api-test/network-api-test.c b/src/tests/network-api-test/network-api-test.c index 58da01a02..891bcb6d8 100644 --- a/src/tests/network-api-test/network-api-test.c +++ b/src/tests/network-api-test/network-api-test.c @@ -113,8 +113,14 @@ void TestDatagramNetworkApi_Setup(void) /* OS_SocketOpen */ actual = OS_SocketOpen(&socket_id, OS_SocketDomain_INET6, OS_SocketType_DATAGRAM); - UtAssert_True(actual == OS_SUCCESS || actual == OS_ERR_NOT_IMPLEMENTED, - "OS_SocketOpen() (%ld) Passed", (long)actual); + if (actual == OS_ERR_NOT_IMPLEMENTED) + { + UtPrintf("INET6 not supported\n"); + } + else + { + UtAssert_True(actual == OS_SUCCESS, "OS_SocketOpen() (%ld) Passed", (long)actual); + } OS_close(socket_id); expected = OS_INVALID_POINTER; @@ -127,12 +133,24 @@ void TestDatagramNetworkApi_Setup(void) /* OS_SocketAddrInit */ actual = OS_SocketAddrInit(&addr, OS_SocketDomain_INET6); - UtAssert_True(actual == OS_SUCCESS || actual == OS_ERR_NOT_IMPLEMENTED, - "OS_SocketAddrInit() (%ld) == OS_SUCCESS", (long)actual); + if (actual == OS_ERR_NOT_IMPLEMENTED) + { + UtPrintf("INET6 not supported\n"); + } + else + { + UtAssert_True(actual == OS_SUCCESS, "OS_SocketAddrInit() (%ld) == OS_SUCCESS", (long)actual); + } actual = OS_SocketAddrInit(NULL, OS_SocketDomain_INET6); - UtAssert_True(actual == OS_INVALID_POINTER || actual == OS_ERR_NOT_IMPLEMENTED, - "OS_SocketAddrInit() (%ld) == OS_INVALID_POINTER", (long)actual); + if (actual == OS_ERR_NOT_IMPLEMENTED) + { + UtPrintf("INET6 not supported\n"); + } + else + { + UtAssert_True(actual == OS_INVALID_POINTER, "OS_SocketAddrInit() (%ld) == OS_INVALID_POINTER", (long)actual); + } expected = OS_ERR_NOT_IMPLEMENTED; actual = OS_SocketAddrInit(&addr, OS_SocketDomain_INVALID); From 55aa1a7267723a5eef89843aa8b7dfbd9ca1166a Mon Sep 17 00:00:00 2001 From: Alex Campbell Date: Thu, 17 Dec 2020 11:20:38 -0500 Subject: [PATCH 08/21] Fix #591, add test teardown failure to test summary --- ut_assert/src/utassert.c | 3 ++- ut_assert/src/utbsp.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ut_assert/src/utassert.c b/ut_assert/src/utassert.c index 677614cbf..a4a88ddda 100644 --- a/ut_assert/src/utassert.c +++ b/ut_assert/src/utassert.c @@ -79,12 +79,13 @@ void UtAssert_DoTestSegmentReport(const char *SegmentName, const UtAssert_TestCo char ReportBuffer[144]; snprintf(ReportBuffer, sizeof(ReportBuffer), - "%02u %-20s TOTAL::%-4u PASS::%-4u FAIL::%-4u MIR::%-4u TSF::%-4u N/A::%-4u\n", + "%02u %-20s TOTAL::%-4u PASS::%-4u FAIL::%-4u MIR::%-4u TSF::%-4u TTF::%-4u N/A::%-4u\n", (unsigned int)TestCounters->TestSegmentCount, SegmentName, (unsigned int)TestCounters->TotalTestCases, (unsigned int)TestCounters->CaseCount[UTASSERT_CASETYPE_PASS], (unsigned int)TestCounters->CaseCount[UTASSERT_CASETYPE_FAILURE], (unsigned int)TestCounters->CaseCount[UTASSERT_CASETYPE_MIR], (unsigned int)TestCounters->CaseCount[UTASSERT_CASETYPE_TSF], + (unsigned int)TestCounters->CaseCount[UTASSERT_CASETYPE_TTF], (unsigned int)TestCounters->CaseCount[UTASSERT_CASETYPE_NA]); UT_BSP_DoText(UTASSERT_CASETYPE_END, ReportBuffer); diff --git a/ut_assert/src/utbsp.c b/ut_assert/src/utbsp.c index 5e8b7998e..11b508efb 100644 --- a/ut_assert/src/utbsp.c +++ b/ut_assert/src/utbsp.c @@ -132,6 +132,7 @@ void UT_BSP_DoText(uint8 MessageType, const char *OutputMessage) Prefix = "TSF"; break; case UTASSERT_CASETYPE_TTF: + TermModeBits = OS_BSP_CONSOLEMODE_HIGHLIGHT | OS_BSP_CONSOLEMODE_RED | OS_BSP_CONSOLEMODE_BLUE; Prefix = "TTF"; break; case UTASSERT_CASETYPE_NA: From b0cb76ed53473f77b1589744aea55ccf2a122848 Mon Sep 17 00:00:00 2001 From: Alex Campbell Date: Mon, 11 Jan 2021 09:32:46 -0500 Subject: [PATCH 09/21] Fix #699, format printf correctly --- src/tests/select-test/select-test.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tests/select-test/select-test.c b/src/tests/select-test/select-test.c index bcdef177a..7f09b1db6 100644 --- a/src/tests/select-test/select-test.c +++ b/src/tests/select-test/select-test.c @@ -318,7 +318,7 @@ void TestSelectSingleRead(void) /* Verify Outputs */ UtAssert_True(actual == expected, "OS_SelectSingle() (%ld) == OS_ERROR_TIMEOUT", (long)actual); - UtAssert_True(StateFlags == 0, "OS_SelectSingle() (%d) == None", StateFlags); + UtAssert_True(StateFlags == 0, "OS_SelectSingle() (0x%x) == None", (unsigned int)StateFlags); status = OS_BinSemGive(bin_sem_id); @@ -433,7 +433,7 @@ void TestSelectSingleWrite(void) expected = OS_ERROR_TIMEOUT; /* Verify Outputs */ UtAssert_True(actual == expected, "OS_SelectSingle() (%ld) == OS_ERROR_TIMEOUT", (long)actual); - UtAssert_True(StateFlags == 0, "OS_SelectSingle() (%d) == None", StateFlags); + UtAssert_True(StateFlags == 0, "OS_SelectSingle() (0x%x) == None", (unsigned int)StateFlags); expected = OS_SUCCESS; StateFlags = OS_STREAM_STATE_WRITABLE; @@ -549,7 +549,7 @@ void TestSelectSingleFile(void) /* Verify Outputs */ UtAssert_True(actual == expected, "OS_SelectSingle() (%ld) == OS_ERROR_TIMEOUT", (long)actual); - UtAssert_True(StateFlags == 0, "OS_SelectSingle() (%d) == None", StateFlags); + UtAssert_True(StateFlags == 0, "OS_SelectSingle() (0x%x) == None", (unsigned int)StateFlags); } void UtTest_Setup(void) From 9074cf98260d987a8af166d40002cac3d3307dd7 Mon Sep 17 00:00:00 2001 From: Alex Campbell Date: Tue, 5 Jan 2021 11:10:48 -0500 Subject: [PATCH 10/21] Fix #685, change file create to use read write --- src/tests/file-api-test/file-api-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/file-api-test/file-api-test.c b/src/tests/file-api-test/file-api-test.c index 2ff84524f..120c2a6f4 100644 --- a/src/tests/file-api-test/file-api-test.c +++ b/src/tests/file-api-test/file-api-test.c @@ -253,7 +253,7 @@ void TestChmod(void) /*Make a file to test on. Start in Read only mode */ strncpy(filename, "/drive0/Filename1", sizeof(filename) - 1); filename[sizeof(filename) - 1] = 0; - status = OS_OpenCreate(&fd, filename, OS_FILE_FLAG_CREATE | OS_FILE_FLAG_TRUNCATE, OS_READ_ONLY); + status = OS_OpenCreate(&fd, filename, OS_FILE_FLAG_CREATE , OS_READ_WRITE); UtAssert_True(status >= OS_SUCCESS, "status after creat = %d", (int)status); status = OS_close(fd); UtAssert_True(status == OS_SUCCESS, "status after close = %d", (int)status); From 0d4c3c75cdbcd91da9fe34cbf09724d968cc6ff0 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Thu, 14 Jan 2021 13:09:21 -0500 Subject: [PATCH 11/21] Fix #748, add additional casts --- src/tests/select-test/select-test.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/tests/select-test/select-test.c b/src/tests/select-test/select-test.c index 7f09b1db6..066064bfc 100644 --- a/src/tests/select-test/select-test.c +++ b/src/tests/select-test/select-test.c @@ -328,8 +328,8 @@ void TestSelectSingleRead(void) /* Verify Outputs */ UtAssert_True(actual == expected, "OS_SelectSingle() (%ld) == OS_SUCCESS", (long)actual); - UtAssert_True(StateFlags == OS_STREAM_STATE_READABLE, "OS_SelectSingle() (%d) == OS_STREAM_STATE_READABLE", - StateFlags); + UtAssert_True(StateFlags == OS_STREAM_STATE_READABLE, "OS_SelectSingle() (%x) == OS_STREAM_STATE_READABLE", + (unsigned int)StateFlags); } void TestSelectMultipleRead(void) @@ -441,8 +441,8 @@ void TestSelectSingleWrite(void) /* Verify Outputs */ UtAssert_True(actual == expected, "OS_SelectSingle() (%ld) == OS_SUCCESS", (long)actual); - UtAssert_True(StateFlags == OS_STREAM_STATE_WRITABLE, "OS_SelectSingle() (%d) == OS_STREAM_STATE_WRITABLE", - StateFlags); + UtAssert_True(StateFlags == OS_STREAM_STATE_WRITABLE, "OS_SelectSingle() (%x) == OS_STREAM_STATE_WRITABLE", + (unsigned int)StateFlags); } } @@ -532,16 +532,16 @@ void TestSelectSingleFile(void) /* Verify Outputs */ UtAssert_True(actual == expected, "OS_SelectSingle() (%ld) == OS_SUCCESS", (long)actual); - UtAssert_True(StateFlags == OS_STREAM_STATE_READABLE, "OS_SelectSingle() (%d) == OS_STREAM_STATE_READABLE", - StateFlags); + UtAssert_True(StateFlags == OS_STREAM_STATE_READABLE, "OS_SelectSingle() (%x) == OS_STREAM_STATE_READABLE", + (unsigned int)StateFlags); StateFlags = OS_STREAM_STATE_WRITABLE; actual = OS_SelectSingle(fd, &StateFlags, 100); /* Verify Outputs */ UtAssert_True(actual == expected, "OS_SelectSingle() (%ld) == OS_SUCCESS", (long)actual); - UtAssert_True(StateFlags == OS_STREAM_STATE_WRITABLE, "OS_SelectSingle() (%d) == OS_STREAM_STATE_WRITABLE", - StateFlags); + UtAssert_True(StateFlags == OS_STREAM_STATE_WRITABLE, "OS_SelectSingle() (%x) == OS_STREAM_STATE_WRITABLE", + (unsigned int)StateFlags); expected = OS_ERROR_TIMEOUT; StateFlags = OS_STREAM_STATE_BOUND; From 619e88ffb2ce97e6cf516377a1519084618711b1 Mon Sep 17 00:00:00 2001 From: Ariel Adams Date: Thu, 17 Dec 2020 11:52:58 -0600 Subject: [PATCH 12/21] Fix #743, Create Security Policy --- SECURITY.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 000000000..30252dba3 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,15 @@ +# Security Policy + +## Reporting a Vulnerability + +To report a vulnerability for the OSAL subsystem please [submit an issue](https://github.com/nasa/osal/issues/new/choose). + +For general cFS vulnerabilities please [open a cFS framework issue](https://github.com/nasa/cfs/issues/new/choose) and see our [top-level security policy](https://github.com/nasa/cFS/security/policy). + +In either case please use the "Bug Report" template and provide as much information as possible. Apply appropraite labels for each report. For security related reports, tag the issue with the "security" label. + +## Additional Support + +For additional support, email us at cfs-program@lists.nasa.gov. For help using OSAL and cFS, [subscribe to our mailing list](https://lists.nasa.gov/mailman/listinfo/cfs-community) that includes all the community members/users of the NASA core Flight Software (cFS) product line. The mailing list is used to communicate any information related to the cFS product such as current releases, bug findings and fixes, enhancement requests, community meeting notifications, sending out meeting minutes, etc. + +If you wish to report a cybersecurity incident or concern please contact the NASA Security Operations Center either by phone at 1-877-627-2732 or via email address soc@nasa.gov. From 7e34a2c2242d6e75a75d5479ea65ca2aeac5cea2 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Wed, 30 Dec 2020 13:47:48 -0500 Subject: [PATCH 13/21] Fix #429, update OS_time_t definition to 64-bit ticks Use a single 64-bit tick counter as OS_time_t, rather than a split 32 bit seconds + 32 bit microseconds counter. This benefits in several ways: - increases the timing precision by 10x (0.1us ticks) - increases the representable range by 400x (+/-14000 yrs) - simplifies addition/subtraction (no carry over) - avoids "year 2038" bug w/32-bit timestamps --- src/os/inc/osapi-clock.h | 78 ++++++++++--------- .../shared/src/coveragetest-clock.c | 12 +-- 2 files changed, 47 insertions(+), 43 deletions(-) diff --git a/src/os/inc/osapi-clock.h b/src/os/inc/osapi-clock.h index 30b7215e0..fa854209f 100644 --- a/src/os/inc/osapi-clock.h +++ b/src/os/inc/osapi-clock.h @@ -44,10 +44,29 @@ */ typedef struct { - uint32 seconds; - uint32 microsecs; + int64 ticks; /**< Ticks elapsed since reference point */ } OS_time_t; + +/** + * @brief Multipliers/divisors to convert ticks into standardized units + * + * Various fixed conversion factor constants used by the conversion routines + * + * A 100ns tick time allows max intervals of about +/- 14000 years in + * a 64-bit signed integer value. + * + * @note Applications should not directly use these values, but rather use + * conversion routines below to obtain standardized units (seconds/microseconds/etc). + */ +enum +{ + OS_TIME_TICK_RESOLUTION_NS = 100, + OS_TIME_TICKS_PER_SECOND = 1000000000 / OS_TIME_TICK_RESOLUTION_NS, + OS_TIME_TICKS_PER_MSEC = 1000000 / OS_TIME_TICK_RESOLUTION_NS, + OS_TIME_TICKS_PER_USEC = 1000 / OS_TIME_TICK_RESOLUTION_NS +}; + /** @defgroup OSAPIClock OSAL Real Time Clock APIs * @{ */ @@ -108,7 +127,7 @@ int32 OS_SetLocalTime(const OS_time_t *time_struct); */ static inline int64 OS_TimeGetTotalSeconds(OS_time_t tm) { - return (tm.seconds); + return (tm.ticks / OS_TIME_TICKS_PER_SECOND); } /*-------------------------------------------------------------------------------------*/ @@ -122,7 +141,7 @@ static inline int64 OS_TimeGetTotalSeconds(OS_time_t tm) */ static inline int64 OS_TimeGetTotalMilliseconds(OS_time_t tm) { - return (((int64)tm.seconds * 1000) + (tm.microsecs / 1000)); + return (tm.ticks / OS_TIME_TICKS_PER_MSEC); } /*-------------------------------------------------------------------------------------*/ @@ -136,7 +155,7 @@ static inline int64 OS_TimeGetTotalMilliseconds(OS_time_t tm) */ static inline int64 OS_TimeGetTotalMicroseconds(OS_time_t tm) { - return (((int64)tm.seconds * 1000000) + tm.microsecs); + return (tm.ticks / OS_TIME_TICKS_PER_USEC); } /*-------------------------------------------------------------------------------------*/ @@ -154,7 +173,7 @@ static inline int64 OS_TimeGetTotalMicroseconds(OS_time_t tm) */ static inline int64 OS_TimeGetTotalNanoseconds(OS_time_t tm) { - return (((int64)tm.seconds * 1000000000) + (tm.microsecs * 1000)); + return (tm.ticks * OS_TIME_TICK_RESOLUTION_NS); } /*-------------------------------------------------------------------------------------*/ @@ -169,7 +188,7 @@ static inline int64 OS_TimeGetTotalNanoseconds(OS_time_t tm) */ static inline int64 OS_TimeGetFractionalPart(OS_time_t tm) { - return (tm.microsecs); + return (tm.ticks % OS_TIME_TICKS_PER_SECOND); } /*-------------------------------------------------------------------------------------*/ @@ -194,7 +213,8 @@ static inline uint32 OS_TimeGetSubsecondsPart(OS_time_t tm) * It also must round up, otherwise this may result in a value one * less than the original when converted back to usec again. */ - return (((OS_TimeGetFractionalPart(tm) << 26) + 15624) / 15625); + int64 frac = (OS_TimeGetFractionalPart(tm) << 30) + (OS_TIME_TICKS_PER_SECOND >> 2); + return (uint32)((frac - 1) / (OS_TIME_TICKS_PER_SECOND >> 2)); } @@ -212,7 +232,7 @@ static inline uint32 OS_TimeGetSubsecondsPart(OS_time_t tm) */ static inline uint32 OS_TimeGetMillisecondsPart(OS_time_t tm) { - return OS_TimeGetFractionalPart(tm) / 1000; + return (uint32)OS_TimeGetFractionalPart(tm) / OS_TIME_TICKS_PER_MSEC; } /*-------------------------------------------------------------------------------------*/ @@ -237,7 +257,7 @@ static inline uint32 OS_TimeGetMillisecondsPart(OS_time_t tm) */ static inline uint32 OS_TimeGetMicrosecondsPart(OS_time_t tm) { - return OS_TimeGetFractionalPart(tm); + return (uint32)OS_TimeGetFractionalPart(tm) / OS_TIME_TICKS_PER_USEC; } /*-------------------------------------------------------------------------------------*/ @@ -256,7 +276,7 @@ static inline uint32 OS_TimeGetMicrosecondsPart(OS_time_t tm) */ static inline uint32 OS_TimeGetNanosecondsPart(OS_time_t tm) { - return OS_TimeGetFractionalPart(tm) * 1000; + return (uint32)OS_TimeGetFractionalPart(tm) * OS_TIME_TICK_RESOLUTION_NS; } /*-------------------------------------------------------------------------------------*/ @@ -278,8 +298,8 @@ static inline uint32 OS_TimeGetNanosecondsPart(OS_time_t tm) static inline OS_time_t OS_TimeAssembleFromNanoseconds(int64 seconds, uint32 nanoseconds) { OS_time_t result; - result.seconds = seconds; - result.microsecs = nanoseconds / 1000; + result.ticks = seconds * OS_TIME_TICKS_PER_SECOND; + result.ticks += nanoseconds / OS_TIME_TICK_RESOLUTION_NS; return result; } @@ -302,8 +322,8 @@ static inline OS_time_t OS_TimeAssembleFromNanoseconds(int64 seconds, uint32 nan static inline OS_time_t OS_TimeAssembleFromMicroseconds(int64 seconds, uint32 microseconds) { OS_time_t result; - result.seconds = seconds; - result.microsecs = microseconds; + result.ticks = seconds * OS_TIME_TICKS_PER_SECOND; + result.ticks += microseconds * OS_TIME_TICKS_PER_USEC; return result; } @@ -326,8 +346,8 @@ static inline OS_time_t OS_TimeAssembleFromMicroseconds(int64 seconds, uint32 mi static inline OS_time_t OS_TimeAssembleFromMilliseconds(int64 seconds, uint32 milliseconds) { OS_time_t result; - result.seconds = seconds; - result.microsecs = milliseconds * 1000; + result.ticks = seconds * OS_TIME_TICKS_PER_SECOND; + result.ticks += milliseconds * OS_TIME_TICKS_PER_MSEC; return result; } @@ -350,9 +370,9 @@ static inline OS_time_t OS_TimeAssembleFromMilliseconds(int64 seconds, uint32 mi static inline OS_time_t OS_TimeAssembleFromSubseconds(int64 seconds, uint32 subseconds) { OS_time_t result; - result.seconds = seconds; + result.ticks = seconds * OS_TIME_TICKS_PER_SECOND; /* this should not round in any way, as the 32-bit input value has higher precision */ - result.microsecs = ((int64)subseconds * 15625) >> 26; + result.ticks += ((int64)subseconds * (OS_TIME_TICKS_PER_SECOND >> 2)) >> 30; return result; } @@ -367,15 +387,7 @@ static inline OS_time_t OS_TimeAssembleFromSubseconds(int64 seconds, uint32 subs */ static inline OS_time_t OS_TimeAdd(OS_time_t time1, OS_time_t time2) { - OS_time_t result = time1; - result.seconds += time2.seconds; - result.microsecs += time2.microsecs; - if (result.microsecs >= 1000000) - { - ++result.seconds; - result.microsecs -= 1000000; - } - return result; + return ((OS_time_t) { time1.ticks + time2.ticks }); } /*-------------------------------------------------------------------------------------*/ @@ -389,15 +401,7 @@ static inline OS_time_t OS_TimeAdd(OS_time_t time1, OS_time_t time2) */ static inline OS_time_t OS_TimeSubtract(OS_time_t time1, OS_time_t time2) { - OS_time_t result = time1; - result.seconds -= time2.seconds; - result.microsecs -= time2.microsecs; - if (result.microsecs >= 1000000) - { - --result.seconds; - result.microsecs += 1000000; - } - return result; + return ((OS_time_t) { time1.ticks - time2.ticks }); } diff --git a/src/unit-test-coverage/shared/src/coveragetest-clock.c b/src/unit-test-coverage/shared/src/coveragetest-clock.c index 20959c987..8c7685c9f 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-clock.c +++ b/src/unit-test-coverage/shared/src/coveragetest-clock.c @@ -118,14 +118,14 @@ void Test_OS_TimeAccessConversions(void) UtAssert_UINT32_EQ(OS_TimeGetTotalMicroseconds(t4), 1901000); /* Note: Nanoseconds/Subseconds may not be exact due to limitations of OS_time_t resolution */ - UtAssert_UINT32_EQ(OS_TimeGetTotalNanoseconds(t1), 1234567000); - UtAssert_UINT32_EQ(OS_TimeGetTotalNanoseconds(t2), 2528888000); + UtAssert_UINT32_EQ(OS_TimeGetTotalNanoseconds(t1), 1234567800); + UtAssert_UINT32_EQ(OS_TimeGetTotalNanoseconds(t2), 2528888800); UtAssert_UINT32_EQ(OS_TimeGetTotalNanoseconds(t3), 45678000); UtAssert_UINT32_EQ(OS_TimeGetTotalNanoseconds(t4), 1901000000); /* These functions only return the fractional part, not the whole part */ - UtAssert_UINT32_EQ(OS_TimeGetSubsecondsPart(t1), 0x3c0c953a); - UtAssert_UINT32_EQ(OS_TimeGetSubsecondsPart(t2), 0x87653438); + UtAssert_UINT32_EQ(OS_TimeGetSubsecondsPart(t1), 0x3c0ca2a6); + UtAssert_UINT32_EQ(OS_TimeGetSubsecondsPart(t2), 0x876541a4); UtAssert_UINT32_EQ(OS_TimeGetSubsecondsPart(t3), 0x0bb18dad); UtAssert_UINT32_EQ(OS_TimeGetSubsecondsPart(t4), 0xe6a7ef9e); @@ -139,8 +139,8 @@ void Test_OS_TimeAccessConversions(void) UtAssert_UINT32_EQ(OS_TimeGetMicrosecondsPart(t3), 45678); UtAssert_UINT32_EQ(OS_TimeGetMicrosecondsPart(t4), 901000); - UtAssert_UINT32_EQ(OS_TimeGetNanosecondsPart(t1), 234567000); - UtAssert_UINT32_EQ(OS_TimeGetNanosecondsPart(t2), 528888000); + UtAssert_UINT32_EQ(OS_TimeGetNanosecondsPart(t1), 234567800); + UtAssert_UINT32_EQ(OS_TimeGetNanosecondsPart(t2), 528888800); UtAssert_UINT32_EQ(OS_TimeGetNanosecondsPart(t3), 45678000); UtAssert_UINT32_EQ(OS_TimeGetNanosecondsPart(t4), 901000000); From 8c7535c523aa140b3a5d43e674ba42c8345a16ad Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Thu, 14 Jan 2021 17:08:48 -0500 Subject: [PATCH 14/21] Fix #718, deprecate OS_fsBlocksFree and OS_fsBytesFree Users should call OS_FileSysStatVolume() and read the respective output members of the structure as indicated. --- src/os/inc/osapi-filesys.h | 11 + src/os/shared/src/osapi-filesys.c | 4 + .../shared/src/coveragetest-filesys.c | 77 ------- .../osfilesys-test/ut_osfilesys_diskio_test.c | 217 ------------------ .../osfilesys-test/ut_osfilesys_diskio_test.h | 2 - .../osfilesys-test/ut_osfilesys_test.c | 2 - src/ut-stubs/osapi-utstub-filesys.c | 4 + 7 files changed, 19 insertions(+), 298 deletions(-) diff --git a/src/os/inc/osapi-filesys.h b/src/os/inc/osapi-filesys.h index 8e37bdfb4..b0f719ce3 100644 --- a/src/os/inc/osapi-filesys.h +++ b/src/os/inc/osapi-filesys.h @@ -189,6 +189,8 @@ int32 OS_rmfs(const char *devname); */ int32 OS_unmount(const char *mountpoint); +#ifndef OSAL_OMIT_DEPRECATED + /*-------------------------------------------------------------------------------------*/ /** * @brief Obtain number of blocks free @@ -201,6 +203,10 @@ int32 OS_unmount(const char *mountpoint); * @retval #OS_INVALID_POINTER if name is NULL * @retval #OS_FS_ERR_PATH_TOO_LONG if the name is too long * @retval #OS_ERROR if the OS call failed + * + * @deprecated Replaced by OS_FileSysStatVolume() - + * Value can be obtained by reading the "blocks_free" struct member. + * */ int32 OS_fsBlocksFree(const char *name); @@ -221,9 +227,14 @@ int32 OS_fsBlocksFree(const char *name); * @retval #OS_INVALID_POINTER if name is NULL * @retval #OS_FS_ERR_PATH_TOO_LONG if the name is too long * @retval #OS_ERROR if the OS call failed + * + * @deprecated Replaced by OS_FileSysStatVolume(). + * Value can be obtained by multiplying the "blocks_free" by the "block_size" struct members. */ int32 OS_fsBytesFree(const char *name, uint64 *bytes_free); +#endif /* OSAL_OMIT_DEPRECATED */ + /*-------------------------------------------------------------------------------------*/ /** * @brief Obtains information about size and free space in a volume diff --git a/src/os/shared/src/osapi-filesys.c b/src/os/shared/src/osapi-filesys.c index 135e4ca77..6db99f794 100644 --- a/src/os/shared/src/osapi-filesys.c +++ b/src/os/shared/src/osapi-filesys.c @@ -533,6 +533,8 @@ int32 OS_unmount(const char *mountpoint) return return_code; } /* end OS_unmount */ +#ifndef OSAL_OMIT_DEPRECATED + /*---------------------------------------------------------------- * * Function: OS_fsBlocksFree @@ -616,6 +618,8 @@ int32 OS_fsBytesFree(const char *name, uint64 *bytes_free) } /* end OS_fsBytesFree */ +#endif /* OSAL_OMIT_DEPRECATED */ + /*---------------------------------------------------------------- * * Function: OS_FileSysStatVolume diff --git a/src/unit-test-coverage/shared/src/coveragetest-filesys.c b/src/unit-test-coverage/shared/src/coveragetest-filesys.c index 6d3c7191b..8d3180866 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-filesys.c +++ b/src/unit-test-coverage/shared/src/coveragetest-filesys.c @@ -253,81 +253,6 @@ void Test_OS_unmount(void) UtAssert_True(actual == expected, "OS_unmount() (%ld) == OS_FS_ERR_PATH_TOO_LONG", (long)actual); } -void Test_OS_fsBlocksFree(void) -{ - /* - * Test Case For: - * int32 OS_fsBlocksFree (const char *name) - */ - int32 expected = 1111; - int32 actual = ~OS_SUCCESS; - OS_statvfs_t statval; - - statval.block_size = OSAL_SIZE_C(1024); - statval.blocks_free = OSAL_BLOCKCOUNT_C(1111); - statval.total_blocks = OSAL_BLOCKCOUNT_C(2222); - UT_SetDataBuffer(UT_KEY(OS_FileSysStatVolume_Impl), &statval, sizeof(statval), false); - OS_filesys_table[1].flags = OS_FILESYS_FLAG_IS_READY | OS_FILESYS_FLAG_IS_MOUNTED_SYSTEM | - OS_FILESYS_FLAG_IS_MOUNTED_VIRTUAL; - - actual = OS_fsBlocksFree("/cf"); - UtAssert_True(actual == expected, "OS_fsBlocksFree() (%ld) == 1111", (long)actual); - - expected = OS_INVALID_POINTER; - actual = OS_fsBlocksFree(NULL); - UtAssert_True(actual == expected, "OS_fsBlocksFree() (%ld) == OS_INVALID_POINTER", (long)actual); - - UT_SetDefaultReturnValue(UT_KEY(OCS_memchr), OS_ERROR); - expected = OS_FS_ERR_PATH_TOO_LONG; - actual = OS_fsBlocksFree("/cf"); - UtAssert_True(actual == expected, "OS_fsBlocksFree() (%ld) == OS_FS_ERR_PATH_TOO_LONG", (long)actual); - UT_ClearForceFail(UT_KEY(OCS_memchr)); - - UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetBySearch), OS_ERR_NAME_NOT_FOUND); - expected = OS_FS_ERR_PATH_INVALID; - actual = OS_fsBlocksFree("invalid"); - UtAssert_True(actual == expected, "OS_fsBlocksFree() (%ld) == OS_FS_ERR_PATH_INVALID", (long)actual); -} - -void Test_OS_fsBytesFree(void) -{ - /* - * Test Case For: - * int32 OS_fsBytesFree (const char *name, uint64 *bytes_free) - */ - int32 expected = OS_SUCCESS; - int32 actual = ~OS_SUCCESS; - OS_statvfs_t statval; - uint64 bytes_free = 0; - - statval.block_size = OSAL_SIZE_C(1024); - statval.blocks_free = OSAL_BLOCKCOUNT_C(1111); - statval.total_blocks = OSAL_BLOCKCOUNT_C(2222); - UT_SetDataBuffer(UT_KEY(OS_FileSysStatVolume_Impl), &statval, sizeof(statval), false); - OS_filesys_table[1].flags = OS_FILESYS_FLAG_IS_READY | OS_FILESYS_FLAG_IS_MOUNTED_SYSTEM | - OS_FILESYS_FLAG_IS_MOUNTED_VIRTUAL; - - actual = OS_fsBytesFree("/cf", &bytes_free); - - UtAssert_True(actual == expected, "OS_fsBytesFree() (%ld) == OS_SUCCESS", (long)actual); - UtAssert_True(bytes_free == (1024 * 1111), "bytes_free (%lu) == (1024*1111)", (unsigned long)bytes_free); - - expected = OS_INVALID_POINTER; - actual = OS_fsBytesFree(NULL, NULL); - UtAssert_True(actual == expected, "OS_fsBytesFree() (%ld) == OS_INVALID_POINTER", (long)actual); - - UT_SetDefaultReturnValue(UT_KEY(OCS_memchr), OS_ERROR); - expected = OS_FS_ERR_PATH_TOO_LONG; - actual = OS_fsBytesFree("/cf", &bytes_free); - UtAssert_True(actual == expected, "OS_fsBytesFree() (%ld) == OS_FS_ERR_PATH_TOO_LONG", (long)actual); - UT_ClearForceFail(UT_KEY(OCS_memchr)); - - UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetBySearch), OS_ERR_NAME_NOT_FOUND); - expected = OS_FS_ERR_PATH_INVALID; - actual = OS_fsBytesFree("invalid", &bytes_free); - UtAssert_True(actual == expected, "OS_fsBytesFree() (%ld) == OS_FS_ERR_PATH_INVALID", (long)actual); -} - void Test_OS_FileSysStatVolume(void) { /* @@ -625,8 +550,6 @@ void UtTest_Setup(void) ADD_TEST(OS_initfs); ADD_TEST(OS_mount); ADD_TEST(OS_unmount); - ADD_TEST(OS_fsBlocksFree); - ADD_TEST(OS_fsBytesFree); ADD_TEST(OS_chkfs); ADD_TEST(OS_FS_GetPhysDriveName); ADD_TEST(OS_GetFsInfo); diff --git a/src/unit-tests/osfilesys-test/ut_osfilesys_diskio_test.c b/src/unit-tests/osfilesys-test/ut_osfilesys_diskio_test.c index 410e1efbf..e9938c84a 100644 --- a/src/unit-tests/osfilesys-test/ut_osfilesys_diskio_test.c +++ b/src/unit-tests/osfilesys-test/ut_osfilesys_diskio_test.c @@ -1053,223 +1053,6 @@ void UT_os_checkfs_test() return; } -/*--------------------------------------------------------------------------------* -** Syntax: int32 OS_fsBlocksFree(const char *name) -** Purpose: Returns the number of blocks free in a the file system -** Parameters: *name - a pointer to the name of the drive to check for free blocks -** Returns: OS_INVALID_POINTER if the pointer passed in is NULL -** OS_FS_ERR_PATH_TOO_LONG if the path passed in is too long -** OS_ERROR if the OS call failed -** Number of blocks free in a volume if succeeded -** OS_ERR_NOT_IMPLEMENTED if not implemented -** ----------------------------------------------------- -** Test #0: Not-implemented condition -** 1) Call this routine -** 2) If the returned value is OS_ERR_NOT_IMPLEMENTED, then exit test -** 3) Otherwise, continue. -** ----------------------------------------------------- -** Test #1: Null-pointer-arg condition -** 1) Call this routine with a null pointer as one of the arguments -** 2) Expect the returned value to be -** (a) OS_INVALID_POINTER -** ----------------------------------------------------- -** Test #2: Path-too-long-arg condition -** 1) Call this routine with a path name of length greater than Volume table's -** name as argument -** 2) Expect the returned value to be -** (a) OS_FS_ERR_PATH_TOO_LONG -** ----------------------------------------------------- -** Test #3: OS-call-failure condition -** 1) Setup the test to cause the OS call to fail inside this routine -** 2) Call this routine -** 3) Expect the returned value to be -** (a) OS_ERROR -** ----------------------------------------------------- -** Test#4: Nominal condition -** 1) Make sure no file system has been previously created -** 2) Call OS_mkfs -** 3) Expect the returned value to be -** (a) OS_SUCCESS -** 4) Call OS_mount with device name used in #2 -** 5) Expect the returned value to be -** (a) OS_SUCCESS -** 6) Call this routine with mount-point used in #4 -** 7) Expect the returned value to be -** (a) greater than or equal to 0 -** --------------------------------------------------------------------------------*/ -void UT_os_fsblocksfree_test() -{ - const char *testDesc; - - /*-----------------------------------------------------*/ - testDesc = "API not implemented"; - - if (OS_fsBlocksFree(NULL) == OS_ERR_NOT_IMPLEMENTED) - { - UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_NA); - goto UT_os_fsblocksfree_test_exit_tag; - } - - /*-----------------------------------------------------*/ - testDesc = "#1 Null-pointer-arg"; - - if (OS_fsBlocksFree(NULL) == OS_INVALID_POINTER) - UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); - else - UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_FAILURE); - - /*-----------------------------------------------------*/ - testDesc = "#2 Path-too-long-arg"; - - if (OS_fsBlocksFree(g_fsLongName) == OS_FS_ERR_PATH_TOO_LONG) - UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); - else - UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_FAILURE); - - /*-----------------------------------------------------*/ - testDesc = "#3 OS-call-failure"; - - UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_INFO); - - /*-----------------------------------------------------*/ - testDesc = "#4 Nominal"; - - if (OS_mkfs(g_fsAddrPtr, g_devNames[4], g_volNames[4], g_blkSize, g_blkCnt) != OS_SUCCESS) - { - testDesc = "#4 Nominal - File-system-create failed"; - UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_TSF); - goto UT_os_fsblocksfree_test_exit_tag; - } - - if (OS_mount(g_devNames[4], g_mntNames[4]) != OS_SUCCESS) - { - testDesc = "#4 Nominal - File-system-mount failed"; - UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_TSF); - goto UT_os_fsblocksfree_test_exit_tag; - } - - if (OS_fsBlocksFree(g_mntNames[4]) >= 0) - UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); - else - UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_FAILURE); - - /* Reset test environment */ - OS_unmount(g_mntNames[4]); - OS_rmfs(g_devNames[4]); - -UT_os_fsblocksfree_test_exit_tag: - return; -} - -/*--------------------------------------------------------------------------------* -** Syntax: int32 OS_fsBytesFree(const char *name, uint64 *bytes_free) -** Purpose: Returns the number of bytes free in a the file system -** Parameters: *name - a pointer to the name of the drive to check for free bytes -** *bytes_free - a pointer that will hold the number of bytes free -** Returns: OS_INVALID_POINTER if the pointer passed in is NULL -** OS_ERROR if the OS call failed -** OS_SUCCESS if succeeded -** OS_ERR_NOT_IMPLEMENTED if not implemented -** ----------------------------------------------------- -** Test #0: Not-implemented condition -** 1) Call this routine -** 2) If the returned value is OS_ERR_NOT_IMPLEMENTED, then exit test -** 3) Otherwise, continue. -** ----------------------------------------------------- -** Test #1: Null-pointer-arg condition -** 1) Call this routine with a null pointer as one of the arguments -** 2) Expect the returned value to be -** (a) OS_INVALID_POINTER -** ----------------------------------------------------- -** Test #2: Path-too-long-arg condition -** 1) Call this routine with a path name of length greater than Volume table's -** name as argument -** 2) Expect the returned value to be -** (a) OS_FS_ERR_PATH_TOO_LONG -** ----------------------------------------------------- -** Test #3: OS-call-failure condition -** 1) Setup the test to cause the OS call to fail inside this routine -** 2) Call this routine -** 3) Expect the returned value to be -** (a) OS_ERROR -** ----------------------------------------------------- -** Test#4: Nominal condition -** 1) Make sure no file system has been previously created -** 2) Call OS_mkfs -** 3) Expect the returned value to be -** (a) OS_SUCCESS -** 4) Call OS_mount with device name used in #2 -** 5) Expect the returned value to be -** (a) OS_SUCCESS -** 6) Call this routine with mount-point used in #4 -** 7) Expect the returned value to be -** (a) greater than or equal to 0 -** --------------------------------------------------------------------------------*/ -void UT_os_fsbytesfree_test() -{ - uint64 retBytes = 0; - const char *testDesc; - - /*-----------------------------------------------------*/ - testDesc = "API not implemented"; - - if (OS_fsBytesFree(NULL, NULL) == OS_ERR_NOT_IMPLEMENTED) - { - UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_NA); - goto UT_os_fsbytesfree_test_exit_tag; - } - - /*-----------------------------------------------------*/ - testDesc = "#1 Null-pointer-arg"; - - if ((OS_fsBytesFree(NULL, &retBytes) == OS_INVALID_POINTER) && - (OS_fsBytesFree(g_mntNames[1], NULL) == OS_INVALID_POINTER)) - UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); - else - UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_FAILURE); - - /*-----------------------------------------------------*/ - testDesc = "#2 Path-too-long-arg"; - - if (OS_fsBytesFree(g_fsLongName, &retBytes) == OS_FS_ERR_PATH_TOO_LONG) - UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); - else - UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_FAILURE); - - /*-----------------------------------------------------*/ - testDesc = "#3 OS-call-failure"; - - UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_INFO); - - /*-----------------------------------------------------*/ - testDesc = "#4 Nominal"; - - if (OS_mkfs(g_fsAddrPtr, g_devNames[4], g_volNames[4], g_blkSize, g_blkCnt) != OS_SUCCESS) - { - testDesc = "#4 Nominal - File-system-create failed"; - UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_TSF); - goto UT_os_fsbytesfree_test_exit_tag; - } - - if (OS_mount(g_devNames[4], g_mntNames[4]) != OS_SUCCESS) - { - testDesc = "#4 Nominal - File-system-mount failed"; - UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_TSF); - goto UT_os_fsbytesfree_test_exit_tag; - } - - if (OS_fsBytesFree(g_mntNames[4], &retBytes) == OS_SUCCESS) - UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); - else - UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_FAILURE); - - /* Reset test environment */ - OS_unmount(g_mntNames[4]); - OS_rmfs(g_devNames[4]); - -UT_os_fsbytesfree_test_exit_tag: - return; -} /*--------------------------------------------------------------------------------* ** Syntax: int32 OS_fsstatvolume(const char *name) diff --git a/src/unit-tests/osfilesys-test/ut_osfilesys_diskio_test.h b/src/unit-tests/osfilesys-test/ut_osfilesys_diskio_test.h index f1420c68c..b9141a773 100644 --- a/src/unit-tests/osfilesys-test/ut_osfilesys_diskio_test.h +++ b/src/unit-tests/osfilesys-test/ut_osfilesys_diskio_test.h @@ -69,8 +69,6 @@ void UT_os_translatepath_test(void); void UT_os_checkfs_test(void); -void UT_os_fsblocksfree_test(void); -void UT_os_fsbytesfree_test(void); void UT_os_fsstatvolume_test(void); /*--------------------------------------------------------------------------------*/ diff --git a/src/unit-tests/osfilesys-test/ut_osfilesys_test.c b/src/unit-tests/osfilesys-test/ut_osfilesys_test.c index 3850eff52..5a8496d72 100644 --- a/src/unit-tests/osfilesys-test/ut_osfilesys_test.c +++ b/src/unit-tests/osfilesys-test/ut_osfilesys_test.c @@ -135,8 +135,6 @@ void UtTest_Setup(void) UtTest_Add(UT_os_translatepath_test, NULL, NULL, "OS_TranslatePath (internal)"); UtTest_Add(UT_os_checkfs_test, NULL, NULL, "OS_chkfs"); - UtTest_Add(UT_os_fsblocksfree_test, NULL, NULL, "OS_fsBlocksFree"); - UtTest_Add(UT_os_fsbytesfree_test, NULL, NULL, "OS_fsBytesFree"); UtTest_Add(UT_os_fsstatvolume_test, NULL, NULL, "OS_FileSysStatVolume"); } diff --git a/src/ut-stubs/osapi-utstub-filesys.c b/src/ut-stubs/osapi-utstub-filesys.c index b696751e5..f0f4d6175 100644 --- a/src/ut-stubs/osapi-utstub-filesys.c +++ b/src/ut-stubs/osapi-utstub-filesys.c @@ -153,6 +153,8 @@ int32 OS_unmount(const char *mountpoint) return status; } +#ifndef OSAL_OMIT_DEPRECATED + /***************************************************************************** * * Stub function for OS_fsBlocksFree() @@ -192,6 +194,8 @@ int32 OS_fsBytesFree(const char *name, uint64 *bytes_free) return status; } +#endif /* OSAL_OMIT_DEPRECATED */ + /***************************************************************************** * * Stub function for OS_FileSysStatVolume() From 08693ccf8dd0ec22640978509b9e7546bc5bd9bc Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Fri, 15 Jan 2021 10:20:07 -0500 Subject: [PATCH 15/21] Fix #761, Terminate string in TestReadWriteLseek --- src/tests/file-api-test/file-api-test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tests/file-api-test/file-api-test.c b/src/tests/file-api-test/file-api-test.c index 2ff84524f..406ba66eb 100644 --- a/src/tests/file-api-test/file-api-test.c +++ b/src/tests/file-api-test/file-api-test.c @@ -330,7 +330,8 @@ void TestReadWriteLseek(void) status = OS_OpenCreate(&fd, filename, OS_FILE_FLAG_CREATE | OS_FILE_FLAG_TRUNCATE, OS_READ_WRITE); UtAssert_True(status >= OS_SUCCESS, "status after creat = %d", (int)status); - size = strlen(buffer); + /* Write the string including null character */ + size = strlen(buffer) + 1; /* test write portion of R/W mode */ status = OS_write(fd, (void *)buffer, size); From 33738d084f169eccf1018ffe43c1ee01fb2ba736 Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Thu, 21 Jan 2021 11:41:51 -0500 Subject: [PATCH 16/21] HOTFIX - Reset va list in OS_printf stub --- src/ut-stubs/osapi-utstub-printf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ut-stubs/osapi-utstub-printf.c b/src/ut-stubs/osapi-utstub-printf.c index 19b4b4a9c..52d162bcc 100644 --- a/src/ut-stubs/osapi-utstub-printf.c +++ b/src/ut-stubs/osapi-utstub-printf.c @@ -65,10 +65,14 @@ void OS_printf(const char *string, ...) va_list va; char str[128]; + /* Output the message when in debug mode */ va_start(va, string); - vsnprintf(str, sizeof(str), string, va); UtDebug("OS_printf: %s", str); + va_end(va); + + /* Reset va list for next use */ + va_start(va, string); status = UT_DefaultStubImplWithArgs(__func__, UT_KEY(OS_printf), 0, va); From 3fa2f50c078ffc4135e61e1f51c0048040c7a65b Mon Sep 17 00:00:00 2001 From: Alex Campbell Date: Mon, 4 Jan 2021 09:44:24 -0500 Subject: [PATCH 17/21] Fix #724, Refactor UT_ClearForceFail to UT_ClearDefaultReturnValue --- .../portable/src/coveragetest-posix-files.c | 8 +++---- .../shared/src/coveragetest-binsem.c | 2 +- .../shared/src/coveragetest-countsem.c | 2 +- .../shared/src/coveragetest-file.c | 6 ++--- .../shared/src/coveragetest-filesys.c | 14 ++++++------ .../shared/src/coveragetest-idmap.c | 2 +- .../shared/src/coveragetest-mutex.c | 2 +- .../shared/src/coveragetest-queue.c | 4 ++-- .../shared/src/coveragetest-select.c | 2 +- .../shared/src/coveragetest-sockets.c | 2 +- .../shared/src/coveragetest-task.c | 6 ++--- .../shared/src/coveragetest-time.c | 22 +++++++++---------- .../shared/src/coveragetest-timebase.c | 4 ++-- .../vxworks/src/coveragetest-common.c | 2 +- .../vxworks/src/coveragetest-console.c | 4 ++-- .../vxworks/src/coveragetest-filesys.c | 10 ++++----- .../vxworks/src/coveragetest-idmap.c | 2 +- .../vxworks/src/coveragetest-loader.c | 8 +++---- .../vxworks/src/coveragetest-no-module.c | 8 +++---- .../vxworks/src/coveragetest-symtab.c | 6 ++--- .../vxworks/src/coveragetest-tasks.c | 2 +- .../vxworks/src/coveragetest-timebase.c | 4 ++-- ut_assert/inc/utstubs.h | 13 ++++++++++- ut_assert/src/utstubs.c | 21 +++++++++++------- 24 files changed, 86 insertions(+), 70 deletions(-) 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 51ef4581e..28a03e849 100644 --- a/src/unit-test-coverage/portable/src/coveragetest-posix-files.c +++ b/src/unit-test-coverage/portable/src/coveragetest-posix-files.c @@ -69,7 +69,7 @@ void Test_OS_FileStat_Impl(void) /* failure mode */ UT_SetDefaultReturnValue(UT_KEY(OCS_stat), -1); OSAPI_TEST_FUNCTION_RC(OS_FileStat_Impl, ("local", &FileStats), OS_ERROR); - UT_ClearForceFail(UT_KEY(OCS_stat)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_stat)); /* nominal, no permission bits */ memset(&FileStats, 0, sizeof(FileStats)); @@ -108,12 +108,12 @@ void Test_OS_FileChmod_Impl(void) /* failure mode 0 (open) */ UT_SetDefaultReturnValue(UT_KEY(OCS_open), -1); OSAPI_TEST_FUNCTION_RC(OS_FileChmod_Impl, ("local", OS_READ_WRITE), OS_ERROR); - UT_ClearForceFail(UT_KEY(OCS_open)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_open)); /* failure mode 1 (fstat) */ UT_SetDefaultReturnValue(UT_KEY(OCS_fstat), -1); OSAPI_TEST_FUNCTION_RC(OS_FileChmod_Impl, ("local", OS_READ_WRITE), OS_ERROR); - UT_ClearForceFail(UT_KEY(OCS_fstat)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_fstat)); /* failure mode 2 (fchmod) */ UT_SetDefaultReturnValue(UT_KEY(OCS_fchmod), -1); @@ -122,7 +122,7 @@ 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); - UT_ClearForceFail(UT_KEY(OCS_fchmod)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_fchmod)); /* all permission bits with uid/gid match */ RefStat.st_uid = UT_PortablePosixFileTest_GetSelfEUID(); diff --git a/src/unit-test-coverage/shared/src/coveragetest-binsem.c b/src/unit-test-coverage/shared/src/coveragetest-binsem.c index d46010c8b..37bfcd920 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-binsem.c +++ b/src/unit-test-coverage/shared/src/coveragetest-binsem.c @@ -150,7 +150,7 @@ void Test_OS_BinSemGetIdByName(void) actual = OS_BinSemGetIdByName(&objid, "UT"); UtAssert_True(actual == expected, "OS_BinSemGetIdByName() (%ld) == OS_SUCCESS", (long)actual); OSAPI_TEST_OBJID(objid, !=, OS_OBJECT_ID_UNDEFINED); - UT_ClearForceFail(UT_KEY(OS_ObjectIdFindByName)); + UT_ClearDefaultReturnValue(UT_KEY(OS_ObjectIdFindByName)); expected = OS_ERR_NAME_NOT_FOUND; actual = OS_BinSemGetIdByName(&objid, "NF"); diff --git a/src/unit-test-coverage/shared/src/coveragetest-countsem.c b/src/unit-test-coverage/shared/src/coveragetest-countsem.c index b89a2c6ed..f4d9fae62 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-countsem.c +++ b/src/unit-test-coverage/shared/src/coveragetest-countsem.c @@ -136,7 +136,7 @@ void Test_OS_CountSemGetIdByName(void) actual = OS_CountSemGetIdByName(&objid, "UT"); UtAssert_True(actual == expected, "OS_CountSemGetIdByName() (%ld) == OS_SUCCESS", (long)actual); OSAPI_TEST_OBJID(objid, !=, OS_OBJECT_ID_UNDEFINED); - UT_ClearForceFail(UT_KEY(OS_ObjectIdFindByName)); + UT_ClearDefaultReturnValue(UT_KEY(OS_ObjectIdFindByName)); expected = OS_ERR_NAME_NOT_FOUND; actual = OS_CountSemGetIdByName(&objid, "NF"); diff --git a/src/unit-test-coverage/shared/src/coveragetest-file.c b/src/unit-test-coverage/shared/src/coveragetest-file.c index 4292c5497..401ff6ae2 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-file.c +++ b/src/unit-test-coverage/shared/src/coveragetest-file.c @@ -82,7 +82,7 @@ void Test_OS_OpenCreate(void) expected = OS_ERROR; actual = OS_OpenCreate(&filedes, "/cf/file", OS_FILE_FLAG_NONE, OS_READ_WRITE); UtAssert_True(actual == OS_ERROR, "OS_OpenCreate() (%ld) == OS_ERROR (bad path)", (long)actual); - UT_ClearForceFail(UT_KEY(OS_TranslatePath)); + UT_ClearDefaultReturnValue(UT_KEY(OS_TranslatePath)); } void Test_OS_close(void) @@ -271,7 +271,7 @@ void Test_OS_cp(void) expected = -444; actual = OS_cp("/cf/file1", "/cf/file2"); UtAssert_True(actual == expected, "OS_cp() (%ld) == -444", (long)actual); - UT_ClearForceFail(UT_KEY(OS_GenericRead_Impl)); + UT_ClearDefaultReturnValue(UT_KEY(OS_GenericRead_Impl)); UT_SetDataBuffer(UT_KEY(OS_GenericRead_Impl), ReadBuf, sizeof(ReadBuf), false); UT_SetDefaultReturnValue(UT_KEY(OS_GenericWrite_Impl), -555); @@ -283,7 +283,7 @@ void Test_OS_cp(void) expected = OS_INVALID_POINTER; actual = OS_cp("/cf/file1", "/cf/file2"); UtAssert_True(actual == expected, "OS_cp() (%ld) == OS_INVALID_POINTER", (long)actual); - UT_ClearForceFail(UT_KEY(OS_TranslatePath)); + UT_ClearDefaultReturnValue(UT_KEY(OS_TranslatePath)); } void Test_OS_mv(void) diff --git a/src/unit-test-coverage/shared/src/coveragetest-filesys.c b/src/unit-test-coverage/shared/src/coveragetest-filesys.c index 8d3180866..17e8dc1f5 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-filesys.c +++ b/src/unit-test-coverage/shared/src/coveragetest-filesys.c @@ -103,7 +103,7 @@ void Test_OS_mkfs(void) expected = OS_FS_ERR_PATH_TOO_LONG; actual = OS_mkfs(TestBuffer, "/ramdev0", "vol", OSAL_SIZE_C(0), OSAL_BLOCKCOUNT_C(0)); UtAssert_True(actual == expected, "OS_mkfs() (%ld) == OS_FS_ERR_PATH_TOO_LONG", (long)actual); - UT_ClearForceFail(UT_KEY(OCS_memchr)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_memchr)); /* set up for failure due to empty strings */ expected = OS_FS_ERR_PATH_INVALID; @@ -140,7 +140,7 @@ void Test_OS_rmfs(void) expected = OS_ERR_NAME_NOT_FOUND; actual = OS_rmfs("/ramdev4"); UtAssert_True(actual == expected, "OS_rmfs() (%ld) == OS_ERR_NAME_NOT_FOUND", (long)actual); - UT_ClearForceFail(UT_KEY(OS_ObjectIdGetByName)); + UT_ClearDefaultReturnValue(UT_KEY(OS_ObjectIdGetByName)); expected = OS_INVALID_POINTER; actual = OS_rmfs(NULL); @@ -178,7 +178,7 @@ void Test_OS_initfs(void) expected = OS_FS_ERR_PATH_TOO_LONG; actual = OS_initfs(TestBuffer, "/ramdev0", "vol", OSAL_SIZE_C(0), OSAL_BLOCKCOUNT_C(0)); UtAssert_True(actual == expected, "OS_initfs() (%ld) == OS_FS_ERR_PATH_TOO_LONG", (long)actual); - UT_ClearForceFail(UT_KEY(OCS_memchr)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_memchr)); /* set up for failure */ UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdAllocateNew), OS_ERR_NO_FREE_IDS); @@ -326,7 +326,7 @@ void Test_OS_chkfs(void) expected = OS_FS_ERR_PATH_TOO_LONG; actual = OS_chkfs("/cf", false); UtAssert_True(actual == expected, "OS_fsBytesFree() (%ld) == OS_FS_ERR_PATH_TOO_LONG", (long)actual); - UT_ClearForceFail(UT_KEY(OCS_memchr)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_memchr)); /* Test Fail due to no matching VolTab entry */ UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetBySearch), OS_ERR_NAME_NOT_FOUND); @@ -351,7 +351,7 @@ void Test_OS_FS_GetPhysDriveName(void) expected = OS_FS_ERR_PATH_TOO_LONG; actual = OS_FS_GetPhysDriveName(NameBuf, "none"); UtAssert_True(actual == expected, "OS_FS_GetPhysDriveName() (%ld) == OS_FS_ERR_PATH_TOO_LONG", (long)actual); - UT_ClearForceFail(UT_KEY(OCS_memchr)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_memchr)); expected = OS_ERR_INCORRECT_OBJ_STATE; actual = OS_FS_GetPhysDriveName(NameBuf, "none"); @@ -435,7 +435,7 @@ void Test_OS_TranslatePath(void) expected = OS_FS_ERR_PATH_TOO_LONG; actual = OS_TranslatePath("/cf/test", LocalBuffer); UtAssert_True(actual == expected, "OS_TranslatePath() (%ld) == OS_FS_ERR_PATH_TOO_LONG", (long)actual); - UT_ClearForceFail(UT_KEY(OCS_strlen)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_strlen)); /* Invalid no '/' */ expected = OS_FS_ERR_PATH_INVALID; @@ -455,7 +455,7 @@ void Test_OS_TranslatePath(void) UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetBySearch), OS_ERR_NAME_NOT_FOUND); actual = OS_TranslatePath("/cf/test", LocalBuffer); UtAssert_True(actual == expected, "OS_TranslatePath() (%ld) == OS_FS_ERR_PATH_INVALID", (long)actual); - UT_ClearForceFail(UT_KEY(OS_ObjectIdGetBySearch)); + UT_ClearDefaultReturnValue(UT_KEY(OS_ObjectIdGetBySearch)); /* VirtPathLen < VirtPathBegin */ UT_SetDeferredRetcode(UT_KEY(OCS_strlen), 4, OS_MAX_PATH_LEN); diff --git a/src/unit-test-coverage/shared/src/coveragetest-idmap.c b/src/unit-test-coverage/shared/src/coveragetest-idmap.c index 6f7a4db4f..a4c28141a 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-idmap.c +++ b/src/unit-test-coverage/shared/src/coveragetest-idmap.c @@ -441,7 +441,7 @@ void Test_OS_ObjectIdFindByName(void) actual = OS_ObjectIdFindByName(OS_OBJECT_TYPE_OS_TASK, TaskName, &objid); UtAssert_True(actual == expected, "OS_ObjectFindIdByName(%s) (%ld) == OS_ERR_NAME_TOO_LONG", TaskName, (long)actual); - UT_ClearForceFail(UT_KEY(OCS_memchr)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_memchr)); /* * Pass in a name that is actually not found diff --git a/src/unit-test-coverage/shared/src/coveragetest-mutex.c b/src/unit-test-coverage/shared/src/coveragetest-mutex.c index 4c68e64a3..5928c1d2e 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-mutex.c +++ b/src/unit-test-coverage/shared/src/coveragetest-mutex.c @@ -121,7 +121,7 @@ void Test_OS_MutSemGetIdByName(void) actual = OS_MutSemGetIdByName(&objid, "UT"); UtAssert_True(actual == expected, "OS_MutSemGetIdByName() (%ld) == OS_SUCCESS", (long)actual); OSAPI_TEST_OBJID(objid, !=, OS_OBJECT_ID_UNDEFINED); - UT_ClearForceFail(UT_KEY(OS_ObjectIdFindByName)); + UT_ClearDefaultReturnValue(UT_KEY(OS_ObjectIdFindByName)); expected = OS_ERR_NAME_NOT_FOUND; actual = OS_MutSemGetIdByName(&objid, "NF"); diff --git a/src/unit-test-coverage/shared/src/coveragetest-queue.c b/src/unit-test-coverage/shared/src/coveragetest-queue.c index ba4387118..2ccd2ba98 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-queue.c +++ b/src/unit-test-coverage/shared/src/coveragetest-queue.c @@ -73,7 +73,7 @@ void Test_OS_QueueCreate(void) expected = OS_ERR_NAME_TOO_LONG; actual = OS_QueueCreate(&objid, "UT", OSAL_BLOCKCOUNT_C(0), OSAL_SIZE_C(4), 0); UtAssert_True(actual == expected, "OS_QueueCreate() (%ld) == OS_ERR_NAME_TOO_LONG", (long)actual); - UT_ClearForceFail(UT_KEY(OCS_memchr)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_memchr)); expected = OS_QUEUE_INVALID_SIZE; actual = OS_QueueCreate(&objid, "UT", OSAL_BLOCKCOUNT_C(1 + OS_QUEUE_MAX_DEPTH), OSAL_SIZE_C(4), 0); @@ -153,7 +153,7 @@ void Test_OS_QueueGetIdByName(void) UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdFindByName), OS_SUCCESS); actual = OS_QueueGetIdByName(&objid, "UT"); UtAssert_True(actual == expected, "OS_QueueGetIdByName() (%ld) == OS_SUCCESS", (long)actual); - UT_ClearForceFail(UT_KEY(OS_ObjectIdFindByName)); + UT_ClearDefaultReturnValue(UT_KEY(OS_ObjectIdFindByName)); expected = OS_ERR_NAME_NOT_FOUND; actual = OS_QueueGetIdByName(&objid, "NF"); diff --git a/src/unit-test-coverage/shared/src/coveragetest-select.c b/src/unit-test-coverage/shared/src/coveragetest-select.c index bb27e6451..34d81579e 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-select.c +++ b/src/unit-test-coverage/shared/src/coveragetest-select.c @@ -115,7 +115,7 @@ void Test_OS_SelectFdAddClearOps(void) UtAssert_True(!OS_SelectFdIsSet(&UtSet, UT_OBJID_1), "OS_SelectFdIsSet(1) == false"); UtAssert_True(!OS_SelectFdIsSet(&UtSet, UT_OBJID_2), "OS_SelectFdIsSet(2) == false"); - UT_ClearForceFail(UT_KEY(OS_ObjectIdToArrayIndex)); + UT_ClearDefaultReturnValue(UT_KEY(OS_ObjectIdToArrayIndex)); UtAssert_True(OS_SelectFdIsSet(&UtSet, UT_OBJID_1), "OS_SelectFdIsSet(1) == true"); UtAssert_True(!OS_SelectFdIsSet(&UtSet, UT_OBJID_2), "OS_SelectFdIsSet(2) == false"); } diff --git a/src/unit-test-coverage/shared/src/coveragetest-sockets.c b/src/unit-test-coverage/shared/src/coveragetest-sockets.c index 3e807bbe9..6981bfca0 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-sockets.c +++ b/src/unit-test-coverage/shared/src/coveragetest-sockets.c @@ -375,7 +375,7 @@ void Test_OS_SocketGetIdByName(void) actual = OS_SocketGetIdByName(&objid, "UT"); UtAssert_True(actual == expected, "OS_SocketGetIdByName() (%ld) == OS_SUCCESS", (long)actual); OSAPI_TEST_OBJID(objid, !=, OS_OBJECT_ID_UNDEFINED); - UT_ClearForceFail(UT_KEY(OS_ObjectIdFindByName)); + UT_ClearDefaultReturnValue(UT_KEY(OS_ObjectIdFindByName)); expected = OS_ERR_NAME_NOT_FOUND; actual = OS_SocketGetIdByName(&objid, "NF"); diff --git a/src/unit-test-coverage/shared/src/coveragetest-task.c b/src/unit-test-coverage/shared/src/coveragetest-task.c index ad34cf8c0..672a3e101 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-task.c +++ b/src/unit-test-coverage/shared/src/coveragetest-task.c @@ -227,7 +227,7 @@ void Test_OS_TaskGetIdByName(void) actual = OS_TaskGetIdByName(&objid, "UT"); UtAssert_True(actual == expected, "OS_TaskGetIdByName() (%ld) == OS_SUCCESS", (long)actual); OSAPI_TEST_OBJID(objid, !=, OS_OBJECT_ID_UNDEFINED); - UT_ClearForceFail(UT_KEY(OS_ObjectIdFindByName)); + UT_ClearDefaultReturnValue(UT_KEY(OS_ObjectIdFindByName)); expected = OS_ERR_NAME_NOT_FOUND; actual = OS_TaskGetIdByName(&objid, "NF"); @@ -318,14 +318,14 @@ void Test_OS_TaskFindIdBySystemData(void) UT_SetDefaultReturnValue(UT_KEY(OS_TaskValidateSystemData_Impl), expected); actual = OS_TaskFindIdBySystemData(&task_id, &test_sysdata, sizeof(test_sysdata)); UtAssert_True(actual == expected, "OS_TaskFindIdBySystemData() (%ld) == OS_INVALID_POINTER", (long)actual); - UT_ClearForceFail(UT_KEY(OS_TaskValidateSystemData_Impl)); + UT_ClearDefaultReturnValue(UT_KEY(OS_TaskValidateSystemData_Impl)); /* Test search failure */ expected = OS_ERR_NAME_NOT_FOUND; UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetBySearch), expected); actual = OS_TaskFindIdBySystemData(&task_id, &test_sysdata, sizeof(test_sysdata)); UtAssert_True(actual == expected, "OS_TaskFindIdBySystemData() (%ld) == OS_ERR_NAME_NOT_FOUND", (long)actual); - UT_ClearForceFail(UT_KEY(OS_ObjectIdGetBySearch)); + UT_ClearDefaultReturnValue(UT_KEY(OS_ObjectIdGetBySearch)); } /* Osapi_Test_Setup diff --git a/src/unit-test-coverage/shared/src/coveragetest-time.c b/src/unit-test-coverage/shared/src/coveragetest-time.c index 445714f32..bb81ff0d2 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-time.c +++ b/src/unit-test-coverage/shared/src/coveragetest-time.c @@ -85,7 +85,7 @@ void Test_OS_TimerAdd(void) expected = OS_ERR_NAME_TOO_LONG; actual = OS_TimerAdd(&objid, "UT", UT_OBJID_1, UT_TimerArgCallback, &arg); UtAssert_True(actual == expected, "OS_TimerAdd() (%ld) == OS_ERR_NAME_TOO_LONG", (long)actual); - UT_ClearForceFail(UT_KEY(OCS_memchr)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_memchr)); expected = OS_INVALID_POINTER; actual = OS_TimerAdd(&objid, "UT", UT_OBJID_1, NULL, &arg); @@ -95,19 +95,19 @@ void Test_OS_TimerAdd(void) expected = OS_ERR_INCORRECT_OBJ_STATE; actual = OS_TimerAdd(&objid, "UT", UT_OBJID_1, UT_TimerArgCallback, &arg); UtAssert_True(actual == expected, "OS_TimerAdd() (%ld) == OS_ERR_INCORRECT_OBJ_STATE", (long)actual); - UT_ClearForceFail(UT_KEY(OS_TaskGetId_Impl)); + UT_ClearDefaultReturnValue(UT_KEY(OS_TaskGetId_Impl)); UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), OS_ERROR); expected = OS_ERROR; actual = OS_TimerAdd(&objid, "UT", UT_OBJID_1, UT_TimerArgCallback, &arg); UtAssert_True(actual == expected, "OS_TimerAdd() (%ld) == OS_ERROR", (long)actual); - UT_ClearForceFail(UT_KEY(OS_ObjectIdGetById)); + UT_ClearDefaultReturnValue(UT_KEY(OS_ObjectIdGetById)); UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdAllocateNew), OS_ERROR); expected = OS_ERROR; actual = OS_TimerAdd(&objid, "UT", UT_OBJID_1, UT_TimerArgCallback, &arg); UtAssert_True(actual == expected, "OS_TimerAdd() (%ld) == OS_ERROR", (long)actual); - UT_ClearForceFail(UT_KEY(OS_ObjectIdAllocateNew)); + UT_ClearDefaultReturnValue(UT_KEY(OS_ObjectIdAllocateNew)); } void Test_OS_TimerCreate(void) @@ -147,13 +147,13 @@ void Test_OS_TimerCreate(void) expected = OS_ERROR; actual = OS_TimerCreate(&objid, "UT", &accuracy, UT_TimerCallback); UtAssert_True(actual == expected, "OS_TimerCreate() (%ld) == OS_ERROR", (long)actual); - UT_ClearForceFail(UT_KEY(OS_TimeBaseCreate)); + UT_ClearDefaultReturnValue(UT_KEY(OS_TimeBaseCreate)); UT_SetDefaultReturnValue(UT_KEY(OCS_memchr), OS_ERROR); expected = OS_ERR_NAME_TOO_LONG; actual = OS_TimerCreate(&objid, "UT", &accuracy, UT_TimerCallback); UtAssert_True(actual == expected, "OS_TimerCreate() (%ld) == OS_ERR_NAME_TOO_LONG", (long)actual); - UT_ClearForceFail(UT_KEY(OCS_memchr)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_memchr)); } void Test_OS_TimerSet(void) @@ -186,7 +186,7 @@ void Test_OS_TimerSet(void) expected = OS_ERR_INCORRECT_OBJ_STATE; actual = OS_TimerSet(UT_OBJID_2, 0, 1); UtAssert_True(actual == expected, "OS_TimerSet() (%ld) == OS_ERR_INCORRECT_OBJ_STATE", (long)actual); - UT_ClearForceFail(UT_KEY(OS_TaskGetId_Impl)); + UT_ClearDefaultReturnValue(UT_KEY(OS_TaskGetId_Impl)); } void Test_OS_TimerDelete(void) @@ -234,7 +234,7 @@ void Test_OS_TimerDelete(void) expected = OS_ERR_INCORRECT_OBJ_STATE; actual = OS_TimerDelete(UT_OBJID_2); UtAssert_True(actual == expected, "OS_TimerDelete() (%ld) == OS_ERR_INCORRECT_OBJ_STATE", (long)actual); - UT_ClearForceFail(UT_KEY(OS_TaskGetId_Impl)); + UT_ClearDefaultReturnValue(UT_KEY(OS_TaskGetId_Impl)); } void Test_OS_TimerGetIdByName(void) @@ -250,7 +250,7 @@ void Test_OS_TimerGetIdByName(void) UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdFindByName), OS_SUCCESS); actual = OS_TimerGetIdByName(&objid, "UT"); UtAssert_True(actual == expected, "OS_TimerGetIdByName() (%ld) == OS_SUCCESS", (long)actual); - UT_ClearForceFail(UT_KEY(OS_ObjectIdFindByName)); + UT_ClearDefaultReturnValue(UT_KEY(OS_ObjectIdFindByName)); expected = OS_ERR_NAME_NOT_FOUND; actual = OS_TimerGetIdByName(&objid, "NF"); @@ -264,7 +264,7 @@ void Test_OS_TimerGetIdByName(void) expected = OS_ERR_INCORRECT_OBJ_STATE; actual = OS_TimerGetIdByName(&objid, "NF"); UtAssert_True(actual == expected, "OS_TimerGetIdByName() (%ld) == %ld", (long)actual, (long)expected); - UT_ClearForceFail(UT_KEY(OS_TaskGetId_Impl)); + UT_ClearDefaultReturnValue(UT_KEY(OS_TaskGetId_Impl)); } void Test_OS_TimerGetInfo(void) @@ -301,7 +301,7 @@ void Test_OS_TimerGetInfo(void) expected = OS_ERR_INCORRECT_OBJ_STATE; actual = OS_TimerGetInfo(UT_OBJID_1, &timer_prop); UtAssert_True(actual == expected, "OS_TimerGetInfo() (%ld) == OS_ERR_INCORRECT_OBJ_STATE", (long)actual); - UT_ClearForceFail(UT_KEY(OS_TaskGetId_Impl)); + UT_ClearDefaultReturnValue(UT_KEY(OS_TaskGetId_Impl)); } /* Osapi_Test_Setup diff --git a/src/unit-test-coverage/shared/src/coveragetest-timebase.c b/src/unit-test-coverage/shared/src/coveragetest-timebase.c index a1e142590..52489b730 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-timebase.c +++ b/src/unit-test-coverage/shared/src/coveragetest-timebase.c @@ -103,7 +103,7 @@ void Test_OS_TimeBaseCreate(void) expected = OS_ERR_NAME_TOO_LONG; actual = OS_TimeBaseCreate(&objid, "UT", UT_TimerSync); UtAssert_True(actual == expected, "OS_TimeBaseCreate() (%ld) == OS_ERR_NAME_TOO_LONG", (long)actual); - UT_ClearForceFail(UT_KEY(OCS_memchr)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_memchr)); UT_SetDefaultReturnValue(UT_KEY(OS_TaskGetId_Impl), 1 | (OS_OBJECT_TYPE_OS_TIMEBASE << OS_OBJECT_TYPE_SHIFT)); expected = OS_ERR_INCORRECT_OBJ_STATE; @@ -166,7 +166,7 @@ void Test_OS_TimeBaseGetIdByName(void) actual = OS_TimeBaseGetIdByName(&objid, "UT"); UtAssert_True(actual == expected, "OS_TimeBaseGetIdByName() (%ld) == OS_SUCCESS", (long)actual); OSAPI_TEST_OBJID(objid, !=, OS_OBJECT_ID_UNDEFINED); - UT_ClearForceFail(UT_KEY(OS_ObjectIdFindByName)); + UT_ClearDefaultReturnValue(UT_KEY(OS_ObjectIdFindByName)); expected = OS_ERR_NAME_NOT_FOUND; actual = OS_TimeBaseGetIdByName(&objid, "NF"); diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-common.c b/src/unit-test-coverage/vxworks/src/coveragetest-common.c index e8737479d..85ce295c1 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-common.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-common.c @@ -44,7 +44,7 @@ void Test_OS_API_Impl_Init(void) OSAPI_TEST_FUNCTION_RC(OS_API_Impl_Init(0), OS_SUCCESS); UT_SetDefaultReturnValue(UT_StubKey_OS_VxWorks_TableMutex_Init, OS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_API_Impl_Init(OS_OBJECT_TYPE_OS_TASK), OS_ERROR); - UT_ClearForceFail(UT_StubKey_OS_VxWorks_TableMutex_Init); + UT_ClearDefaultReturnValue(UT_StubKey_OS_VxWorks_TableMutex_Init); OSAPI_TEST_FUNCTION_RC(OS_API_Impl_Init(OS_OBJECT_TYPE_OS_TASK), OS_SUCCESS); OSAPI_TEST_FUNCTION_RC(OS_API_Impl_Init(OS_OBJECT_TYPE_OS_QUEUE), OS_SUCCESS); OSAPI_TEST_FUNCTION_RC(OS_API_Impl_Init(OS_OBJECT_TYPE_OS_BINSEM), OS_SUCCESS); diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-console.c b/src/unit-test-coverage/vxworks/src/coveragetest-console.c index 0f0f437fa..39dc83670 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-console.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-console.c @@ -68,11 +68,11 @@ void Test_OS_ConsoleCreate_Impl(void) UT_SetDefaultReturnValue(UT_KEY(OCS_semCInitialize), OCS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_ConsoleCreate_Impl(&token), OS_SEM_FAILURE); - UT_ClearForceFail(UT_KEY(OCS_semCInitialize)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_semCInitialize)); UT_SetDefaultReturnValue(UT_KEY(OCS_taskSpawn), OCS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_ConsoleCreate_Impl(&token), OS_ERROR); - UT_ClearForceFail(UT_KEY(OCS_taskSpawn)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_taskSpawn)); token.obj_idx = OS_MAX_CONSOLES + 1; OSAPI_TEST_FUNCTION_RC(OS_ConsoleCreate_Impl(&token), OS_ERR_NOT_IMPLEMENTED); diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-filesys.c b/src/unit-test-coverage/vxworks/src/coveragetest-filesys.c index de2998415..8e08eae57 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-filesys.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-filesys.c @@ -140,7 +140,7 @@ void Test_OS_FileSysMountVolume_Impl(void) UT_SetDefaultReturnValue(UT_KEY(OCS_open), -1); OSAPI_TEST_FUNCTION_RC(OS_FileSysMountVolume_Impl(&token), OS_ERROR); - UT_ClearForceFail(UT_KEY(OCS_open)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_open)); /* Additional cases for the FS_BASED handling */ OS_filesys_table[0].fstype = OS_FILESYS_TYPE_FS_BASED; @@ -154,7 +154,7 @@ void Test_OS_FileSysMountVolume_Impl(void) OSAPI_TEST_FUNCTION_RC(OS_FileSysMountVolume_Impl(&token), OS_FS_ERR_DRIVE_NOT_CREATED); /* Mount dir does exist but not a directory */ - UT_ClearForceFail(UT_KEY(OCS_stat)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_stat)); OSAPI_TEST_FUNCTION_RC(OS_FileSysMountVolume_Impl(&token), OS_FS_ERR_PATH_INVALID); /* Mount dir does exist and is a directory */ @@ -179,11 +179,11 @@ void Test_OS_FileSysUnmountVolume_Impl(void) UT_SetDefaultReturnValue(UT_KEY(OCS_open), -1); OSAPI_TEST_FUNCTION_RC(OS_FileSysUnmountVolume_Impl(&token), OS_ERROR); - UT_ClearForceFail(UT_KEY(OCS_open)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_open)); UT_SetDefaultReturnValue(UT_KEY(OCS_ioctl), -1); OSAPI_TEST_FUNCTION_RC(OS_FileSysUnmountVolume_Impl(&token), OS_ERROR); - UT_ClearForceFail(UT_KEY(OCS_ioctl)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_ioctl)); /* Additional cases for the FS_BASED handling (no op on unmount) */ OS_filesys_table[0].fstype = OS_FILESYS_TYPE_FS_BASED; @@ -217,7 +217,7 @@ void Test_OS_FileSysCheckVolume_Impl(void) UT_SetDefaultReturnValue(UT_KEY(OCS_open), -1); OSAPI_TEST_FUNCTION_RC(OS_FileSysCheckVolume_Impl(&token, false), OS_ERROR); - UT_ClearForceFail(UT_KEY(OCS_open)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_open)); UT_SetDefaultReturnValue(UT_KEY(OCS_ioctl), -1); OSAPI_TEST_FUNCTION_RC(OS_FileSysCheckVolume_Impl(&token, false), OS_ERROR); diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-idmap.c b/src/unit-test-coverage/vxworks/src/coveragetest-idmap.c index e97635900..f8d7d907c 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-idmap.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-idmap.c @@ -74,7 +74,7 @@ void Test_OS_API_Impl_Init(void) OSAPI_TEST_FUNCTION_RC(UT_Call_OS_VxWorks_TableMutex_Init(0), OS_SUCCESS); UT_SetDefaultReturnValue(UT_KEY(OCS_semMInitialize), -1); OSAPI_TEST_FUNCTION_RC(UT_Call_OS_VxWorks_TableMutex_Init(OS_OBJECT_TYPE_OS_TASK), OS_ERROR); - UT_ClearForceFail(UT_KEY(OCS_semMInitialize)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_semMInitialize)); OSAPI_TEST_FUNCTION_RC(UT_Call_OS_VxWorks_TableMutex_Init(OS_OBJECT_TYPE_OS_TASK), OS_SUCCESS); } diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-loader.c b/src/unit-test-coverage/vxworks/src/coveragetest-loader.c index 21fcb7858..505f69892 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-loader.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-loader.c @@ -55,10 +55,10 @@ void Test_OS_ModuleLoad_Impl(void) OSAPI_TEST_FUNCTION_RC(OS_ModuleLoad_Impl(&token, "local"), OS_SUCCESS); UT_SetDefaultReturnValue(UT_KEY(OCS_open), -1); OSAPI_TEST_FUNCTION_RC(OS_ModuleLoad_Impl(&token, "local"), OS_ERROR); - UT_ClearForceFail(UT_KEY(OCS_open)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_open)); UT_SetDefaultReturnValue(UT_KEY(OCS_loadModule), OCS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_ModuleLoad_Impl(&token, "local"), OS_ERROR); - UT_ClearForceFail(UT_KEY(OCS_loadModule)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_loadModule)); } void Test_OS_ModuleUnload_Impl(void) @@ -71,7 +71,7 @@ void Test_OS_ModuleUnload_Impl(void) OSAPI_TEST_FUNCTION_RC(OS_ModuleUnload_Impl(&token), OS_SUCCESS); UT_SetDefaultReturnValue(UT_KEY(OCS_unldByModuleId), OCS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_ModuleUnload_Impl(&token), OS_ERROR); - UT_ClearForceFail(UT_KEY(OCS_unldByModuleId)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_unldByModuleId)); } void Test_OS_ModuleGetInfo_Impl(void) @@ -93,7 +93,7 @@ void Test_OS_ModuleGetInfo_Impl(void) memset(&module_prop, 0, sizeof(module_prop)); UT_SetDefaultReturnValue(UT_KEY(OCS_moduleInfoGet), OCS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_ModuleGetInfo_Impl(&token, &module_prop), OS_SUCCESS); - UT_ClearForceFail(UT_KEY(OCS_moduleInfoGet)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_moduleInfoGet)); UtAssert_True(!module_prop.addr.valid, "addresses in output not valid"); } diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-no-module.c b/src/unit-test-coverage/vxworks/src/coveragetest-no-module.c index ed9b3083d..e736cbecf 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-no-module.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-no-module.c @@ -51,10 +51,10 @@ void Test_OS_ModuleLoad_Impl(void) OSAPI_TEST_FUNCTION_RC(OS_ModuleLoad_Impl(0, "local"), OS_SUCCESS); UT_SetDefaultReturnValue(UT_KEY(OCS_open), -1); OSAPI_TEST_FUNCTION_RC(OS_ModuleLoad_Impl(0, "local"), OS_ERROR); - UT_ClearForceFail(UT_KEY(OCS_open)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_open)); UT_SetDefaultReturnValue(UT_KEY(OCS_loadModule), OCS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_ModuleLoad_Impl(0, "local"), OS_ERROR); - UT_ClearForceFail(UT_KEY(OCS_loadModule)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_loadModule)); } void Test_OS_ModuleUnload_Impl(void) @@ -65,7 +65,7 @@ void Test_OS_ModuleUnload_Impl(void) OSAPI_TEST_FUNCTION_RC(OS_ModuleUnload_Impl(0), OS_SUCCESS); UT_SetDefaultReturnValue(UT_KEY(OCS_unldByModuleId), OCS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_ModuleUnload_Impl(0), OS_ERROR); - UT_ClearForceFail(UT_KEY(OCS_unldByModuleId)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_unldByModuleId)); } void Test_OS_ModuleGetInfo_Impl(void) @@ -86,7 +86,7 @@ void Test_OS_ModuleGetInfo_Impl(void) memset(&module_prop, 0, sizeof(module_prop)); UT_SetDefaultReturnValue(UT_KEY(OCS_moduleInfoGet), OCS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_ModuleGetInfo_Impl(0, &module_prop), OS_SUCCESS); - UT_ClearForceFail(UT_KEY(OCS_moduleInfoGet)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_moduleInfoGet)); UtAssert_True(!module_prop.addr.valid, "addresses in output not valid"); } diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-symtab.c b/src/unit-test-coverage/vxworks/src/coveragetest-symtab.c index 9f7d9b9db..a3ab7396b 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-symtab.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-symtab.c @@ -71,10 +71,10 @@ void Test_OS_SymTableIterator_Impl(void) OSAPI_TEST_FUNCTION_RC(UT_SymTabTest_CallIteratorFunc("ut", &Data, 100, 101), false); UT_SetDefaultReturnValue(UT_KEY(OCS_strlen), OS_MAX_SYM_LEN + 10); OSAPI_TEST_FUNCTION_RC(UT_SymTabTest_CallIteratorFunc("ut", &Data, 100, 1000), false); - UT_ClearForceFail(UT_KEY(OCS_strlen)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_strlen)); UT_SetDefaultReturnValue(UT_KEY(OCS_write), -1); OSAPI_TEST_FUNCTION_RC(UT_SymTabTest_CallIteratorFunc("ut", &Data, 100, 1000), false); - UT_ClearForceFail(UT_KEY(OCS_write)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_write)); } void Test_OS_SymbolTableDump_Impl(void) @@ -85,7 +85,7 @@ void Test_OS_SymbolTableDump_Impl(void) OSAPI_TEST_FUNCTION_RC(OS_SymbolTableDump_Impl("file", 10000), OS_SUCCESS); UT_SetDefaultReturnValue(UT_KEY(OCS_open), -1); OSAPI_TEST_FUNCTION_RC(OS_SymbolTableDump_Impl("file", 10000), OS_ERROR); - UT_ClearForceFail(UT_KEY(OCS_open)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_open)); } /* ------------------- End of test cases --------------------------------------*/ diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-tasks.c b/src/unit-test-coverage/vxworks/src/coveragetest-tasks.c index 7f27a328d..5b20961e7 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-tasks.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-tasks.c @@ -75,7 +75,7 @@ void Test_OS_TaskCreate_Impl(void) UT_SetDefaultReturnValue(UT_KEY(OCS_malloc), OS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_TaskCreate_Impl(&token, 0), OS_ERROR); - UT_ClearForceFail(UT_KEY(OCS_malloc)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_malloc)); OSAPI_TEST_FUNCTION_RC(OS_TaskCreate_Impl(&token, OS_FP_ENABLED), OS_SUCCESS); UtAssert_True(UT_GetStubCount(UT_KEY(OCS_malloc)) == 2, "malloc() called"); UtAssert_True(UT_GetStubCount(UT_KEY(OCS_free)) == 0, "free() not called"); diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-timebase.c b/src/unit-test-coverage/vxworks/src/coveragetest-timebase.c index 2690966e4..99e64ca8f 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-timebase.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-timebase.c @@ -120,12 +120,12 @@ void Test_OS_TimeBaseCreate_Impl(void) /* fail to initialize the sem */ UT_SetDefaultReturnValue(UT_KEY(OCS_semMInitialize), -1); OSAPI_TEST_FUNCTION_RC(OS_TimeBaseCreate_Impl(&token), OS_TIMER_ERR_INTERNAL); - UT_ClearForceFail(UT_KEY(OCS_semMInitialize)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_semMInitialize)); /* fail to spawn the task */ UT_SetDefaultReturnValue(UT_KEY(OCS_taskSpawn), -1); OSAPI_TEST_FUNCTION_RC(OS_TimeBaseCreate_Impl(&token), OS_TIMER_ERR_INTERNAL); - UT_ClearForceFail(UT_KEY(OCS_taskSpawn)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_taskSpawn)); /* * this call to TimeBaseCreate_Impl should also fail, because diff --git a/ut_assert/inc/utstubs.h b/ut_assert/inc/utstubs.h index af525e553..f464d9e4a 100644 --- a/ut_assert/inc/utstubs.h +++ b/ut_assert/inc/utstubs.h @@ -193,6 +193,15 @@ void UT_GetDataBuffer(UT_EntryKey_t FuncKey, void **DataBuffer, size_t *MaxSize, */ void UT_SetDefaultReturnValue(UT_EntryKey_t FuncKey, int32 Value); +/** + * Disable the forced failure mode for the given stub function + * + * This undoes the action of UT_SetDefaultReturnValue() + * + * \param FuncKey The stub function entry to clear. + */ +void UT_ClearDefaultReturnValue(UT_EntryKey_t FuncKey); + #ifndef OSAL_OMIT_DEPRECATED /** * Enable or disable the forced failure mode for the given stub function @@ -209,7 +218,6 @@ void UT_SetDefaultReturnValue(UT_EntryKey_t FuncKey, int32 Value); * @deprecated replaced by UT_SetDefaultReturnValue */ void UT_SetForceFail(UT_EntryKey_t FuncKey, int32 Value); -#endif /** * Disable the forced failure mode for the given stub function @@ -217,8 +225,11 @@ void UT_SetForceFail(UT_EntryKey_t FuncKey, int32 Value); * This undoes the action of UT_SetDefaultReturnValue() * * \param FuncKey The stub function entry to clear. + * + * @deprecated replaced by UT_ClearDefaultReturnValue */ void UT_ClearForceFail(UT_EntryKey_t FuncKey); +#endif /** * Set a Hook function for a particular call diff --git a/ut_assert/src/utstubs.c b/ut_assert/src/utstubs.c index 87db67fbc..ed737129a 100644 --- a/ut_assert/src/utstubs.c +++ b/ut_assert/src/utstubs.c @@ -335,14 +335,7 @@ void UT_SetDefaultReturnValue(UT_EntryKey_t FuncKey, int32 Value) } } -#ifndef OSAL_OMIT_DEPRECATED -void UT_SetForceFail(UT_EntryKey_t FuncKey, int32 Value) -{ - UT_SetDefaultReturnValue(FuncKey, Value); -} -#endif - -void UT_ClearForceFail(UT_EntryKey_t FuncKey) +void UT_ClearDefaultReturnValue(UT_EntryKey_t FuncKey) { UT_StubTableEntry_t *StubPtr; @@ -353,6 +346,18 @@ void UT_ClearForceFail(UT_EntryKey_t FuncKey) } } +#ifndef OSAL_OMIT_DEPRECATED +void UT_SetForceFail(UT_EntryKey_t FuncKey, int32 Value) +{ + UT_SetDefaultReturnValue(FuncKey, Value); +} + +void UT_ClearForceFail(UT_EntryKey_t FuncKey) +{ + UT_ClearDefaultReturnValue(FuncKey); +} +#endif + bool UT_GetStubRetcodeAndCount(UT_EntryKey_t FuncKey, int32 *Retcode, int32 *Count) { UT_StubTableEntry_t *StubPtr; From e248041a3e42279133b4ef0ce74bbf858d39da64 Mon Sep 17 00:00:00 2001 From: Alex Campbell Date: Mon, 4 Jan 2021 10:09:37 -0500 Subject: [PATCH 18/21] Fix #722, update UT_SetDefaultReturnValue comments --- ut_assert/inc/utstubs.h | 15 +++++---------- ut_assert/src/utstubs.c | 4 ++-- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/ut_assert/inc/utstubs.h b/ut_assert/inc/utstubs.h index f464d9e4a..7c532ec6f 100644 --- a/ut_assert/inc/utstubs.h +++ b/ut_assert/inc/utstubs.h @@ -180,21 +180,16 @@ void UT_SetDataBuffer(UT_EntryKey_t FuncKey, void *DataBuffer, size_t BufferSize void UT_GetDataBuffer(UT_EntryKey_t FuncKey, void **DataBuffer, size_t *MaxSize, size_t *Position); /** - * Enable or disable the forced failure mode for the given stub function - * - * This triggers a constant failure mode from the stub function, if implemented. - * The stub function will invoke a given failure path as defined by - * the stub implementation. - * - * A count of the number of times the failure mode is invoked will be maintained. + * Set the default return value for the given stub function. + * User needs to use UT_ClearDefaultReturnValue to clear the value. * * \param FuncKey The stub function to add the return code to. - * \param Value Arbitrary failure mode value (may or may not be used by the stub) + * \param Value Arbitrary return value (may or may not be used by the stub) */ void UT_SetDefaultReturnValue(UT_EntryKey_t FuncKey, int32 Value); /** - * Disable the forced failure mode for the given stub function + * Disable the default return for the given stub function * * This undoes the action of UT_SetDefaultReturnValue() * @@ -226,7 +221,7 @@ void UT_SetForceFail(UT_EntryKey_t FuncKey, int32 Value); * * \param FuncKey The stub function entry to clear. * - * @deprecated replaced by UT_ClearDefaultReturnValue + * @deprecated replaced by UT_ClearDefaultReturnValue */ void UT_ClearForceFail(UT_EntryKey_t FuncKey); #endif diff --git a/ut_assert/src/utstubs.c b/ut_assert/src/utstubs.c index ed737129a..a4376b444 100644 --- a/ut_assert/src/utstubs.c +++ b/ut_assert/src/utstubs.c @@ -313,13 +313,13 @@ void UT_SetDefaultReturnValue(UT_EntryKey_t FuncKey, int32 Value) UT_StubTableEntry_t *Rc; /* - * First find an existing force fail entry for the function. + * First find an existing default return value entry for the function. * In case one is already set we do not duplicate (unlike deferred codes) */ Rc = UT_GetStubEntry(FuncKey, UT_ENTRYTYPE_FORCE_FAIL); if (Rc == NULL) { - /* Creating force fail entry - repeat search and grab any unused slot */ + /* Creating default return value entry - repeat search and grab any unused slot */ Rc = UT_GetStubEntry(FuncKey, UT_ENTRYTYPE_UNUSED); } From f725ee410b8f37c559835674a7380ed5a9682d13 Mon Sep 17 00:00:00 2001 From: Alex Campbell Date: Wed, 6 Jan 2021 09:56:11 -0500 Subject: [PATCH 19/21] Fix #229, mqueue test uses sequence of numbers --- src/tests/queue-test/queue-test.c | 33 ++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/src/tests/queue-test/queue-test.c b/src/tests/queue-test/queue-test.c index 657dc658a..a79caa265 100644 --- a/src/tests/queue-test/queue-test.c +++ b/src/tests/queue-test/queue-test.c @@ -33,7 +33,9 @@ void QueueTimeoutSetup(void); void QueueTimeoutCheck(void); #define MSGQ_DEPTH 50 -#define MSGQ_SIZE 4 +#define MSGQ_SIZE sizeof(uint32) +#define MSGQ_TOTAL 10 +#define MSGQ_BURST 3 /* Task 1 */ #define TASK_1_STACK_SIZE 1024 @@ -65,8 +67,8 @@ void task_1(void) { int32 status; size_t data_size; - char data_received[4] = {0}; - char expected[4] = "xyz"; + uint32 data_received ; + uint32 expected = 0; OS_printf("Starting task 1\n"); @@ -84,8 +86,10 @@ void task_1(void) if (status == OS_SUCCESS) { ++task_1_messages; - UtAssert_True(strcmp(data_received, expected) == 0, "TASK 1: data_received (%s) == expected (%s)", + UtAssert_True(data_received == expected, "TASK 1: data_received (%u) == expected (%u)", data_received, expected); + + expected++; } else if (status == OS_QUEUE_TIMEOUT) { @@ -194,13 +198,12 @@ void QueueMessageSetup(void) { int32 status; uint32 accuracy; + int i; + uint32 Data = 0; task_1_failures = 0; task_1_messages = 0; task_1_timeouts = 0; - - int i; - const char Data[4] = "xyz"; - + status = OS_QueueCreate(&msgq_id, "MsgQ", OSAL_BLOCKCOUNT_C(MSGQ_DEPTH), OSAL_SIZE_C(MSGQ_SIZE), 0); UtAssert_True(status == OS_SUCCESS, "MsgQ create Id=%lx Rc=%d", OS_ObjectIdToInteger(msgq_id), (int)status); @@ -224,11 +227,17 @@ void QueueMessageSetup(void) status = OS_TimerSet(timer_id, timer_start, timer_interval); UtAssert_True(status == OS_SUCCESS, "Timer 1 set Rc=%d", (int)status); - /* Put 10 messages onto the que with some time inbetween to not overfill the que*/ - for (i = 0; i < 10; i++) + /* + * Put 10 messages onto the que with some time inbetween the later messages + * to make sure the que handles both storing and waiting for messages + */ + for (i = 0; i < MSGQ_TOTAL; i++) { - OS_TaskDelay(200); - status = OS_QueuePut(msgq_id, Data, sizeof(Data), 0); + if(i > MSGQ_BURST) + OS_TaskDelay(400); + + Data = i; + status = OS_QueuePut(msgq_id, (void *)&Data, sizeof(Data), 0); UtAssert_True(status == OS_SUCCESS, "OS Queue Put Rc=%d", (int)status); } } From 773dc88f16317e0b0c5088a3fc0af8d29d0fb496 Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Tue, 19 Jan 2021 11:34:36 -0500 Subject: [PATCH 20/21] Fix #760, Install modules and clean up files for unit tests --- src/tests/file-api-test/file-api-test.c | 9 +++++++++ src/tests/select-test/select-test.c | 10 ++++++++-- src/unit-tests/osfile-test/ut_osfile_fileio_test.c | 3 ++- src/unit-tests/osloader-test/CMakeLists.txt | 3 +++ 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/tests/file-api-test/file-api-test.c b/src/tests/file-api-test/file-api-test.c index 07a2f4126..6d4a41d87 100644 --- a/src/tests/file-api-test/file-api-test.c +++ b/src/tests/file-api-test/file-api-test.c @@ -943,4 +943,13 @@ void TestOpenFileAPI(void) */ status = OS_CloseFileByName(filename2); UtAssert_True(status < OS_SUCCESS, "status after OS_CloseFileByName 2 = %d", (int)status); + + /* Try removing the files from the drive to end the function */ + status = OS_remove(filename1); + UtAssert_True(status == OS_SUCCESS, "status after remove filename1 = %d", (int)status); + status = OS_remove(filename2); + UtAssert_True(status == OS_SUCCESS, "status after remove filename2 = %d", (int)status); + status = OS_remove(filename3); + UtAssert_True(status == OS_SUCCESS, "status after remove filename3 = %d", (int)status); + } diff --git a/src/tests/select-test/select-test.c b/src/tests/select-test/select-test.c index f42599c49..a98db1e29 100644 --- a/src/tests/select-test/select-test.c +++ b/src/tests/select-test/select-test.c @@ -50,6 +50,8 @@ OS_SockAddr_t c_addr; OS_SockAddr_t c2_addr; osal_id_t bin_sem_id; +#define OS_TEST_SELECT_FILENAME "/drive0/select_test.txt" + /* *************************************** MAIN ************************************** */ char * fsAddrPtr = NULL; @@ -58,7 +60,7 @@ static osal_id_t setup_file(void) osal_id_t id; OS_mkfs(fsAddrPtr, "/ramdev0", "RAM", 512, 20); OS_mount("/ramdev0", "/drive0"); - OS_OpenCreate(&id, "/drive0/select_test.txt", OS_FILE_FLAG_CREATE, OS_READ_WRITE); + OS_OpenCreate(&id, OS_TEST_SELECT_FILENAME, OS_FILE_FLAG_CREATE, OS_READ_WRITE); return id; } @@ -531,6 +533,10 @@ void TestSelectSingleFile(void) /* Verify Outputs */ UtAssert_True(actual == expected, "OS_SelectSingle() (%ld) == OS_ERROR_TIMEOUT", (long)actual); UtAssert_True(StateFlags == 0, "OS_SelectSingle() (0x%x) == None", (unsigned int)StateFlags); + + /* Close and remove file */ + OS_close(fd); + OS_remove(OS_TEST_SELECT_FILENAME); } void UtTest_Setup(void) @@ -549,4 +555,4 @@ void UtTest_Setup(void) UtTest_Add(TestSelectSingleWrite, Setup_Single, Teardown_Single, "TestSelectSingleWrite"); UtTest_Add(TestSelectMultipleWrite, Setup_Multi, Teardown_Multi, "TestSelectMultipleWrite"); UtTest_Add(TestSelectSingleFile, NULL, NULL, "TestSelectSingleFile"); -} \ No newline at end of file +} diff --git a/src/unit-tests/osfile-test/ut_osfile_fileio_test.c b/src/unit-tests/osfile-test/ut_osfile_fileio_test.c index 7ed2072f7..5f1f59b4c 100644 --- a/src/unit-tests/osfile-test/ut_osfile_fileio_test.c +++ b/src/unit-tests/osfile-test/ut_osfile_fileio_test.c @@ -2057,11 +2057,12 @@ void UT_os_outputtofile_test() } } +UT_os_outputtofile_test_exit_tag: + /* Reset test environment */ OS_close(g_fDescs[0]); OS_remove(g_fNames[0]); -UT_os_outputtofile_test_exit_tag: return; } diff --git a/src/unit-tests/osloader-test/CMakeLists.txt b/src/unit-tests/osloader-test/CMakeLists.txt index 72152120b..1c3159d9f 100644 --- a/src/unit-tests/osloader-test/CMakeLists.txt +++ b/src/unit-tests/osloader-test/CMakeLists.txt @@ -19,4 +19,7 @@ while(MOD GREATER 0) PREFIX "" LIBRARY_OUTPUT_DIRECTORY utmod) add_dependencies(osal_loader_UT MODULE${MOD}) + foreach(TGT ${INSTALL_TARGET_LIST}) + install(TARGETS MODULE${MOD} DESTINATION ${TGT}/${UT_INSTALL_SUBDIR}/utmod) + endforeach() endwhile(MOD GREATER 0) From 27d99a21c29248514d3f79f52d7814d72a1bdc68 Mon Sep 17 00:00:00 2001 From: "Gerardo E. Cruz-Ortiz" <59618057+astrogeco@users.noreply.github.com> Date: Tue, 26 Jan 2021 19:33:15 -0500 Subject: [PATCH 21/21] Bump to v5.1.0-rc1+dev221 Update ReadMe --- README.md | 19 +++++++++++++++++++ src/os/inc/osapi-version.h | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fe32818ce..51e3caaff 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,25 @@ The autogenerated OSAL user's guide can be viewed at + ### Development Build: 5.1.0-rc1+dev184 - Address issues with OSAL global table management: diff --git a/src/os/inc/osapi-version.h b/src/os/inc/osapi-version.h index d6945377e..bf0946a61 100644 --- a/src/os/inc/osapi-version.h +++ b/src/os/inc/osapi-version.h @@ -30,7 +30,7 @@ /* * Development Build Macro Definitions */ -#define OS_BUILD_NUMBER 184 +#define OS_BUILD_NUMBER 221 #define OS_BUILD_BASELINE "v5.1.0-rc1" /*