diff --git a/README.md b/README.md index 9870446e0..ce37ef13f 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,21 @@ The autogenerated OSAL user's guide can be viewed at + ### Development Build: 5.0.21 - Command line options in Linux are no longer ignored/dropped. diff --git a/src/os/inc/osapi-version.h b/src/os/inc/osapi-version.h index e90b4aa2a..7794b62b6 100644 --- a/src/os/inc/osapi-version.h +++ b/src/os/inc/osapi-version.h @@ -18,24 +18,54 @@ * limitations under the License. */ + /*! @file osapi-version.h + * @brief Purpose: + * @details Provide version identifiers for cFS' Operating System Abstraction Layer + * See @ref cfsversions for version and build number and description + * + */ +#ifndef _osapi_version_h_ +#define _osapi_version_h_ + /* - * File: osapi-version.h - * - * Purpose: - * The OSAL version numbers + * Development Build Macro Definitions */ +#define OS_BUILD_NUMBER 247 +#define OS_BUILD_BASELINE "v5.0.0+dev" -#ifndef _osapi_version_h_ -#define _osapi_version_h_ +/* + * Version Macro Definitions + */ +#define OS_MAJOR_VERSION 5 /*!< @brief ONLY APPLY for OFFICIAL releases. Major version number. */ +#define OS_MINOR_VERSION 0 /*!< @brief ONLY APPLY for OFFICIAL releases. Minor version number. */ +#define OS_REVISION 0 /*!< @brief ONLY APPLY for OFFICIAL releases. Revision number. */ +#define OS_MISSION_REV 0 /*!< @brief ONLY USED by MISSION Implementations. Mission revision */ + +/* + * Tools to construct version string + */ +#define OS_STR_HELPER(x) #x /*!< @brief Helper function to concatenate strings from integer */ +#define OS_STR(x) OS_STR_HELPER(x) /*!< @brief Helper function to concatenate strings from integer */ + +/*! @brief Development Build Version Number. + * @details Baseline git tag + Number of commits since baseline. @n + * See @ref cfsversions for format differences between development and release versions. + */ +#define OS_VERSION OS_BUILD_BASELINE OS_STR(OS_BUILD_NUMBER) -#define OS_MAJOR_VERSION 5 /**< @brief Major version number */ -#define OS_MINOR_VERSION 0 /**< @brief Minor version number */ -#define OS_REVISION 21 /**< @brief Revision number */ -#define OS_MISSION_REV 0 /**< @brief Mission revision */ +/*! @brief Development Build Version String. + * @details Reports the current development build's baseline, number, and name. Also includes a note about the latest official version. @n + * See @ref cfsversions for format differences between development and release versions. +*/ +#define OS_VERSION_STRING \ + " OSAL Development Build\n" \ + " " OS_VERSION " (Codename: Bootes)\n" /* Codename for current development */ \ + " Latest Official Version: osal v5.0.0" /* For full support please use official release version */ -/** - * Combine the revision components into a single value that application code can check against - * e.g. "#if OSAL_API_VERSION >= 40100" would check if some feature added in OSAL 4.1 is present. +/*! @brief Combines the revision components into a single value + * @details Applications can check against this number @n + * e.g. "#if OSAL_API_VERSION >= 40100" would check if some feature added in +OSAL 4.1 is present. */ #define OSAL_API_VERSION ((OS_MAJOR_VERSION * 10000) + (OS_MINOR_VERSION * 100) + OS_REVISION) diff --git a/src/os/posix/inc/os-posix.h b/src/os/posix/inc/os-posix.h index 48a43c202..79e4a009a 100644 --- a/src/os/posix/inc/os-posix.h +++ b/src/os/posix/inc/os-posix.h @@ -80,6 +80,7 @@ typedef struct pthread_key_t ThreadKey; sigset_t MaximumSigMask; sigset_t NormalSigMask; + size_t PageSize; POSIX_PriorityLimits_t PriLimits; int SelectedRtScheduler; } POSIX_GlobalVars_t; diff --git a/src/os/posix/src/os-impl-tasks.c b/src/os/posix/src/os-impl-tasks.c index a318861a0..2e313e9dd 100644 --- a/src/os/posix/src/os-impl-tasks.c +++ b/src/os/posix/src/os-impl-tasks.c @@ -38,6 +38,13 @@ #include "os-shared-task.h" #include "os-shared-idmap.h" +/* + * Defines + */ +#ifndef PTHREAD_STACK_MIN +#define PTHREAD_STACK_MIN (8*1024) +#endif + /* Tables where the OS object information is stored */ OS_impl_task_internal_record_t OS_impl_task_table [OS_MAX_TASKS]; @@ -416,6 +423,8 @@ int32 OS_Posix_TaskAPI_Impl_Init(void) } #endif + POSIX_GlobalVars.PageSize = sysconf(_SC_PAGESIZE); + return OS_SUCCESS; } /* end OS_Posix_TaskAPI_Impl_Init */ @@ -446,14 +455,42 @@ int32 OS_Posix_InternalTaskCreate_Impl(pthread_t *pthr, uint32 priority, size_t return(OS_ERROR); } - - /* - ** Test to see if the original main task scheduling priority worked. - ** If so, then also set the attributes for this task. Otherwise attributes - ** are left at default. + /* + * Adjust the stack size parameter. + * + * POSIX has additional restrictions/limitations on the stack size of tasks that + * other RTOS environments may not have. Specifically POSIX says that the stack + * size must be at least PTHREAD_STACK_MIN and may also need to be a multiple of the + * system page size. + * + * Rounding up means the user might get a bigger stack than they requested, but + * that should not break anything aside from consuming extra memory. */ - if (POSIX_GlobalVars.EnableTaskPriorities) - { + if (stacksz < PTHREAD_STACK_MIN) + { + stacksz = PTHREAD_STACK_MIN; + } + + stacksz += POSIX_GlobalVars.PageSize - 1; + stacksz -= stacksz % POSIX_GlobalVars.PageSize; + + /* + ** Set the Stack Size + */ + return_code = pthread_attr_setstacksize(&custom_attr, stacksz); + if (return_code != 0) + { + OS_DEBUG("pthread_attr_setstacksize error in OS_TaskCreate: %s\n",strerror(return_code)); + return(OS_ERROR); + } + + /* + ** Test to see if the original main task scheduling priority worked. + ** If so, then also set the attributes for this task. Otherwise attributes + ** are left at default. + */ + if (POSIX_GlobalVars.EnableTaskPriorities) + { /* ** Set the scheduling inherit attribute to EXPLICIT */ @@ -464,15 +501,6 @@ int32 OS_Posix_InternalTaskCreate_Impl(pthread_t *pthr, uint32 priority, size_t return(OS_ERROR); } - /* - ** Set the Stack Size - */ - return_code = pthread_attr_setstacksize(&custom_attr, stacksz); - if (return_code != 0) - { - OS_DEBUG("pthread_attr_setstacksize error in OS_TaskCreate: %s\n",strerror(return_code)); - return(OS_ERROR); - } /* ** Set the scheduling policy @@ -503,7 +531,7 @@ int32 OS_Posix_InternalTaskCreate_Impl(pthread_t *pthr, uint32 priority, size_t return(OS_ERROR); } - } /* End if user is root */ + } /* End if user is root */ /* ** Create thread diff --git a/src/tests/timer-test/timer-test.c b/src/tests/timer-test/timer-test.c index 59fce9890..6d7e23597 100644 --- a/src/tests/timer-test/timer-test.c +++ b/src/tests/timer-test/timer-test.c @@ -40,6 +40,7 @@ #define TASK_1_STACK_SIZE 4096 #define TASK_1_PRIORITY 101 + void TimerTestSetup(void); void TimerTestTask(void); void TimerTestCheck(void); @@ -53,11 +54,12 @@ uint32 TimerTestTaskStack[TASK_1_STACK_SIZE]; int32 timer_counter[NUMBER_OF_TIMERS]; uint32 timer_idlookup[OS_MAX_TIMERS]; + /* -** Test timer function. -** Note: For some Host OSs, this is the equivalent of an ISR, so the calls available are limited. -** For example, Linux and vxWorks can call functions like printf, but RTEMS cannot. -*/ + * Test timer function. + * Note: For some Host OSs, this is the equivalent of an ISR, so the calls available are limited. + * For example, Linux and vxWorks can call functions like printf, but RTEMS cannot. + */ void test_func(uint32 timer_id) { OS_ConvertToArrayIndex(timer_id, &timer_id); @@ -119,7 +121,7 @@ void TimerTestTask(void) uint32 ClockAccuracy; - for ( i = 0; i < NUMBER_OF_TIMERS; i++ ) + for ( i = 0; i < NUMBER_OF_TIMERS && i < OS_MAX_TIMERS; i++ ) { TimerStatus[i] = OS_TimerCreate(&TimerID[i], TimerName[i], &ClockAccuracy, &(test_func)); UtAssert_True(TimerStatus[i] == OS_SUCCESS, "Timer %d Created RC=%d ID=%d", i, (int)TimerStatus[i], (int)TimerID[i]); @@ -132,7 +134,7 @@ void TimerTestTask(void) /* Sample the clock now, before starting any timer */ OS_GetLocalTime(&StartTime); - for ( i = 0; i < NUMBER_OF_TIMERS; i++ ) + for ( i = 0; i < NUMBER_OF_TIMERS && i < OS_MAX_TIMERS; i++ ) { /* * to ensure that all timers are started as closely as possible, @@ -144,7 +146,7 @@ void TimerTestTask(void) /* * Now the actual OS_TimerSet() return code can be checked. */ - for ( i = 0; i < NUMBER_OF_TIMERS; i++ ) + for ( i = 0; i < NUMBER_OF_TIMERS && i < OS_MAX_TIMERS; i++ ) { UtAssert_True(TimerStatus[i] == OS_SUCCESS, "Timer %d programmed RC=%d", i, (int)TimerStatus[i]); } @@ -165,12 +167,12 @@ void TimerTestTask(void) } OS_GetLocalTime(&EndTime); - for ( i = 0; i < NUMBER_OF_TIMERS; i++ ) + for ( i = 0; i < NUMBER_OF_TIMERS && i < OS_MAX_TIMERS; i++ ) { TimerStatus[i] = OS_TimerDelete(TimerID[i]); } - for ( i = 0; i < NUMBER_OF_TIMERS; i++ ) + for ( i = 0; i < NUMBER_OF_TIMERS && i < OS_MAX_TIMERS; i++ ) { UtAssert_True(TimerStatus[i] == OS_SUCCESS, "Timer %d delete RC=%d. Count total = %d", i, (int)TimerStatus[i], (int)timer_counter[i]); @@ -200,7 +202,7 @@ void TimerTestCheck(void) } /* Make sure the ratio of the timers are OK */ - for ( i = 0; i < NUMBER_OF_TIMERS; i++ ) + for ( i = 0; i < NUMBER_OF_TIMERS && i < OS_MAX_TIMERS; i++ ) { /* * Expect one tick after the start time (i.e. first tick) diff --git a/src/unit-test-coverage/CMakeLists.txt b/src/unit-test-coverage/CMakeLists.txt index c4b2563c5..390918203 100644 --- a/src/unit-test-coverage/CMakeLists.txt +++ b/src/unit-test-coverage/CMakeLists.txt @@ -84,7 +84,7 @@ function (add_coverage_testrunner TESTNAME FSW_SRCFILE TESTCASE_SRCFILE) add_test(${TESTNAME} ${TESTNAME}-testrunner) foreach(TGT ${INSTALL_TARGET_LIST}) - install(TARGETS ${TESTNAME}-testrunner DESTINATION ${TGTNAME}/${UT_INSTALL_SUBDIR}) + install(TARGETS ${TESTNAME}-testrunner DESTINATION ${TGT}/${UT_INSTALL_SUBDIR}) endforeach() endfunction() diff --git a/src/ut-stubs/osapi-utstub-binsem.c b/src/ut-stubs/osapi-utstub-binsem.c index 3a97cc1d9..ea0cccd42 100644 --- a/src/ut-stubs/osapi-utstub-binsem.c +++ b/src/ut-stubs/osapi-utstub-binsem.c @@ -55,6 +55,8 @@ UT_DEFAULT_STUB(OS_BinSemAPI_Init,(void)) ******************************************************************************/ int32 OS_BinSemTake(uint32 sem_id) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_BinSemTake), sem_id); + int32 status = OS_SUCCESS; status = UT_DEFAULT_IMPL(OS_BinSemTake); @@ -83,6 +85,8 @@ int32 OS_BinSemTake(uint32 sem_id) ******************************************************************************/ int32 OS_BinSemFlush(uint32 sem_id) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_BinSemFlush), sem_id); + int32 status; status = UT_DEFAULT_IMPL(OS_BinSemFlush); @@ -116,6 +120,11 @@ int32 OS_BinSemFlush(uint32 sem_id) int32 OS_BinSemCreate(uint32 *sem_id, const char *sem_name, uint32 sem_initial_value, uint32 options) { + UT_Stub_RegisterContext(UT_KEY(OS_BinSemCreate), sem_id); + UT_Stub_RegisterContext(UT_KEY(OS_BinSemCreate), sem_name); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_BinSemCreate), sem_initial_value); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_BinSemCreate), options); + int32 status; status = UT_DEFAULT_IMPL(OS_BinSemCreate); @@ -150,6 +159,8 @@ int32 OS_BinSemCreate(uint32 *sem_id, const char *sem_name, ******************************************************************************/ int32 OS_BinSemGive(uint32 sem_id) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_BinSemGive), sem_id); + int32 status; status = UT_DEFAULT_IMPL(OS_BinSemGive); @@ -175,6 +186,9 @@ int32 OS_BinSemGive(uint32 sem_id) ******************************************************************************/ int32 OS_BinSemGetInfo(uint32 sem_id, OS_bin_sem_prop_t *bin_prop) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_BinSemGetInfo), sem_id); + UT_Stub_RegisterContext(UT_KEY(OS_BinSemGetInfo), bin_prop); + int32 status; status = UT_DEFAULT_IMPL(OS_BinSemGetInfo); @@ -214,6 +228,8 @@ int32 OS_BinSemGetInfo(uint32 sem_id, OS_bin_sem_prop_t *bin_prop) ******************************************************************************/ int32 OS_BinSemDelete(uint32 sem_id) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_BinSemDelete), sem_id); + int32 status; status = UT_DEFAULT_IMPL(OS_BinSemDelete); @@ -247,6 +263,9 @@ int32 OS_BinSemDelete(uint32 sem_id) ******************************************************************************/ int32 OS_BinSemTimedWait(uint32 sem_id, uint32 msecs) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_BinSemTimedWait), sem_id); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_BinSemTimedWait), msecs); + int32 status; status = UT_DEFAULT_IMPL(OS_BinSemTimedWait); @@ -261,6 +280,9 @@ int32 OS_BinSemTimedWait(uint32 sem_id, uint32 msecs) *****************************************************************************/ int32 OS_BinSemGetIdByName (uint32 *sem_id, const char *sem_name) { + UT_Stub_RegisterContext(UT_KEY(OS_BinSemGetIdByName), sem_id); + UT_Stub_RegisterContext(UT_KEY(OS_BinSemGetIdByName), sem_name); + int32 status; status = UT_DEFAULT_IMPL(OS_BinSemGetIdByName); diff --git a/src/ut-stubs/osapi-utstub-clock.c b/src/ut-stubs/osapi-utstub-clock.c index 9438cf237..871e71ecc 100644 --- a/src/ut-stubs/osapi-utstub-clock.c +++ b/src/ut-stubs/osapi-utstub-clock.c @@ -42,10 +42,11 @@ *****************************************************************************/ int32 OS_GetLocalTime(OS_time_t *time_struct) { + UT_Stub_RegisterContext(UT_KEY(OS_GetLocalTime), time_struct); + int32 status; uint32 count; - UT_Stub_RegisterContext(UT_KEY(OS_GetLocalTime), time_struct); status = UT_DEFAULT_IMPL(OS_GetLocalTime); if (status == OS_SUCCESS && @@ -67,9 +68,10 @@ int32 OS_GetLocalTime(OS_time_t *time_struct) *****************************************************************************/ int32 OS_SetLocalTime(OS_time_t *time_struct) { + UT_Stub_RegisterContext(UT_KEY(OS_SetLocalTime), time_struct); + int32 status; - UT_Stub_RegisterContext(UT_KEY(OS_SetLocalTime), time_struct); status = UT_DEFAULT_IMPL(OS_SetLocalTime); return status; diff --git a/src/ut-stubs/osapi-utstub-common.c b/src/ut-stubs/osapi-utstub-common.c index cf256b701..01d4d131a 100644 --- a/src/ut-stubs/osapi-utstub-common.c +++ b/src/ut-stubs/osapi-utstub-common.c @@ -57,6 +57,8 @@ int32 OS_API_Init(void) *****************************************************************************/ void OS_ApplicationExit(int32 Status) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_ApplicationExit), Status); + /* just call the default so a hook can be attached */ UT_DEFAULT_IMPL(OS_ApplicationExit); } @@ -100,7 +102,8 @@ void OS_IdleLoop(void) *****************************************************************************/ void OS_ApplicationShutdown(uint8 flag) { - UT_Stub_RegisterContext(UT_KEY(OS_ApplicationShutdown), &flag); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_ApplicationShutdown), flag); + UT_DEFAULT_IMPL(OS_ApplicationShutdown); } diff --git a/src/ut-stubs/osapi-utstub-countsem.c b/src/ut-stubs/osapi-utstub-countsem.c index a8ee84bed..b13485490 100644 --- a/src/ut-stubs/osapi-utstub-countsem.c +++ b/src/ut-stubs/osapi-utstub-countsem.c @@ -45,6 +45,11 @@ UT_DEFAULT_STUB(OS_CountSemAPI_Init,(void)) int32 OS_CountSemCreate(uint32 *sem_id, const char *sem_name, uint32 sem_initial_value, uint32 options) { + UT_Stub_RegisterContext(UT_KEY(OS_CountSemCreate), sem_id); + UT_Stub_RegisterContext(UT_KEY(OS_CountSemCreate), sem_name); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_CountSemCreate), sem_initial_value); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_CountSemCreate), options); + int32 status; status = UT_DEFAULT_IMPL(OS_CountSemCreate); @@ -83,6 +88,8 @@ int32 OS_CountSemCreate(uint32 *sem_id, const char *sem_name, ******************************************************************************/ int32 OS_CountSemDelete(uint32 sem_id) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_CountSemDelete), sem_id); + int32 status; status = UT_DEFAULT_IMPL(OS_CountSemDelete); @@ -103,6 +110,8 @@ int32 OS_CountSemDelete(uint32 sem_id) *****************************************************************************/ int32 OS_CountSemGive ( uint32 sem_id ) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_CountSemGive), sem_id); + int32 status; status = UT_DEFAULT_IMPL(OS_CountSemGive); @@ -117,6 +126,8 @@ int32 OS_CountSemGive ( uint32 sem_id ) *****************************************************************************/ int32 OS_CountSemTake ( uint32 sem_id ) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_CountSemTake), sem_id); + int32 status; status = UT_DEFAULT_IMPL(OS_CountSemTake); @@ -131,6 +142,9 @@ int32 OS_CountSemTake ( uint32 sem_id ) *****************************************************************************/ int32 OS_CountSemTimedWait ( uint32 sem_id, uint32 msecs ) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_CountSemTimedWait), sem_id); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_CountSemTimedWait), msecs); + int32 status; status = UT_DEFAULT_IMPL(OS_CountSemTimedWait); @@ -145,6 +159,9 @@ int32 OS_CountSemTimedWait ( uint32 sem_id, uint32 msecs ) *****************************************************************************/ int32 OS_CountSemGetIdByName (uint32 *sem_id, const char *sem_name) { + UT_Stub_RegisterContext(UT_KEY(OS_CountSemGetIdByName), sem_id); + UT_Stub_RegisterContext(UT_KEY(OS_CountSemGetIdByName), sem_name); + int32 status; status = UT_DEFAULT_IMPL(OS_CountSemGetIdByName); @@ -177,6 +194,9 @@ int32 OS_CountSemGetIdByName (uint32 *sem_id, const char *sem_name) ******************************************************************************/ int32 OS_CountSemGetInfo(uint32 sem_id, OS_count_sem_prop_t *count_prop) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_CountSemGetInfo), sem_id); + UT_Stub_RegisterContext(UT_KEY(OS_CountSemGetInfo), count_prop); + int32 status; status = UT_DEFAULT_IMPL(OS_CountSemGetInfo); diff --git a/src/ut-stubs/osapi-utstub-dir.c b/src/ut-stubs/osapi-utstub-dir.c index e15e2a3ec..6f89b47f0 100644 --- a/src/ut-stubs/osapi-utstub-dir.c +++ b/src/ut-stubs/osapi-utstub-dir.c @@ -44,6 +44,9 @@ UT_DEFAULT_STUB(OS_DirAPI_Init,(void)) *****************************************************************************/ int32 OS_mkdir (const char *path, uint32 access) { + UT_Stub_RegisterContext(UT_KEY(OS_mkdir), path); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_mkdir), access); + int32 Status; Status = UT_DEFAULT_IMPL(OS_mkdir); @@ -58,6 +61,8 @@ int32 OS_mkdir (const char *path, uint32 access) *****************************************************************************/ int32 OS_rmdir (const char *path) { + UT_Stub_RegisterContext(UT_KEY(OS_rmdir), path); + int32 Status; Status = UT_DEFAULT_IMPL(OS_rmdir); @@ -74,6 +79,9 @@ int32 OS_rmdir (const char *path) *****************************************************************************/ int32 OS_DirectoryOpen(uint32 *dir_id, const char *path) { + UT_Stub_RegisterContext(UT_KEY(OS_DirectoryOpen), dir_id); + UT_Stub_RegisterContext(UT_KEY(OS_DirectoryOpen), path); + int32 Status; Status = UT_DEFAULT_IMPL(OS_DirectoryOpen); @@ -98,6 +106,8 @@ int32 OS_DirectoryOpen(uint32 *dir_id, const char *path) *****************************************************************************/ int32 OS_DirectoryClose(uint32 dir_id) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_DirectoryClose), dir_id); + int32 Status; Status = UT_DEFAULT_IMPL(OS_DirectoryClose); @@ -117,6 +127,8 @@ int32 OS_DirectoryClose(uint32 dir_id) *****************************************************************************/ int32 OS_DirectoryRewind(uint32 dir_id) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_DirectoryRewind), dir_id); + int32 Status; Status = UT_DEFAULT_IMPL(OS_DirectoryRewind); @@ -131,6 +143,9 @@ int32 OS_DirectoryRewind(uint32 dir_id) *****************************************************************************/ int32 OS_DirectoryRead(uint32 dir_id, os_dirent_t *dirent) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_DirectoryRead), dir_id); + UT_Stub_RegisterContext(UT_KEY(OS_DirectoryRead), dirent); + int32 Status; uint32 CopySize; @@ -159,6 +174,8 @@ int32 OS_DirectoryRead(uint32 dir_id, os_dirent_t *dirent) *****************************************************************************/ os_dirp_t OS_opendir (const char *path) { + UT_Stub_RegisterContext(UT_KEY(OS_opendir), path); + int32 Status; os_dirp_t Dirp; @@ -191,6 +208,8 @@ os_dirp_t OS_opendir (const char *path) *****************************************************************************/ int32 OS_closedir (os_dirp_t directory) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_closedir), directory); + int32 Status; Status = UT_DEFAULT_IMPL(OS_closedir); @@ -206,6 +225,8 @@ int32 OS_closedir (os_dirp_t directory) *****************************************************************************/ os_dirent_t * OS_readdir (os_dirp_t directory) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_readdir), directory); + static os_dirent_t DefaultEntry; os_dirent_t *DirentPtr; int32 Status; @@ -241,6 +262,8 @@ os_dirent_t * OS_readdir (os_dirp_t directory) *****************************************************************************/ void OS_rewinddir(os_dirp_t directory) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_rewinddir), directory); + /* Call the default impl so hooks will work */ UT_DEFAULT_IMPL(OS_rewinddir); } diff --git a/src/ut-stubs/osapi-utstub-errors.c b/src/ut-stubs/osapi-utstub-errors.c index 718906ba3..f3259ff99 100644 --- a/src/ut-stubs/osapi-utstub-errors.c +++ b/src/ut-stubs/osapi-utstub-errors.c @@ -36,6 +36,9 @@ int32 OS_GetErrorName(int32 error_num, os_err_name_t* err_name) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_GetErrorName), error_num); + UT_Stub_RegisterContext(UT_KEY(OS_GetErrorName), err_name); + int32 status; status = UT_DEFAULT_IMPL(OS_GetErrorName); diff --git a/src/ut-stubs/osapi-utstub-file.c b/src/ut-stubs/osapi-utstub-file.c index 20fda6864..719cec567 100644 --- a/src/ut-stubs/osapi-utstub-file.c +++ b/src/ut-stubs/osapi-utstub-file.c @@ -115,6 +115,9 @@ static int32 UT_GenericWriteStub(const char *fname, UT_EntryKey_t fkey, const vo *****************************************************************************/ int32 OS_creat(const char *path, int32 access) { + UT_Stub_RegisterContext(UT_KEY(OS_creat), path); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_creat), access); + int32 status; status = UT_DEFAULT_IMPL(OS_creat); @@ -134,6 +137,10 @@ int32 OS_creat(const char *path, int32 access) *****************************************************************************/ int32 OS_open(const char *path, int32 access, uint32 mode) { + UT_Stub_RegisterContext(UT_KEY(OS_open), path); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_open), access); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_open), mode); + int32 status; status = UT_DEFAULT_IMPL(OS_open); @@ -154,6 +161,8 @@ int32 OS_open(const char *path, int32 access, uint32 mode) *****************************************************************************/ int32 OS_close(uint32 filedes) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_close), filedes); + int32 status; status = UT_DEFAULT_IMPL(OS_close); @@ -193,6 +202,10 @@ int32 OS_StreamWrite(uint32 filedes, const void *buffer, uint32 nbytes, int32 t *****************************************************************************/ int32 OS_read(uint32 filedes, void *buffer, uint32 nbytes) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_read), filedes); + UT_Stub_RegisterContext(UT_KEY(OS_read), buffer); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_read), nbytes); + return UT_GenericReadStub(__func__,UT_KEY(OS_read),buffer,nbytes); } @@ -203,6 +216,10 @@ int32 OS_read(uint32 filedes, void *buffer, uint32 nbytes) *****************************************************************************/ int32 OS_write(uint32 filedes, const void *buffer, uint32 nbytes) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_write), filedes); + UT_Stub_RegisterContext(UT_KEY(OS_write), buffer); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_write), nbytes); + return UT_GenericWriteStub(__func__,UT_KEY(OS_write),buffer,nbytes); } @@ -213,6 +230,11 @@ int32 OS_write(uint32 filedes, const void *buffer, uint32 nbytes) *****************************************************************************/ int32 OS_TimedRead(uint32 filedes, void *buffer, uint32 nbytes, int32 timeout) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TimedRead), filedes); + UT_Stub_RegisterContext(UT_KEY(OS_TimedRead), buffer); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TimedRead), nbytes); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TimedRead), timeout); + return UT_GenericReadStub(__func__,UT_KEY(OS_TimedRead),buffer,nbytes); } @@ -223,6 +245,11 @@ int32 OS_TimedRead(uint32 filedes, void *buffer, uint32 nbytes, int32 timeout) *****************************************************************************/ int32 OS_TimedWrite(uint32 filedes, const void *buffer, uint32 nbytes, int32 timeout) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TimedWrite), filedes); + UT_Stub_RegisterContext(UT_KEY(OS_TimedWrite), buffer); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TimedWrite), nbytes); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TimedWrite), timeout); + return UT_GenericWriteStub(__func__,UT_KEY(OS_TimedWrite),buffer,nbytes); } @@ -234,6 +261,9 @@ int32 OS_TimedWrite(uint32 filedes, const void *buffer, uint32 nbytes, int32 ti *****************************************************************************/ int32 OS_chmod (const char *path, uint32 access) { + UT_Stub_RegisterContext(UT_KEY(OS_chmod), path); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_chmod), access); + int32 Status; Status = UT_DEFAULT_IMPL(OS_chmod); @@ -249,6 +279,9 @@ int32 OS_chmod (const char *path, uint32 access) *****************************************************************************/ int32 OS_stat (const char *path, os_fstat_t *filestats) { + UT_Stub_RegisterContext(UT_KEY(OS_stat), path); + UT_Stub_RegisterContext(UT_KEY(OS_stat), filestats); + int32 Status; Status = UT_DEFAULT_IMPL(OS_stat); @@ -267,6 +300,10 @@ int32 OS_stat (const char *path, os_fstat_t *filestats) *****************************************************************************/ int32 OS_lseek(uint32 filedes, int32 offset, uint32 whence) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_lseek), filedes); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_lseek), offset); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_lseek), whence); + int32 status; status = UT_DEFAULT_IMPL_RC(OS_lseek, offset); @@ -281,6 +318,8 @@ int32 OS_lseek(uint32 filedes, int32 offset, uint32 whence) *****************************************************************************/ int32 OS_remove (const char *path) { + UT_Stub_RegisterContext(UT_KEY(OS_remove), path); + int32 Status; Status = UT_DEFAULT_IMPL(OS_remove); @@ -293,8 +332,11 @@ int32 OS_remove (const char *path) * Stub function for OS_rename() * *****************************************************************************/ -int32 OS_rename (const char *old, const char *new) +int32 OS_rename (const char *old_filename, const char *new_filename) { + UT_Stub_RegisterContext(UT_KEY(OS_rename), old_filename); + UT_Stub_RegisterContext(UT_KEY(OS_rename), new_filename); + int32 Status; Status = UT_DEFAULT_IMPL(OS_rename); @@ -309,6 +351,9 @@ int32 OS_rename (const char *old, const char *new) *****************************************************************************/ int32 OS_cp (const char *src, const char *dest) { + UT_Stub_RegisterContext(UT_KEY(OS_cp), src); + UT_Stub_RegisterContext(UT_KEY(OS_cp), dest); + int32 Status; Status = UT_DEFAULT_IMPL(OS_cp); @@ -323,6 +368,9 @@ int32 OS_cp (const char *src, const char *dest) *****************************************************************************/ int32 OS_mv (const char *src, const char *dest) { + UT_Stub_RegisterContext(UT_KEY(OS_mv), src); + UT_Stub_RegisterContext(UT_KEY(OS_mv), dest); + int32 Status; Status = UT_DEFAULT_IMPL(OS_mv); @@ -338,6 +386,9 @@ int32 OS_mv (const char *src, const char *dest) *****************************************************************************/ int32 OS_FDGetInfo (uint32 filedes, OS_file_prop_t *fd_prop) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_FDGetInfo), filedes); + UT_Stub_RegisterContext(UT_KEY(OS_FDGetInfo), fd_prop); + int32 status; uint32 CopySize; @@ -367,6 +418,8 @@ int32 OS_FDGetInfo (uint32 filedes, OS_file_prop_t *fd_prop) *****************************************************************************/ int32 OS_FileOpenCheck(const char *Filename) { + UT_Stub_RegisterContext(UT_KEY(OS_FileOpenCheck), Filename); + int32 status; status = UT_DEFAULT_IMPL(OS_FileOpenCheck); @@ -381,6 +434,8 @@ int32 OS_FileOpenCheck(const char *Filename) *****************************************************************************/ int32 OS_CloseFileByName(const char *Filename) { + UT_Stub_RegisterContext(UT_KEY(OS_CloseFileByName), Filename); + int32 status; status = UT_DEFAULT_IMPL(OS_CloseFileByName); @@ -409,12 +464,14 @@ int32 OS_CloseAllFiles(void) *****************************************************************************/ int32 OS_ShellOutputToFile(const char* Cmd, uint32 filedes) { + UT_Stub_RegisterContext(UT_KEY(OS_ShellOutputToFile), Cmd); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_ShellOutputToFile), filedes); + int32 status; /* * This allows a hook function to do something with the "Cmd" parameter */ - UT_Stub_RegisterContext(UT_KEY(OS_ShellOutputToFile),Cmd); status = UT_DEFAULT_IMPL(OS_ShellOutputToFile); diff --git a/src/ut-stubs/osapi-utstub-filesys.c b/src/ut-stubs/osapi-utstub-filesys.c index f21f4fa69..4e09777f5 100644 --- a/src/ut-stubs/osapi-utstub-filesys.c +++ b/src/ut-stubs/osapi-utstub-filesys.c @@ -46,6 +46,10 @@ UT_DEFAULT_STUB(OS_FileSysAPI_Init,(void)) int32 OS_FileSysAddFixedMap(uint32 *filesys_id, const char *phys_path, const char *virt_path) { + UT_Stub_RegisterContext(UT_KEY(OS_FileSysAddFixedMap), filesys_id); + UT_Stub_RegisterContext(UT_KEY(OS_FileSysAddFixedMap), phys_path); + UT_Stub_RegisterContext(UT_KEY(OS_FileSysAddFixedMap), virt_path); + int32 status; status = UT_DEFAULT_IMPL(OS_FileSysAddFixedMap); @@ -73,6 +77,12 @@ int32 OS_FileSysAddFixedMap(uint32 *filesys_id, const char *phys_path, int32 OS_mkfs(char *address, const char *devname, const char * volname, uint32 blocksize, uint32 numblocks) { + UT_Stub_RegisterContext(UT_KEY(OS_mkfs), address); + UT_Stub_RegisterContext(UT_KEY(OS_mkfs), devname); + UT_Stub_RegisterContext(UT_KEY(OS_mkfs), volname); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_mkfs), blocksize); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_mkfs), numblocks); + int32 status; status = UT_DEFAULT_IMPL(OS_mkfs); @@ -87,6 +97,8 @@ int32 OS_mkfs(char *address, const char *devname, const char * volname, uint32 b *****************************************************************************/ int32 OS_rmfs(const char *devname) { + UT_Stub_RegisterContext(UT_KEY(OS_rmfs), devname); + int32 status; status = UT_DEFAULT_IMPL(OS_rmfs); @@ -102,6 +114,12 @@ int32 OS_rmfs(const char *devname) int32 OS_initfs(char *address, const char *devname, const char *volname, uint32 blocksize, uint32 numblocks) { + UT_Stub_RegisterContext(UT_KEY(OS_initfs), address); + UT_Stub_RegisterContext(UT_KEY(OS_initfs), devname); + UT_Stub_RegisterContext(UT_KEY(OS_initfs), volname); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_initfs), blocksize); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_initfs), numblocks); + int32 status; status = UT_DEFAULT_IMPL(OS_initfs); @@ -116,6 +134,9 @@ int32 OS_initfs(char *address, const char *devname, const char *volname, *****************************************************************************/ int32 OS_mount(const char *devname, const char* mountpoint) { + UT_Stub_RegisterContext(UT_KEY(OS_mount), devname); + UT_Stub_RegisterContext(UT_KEY(OS_mount), mountpoint); + int32 status; status = UT_DEFAULT_IMPL(OS_mount); @@ -130,6 +151,8 @@ int32 OS_mount(const char *devname, const char* mountpoint) *****************************************************************************/ int32 OS_unmount(const char *mountpoint) { + UT_Stub_RegisterContext(UT_KEY(OS_unmount), mountpoint); + int32 status; status = UT_DEFAULT_IMPL(OS_unmount); @@ -144,6 +167,8 @@ int32 OS_unmount(const char *mountpoint) *****************************************************************************/ int32 OS_fsBlocksFree(const char *name) { + UT_Stub_RegisterContext(UT_KEY(OS_fsBlocksFree), name); + int32 status; status = UT_DEFAULT_IMPL_RC(OS_fsBlocksFree, 100); @@ -158,6 +183,9 @@ int32 OS_fsBlocksFree(const char *name) *****************************************************************************/ int32 OS_fsBytesFree(const char *name, uint64 *bytes_free) { + UT_Stub_RegisterContext(UT_KEY(OS_fsBytesFree), name); + UT_Stub_RegisterContext(UT_KEY(OS_fsBytesFree), bytes_free); + int32 status; status = UT_DEFAULT_IMPL(OS_fsBytesFree); @@ -178,6 +206,9 @@ int32 OS_fsBytesFree(const char *name, uint64 *bytes_free) *****************************************************************************/ int32 OS_chkfs(const char *name, bool repair) { + UT_Stub_RegisterContext(UT_KEY(OS_chkfs), name); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_chkfs), repair); + int32 status; status = UT_DEFAULT_IMPL(OS_chkfs); @@ -192,6 +223,9 @@ int32 OS_chkfs(const char *name, bool repair) *****************************************************************************/ int32 OS_FS_GetPhysDriveName(char * PhysDriveName, const char * MountPoint) { + UT_Stub_RegisterContext(UT_KEY(OS_FS_GetPhysDriveName), PhysDriveName); + UT_Stub_RegisterContext(UT_KEY(OS_FS_GetPhysDriveName), MountPoint); + int32 status; status = UT_DEFAULT_IMPL(OS_FS_GetPhysDriveName); @@ -205,12 +239,14 @@ int32 OS_FS_GetPhysDriveName(char * PhysDriveName, const char * MountPoint) * Stub function for OS_GetFsInfo() * *****************************************************************************/ -int32 OS_GetFsInfo(os_fsinfo_t *FilesysInfo) +int32 OS_GetFsInfo(os_fsinfo_t *filesys_info) { + UT_Stub_RegisterContext(UT_KEY(OS_GetFsInfo), filesys_info); + int32 status; status = UT_DEFAULT_IMPL(OS_GetFsInfo); - memset(FilesysInfo, 0, sizeof (*FilesysInfo)); + memset(filesys_info, 0, sizeof (*filesys_info)); return status; } @@ -222,6 +258,9 @@ int32 OS_GetFsInfo(os_fsinfo_t *FilesysInfo) *****************************************************************************/ int32 OS_TranslatePath( const char *VirtualPath, char *LocalPath) { + UT_Stub_RegisterContext(UT_KEY(OS_TranslatePath), VirtualPath); + UT_Stub_RegisterContext(UT_KEY(OS_TranslatePath), LocalPath); + int32 status; status = UT_DEFAULT_IMPL(OS_TranslatePath); diff --git a/src/ut-stubs/osapi-utstub-fpu.c b/src/ut-stubs/osapi-utstub-fpu.c index 5e74cbca1..3b8952bcc 100644 --- a/src/ut-stubs/osapi-utstub-fpu.c +++ b/src/ut-stubs/osapi-utstub-fpu.c @@ -44,6 +44,10 @@ int32 OS_FPUExcAttachHandler (uint32 ExceptionNumber, osal_task_entry ExceptionHandler , int32 parameter) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_FPUExcAttachHandler), ExceptionNumber); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_FPUExcAttachHandler), ExceptionHandler); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_FPUExcAttachHandler), parameter); + int32 status; status = UT_DEFAULT_IMPL_ARGS(OS_FPUExcAttachHandler, ExceptionNumber, ExceptionHandler, parameter); @@ -58,6 +62,8 @@ int32 OS_FPUExcAttachHandler (uint32 ExceptionNumber, osal_task_entry Exceptio *****************************************************************************/ int32 OS_FPUExcEnable (int32 ExceptionNumber) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_FPUExcEnable), ExceptionNumber); + int32 status; status = UT_DEFAULT_IMPL(OS_FPUExcEnable); @@ -72,6 +78,8 @@ int32 OS_FPUExcEnable (int32 ExceptionNumber) *****************************************************************************/ int32 OS_FPUExcDisable (int32 ExceptionNumber) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_FPUExcDisable), ExceptionNumber); + int32 status; status = UT_DEFAULT_IMPL(OS_FPUExcDisable); @@ -86,6 +94,8 @@ int32 OS_FPUExcDisable (int32 ExceptionNumber) *****************************************************************************/ int32 OS_FPUExcSetMask (uint32 mask) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_FPUExcSetMask), mask); + int32 status; status = UT_DEFAULT_IMPL(OS_FPUExcSetMask); @@ -100,6 +110,8 @@ int32 OS_FPUExcSetMask (uint32 mask) *****************************************************************************/ int32 OS_FPUExcGetMask (uint32 *mask) { + UT_Stub_RegisterContext(UT_KEY(OS_FPUExcGetMask), mask); + int32 status; status = UT_DEFAULT_IMPL(OS_FPUExcGetMask); diff --git a/src/ut-stubs/osapi-utstub-heap.c b/src/ut-stubs/osapi-utstub-heap.c index 08c2cd171..7803958eb 100644 --- a/src/ut-stubs/osapi-utstub-heap.c +++ b/src/ut-stubs/osapi-utstub-heap.c @@ -42,6 +42,8 @@ *****************************************************************************/ int32 OS_HeapGetInfo(OS_heap_prop_t *heap_prop) { + UT_Stub_RegisterContext(UT_KEY(OS_HeapGetInfo), heap_prop); + int32 status; status = UT_DEFAULT_IMPL(OS_HeapGetInfo); diff --git a/src/ut-stubs/osapi-utstub-idmap.c b/src/ut-stubs/osapi-utstub-idmap.c index 11b4cda79..2766d9402 100644 --- a/src/ut-stubs/osapi-utstub-idmap.c +++ b/src/ut-stubs/osapi-utstub-idmap.c @@ -158,7 +158,6 @@ int32 OS_ObjectIdToArrayIndex(uint32 idtype, uint32 id, uint32 *ArrayIndex) return Status; } - /***************************************************************************** * * Stub function for OS_ObjectIdFinalize() @@ -209,7 +208,6 @@ int32 OS_ObjectIdGetBySearch(OS_lock_mode_t lock_mode, uint32 idtype, OS_ObjectM return Status; } - /***************************************************************************** * * Stub function for OS_ObjectIdFindByName() @@ -419,8 +417,12 @@ int32 OS_ObjectIdAllocateNew(uint32 idtype, const char *name, uint32 *array_inde returns: status ---------------------------------------------------------------------------------------*/ -int32 OS_GetResourceName(uint32 id, char *buffer, uint32 buffer_size) +int32 OS_GetResourceName(uint32 object_id, char *buffer, uint32 buffer_size) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_GetResourceName), object_id); + UT_Stub_RegisterContext(UT_KEY(OS_GetResourceName), buffer); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_GetResourceName), buffer_size); + int32 return_code; return_code = UT_DEFAULT_IMPL(OS_GetResourceName); @@ -450,6 +452,9 @@ int32 OS_GetResourceName(uint32 id, char *buffer, uint32 buffer_size) ---------------------------------------------------------------------------------------*/ int32 OS_ConvertToArrayIndex(uint32 object_id, uint32 *ArrayIndex) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_ConvertToArrayIndex), object_id); + UT_Stub_RegisterContext(UT_KEY(OS_ConvertToArrayIndex), ArrayIndex); + int32 return_code; return_code = UT_DEFAULT_IMPL(OS_ConvertToArrayIndex); @@ -485,15 +490,15 @@ int32 OS_ConvertToArrayIndex(uint32 object_id, uint32 *ArrayIndex) ---------------------------------------------------------------------------------------*/ void OS_ForEachObjectOfType (uint32 objtype, uint32 creator_id, OS_ArgCallback_t callback_ptr, void *callback_arg) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_ForEachObjectOfType), objtype); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_ForEachObjectOfType), creator_id); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_ForEachObjectOfType), callback_ptr); + UT_Stub_RegisterContext(UT_KEY(OS_ForEachObjectOfType), callback_arg); + uint32 NextId; uint32 IdSize; - OS_U32ValueWrapper_t wrapper; - - wrapper.arg_callback_func = callback_ptr; /* Although this is "void", Invoke the default impl to log it and invoke any hooks */ - UT_Stub_RegisterContext(UT_KEY(OS_ForEachObjectOfType), wrapper.opaque_arg); - UT_Stub_RegisterContext(UT_KEY(OS_ForEachObjectOfType), callback_arg); UT_DEFAULT_IMPL(OS_ForEachObjectOfType); while (1) @@ -517,15 +522,14 @@ void OS_ForEachObjectOfType (uint32 objtype, uint32 creator_id, OS_ArgCallba ---------------------------------------------------------------------------------------*/ void OS_ForEachObject (uint32 creator_id, OS_ArgCallback_t callback_ptr, void *callback_arg) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_ForEachObject), creator_id); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_ForEachObject), callback_ptr); + UT_Stub_RegisterContext(UT_KEY(OS_ForEachObject), callback_arg); + uint32 NextId; uint32 IdSize; - OS_U32ValueWrapper_t wrapper; - - wrapper.arg_callback_func = callback_ptr; /* Although this is "void", Invoke the default impl to log it and invoke any hooks */ - UT_Stub_RegisterContext(UT_KEY(OS_ForEachObject), wrapper.opaque_arg); - UT_Stub_RegisterContext(UT_KEY(OS_ForEachObject), callback_arg); UT_DEFAULT_IMPL(OS_ForEachObject); while (1) @@ -548,6 +552,8 @@ void OS_ForEachObject (uint32 creator_id, OS_ArgCallback_t callback_ptr, void *c ---------------------------------------------------------------------------------------*/ uint32 OS_IdentifyObject (uint32 object_id) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_IdentifyObject), object_id); + int32 DefaultType; switch ((object_id >> 16) ^ 0x4000U) diff --git a/src/ut-stubs/osapi-utstub-interrupts.c b/src/ut-stubs/osapi-utstub-interrupts.c index db7aa0b08..6087ffbfe 100644 --- a/src/ut-stubs/osapi-utstub-interrupts.c +++ b/src/ut-stubs/osapi-utstub-interrupts.c @@ -42,8 +42,10 @@ *****************************************************************************/ int32 OS_IntAttachHandler (uint32 InterruptNumber, osal_task_entry InterruptHandler, int32 parameter) { - UT_Stub_RegisterContext(UT_KEY(OS_IntAttachHandler), &InterruptHandler); - UT_Stub_RegisterContext(UT_KEY(OS_IntAttachHandler), ¶meter); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_IntAttachHandler), InterruptNumber); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_IntAttachHandler), InterruptHandler); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_IntAttachHandler), parameter); + return UT_DEFAULT_IMPL(OS_IntAttachHandler); } @@ -83,8 +85,10 @@ int32 OS_IntLock(void) ** Returns OS_SUCCESS. ** ******************************************************************************/ -int32 OS_IntUnlock(int32 IntFlags) +int32 OS_IntUnlock(int32 IntLevel) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_IntUnlock), IntLevel); + return UT_DEFAULT_IMPL(OS_IntUnlock); } @@ -95,6 +99,8 @@ int32 OS_IntUnlock(int32 IntFlags) *****************************************************************************/ int32 OS_IntEnable(int32 Level) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_IntEnable), Level); + return UT_DEFAULT_IMPL(OS_IntEnable); } @@ -105,6 +111,8 @@ int32 OS_IntEnable(int32 Level) *****************************************************************************/ int32 OS_IntDisable(int32 Level) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_IntDisable), Level); + return UT_DEFAULT_IMPL(OS_IntDisable); } @@ -113,9 +121,10 @@ int32 OS_IntDisable(int32 Level) * Stub function for OS_IntSetMask() * *****************************************************************************/ -int32 OS_IntSetMask ( uint32 MaskSetting ) +int32 OS_IntSetMask ( uint32 mask ) { - UT_Stub_RegisterContext(UT_KEY(OS_IntSetMask), &MaskSetting); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_IntSetMask), mask); + return UT_DEFAULT_IMPL(OS_IntSetMask); } @@ -124,9 +133,10 @@ int32 OS_IntSetMask ( uint32 MaskSetting ) * Stub function for OS_IntGetMask() * *****************************************************************************/ -int32 OS_IntGetMask ( uint32 * MaskSettingPtr ) +int32 OS_IntGetMask ( uint32 * mask ) { - UT_Stub_RegisterContext(UT_KEY(OS_IntGetMask), MaskSettingPtr); + UT_Stub_RegisterContext(UT_KEY(OS_IntGetMask), mask); + return UT_DEFAULT_IMPL(OS_IntGetMask); } diff --git a/src/ut-stubs/osapi-utstub-module.c b/src/ut-stubs/osapi-utstub-module.c index 5aea8e4b4..8112f9595 100644 --- a/src/ut-stubs/osapi-utstub-module.c +++ b/src/ut-stubs/osapi-utstub-module.c @@ -85,6 +85,10 @@ int32 dummy_function(void) ******************************************************************************/ int32 OS_ModuleLoad(uint32 *module_id, const char *module_name, const char *filename) { + UT_Stub_RegisterContext(UT_KEY(OS_ModuleLoad), module_id); + UT_Stub_RegisterContext(UT_KEY(OS_ModuleLoad), module_name); + UT_Stub_RegisterContext(UT_KEY(OS_ModuleLoad), filename); + int32 status; status = UT_DEFAULT_IMPL(OS_ModuleLoad); @@ -123,6 +127,8 @@ int32 OS_ModuleLoad(uint32 *module_id, const char *module_name, const char *file ******************************************************************************/ int32 OS_ModuleUnload(uint32 module_id) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_ModuleUnload), module_id); + int32 status; status = UT_DEFAULT_IMPL(OS_ModuleUnload); @@ -157,6 +163,9 @@ int32 OS_ModuleUnload(uint32 module_id) ******************************************************************************/ int32 OS_ModuleInfo(uint32 module_id, OS_module_prop_t *module_info) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_ModuleInfo), module_id); + UT_Stub_RegisterContext(UT_KEY(OS_ModuleInfo), module_info); + int32 status; status = UT_DEFAULT_IMPL(OS_ModuleInfo); @@ -192,13 +201,14 @@ int32 OS_ModuleInfo(uint32 module_id, OS_module_prop_t *module_info) ******************************************************************************/ int32 OS_SymbolLookup(cpuaddr *symbol_address, const char *symbol_name) { + UT_Stub_RegisterContext(UT_KEY(OS_SymbolLookup), symbol_address); + UT_Stub_RegisterContext(UT_KEY(OS_SymbolLookup), symbol_name); + int32 status; /* * Register the context so a hook can do something with the parameters */ - UT_Stub_RegisterContext(UT_KEY(OS_SymbolLookup), symbol_address); - UT_Stub_RegisterContext(UT_KEY(OS_SymbolLookup), symbol_name); status = UT_DEFAULT_IMPL(OS_SymbolLookup); @@ -220,8 +230,11 @@ int32 OS_SymbolLookup(cpuaddr *symbol_address, const char *symbol_name) * Stub function for OS_SymbolTableDump() * *****************************************************************************/ -int32 OS_SymbolTableDump ( const char *filename, uint32 SizeLimit ) +int32 OS_SymbolTableDump ( const char *filename, uint32 size_limit ) { + UT_Stub_RegisterContext(UT_KEY(OS_SymbolTableDump), filename); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SymbolTableDump), size_limit); + int32 status; status = UT_DEFAULT_IMPL(OS_SymbolTableDump); diff --git a/src/ut-stubs/osapi-utstub-mutex.c b/src/ut-stubs/osapi-utstub-mutex.c index cd248afc1..c9a049a3c 100644 --- a/src/ut-stubs/osapi-utstub-mutex.c +++ b/src/ut-stubs/osapi-utstub-mutex.c @@ -61,6 +61,10 @@ UT_DEFAULT_STUB(OS_MutexAPI_Init,(void)) ******************************************************************************/ int32 OS_MutSemCreate(uint32 *sem_id, const char *sem_name, uint32 options) { + UT_Stub_RegisterContext(UT_KEY(OS_MutSemCreate), sem_id); + UT_Stub_RegisterContext(UT_KEY(OS_MutSemCreate), sem_name); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_MutSemCreate), options); + int32 status; status = UT_DEFAULT_IMPL(OS_MutSemCreate); @@ -99,6 +103,8 @@ int32 OS_MutSemCreate(uint32 *sem_id, const char *sem_name, uint32 options) ******************************************************************************/ int32 OS_MutSemDelete(uint32 sem_id) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_MutSemDelete), sem_id); + int32 status; status = UT_DEFAULT_IMPL(OS_MutSemDelete); @@ -133,6 +139,8 @@ int32 OS_MutSemDelete(uint32 sem_id) ******************************************************************************/ int32 OS_MutSemGive(uint32 sem_id) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_MutSemGive), sem_id); + int32 status; status = UT_DEFAULT_IMPL(OS_MutSemGive); @@ -162,6 +170,8 @@ int32 OS_MutSemGive(uint32 sem_id) ******************************************************************************/ int32 OS_MutSemTake(uint32 sem_id) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_MutSemTake), sem_id); + int32 status; status = UT_DEFAULT_IMPL(OS_MutSemTake); @@ -176,6 +186,9 @@ int32 OS_MutSemTake(uint32 sem_id) *****************************************************************************/ int32 OS_MutSemGetIdByName (uint32 *sem_id, const char *sem_name) { + UT_Stub_RegisterContext(UT_KEY(OS_MutSemGetIdByName), sem_id); + UT_Stub_RegisterContext(UT_KEY(OS_MutSemGetIdByName), sem_name); + int32 status; status = UT_DEFAULT_IMPL(OS_MutSemGetIdByName); @@ -209,6 +222,9 @@ int32 OS_MutSemGetIdByName (uint32 *sem_id, const char *sem_name) ******************************************************************************/ int32 OS_MutSemGetInfo(uint32 sem_id, OS_mut_sem_prop_t *mut_prop) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_MutSemGetInfo), sem_id); + UT_Stub_RegisterContext(UT_KEY(OS_MutSemGetInfo), mut_prop); + int32 status; status = UT_DEFAULT_IMPL(OS_MutSemGetInfo); diff --git a/src/ut-stubs/osapi-utstub-network.c b/src/ut-stubs/osapi-utstub-network.c index 1ae71a7c6..772cadaec 100644 --- a/src/ut-stubs/osapi-utstub-network.c +++ b/src/ut-stubs/osapi-utstub-network.c @@ -40,6 +40,9 @@ UT_DEFAULT_STUB(OS_NetworkAPI_Init,(void)) int32 OS_NetworkGetHostName(char *host_name, uint32 name_len) { + UT_Stub_RegisterContext(UT_KEY(OS_NetworkGetHostName), host_name); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_NetworkGetHostName), name_len); + int32 status; status = UT_DEFAULT_IMPL(OS_NetworkGetHostName); diff --git a/src/ut-stubs/osapi-utstub-printf.c b/src/ut-stubs/osapi-utstub-printf.c index d37fe8fc2..04b7c49ba 100644 --- a/src/ut-stubs/osapi-utstub-printf.c +++ b/src/ut-stubs/osapi-utstub-printf.c @@ -58,13 +58,14 @@ int32 OS_ConsoleWrite(uint32 console_id, const char *Str) *****************************************************************************/ void OS_printf(const char *string, ...) { + UT_Stub_RegisterContext(UT_KEY(OS_printf), string); + int32 status; int32 length = strlen(string); va_list va; va_start(va,string); - UT_Stub_RegisterContext(UT_KEY(OS_printf), string); status = UT_DefaultStubImplWithArgs(__func__, UT_KEY(OS_printf), 0, va); if (status >= 0) diff --git a/src/ut-stubs/osapi-utstub-queue.c b/src/ut-stubs/osapi-utstub-queue.c index 875b2a250..4b8300950 100644 --- a/src/ut-stubs/osapi-utstub-queue.c +++ b/src/ut-stubs/osapi-utstub-queue.c @@ -68,6 +68,12 @@ int32 OS_QueueCreate(uint32 *queue_id, uint32 data_size, uint32 flags) { + UT_Stub_RegisterContext(UT_KEY(OS_QueueCreate), queue_id); + UT_Stub_RegisterContext(UT_KEY(OS_QueueCreate), queue_name); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_QueueCreate), queue_depth); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_QueueCreate), data_size); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_QueueCreate), flags); + int32 status; status = UT_DEFAULT_IMPL(OS_QueueCreate); @@ -109,6 +115,8 @@ int32 OS_QueueCreate(uint32 *queue_id, ******************************************************************************/ int32 OS_QueueDelete(uint32 queue_id) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_QueueDelete), queue_id); + int32 status; status = UT_DEFAULT_IMPL(OS_QueueDelete); @@ -152,6 +160,12 @@ int32 OS_QueueGet(uint32 queue_id, uint32 *size_copied, int32 timeout) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_QueueGet), queue_id); + UT_Stub_RegisterContext(UT_KEY(OS_QueueGet), data); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_QueueGet), size); + UT_Stub_RegisterContext(UT_KEY(OS_QueueGet), size_copied); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_QueueGet), timeout); + int32 status; status = UT_DEFAULT_IMPL(OS_QueueGet); @@ -193,6 +207,11 @@ int32 OS_QueueGet(uint32 queue_id, ******************************************************************************/ int32 OS_QueuePut(uint32 queue_id, const void *data, uint32 size, uint32 flags) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_QueuePut), queue_id); + UT_Stub_RegisterContext(UT_KEY(OS_QueuePut), data); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_QueuePut), size); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_QueuePut), flags); + int32 status; status = UT_DEFAULT_IMPL(OS_QueuePut); @@ -212,6 +231,9 @@ int32 OS_QueuePut(uint32 queue_id, const void *data, uint32 size, uint32 flags) *****************************************************************************/ int32 OS_QueueGetIdByName (uint32 *queue_id, const char *queue_name) { + UT_Stub_RegisterContext(UT_KEY(OS_QueueGetIdByName), queue_id); + UT_Stub_RegisterContext(UT_KEY(OS_QueueGetIdByName), queue_name); + int32 status; status = UT_DEFAULT_IMPL(OS_QueueGetIdByName); @@ -242,8 +264,11 @@ int32 OS_QueueGetIdByName (uint32 *queue_id, const char *queue_name) ** Returns OS_SUCCESS. ** ******************************************************************************/ -int32 OS_QueueGetInfo(uint32 sem_id, OS_queue_prop_t *queue_prop) +int32 OS_QueueGetInfo(uint32 queue_id, OS_queue_prop_t *queue_prop) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_QueueGetInfo), queue_id); + UT_Stub_RegisterContext(UT_KEY(OS_QueueGetInfo), queue_prop); + int32 status; status = UT_DEFAULT_IMPL(OS_QueueGetInfo); diff --git a/src/ut-stubs/osapi-utstub-select.c b/src/ut-stubs/osapi-utstub-select.c index 72754ab29..3e9e56731 100644 --- a/src/ut-stubs/osapi-utstub-select.c +++ b/src/ut-stubs/osapi-utstub-select.c @@ -40,9 +40,12 @@ *****************************************************************************/ int32 OS_SelectSingle(uint32 objid, uint32 *StateFlags, int32 msecs) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SelectSingle), objid); + UT_Stub_RegisterContext(UT_KEY(OS_SelectSingle), StateFlags); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SelectSingle), msecs); + int32 return_code; - UT_Stub_RegisterContext(UT_KEY(OS_SelectSingle), StateFlags); return_code = UT_DEFAULT_IMPL(OS_SelectSingle); return return_code; @@ -55,10 +58,12 @@ int32 OS_SelectSingle(uint32 objid, uint32 *StateFlags, int32 msecs) *****************************************************************************/ int32 OS_SelectMultiple(OS_FdSet *ReadSet, OS_FdSet *WriteSet, int32 msecs) { - int32 return_code; - UT_Stub_RegisterContext(UT_KEY(OS_SelectMultiple), ReadSet); UT_Stub_RegisterContext(UT_KEY(OS_SelectMultiple), WriteSet); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SelectMultiple), msecs); + + int32 return_code; + return_code = UT_DEFAULT_IMPL(OS_SelectMultiple); return return_code; @@ -71,6 +76,8 @@ int32 OS_SelectMultiple(OS_FdSet *ReadSet, OS_FdSet *WriteSet, int32 msecs) *****************************************************************************/ int32 OS_SelectFdZero(OS_FdSet *Set) { + UT_Stub_RegisterContext(UT_KEY(OS_SelectFdZero), Set); + int32 return_code; return_code = UT_DEFAULT_IMPL(OS_SelectFdZero); @@ -85,6 +92,9 @@ int32 OS_SelectFdZero(OS_FdSet *Set) *****************************************************************************/ int32 OS_SelectFdAdd(OS_FdSet *Set, uint32 objid) { + UT_Stub_RegisterContext(UT_KEY(OS_SelectFdAdd), Set); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SelectFdAdd), objid); + int32 return_code; return_code = UT_DEFAULT_IMPL(OS_SelectFdAdd); @@ -99,6 +109,9 @@ int32 OS_SelectFdAdd(OS_FdSet *Set, uint32 objid) *****************************************************************************/ int32 OS_SelectFdClear(OS_FdSet *Set, uint32 objid) { + UT_Stub_RegisterContext(UT_KEY(OS_SelectFdClear), Set); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SelectFdClear), objid); + int32 return_code; return_code = UT_DEFAULT_IMPL(OS_SelectFdClear); @@ -113,6 +126,9 @@ int32 OS_SelectFdClear(OS_FdSet *Set, uint32 objid) *****************************************************************************/ bool OS_SelectFdIsSet(OS_FdSet *Set, uint32 objid) { + UT_Stub_RegisterContext(UT_KEY(OS_SelectFdIsSet), Set); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SelectFdIsSet), objid); + int32 return_code; return_code = UT_DEFAULT_IMPL(OS_SelectFdIsSet); diff --git a/src/ut-stubs/osapi-utstub-sockets.c b/src/ut-stubs/osapi-utstub-sockets.c index 86929f6e6..72980c001 100644 --- a/src/ut-stubs/osapi-utstub-sockets.c +++ b/src/ut-stubs/osapi-utstub-sockets.c @@ -41,13 +41,17 @@ UT_DEFAULT_STUB(OS_SocketAPI_Init,(void)) *****************************************************************************/ int32 OS_SocketOpen(uint32 *sock_id, OS_SocketDomain_t Domain, OS_SocketType_t Type) { + UT_Stub_RegisterContext(UT_KEY(OS_SocketOpen), sock_id); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SocketOpen), Domain); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SocketOpen), Type); + int32 status; status = UT_DEFAULT_IMPL(OS_SocketOpen); if (status == OS_SUCCESS) { - status = UT_AllocStubObjId(UT_OBJTYPE_SOCKET); + *sock_id = UT_AllocStubObjId(UT_OBJTYPE_SOCKET); } return status; @@ -60,6 +64,9 @@ int32 OS_SocketOpen(uint32 *sock_id, OS_SocketDomain_t Domain, OS_SocketType_t T *****************************************************************************/ int32 OS_SocketBind(uint32 sock_id, const OS_SockAddr_t *Addr) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SocketBind), sock_id); + UT_Stub_RegisterContext(UT_KEY(OS_SocketBind), Addr); + int32 status; status = UT_DEFAULT_IMPL(OS_SocketBind); @@ -73,6 +80,11 @@ int32 OS_SocketBind(uint32 sock_id, const OS_SockAddr_t *Addr) *****************************************************************************/ int32 OS_SocketAccept(uint32 sock_id, uint32 *connsock_id, OS_SockAddr_t *Addr, int32 timeout) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SocketAccept), sock_id); + UT_Stub_RegisterContext(UT_KEY(OS_SocketAccept), connsock_id); + UT_Stub_RegisterContext(UT_KEY(OS_SocketAccept), Addr); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SocketAccept), timeout); + int32 status; status = UT_DEFAULT_IMPL(OS_SocketAccept); @@ -85,8 +97,12 @@ int32 OS_SocketAccept(uint32 sock_id, uint32 *connsock_id, OS_SockAddr_t *Addr, * Stub function for OS_SocketConnect() * *****************************************************************************/ -int32 OS_SocketConnect(uint32 sock_id, const OS_SockAddr_t *Addr, int32 Timeout) +int32 OS_SocketConnect(uint32 sock_id, const OS_SockAddr_t *Addr, int32 timeout) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SocketConnect), sock_id); + UT_Stub_RegisterContext(UT_KEY(OS_SocketConnect), Addr); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SocketConnect), timeout); + int32 status; status = UT_DEFAULT_IMPL(OS_SocketConnect); @@ -101,11 +117,15 @@ int32 OS_SocketConnect(uint32 sock_id, const OS_SockAddr_t *Addr, int32 Timeout) *****************************************************************************/ int32 OS_SocketRecvFrom(uint32 sock_id, void *buffer, uint32 buflen, OS_SockAddr_t *RemoteAddr, int32 timeout) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SocketRecvFrom), sock_id); + UT_Stub_RegisterContext(UT_KEY(OS_SocketRecvFrom), buffer); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SocketRecvFrom), buflen); + UT_Stub_RegisterContext(UT_KEY(OS_SocketRecvFrom), RemoteAddr); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SocketRecvFrom), timeout); + int32 status; uint32 CopySize; - UT_Stub_RegisterContext(UT_KEY(OS_SocketRecvFrom), RemoteAddr); - status = UT_DEFAULT_IMPL(OS_SocketRecvFrom); if (status == 0x7FFFFFFF) @@ -142,11 +162,14 @@ int32 OS_SocketRecvFrom(uint32 sock_id, void *buffer, uint32 buflen, OS_SockAddr *****************************************************************************/ int32 OS_SocketSendTo(uint32 sock_id, const void *buffer, uint32 buflen, const OS_SockAddr_t *RemoteAddr) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SocketSendTo), sock_id); + UT_Stub_RegisterContext(UT_KEY(OS_SocketSendTo), buffer); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SocketSendTo), buflen); + UT_Stub_RegisterContext(UT_KEY(OS_SocketSendTo), RemoteAddr); + int32 status; uint32 CopySize; - UT_Stub_RegisterContext(UT_KEY(OS_SocketSendTo), RemoteAddr); - status = UT_DEFAULT_IMPL_RC(OS_SocketSendTo, 0x7FFFFFFF); if (status == 0x7FFFFFFF) @@ -177,6 +200,9 @@ int32 OS_SocketSendTo(uint32 sock_id, const void *buffer, uint32 buflen, const O *****************************************************************************/ int32 OS_SocketGetIdByName (uint32 *sock_id, const char *sock_name) { + UT_Stub_RegisterContext(UT_KEY(OS_SocketGetIdByName), sock_id); + UT_Stub_RegisterContext(UT_KEY(OS_SocketGetIdByName), sock_name); + int32 status; status = UT_DEFAULT_IMPL(OS_SocketGetIdByName); @@ -198,6 +224,9 @@ int32 OS_SocketGetIdByName (uint32 *sock_id, const char *sock_name) *****************************************************************************/ int32 OS_SocketGetInfo (uint32 sock_id, OS_socket_prop_t *sock_prop) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SocketGetInfo), sock_id); + UT_Stub_RegisterContext(UT_KEY(OS_SocketGetInfo), sock_prop); + int32 status; uint32 CopySize; @@ -221,6 +250,9 @@ int32 OS_SocketGetInfo (uint32 sock_id, OS_socket_prop_t *sock_prop) int32 OS_SocketAddrInit(OS_SockAddr_t *Addr, OS_SocketDomain_t Domain) { + UT_Stub_RegisterContext(UT_KEY(OS_SocketAddrInit), Addr); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SocketAddrInit), Domain); + int32 status; status = UT_DEFAULT_IMPL(OS_SocketAddrInit); @@ -236,6 +268,10 @@ int32 OS_SocketAddrInit(OS_SockAddr_t *Addr, OS_SocketDomain_t Domain) int32 OS_SocketAddrToString(char *buffer, uint32 buflen, const OS_SockAddr_t *Addr) { + UT_Stub_RegisterContext(UT_KEY(OS_SocketAddrToString), buffer); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SocketAddrToString), buflen); + UT_Stub_RegisterContext(UT_KEY(OS_SocketAddrToString), Addr); + int32 status; status = UT_DEFAULT_IMPL(OS_SocketAddrToString); @@ -252,6 +288,9 @@ int32 OS_SocketAddrToString(char *buffer, uint32 buflen, const OS_SockAddr_t *Ad int32 OS_SocketAddrFromString(OS_SockAddr_t *Addr, const char *string) { + UT_Stub_RegisterContext(UT_KEY(OS_SocketAddrFromString), Addr); + UT_Stub_RegisterContext(UT_KEY(OS_SocketAddrFromString), string); + int32 status; status = UT_DEFAULT_IMPL(OS_SocketAddrFromString); @@ -267,6 +306,9 @@ int32 OS_SocketAddrFromString(OS_SockAddr_t *Addr, const char *string) int32 OS_SocketAddrGetPort(uint16 *PortNum, const OS_SockAddr_t *Addr) { + UT_Stub_RegisterContext(UT_KEY(OS_SocketAddrGetPort), PortNum); + UT_Stub_RegisterContext(UT_KEY(OS_SocketAddrGetPort), Addr); + int32 status; status = UT_DEFAULT_IMPL(OS_SocketAddrGetPort); @@ -282,6 +324,9 @@ int32 OS_SocketAddrGetPort(uint16 *PortNum, const OS_SockAddr_t *Addr) int32 OS_SocketAddrSetPort(OS_SockAddr_t *Addr, uint16 PortNum) { + UT_Stub_RegisterContext(UT_KEY(OS_SocketAddrSetPort), Addr); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SocketAddrSetPort), PortNum); + int32 status; status = UT_DEFAULT_IMPL(OS_SocketAddrSetPort); diff --git a/src/ut-stubs/osapi-utstub-task.c b/src/ut-stubs/osapi-utstub-task.c index e855356fc..bd0819cc2 100644 --- a/src/ut-stubs/osapi-utstub-task.c +++ b/src/ut-stubs/osapi-utstub-task.c @@ -59,10 +59,15 @@ int32 OS_TaskCreate(uint32 *task_id, const char *task_name, uint32 stack_size, uint32 priority, uint32 flags) { - int32 status; - - UT_Stub_RegisterContext(UT_KEY(OS_TaskCreate), &function_pointer); + UT_Stub_RegisterContext(UT_KEY(OS_TaskCreate), task_id); + UT_Stub_RegisterContext(UT_KEY(OS_TaskCreate), task_name); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TaskCreate), function_pointer); UT_Stub_RegisterContext(UT_KEY(OS_TaskCreate), stack_pointer); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TaskCreate), stack_size); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TaskCreate), priority); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TaskCreate), flags); + + int32 status; status = UT_DEFAULT_IMPL(OS_TaskCreate); @@ -97,6 +102,8 @@ int32 OS_TaskCreate(uint32 *task_id, const char *task_name, ******************************************************************************/ int32 OS_TaskDelete(uint32 task_id) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TaskDelete), task_id); + int32 status; status = UT_DEFAULT_IMPL(OS_TaskDelete); @@ -150,6 +157,8 @@ void OS_TaskExit() ******************************************************************************/ int32 OS_TaskDelay(uint32 millisecond) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TaskDelay), millisecond); + int32 status; status = UT_DEFAULT_IMPL(OS_TaskDelay); @@ -164,6 +173,9 @@ int32 OS_TaskDelay(uint32 millisecond) *****************************************************************************/ int32 OS_TaskSetPriority (uint32 task_id, uint32 new_priority) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TaskSetPriority), task_id); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TaskSetPriority), new_priority); + int32 status; status = UT_DEFAULT_IMPL(OS_TaskSetPriority); @@ -231,6 +243,9 @@ uint32 OS_TaskGetId(void) *****************************************************************************/ int32 OS_TaskGetIdByName (uint32 *task_id, const char *task_name) { + UT_Stub_RegisterContext(UT_KEY(OS_TaskGetIdByName), task_id); + UT_Stub_RegisterContext(UT_KEY(OS_TaskGetIdByName), task_name); + int32 status; status = UT_DEFAULT_IMPL(OS_TaskGetIdByName); @@ -265,6 +280,9 @@ int32 OS_TaskGetIdByName (uint32 *task_id, const char *task_name) ******************************************************************************/ int32 OS_TaskGetInfo(uint32 task_id, OS_task_prop_t *task_prop) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TaskGetInfo), task_id); + UT_Stub_RegisterContext(UT_KEY(OS_TaskGetInfo), task_prop); + int32 status; status = UT_DEFAULT_IMPL(OS_TaskGetInfo); @@ -297,6 +315,10 @@ int32 OS_TaskGetInfo(uint32 task_id, OS_task_prop_t *task_prop) ******************************************************************************/ int32 OS_TaskFindIdBySystemData(uint32 *task_id, const void *sysdata, size_t sysdata_size) { + UT_Stub_RegisterContext(UT_KEY(OS_TaskFindIdBySystemData), task_id); + UT_Stub_RegisterContext(UT_KEY(OS_TaskFindIdBySystemData), sysdata); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TaskFindIdBySystemData), sysdata_size); + int32 status; status = UT_DEFAULT_IMPL(OS_TaskFindIdBySystemData); @@ -318,9 +340,9 @@ int32 OS_TaskFindIdBySystemData(uint32 *task_id, const void *sysdata, size_t sys *****************************************************************************/ int32 OS_TaskInstallDeleteHandler(osal_task_entry function_pointer) { - int32 status; + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TaskInstallDeleteHandler), function_pointer); - UT_Stub_RegisterContext(UT_KEY(OS_TaskInstallDeleteHandler), &function_pointer); + int32 status; status = UT_DEFAULT_IMPL(OS_TaskInstallDeleteHandler); diff --git a/src/ut-stubs/osapi-utstub-time.c b/src/ut-stubs/osapi-utstub-time.c index 462e67e67..356410eac 100644 --- a/src/ut-stubs/osapi-utstub-time.c +++ b/src/ut-stubs/osapi-utstub-time.c @@ -41,8 +41,14 @@ UT_DEFAULT_STUB(OS_TimerCbAPI_Init,(void)) * Stub function for OS_TimerAdd() * *****************************************************************************/ -int32 OS_TimerAdd(uint32 *timer_id, const char *timer_name, uint32 timebase_ref_id, OS_ArgCallback_t callback_ptr, void *callback_arg) +int32 OS_TimerAdd(uint32 *timer_id, const char *timer_name, uint32 timebase_id, OS_ArgCallback_t callback_ptr, void *callback_arg) { + UT_Stub_RegisterContext(UT_KEY(OS_TimerAdd), timer_id); + UT_Stub_RegisterContext(UT_KEY(OS_TimerAdd), timer_name); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TimerAdd), timebase_id); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TimerAdd), callback_ptr); + UT_Stub_RegisterContext(UT_KEY(OS_TimerAdd), callback_arg); + int32 status; status = UT_DEFAULT_IMPL(OS_TimerAdd); @@ -64,8 +70,13 @@ int32 OS_TimerAdd(uint32 *timer_id, const char *timer_name, uint32 timebase_ref_ * Stub function for OS_TimerCreate() * *****************************************************************************/ -int32 OS_TimerCreate(uint32 *timer_id, const char *timer_name, uint32 *accuracy, OS_TimerCallback_t callback_ptr) +int32 OS_TimerCreate(uint32 *timer_id, const char *timer_name, uint32 *clock_accuracy, OS_TimerCallback_t callback_ptr) { + UT_Stub_RegisterContext(UT_KEY(OS_TimerCreate), timer_id); + UT_Stub_RegisterContext(UT_KEY(OS_TimerCreate), timer_name); + UT_Stub_RegisterContext(UT_KEY(OS_TimerCreate), clock_accuracy); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TimerCreate), callback_ptr); + int32 status; status = UT_DEFAULT_IMPL(OS_TimerCreate); @@ -89,6 +100,10 @@ int32 OS_TimerCreate(uint32 *timer_id, const char *timer_name, uint32 *accuracy, *****************************************************************************/ int32 OS_TimerSet(uint32 timer_id, uint32 start_time, uint32 interval_time) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TimerSet), timer_id); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TimerSet), start_time); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TimerSet), interval_time); + int32 status; status = UT_DEFAULT_IMPL(OS_TimerSet); @@ -114,6 +129,8 @@ int32 OS_TimerSet(uint32 timer_id, uint32 start_time, uint32 interval_time) ******************************************************************************/ int32 OS_TimerDelete(uint32 timer_id) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TimerDelete), timer_id); + int32 status; status = UT_DEFAULT_IMPL(OS_TimerDelete); @@ -133,6 +150,9 @@ int32 OS_TimerDelete(uint32 timer_id) *****************************************************************************/ int32 OS_TimerGetIdByName (uint32 *timer_id, const char *timer_name) { + UT_Stub_RegisterContext(UT_KEY(OS_TimerGetIdByName), timer_id); + UT_Stub_RegisterContext(UT_KEY(OS_TimerGetIdByName), timer_name); + int32 status; status = UT_DEFAULT_IMPL(OS_TimerGetIdByName); @@ -168,6 +188,9 @@ int32 OS_TimerGetIdByName (uint32 *timer_id, const char *timer_name) ******************************************************************************/ int32 OS_TimerGetInfo(uint32 timer_id, OS_timer_prop_t *timer_prop) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TimerGetInfo), timer_id); + UT_Stub_RegisterContext(UT_KEY(OS_TimerGetInfo), timer_prop); + int32 status; status = UT_DEFAULT_IMPL(OS_TimerGetInfo); diff --git a/src/ut-stubs/osapi-utstub-timebase.c b/src/ut-stubs/osapi-utstub-timebase.c index 667b0cc0f..584515294 100644 --- a/src/ut-stubs/osapi-utstub-timebase.c +++ b/src/ut-stubs/osapi-utstub-timebase.c @@ -44,6 +44,10 @@ UT_DEFAULT_STUB(OS_TimeBaseAPI_Init,(void)) *****************************************************************************/ int32 OS_TimeBaseCreate(uint32 *timebase_id, const char *timebase_name, OS_TimerSync_t external_sync) { + UT_Stub_RegisterContext(UT_KEY(OS_TimeBaseCreate), timebase_id); + UT_Stub_RegisterContext(UT_KEY(OS_TimeBaseCreate), timebase_name); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TimeBaseCreate), external_sync); + int32 status; status = UT_DEFAULT_IMPL(OS_TimeBaseCreate); @@ -68,6 +72,10 @@ int32 OS_TimeBaseCreate(uint32 *timebase_id, const char *timebase_name, OS_Timer *****************************************************************************/ int32 OS_TimeBaseSet(uint32 timebase_id, uint32 start_time, uint32 interval_time) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TimeBaseSet), timebase_id); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TimeBaseSet), start_time); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TimeBaseSet), interval_time); + int32 status; status = UT_DEFAULT_IMPL(OS_TimeBaseSet); @@ -83,6 +91,8 @@ int32 OS_TimeBaseSet(uint32 timebase_id, uint32 start_time, uint32 interval_time *****************************************************************************/ int32 OS_TimeBaseDelete(uint32 timebase_id) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TimeBaseDelete), timebase_id); + int32 status; status = UT_DEFAULT_IMPL(OS_TimeBaseDelete); @@ -103,6 +113,9 @@ int32 OS_TimeBaseDelete(uint32 timebase_id) *****************************************************************************/ int32 OS_TimeBaseGetIdByName (uint32 *timebase_id, const char *timebase_name) { + UT_Stub_RegisterContext(UT_KEY(OS_TimeBaseGetIdByName), timebase_id); + UT_Stub_RegisterContext(UT_KEY(OS_TimeBaseGetIdByName), timebase_name); + int32 status; status = UT_DEFAULT_IMPL(OS_TimeBaseGetIdByName); @@ -125,6 +138,9 @@ int32 OS_TimeBaseGetIdByName (uint32 *timebase_id, const char *timebase_name) *****************************************************************************/ int32 OS_TimeBaseGetInfo (uint32 timebase_id, OS_timebase_prop_t *timebase_prop) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TimeBaseGetInfo), timebase_id); + UT_Stub_RegisterContext(UT_KEY(OS_TimeBaseGetInfo), timebase_prop); + int32 status; status = UT_DEFAULT_IMPL(OS_TimeBaseGetInfo); @@ -149,6 +165,9 @@ int32 OS_TimeBaseGetInfo (uint32 timebase_id, OS_timebase_prop_t *timebase_prop) *****************************************************************************/ int32 OS_TimeBaseGetFreeRun (uint32 timebase_id, uint32 *freerun_val) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TimeBaseGetFreeRun), timebase_id); + UT_Stub_RegisterContext(UT_KEY(OS_TimeBaseGetFreeRun), freerun_val); + int32 status; status = UT_DEFAULT_IMPL(OS_TimeBaseGetFreeRun); @@ -204,5 +223,7 @@ int32 OS_Tick2Micros (void) *****************************************************************************/ int32 OS_Milli2Ticks(uint32 milli_seconds) { + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_Milli2Ticks), milli_seconds); + return UT_DEFAULT_IMPL_RC(OS_Milli2Ticks,100); } diff --git a/ut_assert/README.txt b/ut_assert/README.txt index 24dd38375..4fde6aa99 100644 --- a/ut_assert/README.txt +++ b/ut_assert/README.txt @@ -1,4 +1,4 @@ -core Flgith System (cFS) Unit Test (UT) Assert Library +core Flight System (cFS) Unit Test (UT) Assert Library Introduction diff --git a/ut_assert/inc/utstubs.h b/ut_assert/inc/utstubs.h index f2f552664..a5b141962 100644 --- a/ut_assert/inc/utstubs.h +++ b/ut_assert/inc/utstubs.h @@ -109,14 +109,13 @@ typedef int32 (*UT_VaHookFunc_t)(void *UserObj, int32 StubRetcode, uint32 CallCo **************************************************************/ /** - * Reset the Unit test framework for only the given function + * Reset the Unit test framework for a given function, or all functions * * Any return code or data buffer records for the given function key - * are cleared. The special FuncKey value of "0" matches all entries. + * are cleared. * * \param FuncKey The stub function to reset. If zero, all functions - * are reset. This is basically equivalent to UT_Init() without - * changing the Subsys string. + * are reset. */ void UT_ResetState(UT_EntryKey_t FuncKey); @@ -126,7 +125,7 @@ void UT_ResetState(UT_EntryKey_t FuncKey); * A deferred ("count down") return code for the stub function will be * installed. The specific implementation depends on the stub function, * but typically it will return its default code until it is called "Count" - * times, after which it will return the given Retcode, then return to + * times, where it will return the given Retcode, then return to * its default return code again. * * Multiple deferred entries for a single function are allowed. These @@ -152,7 +151,7 @@ void UT_SetDeferredRetcode(UT_EntryKey_t FuncKey, int32 Count, int32 Retcode); * Multiple buffer entries for a single function are allowed. These * will be used in the order they were added. * - * It is recommended to call UT_ResetState() at the beginning of the test case + * It is recommended to call UT_ResetState(0) at the beginning of the test case * to ensure that any old entries for the stub functions are cleared out. * * \param FuncKey The stub function to add the data buffer to. diff --git a/ut_assert/src/utassert.c b/ut_assert/src/utassert.c index fe177de0d..954ceaf1f 100644 --- a/ut_assert/src/utassert.c +++ b/ut_assert/src/utassert.c @@ -42,7 +42,7 @@ UtAssert_CaseType_t DefaultContext = UTASSERT_CASETYPE_FAILURE; UtAssert_TestCounter_t UT_SegmentCounters = { 0 }; UtAssert_TestCounter_t UT_TotalCounters = { 0 }; -static char CurrentSegment[128]; +static char CurrentSegment[64]; /* * Function Definitions @@ -76,7 +76,7 @@ void UtAssert_DoReport(const char *File, uint32 LineNum, uint32 SegmentNum, uint void UtAssert_DoTestSegmentReport(const char *SegmentName, const UtAssert_TestCounter_t *TestCounters) { - char ReportBuffer[128]; + char ReportBuffer[144]; snprintf(ReportBuffer, sizeof(ReportBuffer), "%02u %-20s TOTAL::%-4u PASS::%-4u FAIL::%-4u MIR::%-4u TSF::%-4u N/A::%-4u\n",