Skip to content

Commit

Permalink
Fix nasa#321: Update OS_VxWorks_SigWait test case
Browse files Browse the repository at this point in the history
This is related to the change for nasa#271, where the return value
of this function depends on the configured timer interval.  The
coverage test case for this was not updated in the original change.
  • Loading branch information
jphickey committed Dec 18, 2019
1 parent 155e9eb commit 30e53e2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/unit-test-coverage/ut-stubs/src/posix-time-stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ int OCS_timer_settime (OCS_timer_t timerid, int flags, const struct OCS_itimersp
int32 Status;

Status = UT_DEFAULT_IMPL(OCS_timer_settime);
if (Status == 0)
{
UT_Stub_CopyFromLocal(UT_KEY(OCS_timer_settime), value, sizeof(*value));
}

return Status;
}
Expand Down
12 changes: 9 additions & 3 deletions src/unit-test-coverage/vxworks/src/coveragetest-ostimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,18 +150,24 @@ void Test_OS_VxWorks_SigWait(void)
* (invocation of static function through a wrapper)
*/
int signo = OCS_SIGRTMIN;
struct OCS_itimerspec config_value;

OS_global_timebase_table[0].active_id = 0x12345;
OS_timebase_table[0].nominal_start_time = 8888;
OS_timebase_table[0].nominal_interval_time = 5555;

memset(&config_value, 0, sizeof(config_value));
UT_SetDataBuffer(UT_KEY(OCS_timer_settime),&config_value,sizeof(config_value),false);
UT_SetDataBuffer(UT_KEY(OCS_timer_gettime),&config_value,sizeof(config_value),false);
Osapi_Internal_Setup(0, signo, true);
OS_TimeBaseSet_Impl(0, 1111111, 2222222);

UT_SetDataBuffer(UT_KEY(OCS_sigwait),&signo,sizeof(signo),false);
OSAPI_TEST_FUNCTION_RC(Osapi_Internal_CallSigWaitFunc(0), 8888);
OSAPI_TEST_FUNCTION_RC(Osapi_Internal_CallSigWaitFunc(0), 1111111);
UT_SetDataBuffer(UT_KEY(OCS_sigwait),&signo,sizeof(signo),false);
OSAPI_TEST_FUNCTION_RC(Osapi_Internal_CallSigWaitFunc(0), 5555);
OSAPI_TEST_FUNCTION_RC(Osapi_Internal_CallSigWaitFunc(0), 2222222);
UT_SetDataBuffer(UT_KEY(OCS_sigwait),&signo,sizeof(signo),false);
OSAPI_TEST_FUNCTION_RC(Osapi_Internal_CallSigWaitFunc(0), 5555);
OSAPI_TEST_FUNCTION_RC(Osapi_Internal_CallSigWaitFunc(0), 2222222);

Osapi_Internal_Setup(0, 0, false);
OS_global_timebase_table[0].active_id = 0;
Expand Down

0 comments on commit 30e53e2

Please sign in to comment.