Skip to content

Commit

Permalink
Merge pull request #1098 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
osal Integration candidate: 2021-06-29
  • Loading branch information
astrogeco authored Jul 7, 2021
2 parents 64a6b31 + 5e9c561 commit 5e8f40b
Show file tree
Hide file tree
Showing 12 changed files with 97 additions and 42 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ The autogenerated OSAL user's guide can be viewed at <https://github.com/nasa/cF
## Version History


### Development Build: v5.1.0-rc1+dev564

- Add range to OS_TaskDelay checks
- Return `OS_OBJECT_ID_UNDEFINED` for root task ID on RTEMS
- Increase timeout in network-api-test
- Avoid task delete during UtPrintf
- Increase UT symbol dump size limit
- Do not register RTOS timer for external sync
- Add osal# prefix to Network API group
- Increase timeout in network-api-test
- See <https://github.com/nasa/osal/pull/1098> and <https://github.com/nasa/cfs/pull/287>

### Development Build: v5.1.0-rc1+dev548

- implement missing parameter/retcode test permutations
Expand Down
4 changes: 2 additions & 2 deletions docs/src/osalmain.dox
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@
<UL>
<LI> APIs
<UL>
<LI> \ref OSALAPINetwork
<LI> \ref OSAPINetwork
<LI> \ref OSAPISocketAddr
<LI> \ref OSALAPISocket
<LI> \ref OSAPISocket
</UL>
<LI> \subpage osapi-network.h "Network Reference"
<LI> \subpage osapi-sockets.h "Socket Reference"
Expand Down
4 changes: 2 additions & 2 deletions src/bsp/generic-vxworks/src/bsp_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ int OS_BSPMain(void)
/*
* Initialize the low level access sem
*/
OS_BSP_GenericVxWorksGlobal.AccessMutex =
semMInitialize(OS_BSP_GenericVxWorksGlobal.AccessMutexMem, SEM_Q_PRIORITY | SEM_INVERSION_SAFE);
OS_BSP_GenericVxWorksGlobal.AccessMutex = semMInitialize(OS_BSP_GenericVxWorksGlobal.AccessMutexMem,
SEM_Q_PRIORITY | SEM_INVERSION_SAFE | SEM_DELETE_SAFE);

if (OS_BSP_GenericVxWorksGlobal.AccessMutex == (SEM_ID)0)
{
Expand Down
2 changes: 1 addition & 1 deletion src/os/inc/osapi-network.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "common_types.h"

/**
* @defgroup OSALAPINetwork Network ID APIs
* @defgroup OSAPINetwork OSAL Network ID APIs
*
* Provides some basic methods to query a network host name and ID
*
Expand Down
2 changes: 1 addition & 1 deletion src/os/inc/osapi-sockets.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ int32 OS_SocketAddrSetPort(OS_SockAddr_t *Addr, uint16 PortNum);
/**@}*/

/**
* @defgroup OSALAPISocket OSAL Socket Management APIs
* @defgroup OSAPISocket OSAL Socket Management APIs
*
* These functions are loosely related to the BSD Sockets API but made to be
* more consistent with other OSAL API functions. That is, they operate on
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 @@ -36,7 +36,7 @@
/*
* Development Build Macro Definitions
*/
#define OS_BUILD_NUMBER 548
#define OS_BUILD_NUMBER 564
#define OS_BUILD_BASELINE "v5.1.0-rc1"

/*
Expand Down
11 changes: 10 additions & 1 deletion src/os/rtems/src/os-impl-tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,20 @@ osal_id_t OS_TaskGetId_Impl(void)

task_self = rtems_task_self();
/* When the task was created the OSAL ID was used as the "classic name",
* which gives us an easy way to map it back again */
* which gives us an easy way to map it back again. However, if this
* API is invoked from a non-OSAL task (i.e. the "root" task) then it is
* possible that rtems_object_get_classic_name() succeeds but the result
* is not actually an OSAL task ID. */
status = rtems_object_get_classic_name(task_self, &self_name);
if (status == RTEMS_SUCCESSFUL)
{
global_task_id = OS_ObjectIdFromInteger(self_name);

if (OS_ObjectIdToType_Impl(global_task_id) != OS_OBJECT_TYPE_OS_TASK)
{
/* not an OSAL task */
global_task_id = OS_OBJECT_ID_UNDEFINED;
}
}
else
{
Expand Down
43 changes: 26 additions & 17 deletions src/os/vxworks/src/os-impl-timebase.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,22 +225,31 @@ void OS_VxWorks_RegisterTimer(osal_id_t obj_id)
{
local = OS_OBJECT_TABLE_GET(OS_impl_timebase_table, token);

memset(&evp, 0, sizeof(evp));
evp.sigev_notify = SIGEV_SIGNAL;
evp.sigev_signo = local->assigned_signal;
if (local->assigned_signal == 0)
{
/* nothing to register in RTOS */
status = 0;
}
else
{
memset(&evp, 0, sizeof(evp));
evp.sigev_notify = SIGEV_SIGNAL;
evp.sigev_signo = local->assigned_signal;

/*
** Create the timer
**
** The result is not returned from this function, because
** this is a different task context from the original creator.
**
** The registration status is returned through the OS_impl_timebase_table entry,
** which is checked by the creator before returning.
**
** If set to ERROR, then this task will be subsequently deleted.
*/
status = timer_create(OS_PREFERRED_CLOCK, &evp, &local->host_timerid);
}

/*
** Create the timer
**
** The result is not returned from this function, because
** this is a different task context from the original creator.
**
** The registration status is returned through the OS_impl_timebase_table entry,
** which is checked by the creator before returning.
**
** If set to ERROR, then this task will be subsequently deleted.
*/
status = timer_create(OS_PREFERRED_CLOCK, &evp, &local->host_timerid);
if (status < 0)
{
OS_DEBUG("timer_create() failed: errno=%d\n", errno);
Expand Down Expand Up @@ -529,8 +538,8 @@ int32 OS_TimeBaseSet_Impl(const OS_object_token_t *token, uint32 start_time, uin
/* There is only something to do here if we are generating a simulated tick */
if (local->assigned_signal <= 0)
{
/* An externally synced timebase does not need to be set */
return_code = OS_ERR_NOT_IMPLEMENTED;
/* An externally synced timebase does not need to be set (noop) */
return_code = OS_SUCCESS;
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/tests/network-api-test/network-api-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* where the console is on a slow serial port. Therefore this timeout must
* not be too short.
*/
#define UT_TIMEOUT 1000
#define UT_TIMEOUT 4000

/*
* Variations of client->server connections to create.
Expand Down
29 changes: 20 additions & 9 deletions src/unit-test-coverage/vxworks/src/coveragetest-timebase.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,19 +156,29 @@ void Test_OS_TimeBaseCreate_Impl(void)
/*
* Check outputs of OS_VxWorks_RegisterTimer() function.
*/
UT_TimeBaseTest_ClearTimeBaseRegState(UT_INDEX_1);
UT_TimeBaseTest_CallRegisterTimer(OS_OBJECT_ID_UNDEFINED);
UtAssert_True(UT_TimeBaseTest_CheckTimeBaseRegisteredState(UT_INDEX_0), "timer successfully registered");

UT_TimeBaseTest_ClearTimeBaseRegState(UT_INDEX_1);
UT_TimeBaseTest_Setup(UT_INDEX_0, 10, false);
UT_TimeBaseTest_ClearTimeBaseRegState(UT_INDEX_0);
UT_TimeBaseTest_CallRegisterTimer(token.obj_id);
UtAssert_True(UT_TimeBaseTest_CheckTimeBaseRegisteredState(UT_INDEX_0),
"timer successfully registered, with signal");

UT_TimeBaseTest_Setup(UT_INDEX_0, 10, false);
UT_TimeBaseTest_ClearTimeBaseRegState(UT_INDEX_0);
UT_SetDefaultReturnValue(UT_KEY(OCS_timer_create), -1);
UT_TimeBaseTest_CallRegisterTimer(OS_OBJECT_ID_UNDEFINED);
UT_TimeBaseTest_CallRegisterTimer(token.obj_id);
UtAssert_True(UT_TimeBaseTest_CheckTimeBaseErrorState(UT_INDEX_0), "timer registration failure state");

UT_TimeBaseTest_ClearTimeBaseRegState(UT_INDEX_1);
UT_TimeBaseTest_Setup(UT_INDEX_0, 10, false);
UT_TimeBaseTest_ClearTimeBaseRegState(UT_INDEX_0);
UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), OS_ERROR);
UT_TimeBaseTest_CallRegisterTimer(OS_OBJECT_ID_UNDEFINED);
UT_TimeBaseTest_CallRegisterTimer(token.obj_id);
UtAssert_True(!UT_TimeBaseTest_CheckTimeBaseRegisteredState(UT_INDEX_0), "timer registration bad ID");
UT_ResetState(UT_KEY(OS_ObjectIdGetById));

UT_TimeBaseTest_Setup(UT_INDEX_0, 0, false);
UT_TimeBaseTest_ClearTimeBaseRegState(UT_INDEX_0);
UT_TimeBaseTest_CallRegisterTimer(token.obj_id);
UtAssert_True(UT_TimeBaseTest_CheckTimeBaseRegisteredState(UT_INDEX_0), "timer successfully registered, no signal");
}

void Test_OS_VxWorks_SigWait(void)
Expand Down Expand Up @@ -217,7 +227,8 @@ void Test_OS_TimeBaseSet_Impl(void)
*/
OS_object_token_t token = UT_TOKEN_0;

OSAPI_TEST_FUNCTION_RC(OS_TimeBaseSet_Impl(&token, 1, 1), OS_ERR_NOT_IMPLEMENTED);
UT_TimeBaseTest_Setup(UT_INDEX_0, 0, false);
OSAPI_TEST_FUNCTION_RC(OS_TimeBaseSet_Impl(&token, 1, 1), OS_SUCCESS);

UT_TimeBaseTest_Setup(UT_INDEX_0, OCS_SIGRTMIN, false);
OSAPI_TEST_FUNCTION_RC(OS_TimeBaseSet_Impl(&token, 1, 1), OS_SUCCESS);
Expand Down
16 changes: 11 additions & 5 deletions src/unit-tests/oscore-test/ut_oscore_task_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ void UT_os_task_create_test()
{
break;
}
}

/* Delay to let child tasks run */
OS_TaskDelay(500);
/* Delay to let child task run */
OS_TaskDelay(200);
}

/* Reset test environment */
for (i = 0; i < OS_MAX_TASKS; i++)
Expand Down Expand Up @@ -398,14 +398,20 @@ void UT_os_task_delay_test()
OS_time_t after_time;
int64 elapsed;

/*
* Note, if running under a VM/hypervisor, the real time clock may not
* be very precise, depending on its implementation. Therefore the allowed
* ranges are slightly extended here.
*/

/*-----------------------------------------------------*/
/* Nominal, 100ms delay */
UT_SETUP(OS_GetLocalTime(&before_time));
UT_NOMINAL(OS_TaskDelay(100));
UT_SETUP(OS_GetLocalTime(&after_time));

elapsed = OS_TimeGetTotalMilliseconds(OS_TimeSubtract(after_time, before_time));
UtAssert_True(elapsed >= 100, "Elapsed time %ld msec, expected 100", (long)elapsed);
UtAssert_True(elapsed >= 95, "Elapsed time %ld msec, expected 100", (long)elapsed);

/*-----------------------------------------------------*/
/* Nominal, 250ms delay */
Expand All @@ -414,7 +420,7 @@ void UT_os_task_delay_test()
UT_SETUP(OS_GetLocalTime(&after_time));

elapsed = OS_TimeGetTotalMilliseconds(OS_TimeSubtract(after_time, before_time));
UtAssert_True(elapsed >= 250, "Elapsed time %ld msec, expected 250", (long)elapsed);
UtAssert_True(elapsed >= 245, "Elapsed time %ld msec, expected 250", (long)elapsed);
}

/*--------------------------------------------------------------------------------*
Expand Down
12 changes: 10 additions & 2 deletions src/unit-tests/osloader-test/ut_osloader_symtable_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@
** Macros
**--------------------------------------------------------------------------------*/

/**
* The size limit to pass for OS_SymbolTableDump nominal test
*
* This must be large enough to actually accomodate all of the symbols
* in the target system.
*/
#define UT_SYMTABLE_SIZE_LIMIT 1048576

/*--------------------------------------------------------------------------------*
** Data types
**--------------------------------------------------------------------------------*/
Expand Down Expand Up @@ -188,9 +196,9 @@ void UT_os_symbol_table_dump_test()
/*-----------------------------------------------------*/
/* #3 Nominal */

if (UT_NOMINAL_OR_NOTIMPL(OS_SymbolTableDump(UT_OS_GENERIC_MODULE_DIR "SymbolFile.dat", 32000)))
if (UT_NOMINAL_OR_NOTIMPL(OS_SymbolTableDump(UT_OS_GENERIC_MODULE_DIR "SymbolReal.dat", UT_SYMTABLE_SIZE_LIMIT)))
{
UT_RETVAL(OS_SymbolTableDump(UT_OS_GENERIC_MODULE_DIR "SymbolFile.dat", 0), OS_ERR_OUTPUT_TOO_LARGE);
UT_RETVAL(OS_SymbolTableDump(UT_OS_GENERIC_MODULE_DIR "SymbolZero.dat", 0), OS_ERR_OUTPUT_TOO_LARGE);
}
}

Expand Down

0 comments on commit 5e8f40b

Please sign in to comment.