Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration Candidate 2020-06-10 #511

Merged
merged 8 commits into from
Jun 17, 2020
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ This distribution contains:

## Version History


### Development Build: 5.0.20
- Add "non-zero" to the out variable description for OS_Create (and related) API's.
- Increases the buffer for context info from 128 to 256 bytes and the total report buffer to 320 bytes.
- Add stub functions for `OS_TaskFindIdBySystemData()`, `OS_FileSysAddFixedMap()`,
`OS_TimedRead()`, `OS_TimedWrite()`, and `OS_FileSysAddFixedMap()`
- See <https://github.com/nasa/osal/pull/511>

### Development Build: 5.0.19

- Rename BSPs that can be used on multiple platforms.
Expand Down
10 changes: 5 additions & 5 deletions src/os/inc/osapi-os-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ void OS_ForEachObjectOfType (uint32 objtype, uint32 creator_id, OS_ArgCallba
* Creates a task and passes back the id of the task created. Task names must be unique;
* if the name already exists this function fails. Names cannot be NULL.
*
* @param[out] task_id will be set to the ID of the newly-created resource
* @param[out] task_id will be set to the non-zero ID of the newly-created resource
* @param[in] task_name the name of the new resource to create
* @param[in] function_pointer the entry point of the new task
* @param[in] stack_pointer pointer to the stack for the task, or NULL
Expand Down Expand Up @@ -566,7 +566,7 @@ int32 OS_TaskFindIdBySystemData(uint32 *task_id, const void *sysdata, size_t sys
* function fails. Names cannot be NULL.
*
*
* @param[out] queue_id will be set to the ID of the newly-created resource
* @param[out] queue_id will be set to the non-zero ID of the newly-created resource
* @param[in] queue_name the name of the new resource to create
* @param[in] queue_depth the maximum depth of the queue
* @param[in] data_size the size of each entry in the queue
Expand Down Expand Up @@ -694,7 +694,7 @@ int32 OS_QueueGetInfo (uint32 queue_id, OS_queue_prop_t *queue_prop);
* sem_initial_value and name specified by sem_name. sem_id will be
* returned to the caller
*
* @param[out] sem_id will be set to the ID of the newly-created resource
* @param[out] sem_id will be set to the non-zero ID of the newly-created resource
* @param[in] sem_name the name of the new resource to create
* @param[in] sem_initial_value the initial value of the binary semaphore
* @param[in] options Reserved for future use, should be passed as 0.
Expand Down Expand Up @@ -846,7 +846,7 @@ int32 OS_BinSemGetInfo (uint32 sem_id, OS_bin_sem_prop_t *bin_prop);
* sem_initial_value and name specified by sem_name. sem_id will be
* returned to the caller
*
* @param[out] sem_id will be set to the ID of the newly-created resource
* @param[out] sem_id will be set to the non-zero ID of the newly-created resource
* @param[in] sem_name the name of the new resource to create
* @param[in] sem_initial_value the initial value of the counting semaphore
* @param[in] options Reserved for future use, should be passed as 0.
Expand Down Expand Up @@ -978,7 +978,7 @@ int32 OS_CountSemGetInfo (uint32 sem_id, OS_count_sem_prop_t *count_prop
*
* Mutex semaphores are always created in the unlocked (full) state.
*
* @param[out] sem_id will be set to the ID of the newly-created resource
* @param[out] sem_id will be set to the non-zero ID of the newly-created resource
* @param[in] sem_name the name of the new resource to create
* @param[in] options reserved for future use. Should be passed as 0.
*
Expand Down
4 changes: 2 additions & 2 deletions src/os/inc/osapi-os-filesys.h
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ os_dirent_t * OS_readdir (os_dirp_t directory);
*
* Prepares for reading the files within a directory
*
* @param[out] dir_id The handle ID of the directory
* @param[out] dir_id The non-zero handle ID of the directory
* @param[in] path The directory to open
*
* @return Execution status, see @ref OSReturnCodes
Expand Down Expand Up @@ -765,7 +765,7 @@ int32 OS_rmdir (const char *path);
* This mimics the behavior of a "FS_BASED" entry in the VolumeTable but is registered
* at runtime. It is intended to be called by the PSP/BSP prior to starting the application.
*
* @param[out] filesys_id An OSAL ID reflecting the file system
* @param[out] filesys_id A non-zero OSAL ID reflecting the file system
* @param[in] phys_path The native system directory (an existing mount point)
* @param[in] virt_path The virtual mount point of this filesystem
*
Expand Down
2 changes: 1 addition & 1 deletion src/os/inc/osapi-os-loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ int32 OS_SymbolTableDump ( const char *filename, uint32 size_limit );
*
* Loads an object file into the running operating system
*
* @param[out] module_id OSAL ID corresponding to the loaded module
* @param[out] module_id Non-zero OSAL ID corresponding to the loaded module
* @param[in] module_name Name of module
* @param[in] filename File containing the object code to load
*
Expand Down
2 changes: 1 addition & 1 deletion src/os/inc/osapi-os-net.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ int32 OS_SocketAddrSetPort(OS_SockAddr_t *Addr, uint16 PortNum);
*
* A new, unconnected and unbound socket is allocated of the given domain and type.
*
* @param[out] sock_id Buffer to hold the OSAL ID
* @param[out] sock_id Buffer to hold the non-zero OSAL ID
* @param[in] Domain The domain / address family of the socket (INET or INET6, etc)
* @param[in] Type The type of the socket (STREAM or DATAGRAM)
*
Expand Down
6 changes: 3 additions & 3 deletions src/os/inc/osapi-os-timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ typedef struct
* be configured to support at least (OS_MAX_TASKS + OS_MAX_TIMEBASES) threads,
* to account for the helper threads associated with time base objects.
*
* @param[out] timebase_id An identifier corresponding to the timebase resource
* @param[out] timebase_id A non-zero ID corresponding to the timebase resource
* @param[in] timebase_name The name of the time base
* @param[in] external_sync A synchronization function for BSP hardware-based timer ticks
*
Expand Down Expand Up @@ -204,7 +204,7 @@ int32 OS_TimeBaseGetFreeRun (uint32 timebase_id, uint32 *freerun_val);
* interrupt service routine. Calls that cause the code to block or require
* an application context (like sending events) are generally not supported.
*
* @param[out] timer_id The resource ID of the timer object
* @param[out] timer_id The non-zero resource ID of the timer object
* @param[in] timer_name Name of the timer object
* @param[out] clock_accuracy Expected precision of the timer, in microseconds. This
* is the underlying tick value rounded to the nearest
Expand Down Expand Up @@ -245,7 +245,7 @@ int32 OS_TimerCreate (uint32 *timer_id, const char *timer_name, uint3
* interrupt service routine. Calls that cause the code to block or require
* an application context (like sending events) are generally not supported.
*
* @param[out] timer_id The resource ID of the timer object
* @param[out] timer_id The non-zero resource ID of the timer object
* @param[in] timer_name Name of the timer object
* @param[in] timebase_id The time base resource to use as a reference
* @param[in] callback_ptr Application-provided function to invoke
Expand Down
2 changes: 1 addition & 1 deletion src/os/inc/osapi-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#define OS_MAJOR_VERSION 5 /**< @brief Major version number */
#define OS_MINOR_VERSION 0 /**< @brief Minor version number */
#define OS_REVISION 19 /**< @brief Revision number */
#define OS_REVISION 20 /**< @brief Revision number */
#define OS_MISSION_REV 0 /**< @brief Mission revision */

/**
Expand Down
21 changes: 21 additions & 0 deletions src/ut-stubs/osapi-utstub-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,27 @@ int32 OS_write(uint32 filedes, const void *buffer, uint32 nbytes)
return UT_GenericWriteStub(__func__,UT_KEY(OS_write),buffer,nbytes);
}

/*****************************************************************************
*
* Stub function for OS_TimedRead()
*
*****************************************************************************/
int32 OS_TimedRead(uint32 filedes, void *buffer, uint32 nbytes, int32 timeout)
{
return UT_GenericReadStub(__func__,UT_KEY(OS_TimedRead),buffer,nbytes);
}

/*****************************************************************************
*
* Stub function for OS_TimedWrite()
*
*****************************************************************************/
int32 OS_TimedWrite(uint32 filedes, const void *buffer, uint32 nbytes, int32 timeout)
{
return UT_GenericWriteStub(__func__,UT_KEY(OS_TimedWrite),buffer,nbytes);
}


/*****************************************************************************
*
* Stub function for OS_chmod()
Expand Down
27 changes: 27 additions & 0 deletions src/ut-stubs/osapi-utstub-filesys.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,33 @@
UT_DEFAULT_STUB(OS_FileSysAPI_Init,(void))


/*****************************************************************************
*
* Stub function for OS_FileSysAddFixedMap()
*
*****************************************************************************/
int32 OS_FileSysAddFixedMap(uint32 *filesys_id, const char *phys_path,
const char *virt_path)
{
int32 status;

status = UT_DEFAULT_IMPL(OS_FileSysAddFixedMap);

if (status == OS_SUCCESS)
{
*filesys_id = UT_AllocStubObjId(UT_OBJTYPE_FILESYS);
}
else
{
*filesys_id = 0xDEADBEEFU;
}



return status;
}


/*****************************************************************************
*
* Stub function for OS_mkfs()
Expand Down
11 changes: 11 additions & 0 deletions src/ut-stubs/osapi-utstub-printf.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ int32 OS_ConsoleAPI_Init(void)
return UT_DEFAULT_IMPL(OS_ConsoleAPI_Init);
}

/*****************************************************************************
*
* Stub function for OS_ConsoleWrite()
*
*****************************************************************************/
int32 OS_ConsoleWrite(uint32 console_id, const char *Str)
{
UT_Stub_RegisterContext(UT_KEY(OS_ConsoleWrite), Str);
return UT_DEFAULT_IMPL(OS_ConsoleWrite);
}

/*****************************************************************************
*
* Stub function for OS_printf()
Expand Down
29 changes: 28 additions & 1 deletion src/ut-stubs/osapi-utstub-task.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ int32 OS_TaskGetInfo(uint32 task_id, OS_task_prop_t *task_prop)
status = UT_DEFAULT_IMPL(OS_TaskGetInfo);

if (status == OS_SUCCESS &&
UT_Stub_CopyToLocal(UT_KEY(OS_MutSemGetInfo), task_prop, sizeof(*task_prop)) < sizeof(*task_prop))
UT_Stub_CopyToLocal(UT_KEY(OS_TaskGetInfo), task_prop, sizeof(*task_prop)) < sizeof(*task_prop))
{
task_prop->creator = 1;
UT_FIXUP_ID(task_prop->creator, UT_OBJTYPE_TASK);
Expand All @@ -273,6 +273,33 @@ int32 OS_TaskGetInfo(uint32 task_id, OS_task_prop_t *task_prop)
return status;
}

/*****************************************************************************/
/**
** \brief OS_TaskGetInfo stub function
**
** \par Description
** This function is used to mimic the response of the OS API function
** OS_TaskFindIdBySystemData.
**
** \returns
** The return value instructed by the test case setup
**
******************************************************************************/
int32 OS_TaskFindIdBySystemData(uint32 *task_id, const void *sysdata, size_t sysdata_size)
{
int32 status;

status = UT_DEFAULT_IMPL(OS_TaskFindIdBySystemData);

if (status == OS_SUCCESS &&
UT_Stub_CopyToLocal(UT_KEY(OS_TaskFindIdBySystemData), task_id, sizeof(*task_id)) < sizeof(*task_id))
{
*task_id = 1;
UT_FIXUP_ID(*task_id, UT_OBJTYPE_TASK);
}

return status;
}

/*****************************************************************************
*
Expand Down
2 changes: 1 addition & 1 deletion ut_assert/src/utassert.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ bool UtAssert(bool Expression, const char *Description, const char *File, uint32
bool UtAssertEx(bool Expression, UtAssert_CaseType_t CaseType, const char *File, uint32 Line, const char *MessageFormat, ...)
{
va_list va;
char FinalMessage[128];
char FinalMessage[256];

++UT_SegmentCounters.TotalTestCases;

Expand Down