diff --git a/README.md b/README.md index 13f70b9bb..e5e1f7e05 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,14 @@ The detailed cFE user's guide can be viewed at + ### Development Build: 6.8.0-rc1+dev218 - Adds `CFE_SB_TransmitMsg`, `CFE_SB_TransmitBuffer`, `CFE_SB_ReceiveBuffer` diff --git a/fsw/cfe-core/src/es/cfe_es_api.c b/fsw/cfe-core/src/es/cfe_es_api.c index a9a26abb9..d4d639de1 100644 --- a/fsw/cfe-core/src/es/cfe_es_api.c +++ b/fsw/cfe-core/src/es/cfe_es_api.c @@ -1117,12 +1117,9 @@ int32 CFE_ES_GetLibInfo(CFE_ES_AppInfo_t *LibInfo, CFE_ES_ResourceID_t LibId) */ int32 CFE_ES_GetModuleInfo(CFE_ES_AppInfo_t *ModuleInfo, CFE_ES_ResourceID_t ResourceId) { - uint32 ResourceType; int32 Status; - ResourceType = CFE_ES_ResourceID_ToInteger(ResourceId); - ResourceType -= ResourceType & CFE_ES_RESOURCEID_MAX; - switch(ResourceType) + switch(CFE_ES_ResourceID_GetBase(ResourceId)) { case CFE_ES_APPID_BASE: Status = CFE_ES_GetAppInfo(ModuleInfo, ResourceId); diff --git a/fsw/cfe-core/src/es/cfe_es_apps.c b/fsw/cfe-core/src/es/cfe_es_apps.c index 3a2100db8..c38ee545f 100644 --- a/fsw/cfe-core/src/es/cfe_es_apps.c +++ b/fsw/cfe-core/src/es/cfe_es_apps.c @@ -369,25 +369,53 @@ int32 CFE_ES_ParseFileEntry(const char **TokenList, uint32 NumTokens) ** **------------------------------------------------------------------------------------- */ -int32 CFE_ES_LoadModule(const CFE_ES_ModuleLoadParams_t* LoadParams, CFE_ES_ModuleLoadStatus_t *LoadStatus) +int32 CFE_ES_LoadModule(CFE_ES_ResourceID_t ResourceId, const CFE_ES_ModuleLoadParams_t* LoadParams, CFE_ES_ModuleLoadStatus_t *LoadStatus) { osal_id_t ModuleId; cpuaddr StartAddr; int32 ReturnCode; int32 StatusCode; + uint32 LoadFlags; + LoadFlags = 0; StartAddr = 0; ReturnCode = CFE_SUCCESS; if (LoadParams->FileName[0] != 0) { + switch(CFE_ES_ResourceID_GetBase(ResourceId)) + { + case CFE_ES_APPID_BASE: + /* + * Apps should not typically have symbols exposed to other apps. + * + * Keeping symbols local/private may help ensure this module is unloadable + * in the future, depending on underlying OS/loader implementation. + */ + LoadFlags |= OS_MODULE_FLAG_LOCAL_SYMBOLS; + break; + case CFE_ES_LIBID_BASE: + /* + * Libraries need to have their symbols exposed to other apps. + * + * Note on some OS/loader implementations this may make it so the module + * cannot be unloaded, if there is no way to ensure that symbols + * are not being referenced. CFE does not currently support unloading + * of libraries for this reason, among others. + */ + LoadFlags |= OS_MODULE_FLAG_GLOBAL_SYMBOLS; + break; + default: + break; + } + /* - ** Load the module via OSAL. + * Load the module via OSAL. */ StatusCode = OS_ModuleLoad ( &ModuleId, LoadParams->Name, LoadParams->FileName, - OS_MODULE_FLAG_GLOBAL_SYMBOLS ); + LoadFlags ); if (StatusCode != OS_SUCCESS) { @@ -403,11 +431,11 @@ int32 CFE_ES_LoadModule(const CFE_ES_ModuleLoadParams_t* LoadParams, CFE_ES_Modu } /* - ** If the Load was OK, then lookup the address of the entry point + * If the Load was OK, then lookup the address of the entry point */ if (ReturnCode == CFE_SUCCESS && LoadParams->EntryPoint[0] != 0) { - StatusCode = OS_SymbolLookup(&StartAddr, LoadParams->EntryPoint); + StatusCode = OS_ModuleSymbolLookup(ModuleId, &StartAddr, LoadParams->EntryPoint); if (StatusCode != OS_SUCCESS) { CFE_ES_WriteToSysLog("ES Startup: Could not find symbol:%s. EC = 0x%08X\n", @@ -717,7 +745,7 @@ int32 CFE_ES_AppCreate(CFE_ES_ResourceID_t *ApplicationIdPtr, /* * Load the module based on StartParams configured above. */ - Status = CFE_ES_LoadModule(&AppRecPtr->StartParams.BasicInfo, &AppRecPtr->ModuleInfo); + Status = CFE_ES_LoadModule(PendingAppId, &AppRecPtr->StartParams.BasicInfo, &AppRecPtr->ModuleInfo); /* * If the Load was OK, then complete the initialization @@ -883,7 +911,7 @@ int32 CFE_ES_LoadLibrary(CFE_ES_ResourceID_t *LibraryIdPtr, /* * Load the module based on StartParams configured above. */ - Status = CFE_ES_LoadModule(&LibSlotPtr->BasicInfo, &LibSlotPtr->ModuleInfo); + Status = CFE_ES_LoadModule(PendingLibId, &LibSlotPtr->BasicInfo, &LibSlotPtr->ModuleInfo); if (Status == CFE_SUCCESS) { FunctionPointer = (CFE_ES_LibraryEntryFuncPtr_t)LibSlotPtr->ModuleInfo.EntryAddress; diff --git a/fsw/cfe-core/src/es/cfe_es_apps.h b/fsw/cfe-core/src/es/cfe_es_apps.h index 3be90f7cd..82b307e02 100644 --- a/fsw/cfe-core/src/es/cfe_es_apps.h +++ b/fsw/cfe-core/src/es/cfe_es_apps.h @@ -198,7 +198,7 @@ int32 CFE_ES_ParseFileEntry(const char **TokenList, uint32 NumTokens); ** This only loads the code and looks up relevent runtime information. ** It does not start any tasks. */ -int32 CFE_ES_LoadModule(const CFE_ES_ModuleLoadParams_t* LoadParams, CFE_ES_ModuleLoadStatus_t *LoadStatus); +int32 CFE_ES_LoadModule(CFE_ES_ResourceID_t ResourceId, const CFE_ES_ModuleLoadParams_t* LoadParams, CFE_ES_ModuleLoadStatus_t *LoadStatus); /* ** Internal function to determine the entry point of an app. diff --git a/fsw/cfe-core/src/es/cfe_es_global.h b/fsw/cfe-core/src/es/cfe_es_global.h index d3dbcc9fe..2e12654f7 100644 --- a/fsw/cfe-core/src/es/cfe_es_global.h +++ b/fsw/cfe-core/src/es/cfe_es_global.h @@ -52,6 +52,8 @@ #include "cfe_evs.h" #include "cfe_psp.h" +#include + /* ** Typedefs @@ -104,7 +106,7 @@ typedef struct /* ** Startup Sync */ - uint32 SystemState; + volatile sig_atomic_t SystemState; /* ** ES Task Table diff --git a/fsw/cfe-core/src/es/cfe_es_resource.h b/fsw/cfe-core/src/es/cfe_es_resource.h index 82c936cd3..07af0c0cc 100644 --- a/fsw/cfe-core/src/es/cfe_es_resource.h +++ b/fsw/cfe-core/src/es/cfe_es_resource.h @@ -55,12 +55,34 @@ #define CFE_ES_RESOURCEID_MAX ((1 << CFE_ES_RESOURCEID_SHIFT)-1) #define CFE_ES_RESOURCEID_MARK (0x02000000) +/** + * @defgroup CFEESResourceIDBase ES Resource ID base values + * @{ + */ #define CFE_ES_APPID_BASE (CFE_ES_RESOURCEID_MARK | ((OS_OBJECT_TYPE_USER+1) << CFE_ES_RESOURCEID_SHIFT)) #define CFE_ES_LIBID_BASE (CFE_ES_RESOURCEID_MARK | ((OS_OBJECT_TYPE_USER+2) << CFE_ES_RESOURCEID_SHIFT)) #define CFE_ES_COUNTID_BASE (CFE_ES_RESOURCEID_MARK | ((OS_OBJECT_TYPE_USER+3) << CFE_ES_RESOURCEID_SHIFT)) #define CFE_ES_POOLID_BASE (CFE_ES_RESOURCEID_MARK | ((OS_OBJECT_TYPE_USER+4) << CFE_ES_RESOURCEID_SHIFT)) #define CFE_ES_CDSBLOCKID_BASE (CFE_ES_RESOURCEID_MARK | ((OS_OBJECT_TYPE_USER+5) << CFE_ES_RESOURCEID_SHIFT)) +/** @} */ +/** + * @brief Get the Base value (type/category) from a resource ID value + * + * This masks out the ID serial number to obtain the base value, which is different + * for each resource type. + * + * @note The value is NOT shifted or otherwise adjusted. It should match one of the + * defined base values in @ref CFEESResourceIDBase. + * + * @param[in] ResourceId the resource ID to decode + * @returns The base value associated with that ID + */ +static inline uint32 CFE_ES_ResourceID_GetBase(CFE_ES_ResourceID_t ResourceId) +{ + uint32 ResourceType = CFE_ES_ResourceID_ToInteger(ResourceId); + return (ResourceType - (ResourceType & CFE_ES_RESOURCEID_MAX)); +} /** * @brief Locate the next resource ID which does not map to an in-use table entry diff --git a/fsw/cfe-core/src/inc/cfe_version.h b/fsw/cfe-core/src/inc/cfe_version.h index cf3a9ed31..7bafa0644 100644 --- a/fsw/cfe-core/src/inc/cfe_version.h +++ b/fsw/cfe-core/src/inc/cfe_version.h @@ -35,7 +35,7 @@ /* Development Build Macro Definitions */ -#define CFE_BUILD_NUMBER 218 /*!< Development Build: Number of commits since baseline */ +#define CFE_BUILD_NUMBER 228 /*!< Development Build: Number of commits since baseline */ #define CFE_BUILD_BASELINE "v6.8.0-rc1" /*!< Development Build: git tag that is the base for the current development */ /* Version Macro Definitions */ diff --git a/fsw/cfe-core/unit-test/es_UT.c b/fsw/cfe-core/unit-test/es_UT.c index e6d36c73c..2190e3851 100644 --- a/fsw/cfe-core/unit-test/es_UT.c +++ b/fsw/cfe-core/unit-test/es_UT.c @@ -1389,7 +1389,7 @@ void TestApps(void) * cannot be found */ ES_ResetUnitTest(); - UT_SetDeferredRetcode(UT_KEY(OS_SymbolLookup), 1, -1); + UT_SetDeferredRetcode(UT_KEY(OS_ModuleSymbolLookup), 1, -1); Return = CFE_ES_AppCreate(&Id, "ut/filename.x", "EntryPoint", @@ -1405,7 +1405,7 @@ void TestApps(void) * cannot be found and module unload fails */ ES_ResetUnitTest(); - UT_SetDeferredRetcode(UT_KEY(OS_SymbolLookup), 1, -1); + UT_SetDeferredRetcode(UT_KEY(OS_ModuleSymbolLookup), 1, -1); UT_SetDeferredRetcode(UT_KEY(OS_ModuleUnload), 1, -1); Return = CFE_ES_AppCreate(&Id, "ut/filename.x", @@ -2272,7 +2272,7 @@ void TestLibs(void) * entry point symbol cannot be found */ ES_ResetUnitTest(); - UT_SetDeferredRetcode(UT_KEY(OS_SymbolLookup), 1, -1); + UT_SetDeferredRetcode(UT_KEY(OS_ModuleSymbolLookup), 1, -1); Return = CFE_ES_LoadLibrary(&Id, "/cf/apps/tst_lib.bundle", "TST_LIB_Init", diff --git a/fsw/cfe-core/unit-test/es_UT.h b/fsw/cfe-core/unit-test/es_UT.h index 307d59841..68fa658a6 100644 --- a/fsw/cfe-core/unit-test/es_UT.h +++ b/fsw/cfe-core/unit-test/es_UT.h @@ -50,7 +50,6 @@ #include "cfe.h" #include "common_types.h" #include "osapi.h" -#include "osapi-os-loader.h" #include "cfe_version.h" #include "cfe_es.h" #include "cfe_es_cds.h" diff --git a/modules/msg/unit-test-coverage/CMakeLists.txt b/modules/msg/unit-test-coverage/CMakeLists.txt index 8a5fe49e2..dd06ff924 100644 --- a/modules/msg/unit-test-coverage/CMakeLists.txt +++ b/modules/msg/unit-test-coverage/CMakeLists.txt @@ -15,7 +15,6 @@ target_include_directories(ut_${DEP}_objs PRIVATE set (ut_${DEP}_tests msg_UT.c - test_msg_utils.c test_msg_not.c test_msg_pri_not.c test_cfe_msg_init.c diff --git a/modules/msg/unit-test-coverage/test_cfe_msg_ccsdsext.c b/modules/msg/unit-test-coverage/test_cfe_msg_ccsdsext.c index 05ee2438f..07c2decac 100644 --- a/modules/msg/unit-test-coverage/test_cfe_msg_ccsdsext.c +++ b/modules/msg/unit-test-coverage/test_cfe_msg_ccsdsext.c @@ -72,7 +72,7 @@ void Test_MSG_Init_Ext(void) memset(&msg, 0xFF, sizeof(msg)); msgidval_exp = 0; ASSERT_EQ(CFE_MSG_Init(&msg, CFE_SB_ValueToMsgId(msgidval_exp), sizeof(msg)), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, 0); + UT_DisplayPkt(&msg, 0); /* Default EDS version check */ ASSERT_EQ(CFE_MSG_GetEDSVersion(&msg, &edsver), CFE_SUCCESS); @@ -104,7 +104,7 @@ void Test_MSG_Init_Ext(void) memset(&msg, 0, sizeof(msg)); msgidval_exp = CFE_PLATFORM_SB_HIGHEST_VALID_MSGID; ASSERT_EQ(CFE_MSG_Init(&msg, CFE_SB_ValueToMsgId(msgidval_exp), sizeof(msg)), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, 0); + UT_DisplayPkt(&msg, 0); /* Default EDS version check */ ASSERT_EQ(CFE_MSG_GetEDSVersion(&msg, &edsver), CFE_SUCCESS); @@ -160,7 +160,7 @@ void Test_MSG_EDSVersion(void) ASSERT_EQ(CFE_MSG_GetEDSVersion(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, TEST_EDSVER_MAX); ASSERT_EQ(CFE_MSG_SetEDSVersion(&msg, input[i]), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, sizeof(msg)); + UT_DisplayPkt(&msg, sizeof(msg)); ASSERT_EQ(CFE_MSG_GetEDSVersion(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, input[i]); if (input[i] == TEST_EDSVER_MAX) @@ -180,7 +180,7 @@ void Test_MSG_EDSVersion(void) ASSERT_EQ(CFE_MSG_GetEDSVersion(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, 0); ASSERT_EQ(CFE_MSG_SetEDSVersion(&msg, input[i]), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, sizeof(msg)); + UT_DisplayPkt(&msg, sizeof(msg)); ASSERT_EQ(CFE_MSG_GetEDSVersion(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, input[i]); if (input[i] == 0) @@ -220,7 +220,7 @@ void Test_MSG_Endian(void) ASSERT_EQ(CFE_MSG_GetEndian(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, CFE_MSG_Endian_Little); ASSERT_EQ(CFE_MSG_SetEndian(&msg, input[i]), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, sizeof(msg)); + UT_DisplayPkt(&msg, sizeof(msg)); ASSERT_EQ(CFE_MSG_GetEndian(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, input[i]); if (input[i] == CFE_MSG_Endian_Little) @@ -240,7 +240,7 @@ void Test_MSG_Endian(void) ASSERT_EQ(CFE_MSG_GetEndian(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, CFE_MSG_Endian_Big); ASSERT_EQ(CFE_MSG_SetEndian(&msg, input[i]), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, sizeof(msg)); + UT_DisplayPkt(&msg, sizeof(msg)); ASSERT_EQ(CFE_MSG_GetEndian(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, input[i]); if (input[i] == CFE_MSG_Endian_Big) @@ -280,7 +280,7 @@ void Test_MSG_PlaybackFlag(void) ASSERT_EQ(CFE_MSG_GetPlaybackFlag(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, CFE_MSG_PlayFlag_Playback); ASSERT_EQ(CFE_MSG_SetPlaybackFlag(&msg, input[i]), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, sizeof(msg)); + UT_DisplayPkt(&msg, sizeof(msg)); ASSERT_EQ(CFE_MSG_GetPlaybackFlag(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, input[i]); if (input[i] == CFE_MSG_PlayFlag_Playback) @@ -300,7 +300,7 @@ void Test_MSG_PlaybackFlag(void) ASSERT_EQ(CFE_MSG_GetPlaybackFlag(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, CFE_MSG_PlayFlag_Original); ASSERT_EQ(CFE_MSG_SetPlaybackFlag(&msg, input[i]), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, sizeof(msg)); + UT_DisplayPkt(&msg, sizeof(msg)); ASSERT_EQ(CFE_MSG_GetPlaybackFlag(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, input[i]); if (input[i] == CFE_MSG_PlayFlag_Original) @@ -340,7 +340,7 @@ void Test_MSG_Subsystem(void) ASSERT_EQ(CFE_MSG_GetSubsystem(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, TEST_SUBSYS_MAX); ASSERT_EQ(CFE_MSG_SetSubsystem(&msg, input[i]), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, sizeof(msg)); + UT_DisplayPkt(&msg, sizeof(msg)); ASSERT_EQ(CFE_MSG_GetSubsystem(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, input[i]); if (input[i] == TEST_SUBSYS_MAX) @@ -360,7 +360,7 @@ void Test_MSG_Subsystem(void) ASSERT_EQ(CFE_MSG_GetSubsystem(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, 0); ASSERT_EQ(CFE_MSG_SetSubsystem(&msg, input[i]), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, sizeof(msg)); + UT_DisplayPkt(&msg, sizeof(msg)); ASSERT_EQ(CFE_MSG_GetSubsystem(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, input[i]); if (input[i] == 0) @@ -397,7 +397,7 @@ void Test_MSG_System(void) ASSERT_EQ(CFE_MSG_GetSystem(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, TEST_SYSTEM_MAX); ASSERT_EQ(CFE_MSG_SetSystem(&msg, input[i]), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, sizeof(msg)); + UT_DisplayPkt(&msg, sizeof(msg)); ASSERT_EQ(CFE_MSG_GetSystem(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, input[i]); if (input[i] == TEST_SYSTEM_MAX) @@ -417,7 +417,7 @@ void Test_MSG_System(void) ASSERT_EQ(CFE_MSG_GetSystem(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, 0); ASSERT_EQ(CFE_MSG_SetSystem(&msg, input[i]), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, sizeof(msg)); + UT_DisplayPkt(&msg, sizeof(msg)); ASSERT_EQ(CFE_MSG_GetSystem(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, input[i]); if (input[i] == 0) diff --git a/modules/msg/unit-test-coverage/test_cfe_msg_ccsdspri.c b/modules/msg/unit-test-coverage/test_cfe_msg_ccsdspri.c index 67d84dcef..daffa4947 100644 --- a/modules/msg/unit-test-coverage/test_cfe_msg_ccsdspri.c +++ b/modules/msg/unit-test-coverage/test_cfe_msg_ccsdspri.c @@ -71,7 +71,7 @@ void Test_MSG_Size(void) ASSERT_EQ(CFE_MSG_GetSize(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, 0xFFFF + TEST_MSG_SIZE_OFFSET); ASSERT_EQ(CFE_MSG_SetSize(&msg, input[i]), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, sizeof(msg)); + UT_DisplayPkt(&msg, sizeof(msg)); ASSERT_EQ(CFE_MSG_GetSize(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, input[i]); if (input[i] == 0xFFFF + TEST_MSG_SIZE_OFFSET) @@ -91,7 +91,7 @@ void Test_MSG_Size(void) ASSERT_EQ(CFE_MSG_GetSize(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, TEST_MSG_SIZE_OFFSET); ASSERT_EQ(CFE_MSG_SetSize(&msg, input[i]), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, sizeof(msg)); + UT_DisplayPkt(&msg, sizeof(msg)); ASSERT_EQ(CFE_MSG_GetSize(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, input[i]); if (input[i] == TEST_MSG_SIZE_OFFSET) @@ -131,7 +131,7 @@ void Test_MSG_Type(void) ASSERT_EQ(CFE_MSG_GetType(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, CFE_MSG_Type_Cmd); ASSERT_EQ(CFE_MSG_SetType(&msg, input[i]), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, sizeof(msg)); + UT_DisplayPkt(&msg, sizeof(msg)); ASSERT_EQ(CFE_MSG_GetType(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, input[i]); if (input[i] == CFE_MSG_Type_Cmd) @@ -151,7 +151,7 @@ void Test_MSG_Type(void) ASSERT_EQ(CFE_MSG_GetType(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, CFE_MSG_Type_Tlm); ASSERT_EQ(CFE_MSG_SetType(&msg, input[i]), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, sizeof(msg)); + UT_DisplayPkt(&msg, sizeof(msg)); ASSERT_EQ(CFE_MSG_GetType(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, input[i]); if (input[i] == CFE_MSG_Type_Tlm) @@ -191,7 +191,7 @@ void Test_MSG_HeaderVersion(void) ASSERT_EQ(CFE_MSG_GetHeaderVersion(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, TEST_CCSDSVER_MAX); ASSERT_EQ(CFE_MSG_SetHeaderVersion(&msg, input[i]), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, sizeof(msg)); + UT_DisplayPkt(&msg, sizeof(msg)); ASSERT_EQ(CFE_MSG_GetHeaderVersion(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, input[i]); if (input[i] == TEST_CCSDSVER_MAX) @@ -211,7 +211,7 @@ void Test_MSG_HeaderVersion(void) ASSERT_EQ(CFE_MSG_GetHeaderVersion(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, 0); ASSERT_EQ(CFE_MSG_SetHeaderVersion(&msg, input[i]), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, sizeof(msg)); + UT_DisplayPkt(&msg, sizeof(msg)); ASSERT_EQ(CFE_MSG_GetHeaderVersion(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, input[i]); if (input[i] == 0) @@ -244,13 +244,13 @@ void Test_MSG_HasSecondaryHeader(void) ASSERT_EQ(actual, true); ASSERT_EQ(CFE_MSG_SetHasSecondaryHeader(&msg, true), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, sizeof(msg)); + UT_DisplayPkt(&msg, sizeof(msg)); ASSERT_EQ(CFE_MSG_GetHasSecondaryHeader(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, true); ASSERT_EQ(Test_MSG_NotF(&msg), 0); ASSERT_EQ(CFE_MSG_SetHasSecondaryHeader(&msg, false), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, sizeof(msg)); + UT_DisplayPkt(&msg, sizeof(msg)); ASSERT_EQ(CFE_MSG_GetHasSecondaryHeader(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, false); ASSERT_EQ(Test_MSG_NotF(&msg), MSG_HASSEC_FLAG); @@ -261,13 +261,13 @@ void Test_MSG_HasSecondaryHeader(void) ASSERT_EQ(actual, false); ASSERT_EQ(CFE_MSG_SetHasSecondaryHeader(&msg, false), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, sizeof(msg)); + UT_DisplayPkt(&msg, sizeof(msg)); ASSERT_EQ(CFE_MSG_GetHasSecondaryHeader(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, false); ASSERT_EQ(Test_MSG_NotZero(&msg), 0); ASSERT_EQ(CFE_MSG_SetHasSecondaryHeader(&msg, true), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, sizeof(msg)); + UT_DisplayPkt(&msg, sizeof(msg)); ASSERT_EQ(CFE_MSG_GetHasSecondaryHeader(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, true); ASSERT_EQ(Test_MSG_NotZero(&msg), MSG_HASSEC_FLAG); @@ -299,7 +299,7 @@ void Test_MSG_ApId(void) ASSERT_EQ(CFE_MSG_GetApId(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, TEST_APID_MAX); ASSERT_EQ(CFE_MSG_SetApId(&msg, input[i]), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, sizeof(msg)); + UT_DisplayPkt(&msg, sizeof(msg)); ASSERT_EQ(CFE_MSG_GetApId(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, input[i]); if (input[i] == TEST_APID_MAX) @@ -319,7 +319,7 @@ void Test_MSG_ApId(void) ASSERT_EQ(CFE_MSG_GetApId(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, 0); ASSERT_EQ(CFE_MSG_SetApId(&msg, input[i]), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, sizeof(msg)); + UT_DisplayPkt(&msg, sizeof(msg)); ASSERT_EQ(CFE_MSG_GetApId(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, input[i]); if (input[i] == 0) @@ -360,7 +360,7 @@ void Test_MSG_SegmentationFlag(void) ASSERT_EQ(CFE_MSG_GetSegmentationFlag(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, CFE_MSG_SegFlag_Unsegmented); ASSERT_EQ(CFE_MSG_SetSegmentationFlag(&msg, input[i]), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, sizeof(msg)); + UT_DisplayPkt(&msg, sizeof(msg)); ASSERT_EQ(CFE_MSG_GetSegmentationFlag(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, input[i]); if (input[i] == CFE_MSG_SegFlag_Unsegmented) @@ -380,7 +380,7 @@ void Test_MSG_SegmentationFlag(void) ASSERT_EQ(CFE_MSG_GetSegmentationFlag(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, CFE_MSG_SegFlag_Continue); ASSERT_EQ(CFE_MSG_SetSegmentationFlag(&msg, input[i]), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, sizeof(msg)); + UT_DisplayPkt(&msg, sizeof(msg)); ASSERT_EQ(CFE_MSG_GetSegmentationFlag(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, input[i]); if (input[i] == CFE_MSG_SegFlag_Continue) @@ -420,7 +420,7 @@ void Test_MSG_SequenceCount(void) ASSERT_EQ(CFE_MSG_GetSequenceCount(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, TEST_SEQUENCE_MAX); ASSERT_EQ(CFE_MSG_SetSequenceCount(&msg, input[i]), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, sizeof(msg)); + UT_DisplayPkt(&msg, sizeof(msg)); ASSERT_EQ(CFE_MSG_GetSequenceCount(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, input[i]); if (input[i] == TEST_SEQUENCE_MAX) @@ -440,7 +440,7 @@ void Test_MSG_SequenceCount(void) ASSERT_EQ(CFE_MSG_GetSequenceCount(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, 0); ASSERT_EQ(CFE_MSG_SetSequenceCount(&msg, input[i]), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, sizeof(msg)); + UT_DisplayPkt(&msg, sizeof(msg)); ASSERT_EQ(CFE_MSG_GetSequenceCount(&msg, &actual), CFE_SUCCESS); ASSERT_EQ(actual, input[i]); if (input[i] == 0) diff --git a/modules/msg/unit-test-coverage/test_cfe_msg_checksum.c b/modules/msg/unit-test-coverage/test_cfe_msg_checksum.c index 304b171df..ba2b8b7a2 100644 --- a/modules/msg/unit-test-coverage/test_cfe_msg_checksum.c +++ b/modules/msg/unit-test-coverage/test_cfe_msg_checksum.c @@ -70,7 +70,7 @@ void Test_MSG_Checksum(void) ASSERT_EQ(CFE_MSG_ValidateChecksum(msgptr, &actual), CFE_SUCCESS); ASSERT_EQ(actual, false); ASSERT_EQ(CFE_MSG_GenerateChecksum(msgptr), CFE_SUCCESS); - Test_MSG_PrintMsg(msgptr, sizeof(cmd)); + UT_DisplayPkt(msgptr, sizeof(cmd)); ASSERT_EQ(CFE_MSG_ValidateChecksum(msgptr, &actual), CFE_SUCCESS); ASSERT_EQ(actual, true); ASSERT_EQ(Test_MSG_NotF(msgptr), MSG_LENGTH_FLAG); @@ -83,7 +83,7 @@ void Test_MSG_Checksum(void) ASSERT_EQ(CFE_MSG_ValidateChecksum(msgptr, &actual), CFE_SUCCESS); ASSERT_EQ(actual, false); ASSERT_EQ(CFE_MSG_GenerateChecksum(msgptr), CFE_SUCCESS); - Test_MSG_PrintMsg(msgptr, sizeof(cmd)); + UT_DisplayPkt(msgptr, sizeof(cmd)); ASSERT_EQ(CFE_MSG_ValidateChecksum(msgptr, &actual), CFE_SUCCESS); ASSERT_EQ(actual, true); ASSERT_EQ(Test_MSG_NotZero(msgptr), MSG_LENGTH_FLAG | MSG_HASSEC_FLAG | MSG_TYPE_FLAG); diff --git a/modules/msg/unit-test-coverage/test_cfe_msg_fc.c b/modules/msg/unit-test-coverage/test_cfe_msg_fc.c index 664fa4b1e..41828a2a0 100644 --- a/modules/msg/unit-test-coverage/test_cfe_msg_fc.c +++ b/modules/msg/unit-test-coverage/test_cfe_msg_fc.c @@ -82,7 +82,7 @@ void Test_MSG_FcnCode(void) ASSERT_EQ(CFE_MSG_GetFcnCode(msgptr, &actual), CFE_SUCCESS); ASSERT_EQ(actual, TEST_FCNCODE_MAX); ASSERT_EQ(CFE_MSG_SetFcnCode(msgptr, input[i]), CFE_SUCCESS); - Test_MSG_PrintMsg(msgptr, sizeof(cmd)); + UT_DisplayPkt(msgptr, sizeof(cmd)); ASSERT_EQ(CFE_MSG_GetFcnCode(msgptr, &actual), CFE_SUCCESS); ASSERT_EQ(actual, input[i]); ASSERT_EQ(Test_MSG_NotF(msgptr), 0); @@ -97,7 +97,7 @@ void Test_MSG_FcnCode(void) ASSERT_EQ(CFE_MSG_GetFcnCode(msgptr, &actual), CFE_SUCCESS); ASSERT_EQ(actual, 0); ASSERT_EQ(CFE_MSG_SetFcnCode(msgptr, input[i]), CFE_SUCCESS); - Test_MSG_PrintMsg(msgptr, sizeof(cmd)); + UT_DisplayPkt(msgptr, sizeof(cmd)); ASSERT_EQ(CFE_MSG_GetFcnCode(msgptr, &actual), CFE_SUCCESS); ASSERT_EQ(actual, input[i]); ASSERT_EQ(Test_MSG_NotZero(msgptr), MSG_HASSEC_FLAG | MSG_TYPE_FLAG); diff --git a/modules/msg/unit-test-coverage/test_cfe_msg_init.c b/modules/msg/unit-test-coverage/test_cfe_msg_init.c index 143ab6548..4c2cb4a5d 100644 --- a/modules/msg/unit-test-coverage/test_cfe_msg_init.c +++ b/modules/msg/unit-test-coverage/test_cfe_msg_init.c @@ -65,7 +65,7 @@ void Test_MSG_Init(void) msgidval_exp = 0; ASSERT_EQ(CFE_MSG_Init(&cmd.Msg, CFE_SB_ValueToMsgId(msgidval_exp), sizeof(cmd)), CFE_SUCCESS); - Test_MSG_PrintMsg(&cmd.Msg, 0); + UT_DisplayPkt(&cmd.Msg, 0); ASSERT_EQ(CFE_MSG_GetMsgId(&cmd.Msg, &msgid_act), CFE_SUCCESS); ASSERT_EQ(CFE_SB_MsgIdToValue(msgid_act), msgidval_exp); ASSERT_EQ(CFE_MSG_GetSize(&cmd.Msg, &size), CFE_SUCCESS); @@ -100,7 +100,7 @@ void Test_MSG_Init(void) msgidval_exp = CFE_PLATFORM_SB_HIGHEST_VALID_MSGID; ASSERT_EQ(CFE_MSG_Init(&cmd.Msg, CFE_SB_ValueToMsgId(msgidval_exp), sizeof(cmd)), CFE_SUCCESS); - Test_MSG_PrintMsg(&cmd.Msg, 0); + UT_DisplayPkt(&cmd.Msg, 0); ASSERT_EQ(CFE_MSG_GetMsgId(&cmd.Msg, &msgid_act), CFE_SUCCESS); ASSERT_EQ(CFE_SB_MsgIdToValue(msgid_act), msgidval_exp); ASSERT_EQ(CFE_MSG_GetSize(&cmd.Msg, &size), CFE_SUCCESS); diff --git a/modules/msg/unit-test-coverage/test_cfe_msg_msgid_v1.c b/modules/msg/unit-test-coverage/test_cfe_msg_msgid_v1.c index f8a421dda..3afce7943 100644 --- a/modules/msg/unit-test-coverage/test_cfe_msg_msgid_v1.c +++ b/modules/msg/unit-test-coverage/test_cfe_msg_msgid_v1.c @@ -60,7 +60,7 @@ void Test_MSG_MsgId(void) ASSERT_EQ(CFE_MSG_GetMsgId(&msg, &msgid), CFE_SUCCESS); ASSERT_EQ(CFE_SB_MsgIdToValue(msgid), 0xFFFF); ASSERT_EQ(CFE_MSG_SetMsgId(&msg, 0), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, sizeof(msg)); + UT_DisplayPkt(&msg, sizeof(msg)); ASSERT_EQ(CFE_MSG_GetMsgId(&msg, &msgid), CFE_SUCCESS); ASSERT_EQ(CFE_SB_MsgIdToValue(msgid), 0); ASSERT_EQ(Test_MSG_NotF(&msg), MSG_HDRVER_FLAG | MSG_APID_FLAG | MSG_TYPE_FLAG | MSG_HASSEC_FLAG); @@ -70,7 +70,7 @@ void Test_MSG_MsgId(void) ASSERT_EQ(CFE_MSG_GetMsgId(&msg, &msgid), CFE_SUCCESS); ASSERT_EQ(CFE_SB_MsgIdToValue(msgid), 0); ASSERT_EQ(CFE_MSG_SetMsgId(&msg, CFE_PLATFORM_SB_HIGHEST_VALID_MSGID), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, sizeof(msg)); + UT_DisplayPkt(&msg, sizeof(msg)); ASSERT_EQ(CFE_MSG_GetMsgId(&msg, &msgid), CFE_SUCCESS); ASSERT_EQ(CFE_SB_MsgIdToValue(msgid), CFE_PLATFORM_SB_HIGHEST_VALID_MSGID); ASSERT_EQ(Test_MSG_NotZero(&msg), MSG_APID_FLAG | MSG_TYPE_FLAG | MSG_HASSEC_FLAG); diff --git a/modules/msg/unit-test-coverage/test_cfe_msg_msgid_v2.c b/modules/msg/unit-test-coverage/test_cfe_msg_msgid_v2.c index eb80fa462..a64664f73 100644 --- a/modules/msg/unit-test-coverage/test_cfe_msg_msgid_v2.c +++ b/modules/msg/unit-test-coverage/test_cfe_msg_msgid_v2.c @@ -68,7 +68,7 @@ void Test_MSG_MsgId(void) ASSERT_EQ(CFE_MSG_GetMsgId(&msg, &msgid), CFE_SUCCESS); ASSERT_EQ(CFE_SB_MsgIdToValue(msgid), 0xFFFF); ASSERT_EQ(CFE_MSG_SetMsgId(&msg, 0), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, sizeof(msg)); + UT_DisplayPkt(&msg, sizeof(msg)); ASSERT_EQ(CFE_MSG_GetMsgId(&msg, &msgid), CFE_SUCCESS); ASSERT_EQ(CFE_SB_MsgIdToValue(msgid), 0); ASSERT_EQ(Test_MSG_NotF(&msg), MSG_APID_FLAG | MSG_TYPE_FLAG | local_subsys_flag); @@ -78,7 +78,7 @@ void Test_MSG_MsgId(void) ASSERT_EQ(CFE_MSG_GetMsgId(&msg, &msgid), CFE_SUCCESS); ASSERT_EQ(CFE_SB_MsgIdToValue(msgid), 0); ASSERT_EQ(CFE_MSG_SetMsgId(&msg, CFE_PLATFORM_SB_HIGHEST_VALID_MSGID), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, sizeof(msg)); + UT_DisplayPkt(&msg, sizeof(msg)); ASSERT_EQ(CFE_MSG_GetMsgId(&msg, &msgid), CFE_SUCCESS); ASSERT_EQ(CFE_SB_MsgIdToValue(msgid), CFE_PLATFORM_SB_HIGHEST_VALID_MSGID); ASSERT_EQ(Test_MSG_NotZero(&msg), MSG_APID_FLAG | MSG_TYPE_FLAG | local_subsys_flag); diff --git a/modules/msg/unit-test-coverage/test_cfe_msg_time.c b/modules/msg/unit-test-coverage/test_cfe_msg_time.c index cb57d372f..657dbe227 100644 --- a/modules/msg/unit-test-coverage/test_cfe_msg_time.c +++ b/modules/msg/unit-test-coverage/test_cfe_msg_time.c @@ -73,7 +73,7 @@ void Test_MSG_Time(void) ASSERT_EQ(actual.Seconds, 0xFFFFFFFF); ASSERT_EQ(actual.Subseconds, 0xFFFF0000); ASSERT_EQ(CFE_MSG_SetMsgTime(msgptr, input[i]), CFE_SUCCESS); - Test_MSG_PrintMsg(msgptr, sizeof(tlm)); + UT_DisplayPkt(msgptr, sizeof(tlm)); ASSERT_EQ(CFE_MSG_GetMsgTime(msgptr, &actual), CFE_SUCCESS); ASSERT_EQ(actual.Seconds, input[i].Seconds); ASSERT_EQ(actual.Subseconds, input[i].Subseconds & 0xFFFF0000); @@ -89,7 +89,7 @@ void Test_MSG_Time(void) ASSERT_EQ(actual.Seconds, 0); ASSERT_EQ(actual.Subseconds, 0); ASSERT_EQ(CFE_MSG_SetMsgTime(msgptr, input[i]), CFE_SUCCESS); - Test_MSG_PrintMsg(msgptr, sizeof(tlm)); + UT_DisplayPkt(msgptr, sizeof(tlm)); ASSERT_EQ(CFE_MSG_GetMsgTime(msgptr, &actual), CFE_SUCCESS); ASSERT_EQ(actual.Seconds, input[i].Seconds); ASSERT_EQ(actual.Subseconds, input[i].Subseconds & 0xFFFF0000); diff --git a/modules/msg/unit-test-coverage/test_msg_utils.c b/modules/msg/unit-test-coverage/test_msg_utils.c deleted file mode 100644 index 1b715076e..000000000 --- a/modules/msg/unit-test-coverage/test_msg_utils.c +++ /dev/null @@ -1,72 +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. -*/ - -/* - * Message header test utilities - */ - -/* - * Includes - */ -#include "cfe_msg_api.h" -#include "test_msg_utils.h" -#include "utassert.h" - -void Test_MSG_PrintMsg(const CFE_MSG_Message_t *MsgPtr, CFE_MSG_Size_t Size) -{ - - int i; - char sbuf[121] = {0}; - char wbuf[6] = {0}; - - if (Size == 0) - { - CFE_MSG_GetSize(MsgPtr, &Size); - } - - for (i = 0; i < Size / 2; i++) - { - sprintf(wbuf, "%02X%02X ", MsgPtr->Byte[i * 2], MsgPtr->Byte[(i * 2) + 1]); - strcat(sbuf, wbuf); - - /* Make sure string buffer doesn't overflow */ - if (sizeof(sbuf) < (strlen(sbuf) + 6)) - break; - } - - UtAssert_Message(UTASSERT_CASETYPE_INFO, __FILE__, __LINE__, "Message: %s", sbuf); -} - -unsigned long long int Test_MSG_Sum(const CFE_MSG_Message_t *MsgPtr) -{ - - CFE_MSG_Size_t length; - unsigned long long int sum = 0; - int i; - - CFE_MSG_GetSize(MsgPtr, &length); - - for (i = 0; i < length; i++) - { - sum += MsgPtr->Byte[i]; - } - - return sum; -} diff --git a/modules/msg/unit-test-coverage/test_msg_utils.h b/modules/msg/unit-test-coverage/test_msg_utils.h index 8ff2c6ef8..e79eeda90 100644 --- a/modules/msg/unit-test-coverage/test_msg_utils.h +++ b/modules/msg/unit-test-coverage/test_msg_utils.h @@ -36,10 +36,4 @@ /* Subtest macro */ #define MSG_UT_ADD_SUBTEST(Func) UT_AddSubTest(Func, NULL, NULL, __func__, #Func) -/* Prints the message, 0 length uses length from message */ -void Test_MSG_PrintMsg(const CFE_MSG_Message_t *MsgPtr, CFE_MSG_Size_t Size); - -/* Sums the message for checking, generically check the entire message */ -unsigned long long int Test_MSG_Sum(const CFE_MSG_Message_t *MsgPtr); - -#endif /* test_msg_utils_ */ +#endif /* test_msg_utils_ */ \ No newline at end of file