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 20191030 #281

Merged
merged 10 commits into from
Nov 7, 2019
Prev Previous commit
Next Next commit
Update #230 to correlate with updated timer code
The timer code for VxWorks was fixed in bug #271 and the
coverage code test needs a corresponding update to cover
the code change.

This is kept as a separate update commit as neither
changeset is merged to master yet.
  • Loading branch information
jphickey committed Oct 25, 2019
commit 5cdd4035e5cd1e95984ad542d21d80ed960904ee
1 change: 1 addition & 0 deletions src/unit-test-coverage/ut-stubs/inc/overrides/time.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ extern int OCS_clock_nanosleep (OCS_clockid_t clock_id, int flags, const struct
extern int OCS_clock_settime (OCS_clockid_t clock_id, const struct OCS_timespec * tp);
extern int OCS_timer_create (OCS_clockid_t clock_id, struct OCS_sigevent * evp, OCS_timer_t * timerid);
extern int OCS_timer_delete (OCS_timer_t timerid) ;
extern int OCS_timer_gettime (OCS_timer_t timerid, struct OCS_itimerspec * value);
extern int OCS_timer_settime (OCS_timer_t timerid, int flags, const struct OCS_itimerspec * value, struct OCS_itimerspec * ovalue);

extern int OCS_timer_connect(OCS_timer_t, OCS_VOIDFUNCPTR, int);
Expand Down
14 changes: 14 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 @@ -75,3 +75,17 @@ int OCS_timer_settime (OCS_timer_t timerid, int flags, const struct OCS_itimersp
return Status;
}

int OCS_timer_gettime (OCS_timer_t timerid, struct OCS_itimerspec * value)
{
int32 Status;

Status = UT_DEFAULT_IMPL(OCS_timer_gettime);

if (Status == 0 && UT_Stub_CopyToLocal(UT_KEY(OCS_timer_gettime), value, sizeof(*value)) < sizeof(*value))
{
memset(value, 0, sizeof(*value));
}

return Status;
}

2 changes: 1 addition & 1 deletion src/unit-test-coverage/vxworks/modules/inc/ut-ostimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
int32 OS_VxWorks_TimeBaseAPI_Impl_Init(void);

void Osapi_Internal_ResetState(void);
void Osapi_Internal_Setup(uint32 local_id, int signo);
void Osapi_Internal_Setup(uint32 local_id, int signo, bool reset_flag);

/**
* Invokes OS_VxWorks_SigWait() with the given arguments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@
#define timer_connect OCS_timer_connect
#define timer_create OCS_timer_create
#define timer_delete OCS_timer_delete
#define timer_gettime OCS_timer_gettime
#define timer_settime OCS_timer_settime
#define timer_t OCS_timer_t
#define timespec OCS_timespec
Expand Down
3 changes: 2 additions & 1 deletion src/unit-test-coverage/vxworks/modules/src/ut-ostimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,14 @@ void Osapi_Internal_ResetState(void)
memset(OS_stub_timecb_table, 0, sizeof(OS_stub_timecb_table));
}

void Osapi_Internal_Setup(uint32 local_id, int signo)
void Osapi_Internal_Setup(uint32 local_id, int signo, bool reset_flag)
{
static int FAKE_TASK;
static int FAKE_SEM;

OS_impl_timebase_table[local_id].assigned_signal = signo;
OS_impl_timebase_table[local_id].handler_task = &FAKE_TASK;
OS_impl_timebase_table[local_id].handler_mutex = &FAKE_SEM;
OS_impl_timebase_table[local_id].reset_flag = reset_flag;
}

15 changes: 10 additions & 5 deletions src/unit-test-coverage/vxworks/src/coveragetest-ostimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void Test_OS_TimeBaseCreate_Impl(void)
* and therefore cause future calls to skip this block.
*/
OS_global_timebase_table[1].active_id = 0x1;
Osapi_Internal_Setup(1,OCS_SIGRTMIN);
Osapi_Internal_Setup(1,OCS_SIGRTMIN, false);
UT_SetForceFail(UT_KEY(OCS_sigismember), true);
OSAPI_TEST_FUNCTION_RC(OS_TimeBaseCreate_Impl(0), OS_TIMER_ERR_UNAVAILABLE);
UT_ResetState(UT_KEY(OCS_sigismember));
Expand Down Expand Up @@ -152,13 +152,18 @@ void Test_OS_VxWorks_SigWait(void)
int signo = OCS_SIGRTMIN;

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

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

Osapi_Internal_Setup(0, 0);
Osapi_Internal_Setup(0, 0, false);
OS_global_timebase_table[0].active_id = 0;
OS_timebase_table[0].nominal_interval_time = 0;
}
Expand All @@ -170,7 +175,7 @@ void Test_OS_TimeBaseSet_Impl(void)
*/
OSAPI_TEST_FUNCTION_RC(OS_TimeBaseSet_Impl(0,1,1), OS_ERR_NOT_IMPLEMENTED);

Osapi_Internal_Setup(0, OCS_SIGRTMIN);
Osapi_Internal_Setup(0, OCS_SIGRTMIN, false);
OSAPI_TEST_FUNCTION_RC(OS_TimeBaseSet_Impl(0,1,1), OS_SUCCESS);

UT_SetForceFail(UT_KEY(OCS_timer_settime), -1);
Expand All @@ -182,7 +187,7 @@ void Test_OS_TimeBaseDelete_Impl(void)
/* Test Case For:
* int32 OS_TimeBaseDelete_Impl(uint32 timer_id)
*/
Osapi_Internal_Setup(0, OCS_SIGRTMIN);
Osapi_Internal_Setup(0, OCS_SIGRTMIN, false);
OSAPI_TEST_FUNCTION_RC(OS_TimeBaseDelete_Impl(0), OS_SUCCESS);
}

Expand Down