From 144798d160054ba2b59484eefcf2db92890854d5 Mon Sep 17 00:00:00 2001 From: Chris Knight Date: Fri, 31 Jul 2020 12:26:26 -0700 Subject: [PATCH 1/8] fix #759 - adds CFE_OMIT_DEPRECATED_6_8 tag --- cmake/sample_defs/global_build_options.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/sample_defs/global_build_options.cmake b/cmake/sample_defs/global_build_options.cmake index 642b00082..486dc2aa0 100644 --- a/cmake/sample_defs/global_build_options.cmake +++ b/cmake/sample_defs/global_build_options.cmake @@ -19,7 +19,7 @@ set(OMIT_DEPRECATED $ENV{OMIT_DEPRECATED} CACHE STRING "Omit deprecated elements") if (OMIT_DEPRECATED) message (STATUS "OMIT_DEPRECATED=true: Not including deprecated elements in build") - add_definitions(-DCFE_OMIT_DEPRECATED_6_7 -DCFE_OMIT_DEPRECATED_6_6 -DOSAL_OMIT_DEPRECATED) + add_definitions(-DCFE_OMIT_DEPRECATED_6_8 -DCFE_OMIT_DEPRECATED_6_7 -DCFE_OMIT_DEPRECATED_6_6 -DOSAL_OMIT_DEPRECATED) else() message (STATUS "OMIT_DEPRECATED=false: Deprecated elements included in build") endif (OMIT_DEPRECATED) From 4becb88308ea4c08d1cf740a9e8886a681172de4 Mon Sep 17 00:00:00 2001 From: Chris Knight Date: Fri, 31 Jul 2020 12:30:19 -0700 Subject: [PATCH 2/8] fix #759 - deprecated CFE_SB_GetLastSenderId() --- docs/cFE Application Developers Guide.md | 10 -- fsw/cfe-core/src/inc/cfe_sb.h | 14 ++- fsw/cfe-core/src/inc/cfe_sb_events.h | 7 ++ fsw/cfe-core/src/sb/cfe_sb_api.c | 6 ++ fsw/cfe-core/src/sb/cfe_sb_priv.h | 2 + fsw/cfe-core/unit-test/sb_UT.c | 116 ----------------------- fsw/cfe-core/unit-test/sb_UT.h | 109 +-------------------- fsw/cfe-core/ut-stubs/ut_sb_stubs.c | 4 + 8 files changed, 32 insertions(+), 236 deletions(-) diff --git a/docs/cFE Application Developers Guide.md b/docs/cFE Application Developers Guide.md index 329cff100..86e76a19c 100644 --- a/docs/cFE Application Developers Guide.md +++ b/docs/cFE Application Developers Guide.md @@ -1769,7 +1769,6 @@ for extracting that field from the header: | Total Message Length | CFE_SB_GetTotalMsgLength | Command & Telemetry | | User Data Message Length | CFE_SB_GetUserDataLength | Command & Telemetry | | Command Code | CFE_SB_GetCmdCode | Command Only | -| Sender ID | CFE_SB_GetLastSenderId | Command & Telemetry | | Checksum | CFE_SB_GetChecksum | Command Only | In addition to the function for reading the checksum field, there is @@ -1778,15 +1777,6 @@ and compares it to the checksum in the header. The API is called CFE_SB_ValidateChecksum() and it simply returns a success or failure indication. -It should be noted that the function, CFE_SB_GetLastSendId, is ideal -for verifying that critical commands are arriving from a legitimate -source. This function allows the Developer(s) to define a strict ICD -between two or more Applications to ensure that an erroneous Application -does not accidentally issue a critical command. However, its use for -routine command verification is discouraged since it would increase the -cross-coupling between Applications and require multiple Applications to -be modified if a command's source changes. - If the Application's data structure definitions don't include the header information, then the CFE_SB_GetUserData API could be used to obtain the start address of the SB Message data. diff --git a/fsw/cfe-core/src/inc/cfe_sb.h b/fsw/cfe-core/src/inc/cfe_sb.h index 7f92c3794..6a0b4628b 100644 --- a/fsw/cfe-core/src/inc/cfe_sb.h +++ b/fsw/cfe-core/src/inc/cfe_sb.h @@ -208,7 +208,10 @@ typedef struct { extern CFE_SB_Qos_t CFE_SB_Default_Qos;/**< \brief Defines a default priority and reliabilty for off-board routing */ -/** \brief Message Sender Identification Type Definition +#ifndef CFE_OMIT_DEPRECATED_6_8 + +/** \brief DEPRECATED; Message Sender Identification Type Definition +** \deprecated ** ** Parameter used in #CFE_SB_GetLastSenderId API which allows the receiver of a message ** to validate the sender of the message. @@ -218,6 +221,8 @@ typedef struct { char AppName[OS_MAX_API_NAME];/**< \brief Application that sent the message */ } CFE_SB_SenderId_t; +#endif /* CFE_OMIT_DEPRECATED_6_8 */ + /****************** Function Prototypes **********************/ /** @defgroup CFEAPISBPipe cFE Pipe Management APIs @@ -1173,9 +1178,12 @@ uint16 CFE_SB_GetCmdCode(CFE_SB_MsgPtr_t MsgPtr); **/ CFE_TIME_SysTime_t CFE_SB_GetMsgTime(CFE_SB_MsgPtr_t MsgPtr); +#ifndef CFE_OMIT_DEPRECATED_6_8 + /*****************************************************************************/ /** -** \brief Retrieve the application Info of the sender for the last message. +** \brief DEPRECATED; Retrieve the application Info of the sender for the last message. +** \deprecated ** ** \par Description ** This routine can be used after a successful #CFE_SB_RcvMsg call @@ -1204,6 +1212,8 @@ CFE_TIME_SysTime_t CFE_SB_GetMsgTime(CFE_SB_MsgPtr_t MsgPtr); **/ uint32 CFE_SB_GetLastSenderId(CFE_SB_SenderId_t **Ptr,CFE_SB_PipeId_t PipeId); +#endif /* CFE_OMIT_DEPRECATED_6_8 */ + /******************************************************************************/ /** ** \brief Copies a string out of a software bus message diff --git a/fsw/cfe-core/src/inc/cfe_sb_events.h b/fsw/cfe-core/src/inc/cfe_sb_events.h index 190df22dc..2f9dbda4b 100644 --- a/fsw/cfe-core/src/inc/cfe_sb_events.h +++ b/fsw/cfe-core/src/inc/cfe_sb_events.h @@ -568,6 +568,8 @@ #define CFE_SB_CMD1_RCVD_EID 29 +#ifndef CFE_OMIT_DEPRECATED_6_8 + /** \brief 'SB GetLastSender Err:Rcvd Null Ptr,Pipe=%d,App=%s' ** \event 'SB GetLastSender Err:Rcvd Null Ptr,Pipe=%d,App=%s' ** @@ -592,6 +594,8 @@ **/ #define CFE_SB_LSTSNDER_ERR2_EID 31 +#endif /* CFE_OMIT_DEPRECATED_6_8 */ + /** \brief 'Software Bus Statistics packet sent' ** \event 'Software Bus Statistics packet sent' @@ -712,6 +716,8 @@ #define CFE_SB_SND_RTG_ERR1_EID 40 +#ifndef CFE_OMIT_DEPRECATED_6_8 + /** \brief 'SB GetLastSender Err:Caller(\%s) is not the owner of pipe \%d' ** \event 'SB GetLastSender Err:Caller(\%s) is not the owner of pipe \%d' ** @@ -724,6 +730,7 @@ **/ #define CFE_SB_GLS_INV_CALLER_EID 41 +#endif /* CFE_OMIT_DEPRECATED_6_8 */ /** \brief 'Invalid Cmd, Unexpected Command Code \%d' ** \event 'Invalid Cmd, Unexpected Command Code \%d' diff --git a/fsw/cfe-core/src/sb/cfe_sb_api.c b/fsw/cfe-core/src/sb/cfe_sb_api.c index 7ae142532..3c446f106 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_api.c +++ b/fsw/cfe-core/src/sb/cfe_sb_api.c @@ -1320,12 +1320,14 @@ int32 CFE_SB_SendMsgFull(CFE_SB_Msg_t *MsgPtr, RtgTblPtr->SeqCnt); }/* end if */ + #ifndef CFE_OMIT_DEPRECATED_6_8 /* store the sender information */ if(CFE_SB.SenderReporting != 0) { BufDscPtr->Sender.ProcessorId = CFE_PSP_GetProcessorId(); strncpy(&BufDscPtr->Sender.AppName[0],CFE_SB_GetAppTskName(TskId,FullName),OS_MAX_API_NAME); } + #endif /* CFE_OMIT_DEPRECATED_6_8 */ /* At this point there must be at least one destination for pkt */ @@ -1620,6 +1622,8 @@ int32 CFE_SB_RcvMsg(CFE_SB_MsgPtr_t *BufPtr, }/* end CFE_SB_RcvMsg */ +#ifndef CFE_OMIT_DEPRECATED_6_8 + /* * Function: CFE_SB_GetLastSenderId - See API and header file for details */ @@ -1685,6 +1689,8 @@ uint32 CFE_SB_GetLastSenderId(CFE_SB_SenderId_t **Ptr,CFE_SB_PipeId_t PipeId) }/* end CFE_SB_GetLastSenderId */ +#endif /* CFE_OMIT_DEPRECATED_6_8 */ + /* * Function: CFE_SB_ZeroCopyGetPtr - See API and header file for details diff --git a/fsw/cfe-core/src/sb/cfe_sb_priv.h b/fsw/cfe-core/src/sb/cfe_sb_priv.h index 3aca3f347..832618532 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_priv.h +++ b/fsw/cfe-core/src/sb/cfe_sb_priv.h @@ -172,7 +172,9 @@ typedef struct { uint16 UseCount; uint32 Size; void *Buffer; +#ifndef CFE_OMIT_DEPRECATED_6_8 CFE_SB_SenderId_t Sender; +#endif /* CFE_OMIT_DEPRECATED_6_8 */ } CFE_SB_BufferD_t; diff --git a/fsw/cfe-core/unit-test/sb_UT.c b/fsw/cfe-core/unit-test/sb_UT.c index 2f2ffcf1a..16a4ed279 100644 --- a/fsw/cfe-core/unit-test/sb_UT.c +++ b/fsw/cfe-core/unit-test/sb_UT.c @@ -3332,11 +3332,6 @@ void Test_RcvMsg_API(void) SB_UT_ADD_SUBTEST(Test_RcvMsg_InvalidPipeId); SB_UT_ADD_SUBTEST(Test_RcvMsg_InvalidTimeout); SB_UT_ADD_SUBTEST(Test_RcvMsg_Poll); - SB_UT_ADD_SUBTEST(Test_RcvMsg_GetLastSenderNull); - SB_UT_ADD_SUBTEST(Test_RcvMsg_GetLastSenderInvalidPipe); - SB_UT_ADD_SUBTEST(Test_RcvMsg_GetLastSenderInvalidCaller); - SB_UT_ADD_SUBTEST(Test_RcvMsg_GetLastSenderNoValidSender); - SB_UT_ADD_SUBTEST(Test_RcvMsg_GetLastSenderSuccess); SB_UT_ADD_SUBTEST(Test_RcvMsg_Timeout); SB_UT_ADD_SUBTEST(Test_RcvMsg_PipeReadError); SB_UT_ADD_SUBTEST(Test_RcvMsg_PendForever); @@ -3405,117 +3400,6 @@ void Test_RcvMsg_Poll(void) } /* end Test_RcvMsg_Poll */ -/* -** Test receive last message response to a null sender ID -*/ -void Test_RcvMsg_GetLastSenderNull(void) -{ - CFE_SB_PipeId_t PipeId; - uint32 PipeDepth = 10; - - SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvMsgTestPipe")); - - ASSERT_EQ(CFE_SB_GetLastSenderId(NULL, PipeId), CFE_SB_BAD_ARGUMENT); - - EVTCNT(2); - - EVTSENT(CFE_SB_LSTSNDER_ERR1_EID); - - TEARDOWN(CFE_SB_DeletePipe(PipeId)); - -} /* end Test_RcvMsg_GetLastSenderNull */ - -/* -** Test receive last message response to an invalid pipe ID -*/ -void Test_RcvMsg_GetLastSenderInvalidPipe(void) -{ - CFE_SB_PipeId_t PipeId; - CFE_SB_PipeId_t InvalidPipeId = 250; - CFE_SB_SenderId_t *GLSPtr; - uint32 PipeDepth = 10; - - SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvMsgTestPipe")); - - ASSERT_EQ(CFE_SB_GetLastSenderId(&GLSPtr, InvalidPipeId), CFE_SB_BAD_ARGUMENT); - - EVTCNT(2); - - EVTSENT(CFE_SB_LSTSNDER_ERR2_EID); - - TEARDOWN(CFE_SB_DeletePipe(PipeId)); - -} /* end Test_RcvMsg_GetLastSenderInvalidPipe */ - -/* -** Test receive last message response to an invalid owner ID -*/ -void Test_RcvMsg_GetLastSenderInvalidCaller(void) -{ - CFE_SB_PipeId_t PipeId; - CFE_SB_SenderId_t *GLSPtr; - uint32 PipeDepth = 10; - uint32 OrigPipeOwner; - - SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvMsgTestPipe")); - - /* Change pipe owner ID to execute 'invalid caller' code */ - OrigPipeOwner = CFE_SB.PipeTbl[PipeId].AppId; - CFE_SB.PipeTbl[PipeId].AppId = OrigPipeOwner + 1; - ASSERT_EQ(CFE_SB_GetLastSenderId(&GLSPtr, PipeId), CFE_SB_BAD_ARGUMENT); - - EVTCNT(2); - - EVTSENT(CFE_SB_GLS_INV_CALLER_EID); - - /* Restore original pipe owner apid */ - CFE_SB.PipeTbl[PipeId].AppId = OrigPipeOwner; - TEARDOWN(CFE_SB_DeletePipe(PipeId)); - -} /* end Test_RcvMsg_GetLastSenderInvalidCaller */ - - -void Test_RcvMsg_GetLastSenderNoValidSender(void) -{ - CFE_SB_PipeId_t PipeId; - CFE_SB_SenderId_t *GLSPtr; - uint32 PipeDepth = 10; - - SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvMsgTestPipe")); - ASSERT_EQ(CFE_SB_GetLastSenderId(&GLSPtr, PipeId), CFE_SB_NO_MSG_RECV); - - EVTCNT(1); - - TEARDOWN(CFE_SB_DeletePipe(PipeId)); - -} /* end Test_RcvMsg_GetLastSenderNoValidSender */ - - -/* -** Test successful receive last message request -*/ -void Test_RcvMsg_GetLastSenderSuccess(void) -{ - CFE_SB_PipeId_t PipeId; - CFE_SB_SenderId_t *GLSPtr; - SB_UT_Test_Tlm_t TlmPkt; - CFE_SB_MsgPtr_t TlmPktPtr = (CFE_SB_MsgPtr_t) &TlmPkt; - CFE_SB_MsgPtr_t PtrToMsg; - uint32 PipeDepth = 10; - - SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvMsgTestPipe")); - CFE_SB_InitMsg(&TlmPkt, SB_UT_TLM_MID, sizeof(TlmPkt), true); - SETUP(CFE_SB_Subscribe(SB_UT_TLM_MID, PipeId)); - SETUP(CFE_SB_SendMsg(TlmPktPtr)); - SETUP(CFE_SB_RcvMsg(&PtrToMsg, PipeId,CFE_SB_PEND_FOREVER)); - ASSERT(CFE_SB_GetLastSenderId(&GLSPtr, PipeId)); - - EVTCNT(3); - - TEARDOWN(CFE_SB_DeletePipe(PipeId)); - -} /* end Test_RcvMsg_GetLastSenderSuccess */ - /* ** Test receiving a message response to a timeout */ diff --git a/fsw/cfe-core/unit-test/sb_UT.h b/fsw/cfe-core/unit-test/sb_UT.h index 0ec5effef..b62fca00b 100644 --- a/fsw/cfe-core/unit-test/sb_UT.h +++ b/fsw/cfe-core/unit-test/sb_UT.h @@ -2825,10 +2825,7 @@ void Test_SendMsg_MaxMsgSizePlusOne_ZeroCopy(void); ** This function does not return a value. ** ** \sa #UT_Text, #Test_RcvMsg_InvalidPipeId, #Test_RcvMsg_InvalidTimeout, -** \sa #Test_RcvMsg_Poll, #Test_RcvMsg_GetLastSenderNull, -** \sa #Test_RcvMsg_GetLastSenderInvalidPipe, -** \sa #Test_RcvMsg_GetLastSenderInvalidCaller, -** \sa #Test_RcvMsg_GetLastSenderSuccess, #Test_RcvMsg_Timeout, +** \sa #Test_RcvMsg_Poll, #Test_RcvMsg_Timeout, ** \sa #Test_RcvMsg_PipeReadError, #Test_RcvMsg_PendForever ** ******************************************************************************/ @@ -2898,110 +2895,6 @@ void Test_RcvMsg_InvalidTimeout(void); ******************************************************************************/ void Test_RcvMsg_Poll(void); -/*****************************************************************************/ -/** -** \brief Test receive last message response to a null sender ID -** -** \par Description -** This function tests the receive last message response to a null -** sender ID. -** -** \par Assumptions, External Events, and Notes: -** None -** -** \returns -** This function does not return a value. -** -** \sa #UT_Text, #SB_ResetUnitTest, #CFE_SB_CreatePipe, -** \sa #CFE_SB_GetLastSenderId, #UT_GetNumEventsSent, #UT_EventIsInHistory, -** \sa #CFE_SB_DeletePipe, #UT_Report -** -******************************************************************************/ -void Test_RcvMsg_GetLastSenderNull(void); - -/*****************************************************************************/ -/** -** \brief Test receive last message response to an invalid pipe ID -** -** \par Description -** This function tests the receive last message response to an invalid -** pipe ID. -** -** \par Assumptions, External Events, and Notes: -** None -** -** \returns -** This function does not return a value. -** -** \sa #UT_Text, #SB_ResetUnitTest, #CFE_SB_CreatePipe, -** \sa #CFE_SB_GetLastSenderId, #UT_GetNumEventsSent, #UT_EventIsInHistory, -** \sa #CFE_SB_DeletePipe, #UT_Report -** -******************************************************************************/ -void Test_RcvMsg_GetLastSenderInvalidPipe(void); - -/*****************************************************************************/ -/** -** \brief Test receive last message response to an invalid owner ID -** -** \par Description -** This function tests the receive last message response to an invalid -** owner ID. -** -** \par Assumptions, External Events, and Notes: -** None -** -** \returns -** This function does not return a value. -** -** \sa #UT_Text, #SB_ResetUnitTest, #CFE_SB_CreatePipe, -** \sa #CFE_SB_GetLastSenderId, #UT_GetNumEventsSent, #UT_EventIsInHistory, -** \sa #CFE_SB_DeletePipe, #UT_Report -** -******************************************************************************/ -void Test_RcvMsg_GetLastSenderInvalidCaller(void); - -/*****************************************************************************/ -/** -** \brief Test receive last message response when there is no last sender -** -** \par Description -** This function tests the receive last message response when no last -** sender. -** -** \par Assumptions, External Events, and Notes: -** None -** -** \returns -** This function does not return a value. -** -** \sa #UT_Text, #SB_ResetUnitTest, #CFE_SB_CreatePipe, -** \sa #CFE_SB_GetLastSenderId, #UT_GetNumEventsSent, #UT_EventIsInHistory, -** \sa #CFE_SB_DeletePipe, #UT_Report -** -******************************************************************************/ -void Test_RcvMsg_GetLastSenderNoValidSender(void); - -/*****************************************************************************/ -/** -** \brief Test successful receive last message request -** -** \par Description -** This function tests the successful receive last message request. -** -** \par Assumptions, External Events, and Notes: -** None -** -** \returns -** This function does not return a value. -** -** \sa #UT_Text, #SB_ResetUnitTest, #CFE_SB_CreatePipe, -** \sa #CFE_SB_GetLastSenderId, #UT_GetNumEventsSent, #CFE_SB_DeletePipe, -** \sa #UT_Report -** -******************************************************************************/ -void Test_RcvMsg_GetLastSenderSuccess(void); - /*****************************************************************************/ /** ** \brief Test receiving a message response to a timeout diff --git a/fsw/cfe-core/ut-stubs/ut_sb_stubs.c b/fsw/cfe-core/ut-stubs/ut_sb_stubs.c index 304d835c8..1d6c7d33b 100644 --- a/fsw/cfe-core/ut-stubs/ut_sb_stubs.c +++ b/fsw/cfe-core/ut-stubs/ut_sb_stubs.c @@ -988,6 +988,8 @@ uint16 CFE_SB_GetChecksum(CFE_SB_MsgPtr_t MsgPtr) return status; } +#ifndef CFE_OMIT_DEPRECATED_6_8 + uint32 CFE_SB_GetLastSenderId(CFE_SB_SenderId_t **Ptr, CFE_SB_PipeId_t PipeId) { UT_Stub_RegisterContext(UT_KEY(CFE_SB_GetLastSenderId), Ptr); @@ -1000,6 +1002,8 @@ uint32 CFE_SB_GetLastSenderId(CFE_SB_SenderId_t **Ptr, CFE_SB_PipeId_t PipeId) return status; } +#endif /* CFE_OMIT_DEPRECATED_6_8 */ + int32 CFE_SB_GetPipeOpts(CFE_SB_PipeId_t PipeId, uint8 *OptPtr) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_GetPipeOpts), PipeId); From 26f9c0b36eaadb3518fe38b976de3aabda36a156 Mon Sep 17 00:00:00 2001 From: Hageman Date: Mon, 3 Aug 2020 12:43:58 -0400 Subject: [PATCH 3/8] Fix #787, #587, Update requirements #787 - cES1005.1: Remove application load address from start app command - cTBL6003.1: Clarify table validation pior to activate - cEVS3103.4, cEVS3103.5, cEVS3001: Remove SB qualifier #587 - cSB4344: Added get packet type API requirement - cSB4345: Added message ID validation API requirement --- docs/cFE_FunctionalRequirements.csv | 68 +++-------------------------- 1 file changed, 7 insertions(+), 61 deletions(-) diff --git a/docs/cFE_FunctionalRequirements.csv b/docs/cFE_FunctionalRequirements.csv index dac2c9181..72dce9752 100644 --- a/docs/cFE_FunctionalRequirements.csv +++ b/docs/cFE_FunctionalRequirements.csv @@ -26,8 +26,7 @@ ES: Start Application - Command Contents,cES1005.1,"The Command shall include th - Application Entry Point - Application Name - Application Priority -- Application Stack Size -- Application Load Address +- Application Stack Size - Exception Action (restart application or perform processor reset)", ES: Start Application - Location,cES1005.2,The Command specified cFE Application file shall be in any valid cFE file system including the volatile file system and the non-volatile file system.,"The command itself does not care about where the cFE Application comes from, it is specified In the path." ES: Start Application - Reject Undefined,cES1005.3,"If the Command specified Application is undefined then the cFE shall reject the Command, increment the invalid command counter and generate an event message.",Can't start an undefined application. @@ -56,8 +55,6 @@ ES: Application Status Message,cES1011,"Upon receipt of a Command, the cFE shall - cFE Application Child Task Count","In order to support remote Application management then the Application's properties and current state need to be externally observable. Because the ground interface is with Applications rather than Tasks, Task information should be included as well." ES: Application Status Record To File,cES1012,"Upon receipt of a Command, the cFE shall generate a Command specified file that contains all properties and states of all cFE Applications that are defined in the Systems Resources Definition.",May want information about all applications and tasks defined in the Systems Resources Definition in order to diagnose a problem. ES: Application Status Record To File - Default Filename,cES1012.1,"If a file is not specified, the cFE shall use the `` filename.",Want to specify a default if the user does not want to specify a new filename. -ES: Pass String To Shell,cES1013,"[DELETED]Upon receipt of a Command, the cFE shall submit to the operating system shell, the string supplied as a parameter.","Having access to the operating system shell has proved invaluable during FSW development on missions such as JWST and Triana. Although it is available on-orbit, it is not intended to be used during normal operations." -ES: Pass String To Shell - Message Response,cES1013.1,"[DELETED]Upon execution of the operating system Command, the cFE shall generate one or more messages containing the ascii output generated by the operating system command.","This message will provide the ""output"" from the shell command to allow the implementation of a shell like interface to the cFE." ES: System Log,cES1014,The cFE shall maintain an Executive Services System Log which contains a series of ASCII text strings describing significant events or errors.,"Examples of ES System Log information includes: ""Created new cFE Application: StoredCommand.app"" or ""Could Not Create OS Queue"" or ""File not found error: /eebank1/StoredCommand.app"" This requirement states that the cFE needs to maintain this information. There is a separate requirement for the creation of a file to transfer the information to the ground. Note that the information can also be obtained with a raw memory read." ES: System Log - Timestamps,cES1014.1,Each entry in the Executive Services System Log shall be time tagged with the time that the event happened.,Need to be able to determine when the event occurred. ES: System Log - Calculate Usage,cES1014.2,"The cFE shall calculate the number of bytes used and number of entries in @@ -100,8 +97,6 @@ ES: Get Memory Pool Statistics,cES1033,"Upon receipt of a Command, the cFE shall ES: Register Application,cES1300,"Upon receipt of a Request, the cFE shall register the calling cFE Application with the system.",cFE Applications must register with the cFE in order to allow the cFE to track the Application's resources. This function also allows the system to synchronize the application startup. The cFE Application will wait in this function until the cFE starts up. ES: Report Last Reset,cES1301,"Upon receipt of a Request, the cFE shall provide the type of last reset performed by the processor.",cFE Applications may perform processing that is specific to each reset type. ES: Report Last Reset - Types,cES1301.1,The reset types include: Power On Reset Processor Reset.,cFE Applications may perform processing that is specific to each reset type. -ES: Report Processor ID,cES1302,"[DELETED]Upon receipt of a Request, the cFE shall provide the Processor ID on which the Request was made.","Need to determine the Processor ID. This feature is useful in missions with multiple processors, or to help distinguish prototype vs. flight processor features." -ES: Report Spacecraft ID,cES1303,"[DELETED]Upon receipt of a Request, the cFE shall provide the Spacecraft ID on which the Request was made.","Need to determine the Spacecraft ID. This feature is useful in missions with multiple Spacecraft, or Spacecraft with multiple processors." ES: Report Application ID,cES1304,"Upon receipt of a Request, the cFE shall provide the cFE Application ID of the calling cFE Application.",A cFE Application needs to determine its own Application ID. ES: Report Task and Application Name,cES1305,"Upon receipt of a Request, the cFE shall provide the cFE Task Name and cFE Application Name which corresponds to the specified cFE Task ID.",The command will provide a way to find the cFE Task Name and the parent cFE Application name from any cFE Application or Child task. ES: Report Application ID,cES1306,"Upon receipt of a Request, the cFE shall provide the cFE Application ID which corresponds to the specified cFE Application Name.",The Executive Services will assign an Application ID. The Application Name is specified when the cFE Application is created. This Request will provide a way to determine the cFE Application ID when the pre-determined Application Name is passed in. @@ -132,7 +127,6 @@ ES: Exit Application,cES1319,"Upon receipt of a Request, the cFE shall exit the ES: Prepare Memory Pool,cES1320,"Upon receipt of a Request, the cFE shall prepare a Memory Pool for run time memory allocation/de-allocation.","The Memory Allocation interface allows the cFE Application to supply a Pool of memory, which can be used for efficient memory allocation and de-allocation." ES: Prepare Memory Pool - Too Small,cES1320.1,"If the specified size is less than the minimum block size, the cFE shall record the error in the System Log, and return an error code.","If the size of the Pool is not valid, then an error must be returned." ES: Allocate Memory,cES1321,"Upon receipt of a Request the cFE shall allocate a block of memory of the specified size from the specified Memory Pool, protected with a semaphore while processing.",The Memory Allocation interface allows the cFE Application to allocate a block of memory from a previously created memory pool. -ES: Allocate Memory - Round Up,cES1321.1,[DELETED]To ensure memory allocation and accesses are compatible with processors requiring a 32-bit boundary to access memory.,"If the specified size is not an integral multiple of 32 bit words, the size shall be rounded up to an integral of 32 bit words. " ES: Allocate Memory - Invalid ID,cES1321.2,"If the specified Memory Pool identifier is invalid then the cFE shall record the error in the System Log, and return an error code.","If the handle or Memory Pool ID is not valid, then an error must be returned." ES: Allocate Memory - Too Large,cES1321.3,"If the specified size is too large for the specified Memory Pool, the cFE shall record the error in the System Log, and return an error code.",Cannot allocate a memory block bigger than the pool. ES: De-allocate Memory,cES1322,Upon receipt of a Request the cFE shall de-allocate the specified block of memory from the specified Memory Pool.,The Memory Allocation interface allows the cFE Application to de-allocate a block of memory from a previously created memory pool. @@ -142,12 +136,6 @@ ES: Calculate Data Integrity Value,cES1323,"Upon receipt of a Request, the cFE s - XOR: Exclusive OR - CRC16: 16 Bit Cyclic Redundancy Check - CRC32: 32 Bit Cyclic Redundancy Check",We need to provide a checksum/CRC utility. -ES: Load Device Driver,cES1324,"[DELETED]Upon receipt of a Request, the cFE shall load and initialize a hardware device driver and connect it with the specified hardware handshaking and device processing code.",Need a standard device driver interface. -ES: Unload Device Driver,cES1325,"[DELETED]Upon receipt of a Request, the cFE shall unload a specified hardware device driver and de-allocate all previously allocated resources used by the driver.","Need a way of unloading, stopping a hardware device driver." -ES: Disable Device Driver,cES1326,"[DELETED]Upon receipt of a Request, the cFE shall disable a specified hardware device driver.","Need a way of unloading, stopping a hardware device driver." -ES: Disable Device Driver - Not Loaded,cES1326.1,"[DELETED]If the specified hardware device driver is not loaded, then the cFE shall record the error in the System Log, and return an error code.",Cannot disable a device driver that is not loaded. -ES: Enable Device Driver,cES1327,"[DELETED]Upon receipt of a Request, the cFE shall re-enable a specified hardware device driver.",Need a way to re-enable the device driver and it's associated interrupt. -ES: Enable Device Driver - Not Loaded,cES1327.1,"[DELETED]If the specified hardware device driver is not loaded, then the cFE shall record the error in the System Log, and return an error code.",Cannot disable a device driver that is not loaded. ES: Copy To Critical Data Store,cES1328,"Upon receipt of a Request, the cFE shall copy the data starting at the Request specified address to the Request specified Critical Data Store.",Applications need to periodically copy the local data into the CDS so that it can be preserved. Note that the CDS is not required to exist on-card (local address space). This provides the capability for a mission to use off-card bulk storage. ES: Copy To Critical Data Store - Calculate Data Integrity Value,cES1328.1,The cFE shall calculate a Data Integrity Value for the Request specified Critical Data Store and store it.,"Every time data is written to the CDS, a CRC must be recalculated in order to have a reference for any CDS validation. Note that Applications are responsible for determining whether the contents of a CDS Block are still logically valid." ES: Copy To Critical Data Store - Invalid Critical Data Store,cES1328.2,If the Request Specified Critical Data Store does not exist then the data shall not be copied.,Can't copy data if the reference is wrong. @@ -177,7 +165,6 @@ ES: Power On Reset Set Up Volatile File System,cES1507,"Upon a Power-on Reset, t ES: Power On Reset Process Startup File,cES1508,"Upon a Power-on Reset, the cFE shall process all entries in the cFE Startup File located in the non-volatile file system.","There is a file that contains all of the Applications, Shared Libraries, and Device Drivers that are to be created and started." ES: Power On Reset Process Startup File - Start Apps,cES1508.1,The cFE shall create and start cFE Applications according to the entry in the cFE Startup File.,The cFE supports loading and creating new cFE Applications during system startup. ES: Power On Reset Process Startup File - Init Libs,cES1508.2,The cFE shall create and initialize cFE Shared Libraries according to the entry in the cFE Startup File.,The cFE supports creating and initializing cFE Shared Libraries during system startup. -ES: Power On Reset Process Startup File - Init Device Drivers,cES1508.3,[DELETED]The cFE shall create and initialize cFE Device Drivers according to the entry in the cFE Startup File.,The cFE supports loading and initializing cFE Device Drivers during system startup. ES: Power On Reset Exception and Reset Log Entry,cES1509,"Upon a Power On Reset, the cFE shall make an entry in the Executive Services Exception and Reset Log, recording the Power On Reset.",One purpose of the Executive Services Exception and Reset Log is to log all resets. ES: Processor Reset Identify Sub-Type,cES1510,"Upon a Processor Reset, the cFE shall identify the Processor reset sub-type.",Each mission may want to further distinguish between Processor reset types in order to tailor their system's behavior. For example a mission may want to take different behavior for a watchdog time out and the execution of the processor's reset instructions. ES: Processor Reset Preserve System Log,cES1511,"Upon a Processor Reset, the cFE shall preserve the Executive Services System Log.",Want to be able to determine what errors are logged by the cFE. This log is not preserved on a Power-On reset. @@ -214,23 +201,9 @@ FS: Initialize File Header,cES1601,Upon receipt of a Request the cFE shall initi FS: Write File Header,cES1602,Upon receipt of a Request the cFE shall write the requested header information to the requested file.,File management support. FS: Set File Timestamp,cES1603,Upon receipt of a Request the cFE shall set the requested timestamp on the requested file.,File management support. FS: Extract Filename From Path,cES1604,Upon receipt of a Request the cFE shall provide the file name portion of the requested full path.,File management support. -ES: Maximum Apps,cES1700,[DELETED]The cFE shall support a maximum `` cFE Applications.,TBD has never been exceeded on past missions. Need to bound the number of Applications in order to size the Systems Resources information. -ES: Detect Unmasked Exceptions,cES1702,[DELETED]The cFE shall detect all unmasked CPU exceptions.,Need to be able to detect processor exceptions so that the appropriate action can be taken. -ES: Detect Unmasked Exceptions - Log,cES1702.1,"[DELETED]Upon detection of a CPU exception, the cFE shall add an entry in the Executive Services Exception And Reset Log.",Need to log processor exceptions so that the ground can have visibility into the exception. -ES: Detect Unmasked Exceptions - Restart App,cES1702.2,"[DELETED]If the CPU exception was caused by a cFE Application and the Exception Action indicates that the Application can be started individually, the cFE shall restart the cFE Application that caused the exception.","In most cases, restarting the cFE application will clear up the problem. In some cases, however, applications are tightly coupled with other applications in which case, starting an individual application may have undesirable consequences. The cFE should provide the ability to define if the application should can be restarted or if a processor reset should occur." -ES: Detect Unmasked Exceptions - Platform Response,cES1702.3,[DELETED]If the CPU exception was caused by the Operating System or cFE Core then the cFE shall initiate a `` response.,"An exception in the cFE core or OS will restart the cFE, which results in all cFE Applications being restarted." -ES: Detect FP Exceptions,cES1703,[DELETED]The cFE shall detect all unmasked processor Floating Point Exceptions.,"The low level BSP routines allow the mission to determine what Floating Point exceptions are masked, and what Floating Point exceptions can interrupt the software." -ES: Detect FP Exceptions - Log,cES1703.1,"[DELETED]Upon detection of an unmasked Floating Point exception, the cFE shall add an entry in the Executive Services Exception and Reset Log.",Need to log unmasked Floating Point exceptions so that the ground can have visibility into the exception. -ES: Detect FP Exceptions - Restart App,cES1703.2,"[DELETED]If the Floating Point exception was caused by a cFE Application and the Exception Action indicates that the Application can be started individually, the cFE shall restart the cFE Application that caused the exception.","Want the capability to restart an individual application on a processor reset. Not all Applications should be started individually as they may have some dependencies that result in undesirable behavior. When the Application is started, one of the parameters is whether to restart the app of perform a cFE processor reset." -ES: Detect FP Exceptions - Platform Response,cES1703.3,[DELETED]If the Floating Point exception was caused by the OS or cFE Core then the cFE shall initiate a `` response.,"An exception in the cFE core or OS will restart the cFE, which results in all cFE Applications being restarted." -ES: Volatile File System Size,cES1704,[DELETED]The cFE shall support a `` byte volatile file system.,TBD seems like a reasonable size based on heritage missions. -ES: Non-Volatile File System Size,cES1705,[DELETED]The cFE shall support a `` byte non-volatile file system.,TBD seems like a reasonable size based on heritage missions. -ES: System Log Size,cES1706,[DELETED]The cFE shall support a `` byte Executive Services System Log.,TBD seems like a reasonable size based on heritage missions. -ES: Exception And Reset Log Size,cES1707,[DELETED]The cFE shall support a `` byte Executive Services Exception And Reset Log.,TBD seems like a reasonable size based on heritage missions. -ES: Critical Data Store Size,cES1708,[DELETED]The cFE shall support a `` byte Critical Data Store.,TBD seems like a reasonable size based on heritage missions. ES: Maximum Processor Resets,cES1709,"If the cFE Core goes through `` Maximum Processor Resets, the cFE shall initiate a Power-On Reset of the cFE.","After a number of Processor Resets, the cFE will attempt to recover by doing a Power-on Reset." EVS: Control Message By Event Type,cEVS3000,"Upon receipt of Command the cFE shall enable/disable, as specified in the Command, the future generation of Event Messages for the Command-specified Event Type.",Filtering by type allows the system to behave differently for different users. -EVS: Set Event Format Mode,cEVS3001,"Upon receipt of Command, the cFE shall set the SB Event Format Mode to the command specified value, either Long or Short.",Providing a short format accommodates missions with limited telemetry bandwidth. A long format is desirable because it contains the most information. +EVS: Set Event Format Mode,cEVS3001,"Upon receipt of Command, the cFE shall set the Event Format Mode to the command specified value, either Long or Short.",Providing a short format accommodates missions with limited telemetry bandwidth. A long format is desirable because it contains the most information. EVS: NOOP Event,cEVS3002,Upon receipt of Command the cFE shall generate a NO-OP event message.,This command is useful as a general sub-system aliveness test. EVS: Zero Counters,cEVS3003,"Upon receipt of Command the cFE shall set the following counters to zero in Event Services telemetry: @@ -311,9 +284,9 @@ EVS: Create Message - Data Types,cEVS3103.2,"The cFE shall support the following - Unsigned Long Integer",Not all processors supported under the cFE will allow floating point or real types. EVS: Create Message - Increment Filter Counter,cEVS3103.3,"If the request specified Event ID has been registered for binary event filtering, the cFE shall increment the request specified Application's Binary Filter Counter for the request-specified Event ID.",Support binary event filtering algorithm. EVS: Create Message - Increment Filter Counter - Retain Maximum Value,cEVS3103.3.1,"If the Binary Filter Counter has reached its maximum `` value, the cFE shall retain the maximum value (i.e. do not rollover to zero).",Preventing a counter rollover to zero eliminates the case when a user may think no events have occurred when in fact many events have occurred. -EVS: Create Message - Long Format,cEVS3103.4,"If the SB Format Mode is set to Long, the cFE shall generate an SB Event Message formatted as specified in the cFE User's Guide containing the Spacecraft Time, Processor ID, Application ID, Event ID, Event Type, and the Request-specified Event Data.","To assist with system test and diagnostics it is important to distinguish otherwise identical messages by their sources. This is especially true in a distributed system with common subsystems. It is the intent of this requirement to allow identical subsystems to be resident in multiple processors within the flight system. In cases like this, the subsystem identifier, and message identifier may be the same; only the processor identifier would make the messages unique. A long format is desirable because it contains the most information. Design Note: It is expected that in the implemented event service, the API only requires the Event ID and Type, and that the underlying utility code fills in the processor ID, and Application ID before the message is sent." +EVS: Create Message - Long Format,cEVS3103.4,"If the Format Mode is set to Long, the cFE shall generate an Event Message formatted as specified in the cFE User's Guide containing the Spacecraft Time, Processor ID, Application ID, Event ID, Event Type, and the Request-specified Event Data.","To assist with system test and diagnostics it is important to distinguish otherwise identical messages by their sources. This is especially true in a distributed system with common subsystems. It is the intent of this requirement to allow identical subsystems to be resident in multiple processors within the flight system. In cases like this, the subsystem identifier, and message identifier may be the same; only the processor identifier would make the messages unique. A long format is desirable because it contains the most information. Design Note: It is expected that in the implemented event service, the API only requires the Event ID and Type, and that the underlying utility code fills in the processor ID, and Application ID before the message is sent." EVS: Create Message - Long Format - Truncation,cEVS3103.4.1,"If the Event Data is greater than the `` maximum Event Data, the cFE shall truncate the Event Message with a string-termination character and increment the Message Truncation Counter.","It's important to know if data is lost, but it doesn't need to be maintained on a per-Event ID basis, therefore a single counter is used. A platform-defined length was considered but this prevents application reuse unless a minimum length is specified." -EVS: Create Message - Short Format,cEVS3103.5,"If the SB Format Mode is set to Short, the cFE shall generate an SB Event Message formatted as specified in the cFE User's Guide containing the spacecraft time, Processor ID, Application ID, Event ID, and Event Type.",Providing a short format accommodates missions with limited telemetry bandwidth. +EVS: Create Message - Short Format,cEVS3103.5,"If the Format Mode is set to Short, the cFE shall generate an Event Message formatted as specified in the cFE User's Guide containing the spacecraft time, Processor ID, Application ID, Event ID, and Event Type.",Providing a short format accommodates missions with limited telemetry bandwidth. EVS: Create Message - App ID,cEVS3103.6,The requester shall be able to specify the Application ID to be used in the Event Message.,Need to provide APIs a way to specify an Application ID to ensure the context of the Event is correct. EVS: Create Message - Time,cEVS3103.7,The requester shall be able to specify the time to be used in the Event Message.,"This routine should be used in situations where an error condition is detected at one time, but the event message is reported at a later time." EVS: Increment App Message Sent Counter,cEVS3104,"For each created Event Message, the cFE shall increment the Application Event Message Sent Counter for the request specified Application.",A counter provides a means for keeping track of how many events an application has sent through the event service. Note: The Application Event Message Sent Counter is incremented once regardless of how many enabled ports the message has been sent through. @@ -327,26 +300,12 @@ EVS: Store Message In Event Log - Set Full Flag,cEVS3108.1,"_(OPTIONAL)_ If the EVS: Store Message In Event Log - Increment Overflow Counter,cEVS3108.2,"_(OPTIONAL)_ If the Local Event Log is full, the cFE shall increment the Local Event Log Overflow counter.",Ground operations needs to know how many Event Messages were discarded or overwritten. EVS: Store Message In Event Log - Log Full Behavior,cEVS3108.3,"_(OPTIONAL)_ If the Local Event Log is full, the cFE shall either (1) overwrite the oldest Event Message if the Event Logging Mode is overwrite, or (2) discard the Event Message if the Event Logging Mode is discard.",Overwriting the oldest message is useful for nominal operations because a user doesn't need to periodically clear the Log. If an error occurs when there's no communication then the Local Event Log size must be large enough to retain the Event Messages since communications was lost. Discarding the newest Event Message is useful for trouble shooting a problem. For example there may be a problem during processor initialization that occurs when there's no communications with the processor interfacing with the User. In this case the original Event Messages are critical to solving the problem so they should be preserved. Note that the Event Logging Mode can be changed via stored commanding. EVS: Message Port Routing,cEVS3109,"For each created Event Message, the cFE shall route the Event Message, formatted as an ASCII text string, to each enabled Event Message Output Port.",Debug ports are very useful for FSW development and maintenance. -EVS: Free App Resources,cEVS3110,[DELETED]Upon receipt of Request the cFE shall free resources allocation for the specified Application.,"Need to be able to remove all resources associated with an application when Deleting, Restarting or Reloading an Application. In addition, this is required as part of a Processor Reset." -EVS: Initialize Message Port State On Power On Reset,cEVS3200,"[DELETED]Upon a Power-on Reset, the cFE shall set the `` Event Message Output Ports to their `` default state: - -- Port Number 1: `` -- Port Number 2: `` -- Port Number 3: `` -- Port Number 4: `` -",Event Message Ports are customized for each platform. A rationale for all of the Power-on Reset requirements is that the cFE must initialize to a known state. EVS: Initialize Format On Power On Reset,cEVS3201,"Upon a Power-on Reset, the cFE shall set SB Event Format Mode to `` default mode.","Each mission must determine what format they need, defaulted to LONG." EVS: Initialize Full Flag To False On Power On Reset,cEVS3202,"_(OPTIONAL)_ Upon a Power-on Reset, the cFE shall set the Local Event Log Full Flag to false.",Set cFE to default status across Power-on Resets. EVS: Initialize Logging Mode On Power On Reset,cEVS3203,"_(OPTIONAL)_ Upon a Power-on Reset, the cFE shall set the Event Logging Mode to ``.",Set cFE to default status across Power-on Resets. EVS: Preserve Event Log Reset Mode On Processor Reset,cEVS3207,"_(OPTIONAL)_ Upon a Processor Reset, the cFE shall preserve the Event Logging Mode configuration parameter.",Try to retain mode across a processor reset. The contents of the Local Event Log will be preserved if the Event Logging Mode is configured to Discard. The contents of the Local Event Log may be overwritten (depending on the size and contents of the log prior to the reset) if the Event Logging Mode is configured to Overwrite. EVS: Preserve Log Full State On Processor Reset,cEVS3208,"_(OPTIONAL)_ Upon a Processor Reset, the cFE shall preserve the Local Event Log Full state.",Retain the cFE state across Processor Resets. -EVS: Set Logging Mode On Processor Reset,cEVS3209,"[DELETED]_(OPTIONAL)_ Upon a Processor Reset, the cFE shall set the Event Logging Mode to the `` value. - -TBD - doesn't match rationale",Retain the cFE state across Processor Resets. EVS: Preserve Log Overflow Counter On Processor Reset,cEVS3210,"_(OPTIONAL)_ Upon a Processor Reset, the cFE shall preserve the Local Event Log Overflow Counter.",Retain the cFE state across Processor Resets. -EVS: Support Message Ports,cEVS3300,"[DELETED]The cFE shall support `` Event Message Ports.",Since the number of Event Message Ports is hardware dependent a mission must be able to specify how many ports it will support. -EVS: Event Log Size,cEVS3301,"[DELETED]_(OPTIONAL)_ The cFE shall define a Local Event Log with a capacity of `` Event Messages.",Each mission's processor card memory capacities will dictate what is reasonable. -EVS: Event Filters Per App,cEVS3302,"[DELETED]The cFE shall support `` Event Message Filters per cFE Application.",Each cFE Application that register with EVS is allocated memory to support this limit. SB: NOOP Event,cSB4000,"Upon receipt of a Command, the cFE shall generate a NO-OP event message.",This command is useful as a general sub-system aliveness test. SB: Zero Counters,cSB4001,"Upon receipt of Command the cFE shall set to zero the following counters in housekeeping telemetry: @@ -381,9 +340,7 @@ SB: Invalid Command Counter,cSB4010,"Upon receipt of an invalid Command, the cFE SB: Enable Subscription Reporting,cSB4011,"Upon receipt of a Message, the cFE shall enable generation of a message when a subscription is received.",Subscription reporting intended for use by software bus network class of applications. SB: Disable Subscription Reporting,cSB4012,"Upon receipt of a Message, the cFE shall disable generation of a message when a subscription is received.",Subscription reporting intended for use by software bus network class of applications. SB: Send Previous Subscriptions,cSB4013,"Upon receipt of a Message, the cFE shall generation messages for current subscriptions.",Subscription reporting intended for use by software bus network class of applications. -SB: Zero Copy Message Transfer Mode,cSB4300,[DELETED]The cFE shall provide a zero-copy message transfer mode for intra-processor communication.,"The heritage software bus offered a zero-copy mode, it was used for transferring large packets from one application to another on the same processor. The cost of the zero-copy mode is a more complex application interface." SB: Create Pipe,cSB4301,"Upon receipt of a Request to create a Pipe, the cFE shall create a Pipe with the Request-specified Pipe Depth and the Request-specified name.",Run time creation of Pipes supports the cFE goals of easy Application integration and system reconfiguration. -SB: Delete Pipe,cSB4302,"Upon receipt of a Request to delete a Pipe, the cFE shall Unsubscribe all messages to the Request-specified Pipe, then remove the Pipe from the Routing Information.",An Application must be capable of freeing its own resources. SB: Subscribe To Message,cSB4303,"Upon receipt of a Request to Subscribe to an SB message, the cFE shall establish a route using the Request-specified Message ID, the Request-specified Pipe ID, the Request-specified MsgId-to-Pipe limit and the Request-specified QoS.",Run time subscription supports the cFE goals of easy system integration and run time reconfigurations. SB: Subscribe To Message - Duplicate,cSB4303.1,If the Subscription is a duplicate of a previous subscription then the cFE shall issue an event message.,"Duplicate subscriptions are still a success, however, want to notify the ground." SB: Unsubscribe To Message,cSB4304,"Upon receipt of a Request to Unsubscribe to an SB Message, the cFE shall remove the route corresponding to the Request-specified Message Id and the Request-specified Pipe Id from the Routing Information.","Allow an Application to dynamically change what Messages it receives. Since the ground can manipulate the state of the routing, it is not considered an error if the Message is not currently being subscribed to when an unsubscribe request is made." @@ -400,7 +357,6 @@ SB: Receive Message With Timeout,cSB4307,"Upon receipt of a Request to receive a " SB: Receive Message Infinite Timeout,cSB4308,"Upon receipt of a Request to receive a SB Message from a Pipe with an infinite timeout, the cFE shall suspend execution of the Application until a SB Message is present on the Pipe.",This mode of receiving has been the most commonly used mode on the heritage SB. SB: Last Message Sender Info,cSB4309,"Upon receipt of a Request, the cFE shall provide sender information for the last message received on an Application's Pipe.","Heritage SB did a 'valid senders check' before delivering a packet to a pipe. Since the cFE supports a dynamic environment and the sender of a packet is somewhat unknown, the cFE must provide a means for the application to do the 'valid sender check'." -SB: Free App Resources,cSB4310,[DELETED]Upon receipt of Request the cFE shall free resources allocation for the specified Application.,"Need to be able to remove all resources associated with an application when Deleting, Restarting or Reloading an Application. In addition, this is required as part of a Processor Reset." SB: Get Message ID,cSB4311,"Upon receipt of a Request, the cFE shall provide the message ID of the requested message.",Message management utility. SB: Set Message ID,cSB4312,"Upon receipt of a Request, the cFE shall set the received message with the received message ID.",Message management utility. SB: Get Message String,cSB4313,"Upon receipt of a Request, the cFE shall provide the requested string from the requested message.",Message management utility. @@ -436,13 +392,10 @@ SB: Zero Copy Get Pointer,cSB4340,"Upon receipt of a Request, the cFE shall prov SB: Zero Copy Release Pointer,cSB4341,"Upon receipt of a Request, the cFE shall release the requested zero copy pointer.",Zero copy message passing support for reduced overhead at the cost of additional pointer management. SB: Zero Copy Send Message,cSB4342,"Upon receipt of a Request, the cFE shall route the requested zero copy message to all subscribed pipes.",Zero copy message passing support for reduced overhead at the cost of additional pointer management. SB: Zero Copy Pass Message,cSB4343,"Upon receipt of a Request, the cFE shall route the requested zero copy message to all subscribed pipes without updating the message sequence counter.",Zero copy message passing support for reduced overhead at the cost of additional pointer management. +SB: Get Packet Type,cSB4344,"Upon receipt of a Request, the CFE shall provide the message packet type.",Provides abstraction for apps to get the packet type (command or telemetry). +SB: Validate Message ID,cSB4345,"Upon receipt of a Request, the cFE shall provide the validation status of the message ID.",Provides abstraction for apps to validate a message ID. SB: Initialize Routing On Power On Reset,cSB4500,Upon a Power-on Reset the cFE shall initialize the Routing Information and clear all error counters.,The cFE must initialize to a known state. SB: Initialize Routing On Processor Reset,cSB4501,Upon a Processor Reset the cFE shall initialize the Routing Information and clear all error counters,The cFE must initialize to a known state. -SB: Maximum Message IDs,cSB4700,"[DELETED]The cFE shall support a maximum of `` Message ID's.",Allow a mission to scale the number of messages it can process to reduce SB memory usage. A maximum is specified to yield an efficient design. 1024 was chosen as the default based on the message count of previous missions. -SB: Maximum Message Size,cSB4701,"[DELETED]The cFE shall support a `` bytes maximum system packet size.",The cFE must have some protection in the event that the packet length field of a sender's packet becomes corrupted or is invalid. -SB: Maximum Destinations,cSB4704,"[DELETED]The cFE shall support a maximum of `` Destinations for a Message ID.",Allow a mission to scale the number of destinations per message ID to reduce memory requirements. A maximum is specified to yield an efficient design. The default of 16 is used in the heritage SB. -SB: Maximum Pipes,cSB4705,"[DELETED]The cFE shall support a maximum of `` Pipes per processor.",Allow a mission to scale the number of Pipes to reduce memory requirements. The default of 255 allows a single byte to be used for the pipe id. -SB: Maximum Pipe Depth,cSB4706,"The cFE shall support a maximum Pipe depth of `` SB Messages.",Allow a mission to scale the Pipe depth to reduce memory requirements. The default of 65535 is a power of 2 which may simplify implementation and based on recent missions 64 SB Messages is more than adequate. TBL: Load Inactive Table From File,cTBL6000,Upon receipt of Command the cFE shall load an Inactive Table Image with the contents of the Command specified File.,Loading from a file allows for multiple versions of a table to be stored on board and loaded to the active table when appropriate. The file header will identify the Table that the file contents are for. TBL: Load Inactive Table From File - Partial Load,cTBL6000.1,"If the Command specified file's header indicates that the file contains only a portion of the Table, the cFE shall first load an Inactive Table Image with the contents of the Active Table Image and then load the contents of the Command specified File.","A Partial Table load capability is useful when dealing with large Tables. It helps to ensure that additional parameters are not unintentionally modified, reduces command time required to perform a Table update and is a feature that has been used on previous missions." TBL: Load Inactive Table From File - Greater Than Max Size,cTBL6000.2,If the number of data bytes contained in the file is greater than the maximum size of the table then the load shall be aborted and an event message shall be generated.,This is a sanity check to make sure that the ground generated table load does not include more data than a table can handle. @@ -454,7 +407,7 @@ TBL: Validate,cTBL6002,Upon receipt of Command the cFE shall determine the valid TBL: Validate - Compute Data Integrity Check Value,cTBL6002.1,The cFE shall compute a Data Integrity Check Value on the contents of either the Active or Inactive Table Image of the Command specified Table and report the result in telemetry.,A Data Integrity Check Value can provide a quick method of validating the proper contents of a Table without performing a Table Dump and Comparison. TBL: Validate - App Content,cTBL6002.2,The cFE shall Request an Application to validate the contents of either the Active or Inactive Table Image of the Command specified Table and report the result in telemetry.,A Table Validation function provided by the Application can verify that the data content of a Table are reasonable. TBL: Activate,cTBL6003,Upon receipt of Command the cFE shall make an Inactive Table Image of the Command specified Table the Active Table Image.,"A Commit Command is useful by allowing modifications and the verification of those modifications to be accomplished in the background while an Application continues to use its previous Table data. Then, upon Command, the new Table data is made Active." -TBL: Activate - Validate,cTBL6003.1,"If a Table Validation Function exists for the specified Table, the Inactive Table Image shall be validated.",Validation functions are there for a reason so want to prevent loading invalid tables. Inactive buffer retains the data so that the ground can dump the contents to see why the validation failed. +TBL: Activate - Validate,cTBL6003.1,The cFE shall reject an activate table command for a table that has a validation function but has not been validated.,Validation functions are there for a reason so want to prevent loading invalid tables. Inactive buffer retains the data so that the ground can dump the contents to see why the validation failed. TBL: Activate - Validate - Failure,cTBL6003.1.1,If the Inactive Table Image fails validation then the Inactive Table Image shall not be loaded into the Active Table Image.,Prevent loading of an invalid table. Note that the Inactive Table still contains the table image so that the ground can dump it. TBL: Activate - Validate - No Validation Function,cTBL6003.1.2,"If a Table Validation Function does not exist for the specified Table, the Table shall be considered valid.",If there is no validation function then assume the table has good data in it (no way to check otherwise). TBL: Write Table Registry To File,cTBL6005,Upon receipt of Command the cFE shall write the contents of the Table Registry to a file.,"The Table Registry will provide a list of the Tables currently registered, their attributes (double or single-buffered, dump-only, etc), a history of what files were last loaded into the Active Table Images, what time the load occurred and whether the image has been modified via Partial Table Load." @@ -496,7 +449,6 @@ TBL: Delete CDS - Not Critical Table,cTBL6013.2,If the specified table is not a TBL: Delete CDS - Already Deleted,cTBL6013.3,If the specified Table CDS has already been deleted the command shall be rejected and an event message generated.,Reject if table CDS has already been deleted. TBL: Create,cTBL6300,"Upon receipt of Request, the cFE shall create a zero filled Table Image with the Request specified name, size, buffering characteristics (single or double-buffer), dump-only characteristics, criticality and Table Validation Function address.","Supports the cFE's dynamic Application model. Tables will be able to be either single or double-buffered. Double-buffering will allow instantaneous updates from the Application's point of view and will be useful for interrupt service routines, etc. However, double-buffering will consume more memory resources. The Table Validation Function is optionally provided by the Application and is called when a Command to Validate the table is made. Note that a zero filled image will not be created if the Application specifies an address for the dump-only table (see cTBL6300.1)." TBL: Create - App Supplied Address For Dump Only,cTBL6300.1,The cFE shall allow an Application to specify an address as the one and only buffer for a dump-only Table.,"Heritage code allowed for dump only tables to come from an address instead of a true table. In this case, table services does not allocate any memory for the dump only table. This is referred to an an Application-Defined-Address-Table." -TBL: Free App Resources,cTBL6301,"[DELETED]Upon receipt of Request, the cFE shall free the resources associated the Request specified Application.","When an Application exits prematurely, the cFE requires a mechanism to free resources allocated to that Application." TBL: Initialize Contents,cTBL6302,"Upon receipt of Request, the cFE shall initialize the contents of the Request specified Table Image with the contents of the Request specified File.",Supports the cFE's dynamic Application model. TBL: Initialize Contents - Greater Than Max Size,cTBL6302.1,"If the Request specified File contains more data than the size of the Request specified Table, the Table Image will not be initialized and an Event Message shall be generated.","If a File contains more data than memory allows, there is a high likelihood that the Application is expecting the data to be in a different format. Additionally, the cFE would not know whether to throw out the last part or the first part of the data." TBL: Initialize Contents - Partial,cTBL6302.2,"If the Request specified File contains less data than the size of the Request specified Table, the first portion of the Table Image will be initialized with the contents of the File and an Event Message shall be generated.",Some tables may allocate more space than is necessary at all times. The Event Message will serve as a warning but not prevent the initialization of the Table. @@ -542,8 +494,6 @@ TBL: Manage,cTBL6316,"Upon receipt of a Request, the cFE shall perform the follo TBL: Free Resources On Power On Reset,cTBL6500,Upon a Power-on Reset all Table resources shall be freed.,The Table Service cannot assume the contents of any Table is legitimate after a reset. TBL: Free Resources On Processor Reset,cTBL6501,Upon a Processor Reset all Table resources shall be freed.,The Table Service cannot assume the contents of any Table is legitimate after a reset. TBL: Free Resources On Processor Reset - Preserve Critical,cTBL6501.1,If the Table is a critical table then the contents of the Table shall be preserved.,Goal of a processor reset is preserve certain data to facilitate recovery. -TBL: Maximum Tables,cTBL6700,"[DELETED]The cFE shall support `` Tables.",Each mission's processor card memory capacities will dictate what is reasonable. -TBL: Maximum Simultaneous Loads and Dumps,cTBL6701,"[DELETED]The cFE shall support Single-Buffer Table Loads and Application-Defined-Address-Table dumps simultaneously. ","It is desirable to allow for Tables to be modified by ground command while other Tables are be being modified autonomously by on board software (i.e. stored command processor, etc). This limit represents the total supported for the combined number of Single-Buffer and Application-Defined-Address-Table Tables being loaded." TIME: Housekeeping Message,cTIME2000,"Upon receipt of a Message, the cFE shall generate a housekeeping message that includes the following Time Services items: - Time Status @@ -560,7 +510,6 @@ TIME: Set STCF,cTIME2006,Upon receipt of Command the cFE shall set the STCF to t TIME: Update STCF Given Current Time,cTIME2007,Upon receipt of Command the cFE shall compute a new value for STCF using the Command-specified value as current time.,"This command provides a useful alternative to setting the STCF explicitly, as the command does not require knowledge of the current MET value. If the default time format is TAI then the new value for STCF is the Command-specified time value less MET." -TIME: Adjust STCF,cTIME2008,[DELETED]Upon receipt of Command the cFE shall make a one time delta adjustment to the STCF by the Command-specified value.,"It is common to set the clock as a delta adjustment from the current time value. The commanded value is signed so a positive or negative adjustment may be made. Note, there's no need for a command to apply a 'large' adjustment over a command-spec." TIME: Delta Adjust STCF,cTIME2009,Upon receipt of Command the cFE shall make a continuous 1Hz delta adjustment to the STCF by the Command-specified value.,"Upon receipt of a Command to make a 'continuous' adjustment to the STCF, the cFE shall adjust the STCF each second by the Command-specified value. The commanded value is signed so a positive or negative adjustment may be made." TIME: Switch Tone Signal Source,cTIME2010,Upon receipt of Command the cFE shall switch to the Command-specified Tone Signal source.,"The behavior of this command is hardware specific, but provides the capability to command Tone Signal source selection if implemented at the hardware level." TIME: Diagnostic Message,cTIME2011,Upon receipt of Command the cFE shall generate a Software Bus message that includes time diagnostic information.,"When testing or debugging the time application, more details about time services are required." @@ -618,6 +567,3 @@ TIME: CDS Elements,cTIME2700,"During normal operation, the cFE shall preserve th - STCF - Leap Seconds - MET",Time is a critical system resource and every effort should be made to preserve it. Preserving time allows applications to 'fly through' resets. -TIME: Time At Tone Window,cTIME2701,[DELETED]The cFE Time Services Server shall send a time at the tone Software Bus message within a `` period of time preceding or following the tone.,"The primary purpose of a time server is to distribute time updates to time clients. Although the time tone is generally a 1PPS signal, there is no cFE restriction on the frequency of the tone. Also, there is no cFE restriction on whether the ""time at the tone"" message precedes or follows the tone." -TIME: Update MET,cTIME2702,[DELETED]The cFE Time Services Server shall update its MET using the timer hardware interface defined in the cFE Application Developer's Guide.,Every mission needs an MET and using a cFE-defined software interface to the timer hardware driver makes the Time Services portable. -TIME: MET Resolution,cTIME2703,[DELETED]The cFE shall define a MET with a `` resolution.,"The resolution (clock ticks per second) is hardware dependent. Since no other cFE component places any constraints on the resolution this requirement is not bounded with a minimum. However, both the maximum number of MET seconds and the resolution of sub-seconds are both restricted to a value that can be stored as an unsigned 32 bit integer." From f18a935e78653bda26b86b342a4972d770692cef Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Tue, 16 Jun 2020 16:04:59 -0400 Subject: [PATCH 4/8] Fix #778, Add CFE_Assert library and test module Provides ability to load UT assert as a CFE app, and an example of using this to test some basic CFE ES functions. --- cmake/arch_build.cmake | 1 - cmake/mission_defaults.cmake | 7 ++ modules/cfe_assert/CMakeLists.txt | 12 ++ modules/cfe_assert/inc/cfe_assert.h | 63 +++++++++++ modules/cfe_assert/src/cfe_assert_io.c | 137 +++++++++++++++++++++++ modules/cfe_assert/src/cfe_assert_main.c | 135 ++++++++++++++++++++++ modules/cfe_test/CMakeLists.txt | 8 ++ modules/cfe_test/src/cfe_test.c | 45 ++++++++ modules/cfe_test/src/cfe_test.h | 45 ++++++++ modules/cfe_test/src/es_test.c | 46 ++++++++ 10 files changed, 498 insertions(+), 1 deletion(-) create mode 100644 modules/cfe_assert/CMakeLists.txt create mode 100644 modules/cfe_assert/inc/cfe_assert.h create mode 100644 modules/cfe_assert/src/cfe_assert_io.c create mode 100644 modules/cfe_assert/src/cfe_assert_main.c create mode 100644 modules/cfe_test/CMakeLists.txt create mode 100644 modules/cfe_test/src/cfe_test.c create mode 100644 modules/cfe_test/src/cfe_test.h create mode 100644 modules/cfe_test/src/es_test.c diff --git a/cmake/arch_build.cmake b/cmake/arch_build.cmake index db99d03e9..d3b98d4d3 100644 --- a/cmake/arch_build.cmake +++ b/cmake/arch_build.cmake @@ -215,7 +215,6 @@ function(add_unit_test_exe UT_NAME UT_SRCS) add_test(${UT_NAME} ${UT_NAME}) endfunction(add_unit_test_exe) - ################################################################## # # FUNCTION: cfe_exec_do_install diff --git a/cmake/mission_defaults.cmake b/cmake/mission_defaults.cmake index 8f49d54d5..59cf835a4 100644 --- a/cmake/mission_defaults.cmake +++ b/cmake/mission_defaults.cmake @@ -45,3 +45,10 @@ set(MISSION_MODULE_SEARCH_PATH set(cfe-core_SEARCH_PATH "cfe/fsw") set(osal_SEARCH_PATH ".") set(psp_SEARCH_PATH ".") + +# If ENABLE_UNIT_TEST is enabled, then include the cfe_assert library in +# all targets. This can still be overridden in targets.cmake. +if (ENABLE_UNIT_TESTS) + list(APPEND MISSION_GLOBAL_APPLIST cfe_assert cfe_test) +endif (ENABLE_UNIT_TESTS) + diff --git a/modules/cfe_assert/CMakeLists.txt b/modules/cfe_assert/CMakeLists.txt new file mode 100644 index 000000000..1b4602170 --- /dev/null +++ b/modules/cfe_assert/CMakeLists.txt @@ -0,0 +1,12 @@ +project(CFE_ASSERT C) + +include_directories("${CFE_ASSERT_SOURCE_DIR}/inc") +include_directories("${UT_ASSERT_SOURCE_DIR}/inc") + +# Create the app module +add_cfe_app(cfe_assert + src/cfe_assert_io.c + src/cfe_assert_main.c + $ +) + diff --git a/modules/cfe_assert/inc/cfe_assert.h b/modules/cfe_assert/inc/cfe_assert.h new file mode 100644 index 000000000..8dde70a4f --- /dev/null +++ b/modules/cfe_assert/inc/cfe_assert.h @@ -0,0 +1,63 @@ +/************************************************************************* +** +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +** +** File: cfe_assert.h +** +** Purpose: +** Specification for the CFE assert (UT assert wrapper) functions. +** +*************************************************************************/ +#ifndef cfe_assert_h_ +#define cfe_assert_h_ + +/************************************************************************ +** Includes +*************************************************************************/ +#include + +/************************************************************************ +** Type Definitions +*************************************************************************/ + +/************************************************************************* +** Exported Functions +*************************************************************************/ + +/************************************************************************/ +/** \brief Application Entry Point Function +** +** \par Description +** This function should be specified in the cfe_es_startup.scr file +** as part of starting this application. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \return Execution status, see \ref CFEReturnCodes +** +** +*************************************************************************/ +void CFE_Assert_AppMain(void); + +#endif /* cfe_assert_h_ */ + +/************************/ +/* End of File Comment */ +/************************/ diff --git a/modules/cfe_assert/src/cfe_assert_io.c b/modules/cfe_assert/src/cfe_assert_io.c new file mode 100644 index 000000000..85fe44932 --- /dev/null +++ b/modules/cfe_assert/src/cfe_assert_io.c @@ -0,0 +1,137 @@ +/************************************************************************* +** +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +** +** File: cfe_assert_io.c +** +** Purpose: +** Implementation of the CFE assert (UT assert wrapper) functions. +** +*************************************************************************/ + +#include +#include +#include +#include + +#include + +#include "utbsp.h" +#include "uttest.h" + +/* +** Local Variables +*/ +typedef struct +{ + uint32 CurrVerbosity; +} BSP_UT_GlobalData_t; + +BSP_UT_GlobalData_t BSP_UT_Global; + +void UT_BSP_Setup(void) +{ + BSP_UT_Global.CurrVerbosity = (2 << UTASSERT_CASETYPE_PASS) - 1; + UT_BSP_DoText(UTASSERT_CASETYPE_BEGIN, "CFE FUNCTIONAL TEST"); +} + +void UT_BSP_StartTestSegment(uint32 SegmentNumber, const char *SegmentName) +{ + char ReportBuffer[128]; + + snprintf(ReportBuffer, sizeof(ReportBuffer), "%02u %s", (unsigned int)SegmentNumber, SegmentName); + UT_BSP_DoText(UTASSERT_CASETYPE_BEGIN, ReportBuffer); +} + +void UT_BSP_DoText(uint8 MessageType, const char *OutputMessage) +{ + const char *Prefix; + uint32 MsgEnabled = BSP_UT_Global.CurrVerbosity >> MessageType; + + if (MsgEnabled & 1) + { + switch (MessageType) + { + case UTASSERT_CASETYPE_ABORT: + Prefix = "ABORT"; + break; + case UTASSERT_CASETYPE_FAILURE: + Prefix = "FAIL"; + break; + case UTASSERT_CASETYPE_MIR: + Prefix = "MIR"; + break; + case UTASSERT_CASETYPE_TSF: + Prefix = "TSF"; + break; + case UTASSERT_CASETYPE_TTF: + Prefix = "TTF"; + break; + case UTASSERT_CASETYPE_NA: + Prefix = "N/A"; + break; + case UTASSERT_CASETYPE_BEGIN: + Prefix = "BEGIN"; + break; + case UTASSERT_CASETYPE_END: + Prefix = "END"; + break; + case UTASSERT_CASETYPE_PASS: + Prefix = "PASS"; + break; + case UTASSERT_CASETYPE_INFO: + Prefix = "INFO"; + break; + case UTASSERT_CASETYPE_DEBUG: + Prefix = "DEBUG"; + break; + default: + Prefix = "OTHER"; + break; + } + + CFE_ES_WriteToSysLog("[%5s] %s\n", Prefix, OutputMessage); + } + + /* + * If any ABORT (major failure) message is thrown, + * then call a BSP-provided routine to stop the test and possibly dump a core + */ + if (MessageType == UTASSERT_CASETYPE_ABORT) + { + OS_TaskExit(); + } +} + +void UT_BSP_EndTest(const UtAssert_TestCounter_t *TestCounters) +{ + /* + * Only output a "summary" if there is more than one test Segment. + * Otherwise it is a duplicate of the report already given. + */ + if (TestCounters->TestSegmentCount > 1) + { + UtAssert_DoTestSegmentReport("SUMMARY", TestCounters); + } + + CFE_ES_WriteToSysLog("TEST COMPLETE: %u tests Segment(s) executed\n\n", + (unsigned int)TestCounters->TestSegmentCount); + + OS_TaskExit(); +} diff --git a/modules/cfe_assert/src/cfe_assert_main.c b/modules/cfe_assert/src/cfe_assert_main.c new file mode 100644 index 000000000..d488be8ec --- /dev/null +++ b/modules/cfe_assert/src/cfe_assert_main.c @@ -0,0 +1,135 @@ +/************************************************************************* +** +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +** +** File: cfe_assert_main.c +** +** Purpose: +** Implementation of the CFE assert (UT assert wrapper) functions. +** +*************************************************************************/ + +/* + * Includes + */ + +#include + +#include "cfe_assert.h" + +#include "uttest.h" +#include "utbsp.h" + +/* + * The maximum amount of time that the application will delay to + * wait for other apps to complete startup before running the tests. + * + * The value is in milliseconds. Normally this shouldn't be more than + * a second or two for apps to all reach their respective main loop(s). + */ +#define CFE_ASSERT_MAX_STARTUP_WAIT 30000 + +/* + * Small Extra delay before starting tests. + * + * This is not strictly necessary, but it does give a bit of time for other apps + * to settle their final syslog writes/events such that they will not be intermixed + * with test messages in the syslog. + * + * The value is in milliseconds. + */ +#define CFE_ASSERT_START_DELAY 4000 + + +/* + * Entry point for this application + */ +void CFE_Assert_AppMain(void) +{ + int32 rc; + uint32 RunStatus; + + /* + ** Register the app with Executive services + */ + rc = CFE_ES_RegisterApp(); + if (rc != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("Error in CFE_ES_RegisterApp(): %08lx\n", (unsigned long)rc); + return; + } + + UtTest_EarlyInit(); + UT_BSP_Setup(); + + /* + * Start a test case for all startup logic. + * + * Test libs may use assert statements within their init function and these + * will be reported as a "startup" test case. + */ + UtAssert_BeginTest("CFE-STARTUP"); + + /* + * Delay until the system reaches "operational" state -- this is when all libs have initialized + * and all apps have reached their RunLoop. + */ + rc = CFE_ES_WaitForSystemState(CFE_ES_SystemState_OPERATIONAL, CFE_ASSERT_MAX_STARTUP_WAIT); + if (rc != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("Error while waiting for OPERATIONAL state: %08lx\n", (unsigned long)rc); + return; + } + + /* + * Startup Phase has ended. + */ + UtAssert_EndTest(); + + /* + * Note - in a normal app this would be a while loop, + * but is just an "if" right now as it only runs once. + * + * A future enhancement to this app might be to create an SB pipe + * and execute tests based on the receipt of a command to do so. + * + * For now, it just works in a one-shot mode to run tests that were + * registered during startup, then it self-exits. + */ + RunStatus = CFE_ES_RunStatus_APP_RUN; + if(CFE_ES_RunLoop(&RunStatus)) + { + OS_TaskDelay(CFE_ASSERT_START_DELAY); + + /* + * Run all registered test cases. + */ + UtTest_Run(); + + /* + * Exit the main task. + */ + RunStatus = CFE_ES_RunStatus_APP_EXIT; + } + + + CFE_ES_ExitApp(RunStatus); +} + + diff --git a/modules/cfe_test/CMakeLists.txt b/modules/cfe_test/CMakeLists.txt new file mode 100644 index 000000000..4f6353434 --- /dev/null +++ b/modules/cfe_test/CMakeLists.txt @@ -0,0 +1,8 @@ +include_directories("${CFE_ASSERT_SOURCE_DIR}/inc") +include_directories("${UT_ASSERT_SOURCE_DIR}/inc") + +# Create the app module +add_cfe_app(cfe_test + src/cfe_test.c + src/es_test.c +) diff --git a/modules/cfe_test/src/cfe_test.c b/modules/cfe_test/src/cfe_test.c new file mode 100644 index 000000000..fe5842928 --- /dev/null +++ b/modules/cfe_test/src/cfe_test.c @@ -0,0 +1,45 @@ +/************************************************************************* +** +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +** +** File: cfe_test.c +** +** Purpose: +** Initialization routine for CFE functional test +** Demonstration of how to register and use the UT assert functions. +** +*************************************************************************/ + +/* + * Includes + */ + +#include "cfe_test.h" + +/* + * Initialization function + * Register this test routine with CFE Assert + */ +int32 CFE_Test_Init(int32 LibId) +{ + UtTest_Add(ES_Test_AppId, NULL, NULL, "ES AppID"); + return CFE_SUCCESS; +} + + diff --git a/modules/cfe_test/src/cfe_test.h b/modules/cfe_test/src/cfe_test.h new file mode 100644 index 000000000..77acd1e8a --- /dev/null +++ b/modules/cfe_test/src/cfe_test.h @@ -0,0 +1,45 @@ +/************************************************************************* +** +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +** +** File: cfe_test.c +** +** Purpose: +** Initialization routine for CFE functional test +** Demonstration of how to register and use the UT assert functions. +** +*************************************************************************/ + +#ifndef CFE_TEST_H +#define CFE_TEST_H + +/* + * Includes + */ + +#include + +#include "uttest.h" +#include "utassert.h" + +void ES_Test_AppId(void); +int32 CFE_Test_Init(int32 LibId); + + +#endif /* CFE_TEST_H */ diff --git a/modules/cfe_test/src/es_test.c b/modules/cfe_test/src/es_test.c new file mode 100644 index 000000000..632b084aa --- /dev/null +++ b/modules/cfe_test/src/es_test.c @@ -0,0 +1,46 @@ +/************************************************************************* +** +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +** +** File: es_test.c +** +** Purpose: +** Functional test of basic ES APIs +** +** Demonstration of how to register and use the UT assert functions. +** +*************************************************************************/ + +/* + * Includes + */ + +#include "cfe_test.h" + + +void ES_Test_AppId(void) +{ + uint32 AppId; + char AppNameBuf[OS_MAX_API_NAME+4]; + + UtAssert_INT32_EQ(CFE_ES_GetAppID(&AppId), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_ES_GetAppName(AppNameBuf, AppId, sizeof(AppNameBuf)), CFE_SUCCESS); + UtAssert_StrCmp(AppNameBuf, "ASSERT_APP", "CFE_ES_GetAppName() returned ASSERT_APP"); +} + From 40166053ccf941943bc8214414cc3de687b9f6bb Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Tue, 11 Aug 2020 15:37:45 -0400 Subject: [PATCH 5/8] Update #778: Apply whitespace rules to new code --- cmake/arch_build.cmake | 1 + modules/cfe_assert/src/cfe_assert_io.c | 14 +++++++------- modules/cfe_assert/src/cfe_assert_main.c | 12 ++++-------- modules/cfe_test/src/cfe_test.c | 2 -- modules/cfe_test/src/cfe_test.h | 3 +-- modules/cfe_test/src/es_test.c | 4 +--- 6 files changed, 14 insertions(+), 22 deletions(-) diff --git a/cmake/arch_build.cmake b/cmake/arch_build.cmake index d3b98d4d3..db99d03e9 100644 --- a/cmake/arch_build.cmake +++ b/cmake/arch_build.cmake @@ -215,6 +215,7 @@ function(add_unit_test_exe UT_NAME UT_SRCS) add_test(${UT_NAME} ${UT_NAME}) endfunction(add_unit_test_exe) + ################################################################## # # FUNCTION: cfe_exec_do_install diff --git a/modules/cfe_assert/src/cfe_assert_io.c b/modules/cfe_assert/src/cfe_assert_io.c index 85fe44932..5c01213c3 100644 --- a/modules/cfe_assert/src/cfe_assert_io.c +++ b/modules/cfe_assert/src/cfe_assert_io.c @@ -62,23 +62,23 @@ void UT_BSP_StartTestSegment(uint32 SegmentNumber, const char *SegmentName) void UT_BSP_DoText(uint8 MessageType, const char *OutputMessage) { const char *Prefix; - uint32 MsgEnabled = BSP_UT_Global.CurrVerbosity >> MessageType; + uint32 MsgEnabled = BSP_UT_Global.CurrVerbosity >> MessageType; if (MsgEnabled & 1) { switch (MessageType) { case UTASSERT_CASETYPE_ABORT: - Prefix = "ABORT"; + Prefix = "ABORT"; break; case UTASSERT_CASETYPE_FAILURE: - Prefix = "FAIL"; + Prefix = "FAIL"; break; case UTASSERT_CASETYPE_MIR: - Prefix = "MIR"; + Prefix = "MIR"; break; case UTASSERT_CASETYPE_TSF: - Prefix = "TSF"; + Prefix = "TSF"; break; case UTASSERT_CASETYPE_TTF: Prefix = "TTF"; @@ -93,7 +93,7 @@ void UT_BSP_DoText(uint8 MessageType, const char *OutputMessage) Prefix = "END"; break; case UTASSERT_CASETYPE_PASS: - Prefix = "PASS"; + Prefix = "PASS"; break; case UTASSERT_CASETYPE_INFO: Prefix = "INFO"; @@ -131,7 +131,7 @@ void UT_BSP_EndTest(const UtAssert_TestCounter_t *TestCounters) } CFE_ES_WriteToSysLog("TEST COMPLETE: %u tests Segment(s) executed\n\n", - (unsigned int)TestCounters->TestSegmentCount); + (unsigned int)TestCounters->TestSegmentCount); OS_TaskExit(); } diff --git a/modules/cfe_assert/src/cfe_assert_main.c b/modules/cfe_assert/src/cfe_assert_main.c index d488be8ec..eb8e65652 100644 --- a/modules/cfe_assert/src/cfe_assert_main.c +++ b/modules/cfe_assert/src/cfe_assert_main.c @@ -43,7 +43,7 @@ * The value is in milliseconds. Normally this shouldn't be more than * a second or two for apps to all reach their respective main loop(s). */ -#define CFE_ASSERT_MAX_STARTUP_WAIT 30000 +#define CFE_ASSERT_MAX_STARTUP_WAIT 30000 /* * Small Extra delay before starting tests. @@ -54,15 +54,14 @@ * * The value is in milliseconds. */ -#define CFE_ASSERT_START_DELAY 4000 - +#define CFE_ASSERT_START_DELAY 4000 /* * Entry point for this application */ void CFE_Assert_AppMain(void) { - int32 rc; + int32 rc; uint32 RunStatus; /* @@ -113,7 +112,7 @@ void CFE_Assert_AppMain(void) * registered during startup, then it self-exits. */ RunStatus = CFE_ES_RunStatus_APP_RUN; - if(CFE_ES_RunLoop(&RunStatus)) + if (CFE_ES_RunLoop(&RunStatus)) { OS_TaskDelay(CFE_ASSERT_START_DELAY); @@ -128,8 +127,5 @@ void CFE_Assert_AppMain(void) RunStatus = CFE_ES_RunStatus_APP_EXIT; } - CFE_ES_ExitApp(RunStatus); } - - diff --git a/modules/cfe_test/src/cfe_test.c b/modules/cfe_test/src/cfe_test.c index fe5842928..d9606b9eb 100644 --- a/modules/cfe_test/src/cfe_test.c +++ b/modules/cfe_test/src/cfe_test.c @@ -41,5 +41,3 @@ int32 CFE_Test_Init(int32 LibId) UtTest_Add(ES_Test_AppId, NULL, NULL, "ES AppID"); return CFE_SUCCESS; } - - diff --git a/modules/cfe_test/src/cfe_test.h b/modules/cfe_test/src/cfe_test.h index 77acd1e8a..45f98e890 100644 --- a/modules/cfe_test/src/cfe_test.h +++ b/modules/cfe_test/src/cfe_test.h @@ -38,8 +38,7 @@ #include "uttest.h" #include "utassert.h" -void ES_Test_AppId(void); +void ES_Test_AppId(void); int32 CFE_Test_Init(int32 LibId); - #endif /* CFE_TEST_H */ diff --git a/modules/cfe_test/src/es_test.c b/modules/cfe_test/src/es_test.c index 632b084aa..93ed3e840 100644 --- a/modules/cfe_test/src/es_test.c +++ b/modules/cfe_test/src/es_test.c @@ -33,14 +33,12 @@ #include "cfe_test.h" - void ES_Test_AppId(void) { uint32 AppId; - char AppNameBuf[OS_MAX_API_NAME+4]; + char AppNameBuf[OS_MAX_API_NAME + 4]; UtAssert_INT32_EQ(CFE_ES_GetAppID(&AppId), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_ES_GetAppName(AppNameBuf, AppId, sizeof(AppNameBuf)), CFE_SUCCESS); UtAssert_StrCmp(AppNameBuf, "ASSERT_APP", "CFE_ES_GetAppName() returned ASSERT_APP"); } - From fa9c25360eb618d514d63539d8dbc3ef3a374307 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Fri, 14 Aug 2020 13:15:30 -0400 Subject: [PATCH 6/8] Fix #778, Add CFE_Assert library and test module Provides ability to load UT assert as a CFE app, and an example of using this to test some basic CFE ES functions. This introduces a separate library for the basic UT assert functions (cfe_assert) and an app that executes the test (cfe_testrunner) rather than combining these into a single module. --- cmake/mission_defaults.cmake | 7 + docs/README_functionaltest.md | 40 +++++ modules/cfe_assert/CMakeLists.txt | 12 ++ modules/cfe_assert/inc/cfe_assert.h | 63 ++++++++ modules/cfe_assert/src/cfe_assert_init.c | 56 +++++++ modules/cfe_assert/src/cfe_assert_io.c | 137 ++++++++++++++++++ modules/cfe_testcase/CMakeLists.txt | 8 + modules/cfe_testcase/src/cfe_test.c | 43 ++++++ modules/cfe_testcase/src/cfe_test.h | 44 ++++++ modules/cfe_testcase/src/es_test.c | 44 ++++++ modules/cfe_testrunner/CMakeLists.txt | 10 ++ modules/cfe_testrunner/inc/cfe_testrunner.h | 63 ++++++++ .../cfe_testrunner/src/cfe_testrunner_main.c | 120 +++++++++++++++ 13 files changed, 647 insertions(+) create mode 100644 docs/README_functionaltest.md create mode 100644 modules/cfe_assert/CMakeLists.txt create mode 100644 modules/cfe_assert/inc/cfe_assert.h create mode 100644 modules/cfe_assert/src/cfe_assert_init.c create mode 100644 modules/cfe_assert/src/cfe_assert_io.c create mode 100644 modules/cfe_testcase/CMakeLists.txt create mode 100644 modules/cfe_testcase/src/cfe_test.c create mode 100644 modules/cfe_testcase/src/cfe_test.h create mode 100644 modules/cfe_testcase/src/es_test.c create mode 100644 modules/cfe_testrunner/CMakeLists.txt create mode 100644 modules/cfe_testrunner/inc/cfe_testrunner.h create mode 100644 modules/cfe_testrunner/src/cfe_testrunner_main.c diff --git a/cmake/mission_defaults.cmake b/cmake/mission_defaults.cmake index 8f49d54d5..43818473a 100644 --- a/cmake/mission_defaults.cmake +++ b/cmake/mission_defaults.cmake @@ -45,3 +45,10 @@ set(MISSION_MODULE_SEARCH_PATH set(cfe-core_SEARCH_PATH "cfe/fsw") set(osal_SEARCH_PATH ".") set(psp_SEARCH_PATH ".") + +# If ENABLE_UNIT_TEST is enabled, then include the cfe_assert library in +# all targets. This can still be overridden in targets.cmake. +if (ENABLE_UNIT_TESTS) + list(APPEND MISSION_GLOBAL_APPLIST cfe_assert cfe_testrunner cfe_testcase) +endif (ENABLE_UNIT_TESTS) + diff --git a/docs/README_functionaltest.md b/docs/README_functionaltest.md new file mode 100644 index 000000000..027e9f757 --- /dev/null +++ b/docs/README_functionaltest.md @@ -0,0 +1,40 @@ +# Mini-HOWTO guide for running CFE functional tests + +This version of CFE includes additional modular libraries and an application +to execute functional tests within an unmodified CFE environment. These are +distinct from the unit tests, which are executed separately from CFE in a +confined (non-CFE, test-specific) environment. + +## Building the modules + +These modules are built automatically when `ENABLE_UNIT_TESTS` is enabled +in the build. However, they can be added to any CFE build by adding the +following to the `APPLIST` of any target in `targets.cmake`: + +- `cfe_assert`: a CFE-compatible library wrapping the basic UT assert library. This +is the same library that all other unit tests use, but configured to be +dynamically loaded into the CFE environment, and using CFE syslog for its output. +This must be the first library loaded for any functional test. + +- `cfe_testcase`: a CFE-compatible library implementing test cases for CFE core apps. +This must be loaded after `cfe_assert`. + +- `cfe_testrunner`: a CFE application that actually executes the tests. This is a very +simple app that waits for CFE startup to complete, then executes all registered test +cases. It also must be loaded after `cfe_assert`. + + +## Example startup script entries + +To execute tests at startup, the following lines can be added to `cfe_es_startup.scr` on the +designated test target: + + CFE_LIB, /cf/cfe_assert.so, CFE_Assert_LibInit, ASSERT_LIB, 0, 0, 0x0, 0; + CFE_APP, /cf/cfe_testrunner.so, CFE_TestRunner_AppMain, TESTRUN_APP, 100, 16384, 0x0, 0; + CFE_LIB, /cf/cfe_testcase.so, CFE_Test_Init, CFETEST_LIB, 0, 0, 0x0, 0; + CFE_LIB, /cf/psp_test.so, PSP_Test_Init, PSPTEST_LIB, 0, 0, 0x0, 0; + +It is important that `cfe_assert` is loaded first, as all other test libraries depend on +symbols provided in this library. The order of loading other test cases should not +matter with respect to symbol resolution, but note that test cases will be executed in +the same order that they are registered. diff --git a/modules/cfe_assert/CMakeLists.txt b/modules/cfe_assert/CMakeLists.txt new file mode 100644 index 000000000..c80330ab8 --- /dev/null +++ b/modules/cfe_assert/CMakeLists.txt @@ -0,0 +1,12 @@ +project(CFE_ASSERT C) + +include_directories("${CFE_ASSERT_SOURCE_DIR}/inc") +include_directories("${UT_ASSERT_SOURCE_DIR}/inc") + +# Create the app module +add_cfe_app(cfe_assert + src/cfe_assert_io.c + src/cfe_assert_init.c + $ +) + diff --git a/modules/cfe_assert/inc/cfe_assert.h b/modules/cfe_assert/inc/cfe_assert.h new file mode 100644 index 000000000..8dde70a4f --- /dev/null +++ b/modules/cfe_assert/inc/cfe_assert.h @@ -0,0 +1,63 @@ +/************************************************************************* +** +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +** +** File: cfe_assert.h +** +** Purpose: +** Specification for the CFE assert (UT assert wrapper) functions. +** +*************************************************************************/ +#ifndef cfe_assert_h_ +#define cfe_assert_h_ + +/************************************************************************ +** Includes +*************************************************************************/ +#include + +/************************************************************************ +** Type Definitions +*************************************************************************/ + +/************************************************************************* +** Exported Functions +*************************************************************************/ + +/************************************************************************/ +/** \brief Application Entry Point Function +** +** \par Description +** This function should be specified in the cfe_es_startup.scr file +** as part of starting this application. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \return Execution status, see \ref CFEReturnCodes +** +** +*************************************************************************/ +void CFE_Assert_AppMain(void); + +#endif /* cfe_assert_h_ */ + +/************************/ +/* End of File Comment */ +/************************/ diff --git a/modules/cfe_assert/src/cfe_assert_init.c b/modules/cfe_assert/src/cfe_assert_init.c new file mode 100644 index 000000000..d1923785a --- /dev/null +++ b/modules/cfe_assert/src/cfe_assert_init.c @@ -0,0 +1,56 @@ +/************************************************************************* +** +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +** +** File: cfe_assert_main.c +** +** Purpose: +** Implementation of the CFE assert (UT assert wrapper) functions. +** +*************************************************************************/ + +/* + * Includes + */ + +#include + +#include "cfe_assert.h" + +#include "uttest.h" +#include "utbsp.h" + +/* + * Initialization Function for this library + */ +int32 CFE_Assert_LibInit(uint32 LibId) +{ + UtTest_EarlyInit(); + UT_BSP_Setup(); + + /* + * Start a test case for all startup logic. + * + * Test libs may use assert statements within their init function and these + * will be reported as a "startup" test case. + */ + UtAssert_BeginTest("CFE-STARTUP"); + + return CFE_SUCCESS; +} diff --git a/modules/cfe_assert/src/cfe_assert_io.c b/modules/cfe_assert/src/cfe_assert_io.c new file mode 100644 index 000000000..5c01213c3 --- /dev/null +++ b/modules/cfe_assert/src/cfe_assert_io.c @@ -0,0 +1,137 @@ +/************************************************************************* +** +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +** +** File: cfe_assert_io.c +** +** Purpose: +** Implementation of the CFE assert (UT assert wrapper) functions. +** +*************************************************************************/ + +#include +#include +#include +#include + +#include + +#include "utbsp.h" +#include "uttest.h" + +/* +** Local Variables +*/ +typedef struct +{ + uint32 CurrVerbosity; +} BSP_UT_GlobalData_t; + +BSP_UT_GlobalData_t BSP_UT_Global; + +void UT_BSP_Setup(void) +{ + BSP_UT_Global.CurrVerbosity = (2 << UTASSERT_CASETYPE_PASS) - 1; + UT_BSP_DoText(UTASSERT_CASETYPE_BEGIN, "CFE FUNCTIONAL TEST"); +} + +void UT_BSP_StartTestSegment(uint32 SegmentNumber, const char *SegmentName) +{ + char ReportBuffer[128]; + + snprintf(ReportBuffer, sizeof(ReportBuffer), "%02u %s", (unsigned int)SegmentNumber, SegmentName); + UT_BSP_DoText(UTASSERT_CASETYPE_BEGIN, ReportBuffer); +} + +void UT_BSP_DoText(uint8 MessageType, const char *OutputMessage) +{ + const char *Prefix; + uint32 MsgEnabled = BSP_UT_Global.CurrVerbosity >> MessageType; + + if (MsgEnabled & 1) + { + switch (MessageType) + { + case UTASSERT_CASETYPE_ABORT: + Prefix = "ABORT"; + break; + case UTASSERT_CASETYPE_FAILURE: + Prefix = "FAIL"; + break; + case UTASSERT_CASETYPE_MIR: + Prefix = "MIR"; + break; + case UTASSERT_CASETYPE_TSF: + Prefix = "TSF"; + break; + case UTASSERT_CASETYPE_TTF: + Prefix = "TTF"; + break; + case UTASSERT_CASETYPE_NA: + Prefix = "N/A"; + break; + case UTASSERT_CASETYPE_BEGIN: + Prefix = "BEGIN"; + break; + case UTASSERT_CASETYPE_END: + Prefix = "END"; + break; + case UTASSERT_CASETYPE_PASS: + Prefix = "PASS"; + break; + case UTASSERT_CASETYPE_INFO: + Prefix = "INFO"; + break; + case UTASSERT_CASETYPE_DEBUG: + Prefix = "DEBUG"; + break; + default: + Prefix = "OTHER"; + break; + } + + CFE_ES_WriteToSysLog("[%5s] %s\n", Prefix, OutputMessage); + } + + /* + * If any ABORT (major failure) message is thrown, + * then call a BSP-provided routine to stop the test and possibly dump a core + */ + if (MessageType == UTASSERT_CASETYPE_ABORT) + { + OS_TaskExit(); + } +} + +void UT_BSP_EndTest(const UtAssert_TestCounter_t *TestCounters) +{ + /* + * Only output a "summary" if there is more than one test Segment. + * Otherwise it is a duplicate of the report already given. + */ + if (TestCounters->TestSegmentCount > 1) + { + UtAssert_DoTestSegmentReport("SUMMARY", TestCounters); + } + + CFE_ES_WriteToSysLog("TEST COMPLETE: %u tests Segment(s) executed\n\n", + (unsigned int)TestCounters->TestSegmentCount); + + OS_TaskExit(); +} diff --git a/modules/cfe_testcase/CMakeLists.txt b/modules/cfe_testcase/CMakeLists.txt new file mode 100644 index 000000000..a2a48bde9 --- /dev/null +++ b/modules/cfe_testcase/CMakeLists.txt @@ -0,0 +1,8 @@ +include_directories("${CFE_ASSERT_SOURCE_DIR}/inc") +include_directories("${UT_ASSERT_SOURCE_DIR}/inc") + +# Create the app module +add_cfe_app(cfe_testcase + src/cfe_test.c + src/es_test.c +) diff --git a/modules/cfe_testcase/src/cfe_test.c b/modules/cfe_testcase/src/cfe_test.c new file mode 100644 index 000000000..d9606b9eb --- /dev/null +++ b/modules/cfe_testcase/src/cfe_test.c @@ -0,0 +1,43 @@ +/************************************************************************* +** +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +** +** File: cfe_test.c +** +** Purpose: +** Initialization routine for CFE functional test +** Demonstration of how to register and use the UT assert functions. +** +*************************************************************************/ + +/* + * Includes + */ + +#include "cfe_test.h" + +/* + * Initialization function + * Register this test routine with CFE Assert + */ +int32 CFE_Test_Init(int32 LibId) +{ + UtTest_Add(ES_Test_AppId, NULL, NULL, "ES AppID"); + return CFE_SUCCESS; +} diff --git a/modules/cfe_testcase/src/cfe_test.h b/modules/cfe_testcase/src/cfe_test.h new file mode 100644 index 000000000..45f98e890 --- /dev/null +++ b/modules/cfe_testcase/src/cfe_test.h @@ -0,0 +1,44 @@ +/************************************************************************* +** +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +** +** File: cfe_test.c +** +** Purpose: +** Initialization routine for CFE functional test +** Demonstration of how to register and use the UT assert functions. +** +*************************************************************************/ + +#ifndef CFE_TEST_H +#define CFE_TEST_H + +/* + * Includes + */ + +#include + +#include "uttest.h" +#include "utassert.h" + +void ES_Test_AppId(void); +int32 CFE_Test_Init(int32 LibId); + +#endif /* CFE_TEST_H */ diff --git a/modules/cfe_testcase/src/es_test.c b/modules/cfe_testcase/src/es_test.c new file mode 100644 index 000000000..afe13e74e --- /dev/null +++ b/modules/cfe_testcase/src/es_test.c @@ -0,0 +1,44 @@ +/************************************************************************* +** +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +** +** File: es_test.c +** +** Purpose: +** Functional test of basic ES APIs +** +** Demonstration of how to register and use the UT assert functions. +** +*************************************************************************/ + +/* + * Includes + */ + +#include "cfe_test.h" + +void ES_Test_AppId(void) +{ + uint32 AppId; + char AppNameBuf[OS_MAX_API_NAME + 4]; + + UtAssert_INT32_EQ(CFE_ES_GetAppID(&AppId), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_ES_GetAppName(AppNameBuf, AppId, sizeof(AppNameBuf)), CFE_SUCCESS); + UtAssert_StrCmp(AppNameBuf, "TESTRUN_APP", "CFE_ES_GetAppName() returned TESTRUN_APP"); +} diff --git a/modules/cfe_testrunner/CMakeLists.txt b/modules/cfe_testrunner/CMakeLists.txt new file mode 100644 index 000000000..24d153262 --- /dev/null +++ b/modules/cfe_testrunner/CMakeLists.txt @@ -0,0 +1,10 @@ +project(CFE_TESTRUNNER C) + +include_directories("inc") +include_directories("${UT_ASSERT_SOURCE_DIR}/inc") + +# Create the app module +add_cfe_app(cfe_testrunner + src/cfe_testrunner_main.c +) + diff --git a/modules/cfe_testrunner/inc/cfe_testrunner.h b/modules/cfe_testrunner/inc/cfe_testrunner.h new file mode 100644 index 000000000..8502714af --- /dev/null +++ b/modules/cfe_testrunner/inc/cfe_testrunner.h @@ -0,0 +1,63 @@ +/************************************************************************* +** +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +** +** File: cfe_testrunner.h +** +** Purpose: +** Specification for the CFE testrunner (UT testrunner wrapper) functions. +** +*************************************************************************/ +#ifndef cfe_testrunner_h_ +#define cfe_testrunner_h_ + +/************************************************************************ +** Includes +*************************************************************************/ +#include + +/************************************************************************ +** Type Definitions +*************************************************************************/ + +/************************************************************************* +** Exported Functions +*************************************************************************/ + +/************************************************************************/ +/** \brief Application Entry Point Function +** +** \par Description +** This function should be specified in the cfe_es_startup.scr file +** as part of starting this application. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \return Execution status, see \ref CFEReturnCodes +** +** +*************************************************************************/ +void CFE_TestRunner_AppMain(void); + +#endif /* cfe_testrunner_h_ */ + +/************************/ +/* End of File Comment */ +/************************/ diff --git a/modules/cfe_testrunner/src/cfe_testrunner_main.c b/modules/cfe_testrunner/src/cfe_testrunner_main.c new file mode 100644 index 000000000..c12153a23 --- /dev/null +++ b/modules/cfe_testrunner/src/cfe_testrunner_main.c @@ -0,0 +1,120 @@ +/************************************************************************* +** +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +** +** File: cfe_testrunner_main.c +** +** Purpose: +** Implementation of the CFE testrunner (UT testrunner wrapper) functions. +** +*************************************************************************/ + +/* + * Includes + */ + +#include + +#include "cfe_testrunner.h" + +#include "uttest.h" +#include "utbsp.h" + +/* + * The maximum amount of time that the application will delay to + * wait for other apps to complete startup before running the tests. + * + * The value is in milliseconds. Normally this shouldn't be more than + * a second or two for apps to all reach their respective main loop(s). + */ +#define CFE_TESTRUNNER_MAX_STARTUP_WAIT 30000 + +/* + * Small Extra delay before starting tests. + * + * This is not strictly necessary, but it does give a bit of time for other apps + * to settle their final syslog writes/events such that they will not be intermixed + * with test messages in the syslog. + * + * The value is in milliseconds. + */ +#define CFE_TESTRUNNER_START_DELAY 4000 + +/* + * Entry point for this application + */ +void CFE_TestRunner_AppMain(void) +{ + int32 rc; + uint32 RunStatus; + + /* + ** Register the app with Executive services + */ + rc = CFE_ES_RegisterApp(); + if (rc != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("Error in CFE_ES_RegisterApp(): %08lx\n", (unsigned long)rc); + return; + } + + /* + * Delay until the system reaches "operational" state -- this is when all libs have initialized + * and all apps have reached their RunLoop. + */ + rc = CFE_ES_WaitForSystemState(CFE_ES_SystemState_OPERATIONAL, CFE_TESTRUNNER_MAX_STARTUP_WAIT); + if (rc != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("Error while waiting for OPERATIONAL state: %08lx\n", (unsigned long)rc); + return; + } + + /* + * Startup Phase has ended. + */ + UtAssert_EndTest(); + + /* + * Note - in a normal app this would be a while loop, + * but is just an "if" right now as it only runs once. + * + * A future enhancement to this app might be to create an SB pipe + * and execute tests based on the receipt of a command to do so. + * + * For now, it just works in a one-shot mode to run tests that were + * registered during startup, then it self-exits. + */ + RunStatus = CFE_ES_RunStatus_APP_RUN; + if (CFE_ES_RunLoop(&RunStatus)) + { + OS_TaskDelay(CFE_TESTRUNNER_START_DELAY); + + /* + * Run all registered test cases. + */ + UtTest_Run(); + + /* + * Exit the main task. + */ + RunStatus = CFE_ES_RunStatus_APP_EXIT; + } + + CFE_ES_ExitApp(RunStatus); +} From ee7ffdabb202756d09483a0e8b8de531123181cf Mon Sep 17 00:00:00 2001 From: skliper <47541139+skliper@users.noreply.github.com> Date: Fri, 14 Aug 2020 13:59:31 -0400 Subject: [PATCH 7/8] Revert "Fix #778, add cfe assert and example lib" --- cmake/mission_defaults.cmake | 7 -- modules/cfe_assert/CMakeLists.txt | 12 -- modules/cfe_assert/inc/cfe_assert.h | 63 ----------- modules/cfe_assert/src/cfe_assert_io.c | 137 ----------------------- modules/cfe_assert/src/cfe_assert_main.c | 131 ---------------------- modules/cfe_test/CMakeLists.txt | 8 -- modules/cfe_test/src/cfe_test.c | 43 ------- modules/cfe_test/src/cfe_test.h | 44 -------- modules/cfe_test/src/es_test.c | 44 -------- 9 files changed, 489 deletions(-) delete mode 100644 modules/cfe_assert/CMakeLists.txt delete mode 100644 modules/cfe_assert/inc/cfe_assert.h delete mode 100644 modules/cfe_assert/src/cfe_assert_io.c delete mode 100644 modules/cfe_assert/src/cfe_assert_main.c delete mode 100644 modules/cfe_test/CMakeLists.txt delete mode 100644 modules/cfe_test/src/cfe_test.c delete mode 100644 modules/cfe_test/src/cfe_test.h delete mode 100644 modules/cfe_test/src/es_test.c diff --git a/cmake/mission_defaults.cmake b/cmake/mission_defaults.cmake index 59cf835a4..8f49d54d5 100644 --- a/cmake/mission_defaults.cmake +++ b/cmake/mission_defaults.cmake @@ -45,10 +45,3 @@ set(MISSION_MODULE_SEARCH_PATH set(cfe-core_SEARCH_PATH "cfe/fsw") set(osal_SEARCH_PATH ".") set(psp_SEARCH_PATH ".") - -# If ENABLE_UNIT_TEST is enabled, then include the cfe_assert library in -# all targets. This can still be overridden in targets.cmake. -if (ENABLE_UNIT_TESTS) - list(APPEND MISSION_GLOBAL_APPLIST cfe_assert cfe_test) -endif (ENABLE_UNIT_TESTS) - diff --git a/modules/cfe_assert/CMakeLists.txt b/modules/cfe_assert/CMakeLists.txt deleted file mode 100644 index 1b4602170..000000000 --- a/modules/cfe_assert/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -project(CFE_ASSERT C) - -include_directories("${CFE_ASSERT_SOURCE_DIR}/inc") -include_directories("${UT_ASSERT_SOURCE_DIR}/inc") - -# Create the app module -add_cfe_app(cfe_assert - src/cfe_assert_io.c - src/cfe_assert_main.c - $ -) - diff --git a/modules/cfe_assert/inc/cfe_assert.h b/modules/cfe_assert/inc/cfe_assert.h deleted file mode 100644 index 8dde70a4f..000000000 --- a/modules/cfe_assert/inc/cfe_assert.h +++ /dev/null @@ -1,63 +0,0 @@ -/************************************************************************* -** -** GSC-18128-1, "Core Flight Executive Version 6.7" -** -** Copyright (c) 2006-2019 United States Government as represented by -** the Administrator of the National Aeronautics and Space Administration. -** All Rights Reserved. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** File: cfe_assert.h -** -** Purpose: -** Specification for the CFE assert (UT assert wrapper) functions. -** -*************************************************************************/ -#ifndef cfe_assert_h_ -#define cfe_assert_h_ - -/************************************************************************ -** Includes -*************************************************************************/ -#include - -/************************************************************************ -** Type Definitions -*************************************************************************/ - -/************************************************************************* -** Exported Functions -*************************************************************************/ - -/************************************************************************/ -/** \brief Application Entry Point Function -** -** \par Description -** This function should be specified in the cfe_es_startup.scr file -** as part of starting this application. -** -** \par Assumptions, External Events, and Notes: -** None -** -** \return Execution status, see \ref CFEReturnCodes -** -** -*************************************************************************/ -void CFE_Assert_AppMain(void); - -#endif /* cfe_assert_h_ */ - -/************************/ -/* End of File Comment */ -/************************/ diff --git a/modules/cfe_assert/src/cfe_assert_io.c b/modules/cfe_assert/src/cfe_assert_io.c deleted file mode 100644 index 5c01213c3..000000000 --- a/modules/cfe_assert/src/cfe_assert_io.c +++ /dev/null @@ -1,137 +0,0 @@ -/************************************************************************* -** -** GSC-18128-1, "Core Flight Executive Version 6.7" -** -** Copyright (c) 2006-2019 United States Government as represented by -** the Administrator of the National Aeronautics and Space Administration. -** All Rights Reserved. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** File: cfe_assert_io.c -** -** Purpose: -** Implementation of the CFE assert (UT assert wrapper) functions. -** -*************************************************************************/ - -#include -#include -#include -#include - -#include - -#include "utbsp.h" -#include "uttest.h" - -/* -** Local Variables -*/ -typedef struct -{ - uint32 CurrVerbosity; -} BSP_UT_GlobalData_t; - -BSP_UT_GlobalData_t BSP_UT_Global; - -void UT_BSP_Setup(void) -{ - BSP_UT_Global.CurrVerbosity = (2 << UTASSERT_CASETYPE_PASS) - 1; - UT_BSP_DoText(UTASSERT_CASETYPE_BEGIN, "CFE FUNCTIONAL TEST"); -} - -void UT_BSP_StartTestSegment(uint32 SegmentNumber, const char *SegmentName) -{ - char ReportBuffer[128]; - - snprintf(ReportBuffer, sizeof(ReportBuffer), "%02u %s", (unsigned int)SegmentNumber, SegmentName); - UT_BSP_DoText(UTASSERT_CASETYPE_BEGIN, ReportBuffer); -} - -void UT_BSP_DoText(uint8 MessageType, const char *OutputMessage) -{ - const char *Prefix; - uint32 MsgEnabled = BSP_UT_Global.CurrVerbosity >> MessageType; - - if (MsgEnabled & 1) - { - switch (MessageType) - { - case UTASSERT_CASETYPE_ABORT: - Prefix = "ABORT"; - break; - case UTASSERT_CASETYPE_FAILURE: - Prefix = "FAIL"; - break; - case UTASSERT_CASETYPE_MIR: - Prefix = "MIR"; - break; - case UTASSERT_CASETYPE_TSF: - Prefix = "TSF"; - break; - case UTASSERT_CASETYPE_TTF: - Prefix = "TTF"; - break; - case UTASSERT_CASETYPE_NA: - Prefix = "N/A"; - break; - case UTASSERT_CASETYPE_BEGIN: - Prefix = "BEGIN"; - break; - case UTASSERT_CASETYPE_END: - Prefix = "END"; - break; - case UTASSERT_CASETYPE_PASS: - Prefix = "PASS"; - break; - case UTASSERT_CASETYPE_INFO: - Prefix = "INFO"; - break; - case UTASSERT_CASETYPE_DEBUG: - Prefix = "DEBUG"; - break; - default: - Prefix = "OTHER"; - break; - } - - CFE_ES_WriteToSysLog("[%5s] %s\n", Prefix, OutputMessage); - } - - /* - * If any ABORT (major failure) message is thrown, - * then call a BSP-provided routine to stop the test and possibly dump a core - */ - if (MessageType == UTASSERT_CASETYPE_ABORT) - { - OS_TaskExit(); - } -} - -void UT_BSP_EndTest(const UtAssert_TestCounter_t *TestCounters) -{ - /* - * Only output a "summary" if there is more than one test Segment. - * Otherwise it is a duplicate of the report already given. - */ - if (TestCounters->TestSegmentCount > 1) - { - UtAssert_DoTestSegmentReport("SUMMARY", TestCounters); - } - - CFE_ES_WriteToSysLog("TEST COMPLETE: %u tests Segment(s) executed\n\n", - (unsigned int)TestCounters->TestSegmentCount); - - OS_TaskExit(); -} diff --git a/modules/cfe_assert/src/cfe_assert_main.c b/modules/cfe_assert/src/cfe_assert_main.c deleted file mode 100644 index eb8e65652..000000000 --- a/modules/cfe_assert/src/cfe_assert_main.c +++ /dev/null @@ -1,131 +0,0 @@ -/************************************************************************* -** -** GSC-18128-1, "Core Flight Executive Version 6.7" -** -** Copyright (c) 2006-2019 United States Government as represented by -** the Administrator of the National Aeronautics and Space Administration. -** All Rights Reserved. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** File: cfe_assert_main.c -** -** Purpose: -** Implementation of the CFE assert (UT assert wrapper) functions. -** -*************************************************************************/ - -/* - * Includes - */ - -#include - -#include "cfe_assert.h" - -#include "uttest.h" -#include "utbsp.h" - -/* - * The maximum amount of time that the application will delay to - * wait for other apps to complete startup before running the tests. - * - * The value is in milliseconds. Normally this shouldn't be more than - * a second or two for apps to all reach their respective main loop(s). - */ -#define CFE_ASSERT_MAX_STARTUP_WAIT 30000 - -/* - * Small Extra delay before starting tests. - * - * This is not strictly necessary, but it does give a bit of time for other apps - * to settle their final syslog writes/events such that they will not be intermixed - * with test messages in the syslog. - * - * The value is in milliseconds. - */ -#define CFE_ASSERT_START_DELAY 4000 - -/* - * Entry point for this application - */ -void CFE_Assert_AppMain(void) -{ - int32 rc; - uint32 RunStatus; - - /* - ** Register the app with Executive services - */ - rc = CFE_ES_RegisterApp(); - if (rc != CFE_SUCCESS) - { - CFE_ES_WriteToSysLog("Error in CFE_ES_RegisterApp(): %08lx\n", (unsigned long)rc); - return; - } - - UtTest_EarlyInit(); - UT_BSP_Setup(); - - /* - * Start a test case for all startup logic. - * - * Test libs may use assert statements within their init function and these - * will be reported as a "startup" test case. - */ - UtAssert_BeginTest("CFE-STARTUP"); - - /* - * Delay until the system reaches "operational" state -- this is when all libs have initialized - * and all apps have reached their RunLoop. - */ - rc = CFE_ES_WaitForSystemState(CFE_ES_SystemState_OPERATIONAL, CFE_ASSERT_MAX_STARTUP_WAIT); - if (rc != CFE_SUCCESS) - { - CFE_ES_WriteToSysLog("Error while waiting for OPERATIONAL state: %08lx\n", (unsigned long)rc); - return; - } - - /* - * Startup Phase has ended. - */ - UtAssert_EndTest(); - - /* - * Note - in a normal app this would be a while loop, - * but is just an "if" right now as it only runs once. - * - * A future enhancement to this app might be to create an SB pipe - * and execute tests based on the receipt of a command to do so. - * - * For now, it just works in a one-shot mode to run tests that were - * registered during startup, then it self-exits. - */ - RunStatus = CFE_ES_RunStatus_APP_RUN; - if (CFE_ES_RunLoop(&RunStatus)) - { - OS_TaskDelay(CFE_ASSERT_START_DELAY); - - /* - * Run all registered test cases. - */ - UtTest_Run(); - - /* - * Exit the main task. - */ - RunStatus = CFE_ES_RunStatus_APP_EXIT; - } - - CFE_ES_ExitApp(RunStatus); -} diff --git a/modules/cfe_test/CMakeLists.txt b/modules/cfe_test/CMakeLists.txt deleted file mode 100644 index 4f6353434..000000000 --- a/modules/cfe_test/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -include_directories("${CFE_ASSERT_SOURCE_DIR}/inc") -include_directories("${UT_ASSERT_SOURCE_DIR}/inc") - -# Create the app module -add_cfe_app(cfe_test - src/cfe_test.c - src/es_test.c -) diff --git a/modules/cfe_test/src/cfe_test.c b/modules/cfe_test/src/cfe_test.c deleted file mode 100644 index d9606b9eb..000000000 --- a/modules/cfe_test/src/cfe_test.c +++ /dev/null @@ -1,43 +0,0 @@ -/************************************************************************* -** -** GSC-18128-1, "Core Flight Executive Version 6.7" -** -** Copyright (c) 2006-2019 United States Government as represented by -** the Administrator of the National Aeronautics and Space Administration. -** All Rights Reserved. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** File: cfe_test.c -** -** Purpose: -** Initialization routine for CFE functional test -** Demonstration of how to register and use the UT assert functions. -** -*************************************************************************/ - -/* - * Includes - */ - -#include "cfe_test.h" - -/* - * Initialization function - * Register this test routine with CFE Assert - */ -int32 CFE_Test_Init(int32 LibId) -{ - UtTest_Add(ES_Test_AppId, NULL, NULL, "ES AppID"); - return CFE_SUCCESS; -} diff --git a/modules/cfe_test/src/cfe_test.h b/modules/cfe_test/src/cfe_test.h deleted file mode 100644 index 45f98e890..000000000 --- a/modules/cfe_test/src/cfe_test.h +++ /dev/null @@ -1,44 +0,0 @@ -/************************************************************************* -** -** GSC-18128-1, "Core Flight Executive Version 6.7" -** -** Copyright (c) 2006-2019 United States Government as represented by -** the Administrator of the National Aeronautics and Space Administration. -** All Rights Reserved. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** File: cfe_test.c -** -** Purpose: -** Initialization routine for CFE functional test -** Demonstration of how to register and use the UT assert functions. -** -*************************************************************************/ - -#ifndef CFE_TEST_H -#define CFE_TEST_H - -/* - * Includes - */ - -#include - -#include "uttest.h" -#include "utassert.h" - -void ES_Test_AppId(void); -int32 CFE_Test_Init(int32 LibId); - -#endif /* CFE_TEST_H */ diff --git a/modules/cfe_test/src/es_test.c b/modules/cfe_test/src/es_test.c deleted file mode 100644 index 93ed3e840..000000000 --- a/modules/cfe_test/src/es_test.c +++ /dev/null @@ -1,44 +0,0 @@ -/************************************************************************* -** -** GSC-18128-1, "Core Flight Executive Version 6.7" -** -** Copyright (c) 2006-2019 United States Government as represented by -** the Administrator of the National Aeronautics and Space Administration. -** All Rights Reserved. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -** -** File: es_test.c -** -** Purpose: -** Functional test of basic ES APIs -** -** Demonstration of how to register and use the UT assert functions. -** -*************************************************************************/ - -/* - * Includes - */ - -#include "cfe_test.h" - -void ES_Test_AppId(void) -{ - uint32 AppId; - char AppNameBuf[OS_MAX_API_NAME + 4]; - - UtAssert_INT32_EQ(CFE_ES_GetAppID(&AppId), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_ES_GetAppName(AppNameBuf, AppId, sizeof(AppNameBuf)), CFE_SUCCESS); - UtAssert_StrCmp(AppNameBuf, "ASSERT_APP", "CFE_ES_GetAppName() returned ASSERT_APP"); -} From fc8a0206e94533d48ee66843b48db8141ab08dd3 Mon Sep 17 00:00:00 2001 From: astrogeco <59618057+astrogeco@users.noreply.github.com> Date: Wed, 19 Aug 2020 09:42:17 -0400 Subject: [PATCH 8/8] Increase version to 6.8.0-rc1+dev13 --- README.md | 11 +++++++++-- fsw/cfe-core/src/inc/cfe_version.h | 24 ++++++++++++------------ 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index df22dc40d..c88bbc373 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,13 @@ The detailed cFE user's guide can be viewed at + ### Development Build: 6.7.0+dev292 - Add missing include path to the target/h and wrn/coreip directory. @@ -27,7 +34,7 @@ Remove unrelated comment about CEXP (remnant from RTEMS). No more errors about m - All parameters to the stub function are registered in the context object, so the values will be available to hook functions. - The names of all parameters match the prototype/documentation, so hook functions that use name-based argument value retrieval will work. - Adds to table search path in `arch_build.cmake` -- Calls to OS_open() now use the OSAL-defined symbol, not the POSIX symbol. +- Calls to OS_open() now use the OSAL-defined symbol, not the POSIX symbol. - Defines new macros to report the build number and build baseline and new strings containing the version number of cFE and a combined string with the version number for OSAL, PSP, and CFE. - Allow explicitly setting of the processor ID in `targets.cmake`. The `TGTx_PROCESSOR_ID` setting will be passed to the final build/link of CFE core as the CPU ID. If unspecified, then the CMake index value is used instead (backward compatible). - `cmake` now detects conditions where no files were present to fulfill an config include file requirement and reports an error during `make prep` lists the files it checked for rather than generating an empty file. @@ -39,7 +46,7 @@ Remove unrelated comment about CEXP (remnant from RTEMS). No more errors about m - Added cFE User's Guide Reference to README.md - Removes old license - See - + ### Development Build: 6.7.20 - SB Unit use of the UT assert framework is closer to original design intent diff --git a/fsw/cfe-core/src/inc/cfe_version.h b/fsw/cfe-core/src/inc/cfe_version.h index f58244946..57e55fe66 100644 --- a/fsw/cfe-core/src/inc/cfe_version.h +++ b/fsw/cfe-core/src/inc/cfe_version.h @@ -24,19 +24,19 @@ /*! @file cfe_version.h * @brief Purpose: * Provide version identifiers for the cFE core. - * + * * target_config.h contains extended version information within it. * This information is generated automatically by the build using * git to determine the most recent tag and commit id. - * + * */ #include /* Development Build Macro Definitions */ -#define CFE_BUILD_NUMBER 292 /*!< Development Build: Number of commits since baseline */ -#define CFE_BUILD_BASELINE "v6.7.0" /*!< Development Build: git tag that is the base for the current development */ +#define CFE_BUILD_NUMBER 13 /*!< Development Build: Number of commits since baseline */ +#define CFE_BUILD_BASELINE "v6.8.0-rc1+dev" /*!< Development Build: git tag that is the base for the current development */ /* Version Macro Definitions */ @@ -48,27 +48,27 @@ #define CFE_STR_HELPER(x) #x /*!< @brief Helper function to concatenate strings from integer macros */ #define CFE_STR(x) CFE_STR_HELPER(x) /*!< @brief Helper function to concatenate strings from integer macros */ -/*! @brief Development Build Version Number. +/*! @brief Development Build Version Number. * @details Baseline git tag + Number of commits since baseline. @n * See @ref cfsversions for format differences between development and release versions. */ -#define CFE_SRC_VERSION CFE_BUILD_BASELINE "+dev" CFE_STR(CFE_BUILD_NUMBER) +#define CFE_SRC_VERSION CFE_BUILD_BASELINE "+dev" CFE_STR(CFE_BUILD_NUMBER) /*! @brief Development Build Version String. * @details Reports the current development build's baseline, number, and name. Also includes a note about the latest official version. @n - * See @ref cfsversions for format differences between development and release versions. -*/ + * See @ref cfsversions for format differences between development and release versions. +*/ #define CFE_VERSION_STRING \ " cFE DEVELOPMENT BUILD " \ CFE_SRC_VERSION " (Codename: Bootes)" /* Codename for current development */ \ ", Last Official Release: cfe v6.7.0" /* For full support please use this version */ -/*! @brief OSAL Version Definitions. +/*! @brief OSAL Version Definitions. * @details Allows for backwards compatibility. @n - * This will be defined by osal in the future + * This will be defined by osal in the future */ -#ifndef OS_VERSION +#ifndef OS_VERSION #define OS_VERSION \ CFE_STR(OS_MAJOR_VERSION) "." \ CFE_STR(OS_MINOR_VERSION) "." \ @@ -81,6 +81,6 @@ "cFS Versions:" \ " cfe " CFE_SRC_VERSION \ ", osal " OS_VERSION \ - ", psp " /* CFE_PSP_VERSION is defined at runtime */ + ", psp " /* CFE_PSP_VERSION is defined at runtime */ #endif /* _cfe_version_ */