From 9a7f5898d24c29f92fd897596b63e77231af798d Mon Sep 17 00:00:00 2001 From: Avi Weiss Date: Sat, 28 Sep 2024 18:45:32 +0200 Subject: [PATCH] Fix #2439, Update tests for external time source --- modules/time/ut-coverage/time_UT.c | 214 ++++++++++++++--------------- 1 file changed, 107 insertions(+), 107 deletions(-) diff --git a/modules/time/ut-coverage/time_UT.c b/modules/time/ut-coverage/time_UT.c index 36b1a65ad..edb82cae7 100644 --- a/modules/time/ut-coverage/time_UT.c +++ b/modules/time/ut-coverage/time_UT.c @@ -147,7 +147,7 @@ void OS_SelectTone(int16 Signal) {} int32 UT_TimeRefUpdateHook(void *UserObj, int32 StubRetcode, uint32 CallCount, const UT_StubContext_t *Context) { volatile CFE_TIME_ReferenceState_t *RefState; - uint32 * UpdateCount = UserObj; + uint32 *UpdateCount = UserObj; uint32 i; /* @@ -1024,11 +1024,11 @@ void Test_External(void) * state not set */ UT_InitData(); - CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; - CFE_TIME_Global.ClockSetState = CFE_TIME_SetState_NOT_SET; - CFE_TIME_Global.ExternalCount = 0; - settime.Seconds = 0; - settime.Subseconds = 0; + CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; + CFE_TIME_Global.ReferenceState[0].ClockSetState = CFE_TIME_SetState_NOT_SET; + CFE_TIME_Global.ExternalCount = 0; + settime.Seconds = 0; + settime.Subseconds = 0; CFE_TIME_ExternalMET(settime); UtAssert_UINT32_EQ(CFE_TIME_Global.ExternalCount, 1); @@ -1036,21 +1036,21 @@ void Test_External(void) * state set and time less than the minimum */ UT_InitData(); - CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; - CFE_TIME_Global.ClockSetState = CFE_TIME_SetState_WAS_SET; - settime.Seconds = 0; - settime.Subseconds = 0; - CFE_TIME_Global.InternalCount = 0; - CFE_TIME_Global.AtToneMET.Seconds = 10; - CFE_TIME_Global.AtToneMET.Subseconds = 0; - CFE_TIME_Global.AtToneDelay.Seconds = 0; - CFE_TIME_Global.AtToneDelay.Subseconds = 0; - CFE_TIME_Global.AtToneLatch.Seconds = 0; - CFE_TIME_Global.AtToneLatch.Subseconds = 0; - CFE_TIME_Global.MaxDelta.Seconds = 0; - CFE_TIME_Global.MaxDelta.Subseconds = 1; - CFE_TIME_Global.MaxLocalClock.Seconds = 0; - CFE_TIME_Global.MaxLocalClock.Subseconds = 0; + CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; + CFE_TIME_Global.ReferenceState[0].ClockSetState = CFE_TIME_SetState_WAS_SET; + settime.Seconds = 0; + settime.Subseconds = 0; + CFE_TIME_Global.InternalCount = 0; + CFE_TIME_Global.ReferenceState[0].AtToneMET.Subseconds = 0; + CFE_TIME_Global.ReferenceState[0].AtToneDelay.Seconds = 0; + CFE_TIME_Global.ReferenceState[0].AtToneMET.Seconds = 10; + CFE_TIME_Global.ReferenceState[0].AtToneDelay.Subseconds = 0; + CFE_TIME_Global.ReferenceState[0].AtToneLatch.Seconds = 0; + CFE_TIME_Global.ReferenceState[0].AtToneLatch.Subseconds = 0; + CFE_TIME_Global.MaxDelta.Seconds = 0; + CFE_TIME_Global.MaxDelta.Subseconds = 1; + CFE_TIME_Global.MaxLocalClock.Seconds = 0; + CFE_TIME_Global.MaxLocalClock.Subseconds = 0; UT_SetBSP_Time(0, 0); CFE_TIME_ExternalMET(settime); UtAssert_UINT32_EQ(CFE_TIME_Global.InternalCount, 1); @@ -1059,42 +1059,42 @@ void Test_External(void) * state set and time greater than the maximum */ UT_InitData(); - CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; - CFE_TIME_Global.ClockSetState = CFE_TIME_SetState_WAS_SET; - settime.Seconds = 20; - settime.Subseconds = 0; - CFE_TIME_Global.InternalCount = 0; - CFE_TIME_Global.AtToneMET.Seconds = 10; - CFE_TIME_Global.AtToneMET.Subseconds = 0; - CFE_TIME_Global.AtToneDelay.Seconds = 0; - CFE_TIME_Global.AtToneDelay.Subseconds = 0; - CFE_TIME_Global.AtToneLatch.Seconds = 0; - CFE_TIME_Global.AtToneLatch.Subseconds = 0; - CFE_TIME_Global.MaxDelta.Seconds = 0; - CFE_TIME_Global.MaxDelta.Subseconds = 1; - CFE_TIME_Global.MaxLocalClock.Seconds = 0; - CFE_TIME_Global.MaxLocalClock.Subseconds = 0; + CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; + CFE_TIME_Global.ReferenceState[0].ClockSetState = CFE_TIME_SetState_WAS_SET; + settime.Seconds = 20; + settime.Subseconds = 0; + CFE_TIME_Global.InternalCount = 0; + CFE_TIME_Global.ReferenceState[0].AtToneMET.Seconds = 10; + CFE_TIME_Global.ReferenceState[0].AtToneMET.Subseconds = 0; + CFE_TIME_Global.ReferenceState[0].AtToneDelay.Seconds = 0; + CFE_TIME_Global.ReferenceState[0].AtToneDelay.Subseconds = 0; + CFE_TIME_Global.ReferenceState[0].AtToneLatch.Seconds = 0; + CFE_TIME_Global.ReferenceState[0].AtToneLatch.Subseconds = 0; + CFE_TIME_Global.MaxDelta.Seconds = 0; + CFE_TIME_Global.MaxDelta.Subseconds = 1; + CFE_TIME_Global.MaxLocalClock.Seconds = 0; + CFE_TIME_Global.MaxLocalClock.Subseconds = 0; UT_SetBSP_Time(0, 0); CFE_TIME_ExternalMET(settime); UtAssert_UINT32_EQ(CFE_TIME_Global.InternalCount, 1); /* Test setting time data from MET (external source, state set) */ UT_InitData(); - CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; - CFE_TIME_Global.ClockSetState = CFE_TIME_SetState_NOT_SET; - settime.Seconds = 10; - settime.Subseconds = 0; - CFE_TIME_Global.ExternalCount = 0; - CFE_TIME_Global.AtToneMET.Seconds = 10; - CFE_TIME_Global.AtToneMET.Subseconds = 0; - CFE_TIME_Global.AtToneDelay.Seconds = 0; - CFE_TIME_Global.AtToneDelay.Subseconds = 0; - CFE_TIME_Global.AtToneLatch.Seconds = 0; - CFE_TIME_Global.AtToneLatch.Subseconds = 0; - CFE_TIME_Global.MaxDelta.Seconds = 0; - CFE_TIME_Global.MaxDelta.Subseconds = 1; - CFE_TIME_Global.MaxLocalClock.Seconds = 0; - CFE_TIME_Global.MaxLocalClock.Subseconds = 0; + CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; + CFE_TIME_Global.ReferenceState[0].ClockSetState = CFE_TIME_SetState_NOT_SET; + settime.Seconds = 10; + settime.Subseconds = 0; + CFE_TIME_Global.ExternalCount = 0; + CFE_TIME_Global.ReferenceState[0].AtToneMET.Seconds = 10; + CFE_TIME_Global.ReferenceState[0].AtToneMET.Subseconds = 0; + CFE_TIME_Global.ReferenceState[0].AtToneDelay.Seconds = 0; + CFE_TIME_Global.ReferenceState[0].AtToneDelay.Subseconds = 0; + CFE_TIME_Global.ReferenceState[0].AtToneLatch.Seconds = 0; + CFE_TIME_Global.ReferenceState[0].AtToneLatch.Subseconds = 0; + CFE_TIME_Global.MaxDelta.Seconds = 0; + CFE_TIME_Global.MaxDelta.Subseconds = 1; + CFE_TIME_Global.MaxLocalClock.Seconds = 0; + CFE_TIME_Global.MaxLocalClock.Subseconds = 0; UT_SetBSP_Time(0, 0); CFE_TIME_ExternalMET(settime); UtAssert_UINT32_EQ(CFE_TIME_Global.ExternalCount, 1); @@ -1118,11 +1118,11 @@ void Test_External(void) * state not set */ UT_InitData(); - CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; - CFE_TIME_Global.ClockSetState = CFE_TIME_SetState_NOT_SET; - CFE_TIME_Global.ExternalCount = 0; - settime.Seconds = 0; - settime.Subseconds = 0; + CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; + CFE_TIME_Global.ReferenceState[0].ClockSetState = CFE_TIME_SetState_NOT_SET; + CFE_TIME_Global.ExternalCount = 0; + settime.Seconds = 0; + settime.Subseconds = 0; CFE_TIME_ExternalGPS(settime, 0); UtAssert_UINT32_EQ(CFE_TIME_Global.ExternalCount, 1); @@ -1130,23 +1130,23 @@ void Test_External(void) * state set and time less than the minimum */ UT_InitData(); - CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; - CFE_TIME_Global.ClockSetState = CFE_TIME_SetState_WAS_SET; - settime.Seconds = 0; - settime.Subseconds = 0; - CFE_TIME_Global.InternalCount = 0; - CFE_TIME_Global.AtToneMET.Seconds = 0; - CFE_TIME_Global.AtToneMET.Subseconds = 0; - CFE_TIME_Global.AtToneSTCF.Seconds = 10; - CFE_TIME_Global.AtToneSTCF.Subseconds = 0; - CFE_TIME_Global.AtToneDelay.Seconds = 0; - CFE_TIME_Global.AtToneDelay.Subseconds = 0; - CFE_TIME_Global.AtToneLatch.Seconds = 0; - CFE_TIME_Global.AtToneLatch.Subseconds = 0; - CFE_TIME_Global.MaxDelta.Seconds = 0; - CFE_TIME_Global.MaxDelta.Subseconds = 1; - CFE_TIME_Global.MaxLocalClock.Seconds = 0; - CFE_TIME_Global.MaxLocalClock.Subseconds = 0; + CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; + CFE_TIME_Global.ReferenceState[0].ClockSetState = CFE_TIME_SetState_WAS_SET; + settime.Seconds = 0; + settime.Subseconds = 0; + CFE_TIME_Global.InternalCount = 0; + CFE_TIME_Global.ReferenceState[0].AtToneMET.Seconds = 0; + CFE_TIME_Global.ReferenceState[0].AtToneMET.Subseconds = 0; + CFE_TIME_Global.ReferenceState[0].AtToneSTCF.Seconds = 10; + CFE_TIME_Global.ReferenceState[0].AtToneSTCF.Subseconds = 0; + CFE_TIME_Global.ReferenceState[0].AtToneDelay.Seconds = 0; + CFE_TIME_Global.ReferenceState[0].AtToneDelay.Subseconds = 0; + CFE_TIME_Global.ReferenceState[0].AtToneLatch.Seconds = 0; + CFE_TIME_Global.ReferenceState[0].AtToneLatch.Subseconds = 0; + CFE_TIME_Global.MaxDelta.Seconds = 0; + CFE_TIME_Global.MaxDelta.Subseconds = 1; + CFE_TIME_Global.MaxLocalClock.Seconds = 0; + CFE_TIME_Global.MaxLocalClock.Subseconds = 0; UT_SetBSP_Time(0, 0); CFE_TIME_ExternalGPS(settime, 0); UtAssert_UINT32_EQ(CFE_TIME_Global.InternalCount, 1); @@ -1155,46 +1155,46 @@ void Test_External(void) * state set and time greater than the maximum */ UT_InitData(); - CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; - CFE_TIME_Global.ClockSetState = CFE_TIME_SetState_WAS_SET; - settime.Seconds = 20; - settime.Subseconds = 0; - CFE_TIME_Global.InternalCount = 0; - CFE_TIME_Global.AtToneMET.Seconds = 0; - CFE_TIME_Global.AtToneMET.Subseconds = 0; - CFE_TIME_Global.AtToneSTCF.Seconds = 10; - CFE_TIME_Global.AtToneSTCF.Subseconds = 0; - CFE_TIME_Global.AtToneDelay.Seconds = 0; - CFE_TIME_Global.AtToneDelay.Subseconds = 0; - CFE_TIME_Global.AtToneLatch.Seconds = 0; - CFE_TIME_Global.AtToneLatch.Subseconds = 0; - CFE_TIME_Global.MaxDelta.Seconds = 0; - CFE_TIME_Global.MaxDelta.Subseconds = 1; - CFE_TIME_Global.MaxLocalClock.Seconds = 0; - CFE_TIME_Global.MaxLocalClock.Subseconds = 0; + CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; + CFE_TIME_Global.ReferenceState[0].ClockSetState = CFE_TIME_SetState_WAS_SET; + settime.Seconds = 20; + settime.Subseconds = 0; + CFE_TIME_Global.InternalCount = 0; + CFE_TIME_Global.ReferenceState[0].AtToneMET.Seconds = 0; + CFE_TIME_Global.ReferenceState[0].AtToneMET.Subseconds = 0; + CFE_TIME_Global.ReferenceState[0].AtToneSTCF.Seconds = 10; + CFE_TIME_Global.ReferenceState[0].AtToneSTCF.Subseconds = 0; + CFE_TIME_Global.ReferenceState[0].AtToneDelay.Seconds = 0; + CFE_TIME_Global.ReferenceState[0].AtToneDelay.Subseconds = 0; + CFE_TIME_Global.ReferenceState[0].AtToneLatch.Seconds = 0; + CFE_TIME_Global.ReferenceState[0].AtToneLatch.Subseconds = 0; + CFE_TIME_Global.MaxDelta.Seconds = 0; + CFE_TIME_Global.MaxDelta.Subseconds = 1; + CFE_TIME_Global.MaxLocalClock.Seconds = 0; + CFE_TIME_Global.MaxLocalClock.Subseconds = 0; UT_SetBSP_Time(0, 0); CFE_TIME_ExternalGPS(settime, 0); UtAssert_UINT32_EQ(CFE_TIME_Global.InternalCount, 1); /* Test setting time data from GPS (external source, state set) */ UT_InitData(); - CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; - CFE_TIME_Global.ClockSetState = CFE_TIME_SetState_NOT_SET; - settime.Seconds = 10; - settime.Subseconds = 0; - CFE_TIME_Global.ExternalCount = 0; - CFE_TIME_Global.AtToneMET.Seconds = 0; - CFE_TIME_Global.AtToneMET.Subseconds = 0; - CFE_TIME_Global.AtToneSTCF.Seconds = 10; - CFE_TIME_Global.AtToneSTCF.Subseconds = 0; - CFE_TIME_Global.AtToneDelay.Seconds = 0; - CFE_TIME_Global.AtToneDelay.Subseconds = 0; - CFE_TIME_Global.AtToneLatch.Seconds = 0; - CFE_TIME_Global.AtToneLatch.Subseconds = 0; - CFE_TIME_Global.MaxDelta.Seconds = 0; - CFE_TIME_Global.MaxDelta.Subseconds = 1; - CFE_TIME_Global.MaxLocalClock.Seconds = 0; - CFE_TIME_Global.MaxLocalClock.Subseconds = 0; + CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; + CFE_TIME_Global.ReferenceState[0].ClockSetState = CFE_TIME_SetState_NOT_SET; + settime.Seconds = 10; + settime.Subseconds = 0; + CFE_TIME_Global.ExternalCount = 0; + CFE_TIME_Global.ReferenceState[0].AtToneMET.Seconds = 0; + CFE_TIME_Global.ReferenceState[0].AtToneMET.Subseconds = 0; + CFE_TIME_Global.ReferenceState[0].AtToneSTCF.Seconds = 10; + CFE_TIME_Global.ReferenceState[0].AtToneSTCF.Subseconds = 0; + CFE_TIME_Global.ReferenceState[0].AtToneDelay.Seconds = 0; + CFE_TIME_Global.ReferenceState[0].AtToneDelay.Subseconds = 0; + CFE_TIME_Global.ReferenceState[0].AtToneLatch.Seconds = 0; + CFE_TIME_Global.ReferenceState[0].AtToneLatch.Subseconds = 0; + CFE_TIME_Global.MaxDelta.Seconds = 0; + CFE_TIME_Global.MaxDelta.Subseconds = 1; + CFE_TIME_Global.MaxLocalClock.Seconds = 0; + CFE_TIME_Global.MaxLocalClock.Subseconds = 0; UT_SetBSP_Time(0, 0); CFE_TIME_ExternalGPS(settime, 0); UtAssert_UINT32_EQ(CFE_TIME_Global.ExternalCount, 1);