diff --git a/modules/cfe_testcase/arch_build.cmake b/modules/cfe_testcase/arch_build.cmake index b04904ed0..f223914b5 100644 --- a/modules/cfe_testcase/arch_build.cmake +++ b/modules/cfe_testcase/arch_build.cmake @@ -18,13 +18,13 @@ set(TEST_PLATFORM_CONFIG_FILE_LIST # the distribution default copies foreach(TEST_CFGFILE ${TEST_PLATFORM_CONFIG_FILE_LIST}) get_filename_component(CFGKEY "${TEST_CFGFILE}" NAME_WE) - if (DEFINED TEST_CFGFILE_SRC_${CFGKEY}) - set(DEFAULT_SOURCE "${TEST_CFGFILE_SRC_${CFGKEY}}") + if (DEFINED TESTCASE_CFGFILE_SRC_${CFGKEY}) + set(DEFAULT_SOURCE GENERATED_FILE "${TESTCASE_CFGFILE_SRC_${CFGKEY}}") else() - set(DEFAULT_SOURCE "${CMAKE_CURRENT_LIST_DIR}/config/default_${TEST_CFGFILE}") + set(DEFAULT_SOURCE FALLBACK_FILE "${CMAKE_CURRENT_LIST_DIR}/config/default_${TEST_CFGFILE}") endif() generate_config_includefile( FILE_NAME "${TEST_CFGFILE}" - FALLBACK_FILE ${DEFAULT_SOURCE} + ${DEFAULT_SOURCE} ) endforeach() diff --git a/modules/cfe_testcase/config/default_cfe_test_msg.h b/modules/cfe_testcase/config/default_cfe_test_msg.h new file mode 100644 index 000000000..1059d0cad --- /dev/null +++ b/modules/cfe_testcase/config/default_cfe_test_msg.h @@ -0,0 +1,29 @@ +/************************************************************************ + * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * + * Copyright (c) 2020 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 app (CFE_TEST) Application Message Definitions + */ +#ifndef CFE_TEST_MSG_H +#define CFE_TEST_MSG_H + +#include "cfe_test_msgdefs.h" +#include "cfe_test_msgstruct.h" + +#endif diff --git a/modules/cfe_testcase/config/default_cfe_testcase_msgids.h b/modules/cfe_testcase/config/default_cfe_test_msgdefs.h similarity index 69% rename from modules/cfe_testcase/config/default_cfe_testcase_msgids.h rename to modules/cfe_testcase/config/default_cfe_test_msgdefs.h index a4b41aa30..9c3ffc770 100644 --- a/modules/cfe_testcase/config/default_cfe_testcase_msgids.h +++ b/modules/cfe_testcase/config/default_cfe_test_msgdefs.h @@ -18,22 +18,23 @@ /** * @file - * CFE Test app (CFE_TEST) Application Message IDs + * CFE Test app (CFE_TEST) Application Message Definitions */ -#ifndef CFE_TEST_MSGIDS_H -#define CFE_TEST_MSGIDS_H +#ifndef CFE_TEST_MSGDEFS_H +#define CFE_TEST_MSGDEFS_H -#include "cfe_core_api_base_msgids.h" -#include "cfe_test_topicids.h" +#include "common_types.h" -/* -** cFE Command Message Id's -*/ -#define CFE_TEST_CMD_MID CFE_PLATFORM_CMD_MID_BASE + CFE_MISSION_TEST_CMD_MSG /* 0x1802 */ +/* A 64-bit payload (worst case for alignment) */ +typedef struct CFE_TEST_TestPayload64 +{ + uint64 Value; +} CFE_TEST_TestPayload64_t; -/* -** CFE Telemetry Message Id's -*/ -#define CFE_TEST_HK_TLM_MID CFE_PLATFORM_TLM_MID_BASE + CFE_MISSION_TEST_HK_TLM_MSG /* 0x0802 */ +/* A 32-bit payload (most common case for alignment) */ +typedef struct CFE_TEST_TestPayload32 +{ + uint32 Value; +} CFE_TEST_TestPayload32_t; #endif diff --git a/modules/cfe_testcase/config/default_cfe_test_msgstruct.h b/modules/cfe_testcase/config/default_cfe_test_msgstruct.h new file mode 100644 index 000000000..5ee7954a1 --- /dev/null +++ b/modules/cfe_testcase/config/default_cfe_test_msgstruct.h @@ -0,0 +1,57 @@ +/************************************************************************ + * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * + * Copyright (c) 2020 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 app (CFE_TEST) Application Message Definitions + */ +#ifndef CFE_TEST_MSGSTRUCT_H +#define CFE_TEST_MSGSTRUCT_H + +#include "cfe_msg_hdr.h" +#include "cfe_test_msgdefs.h" + +/* A simple command message with a 64 bit payload */ +typedef struct CFE_TEST_TestCmdMessage +{ + CFE_MSG_CommandHeader_t CommandHeader; + CFE_TEST_TestPayload64_t Payload; +} CFE_TEST_TestCmdMessage64_t; + +/* A simple telemetry message with a 64 bit payload */ +typedef struct CFE_TEST_TestTlmMessage +{ + CFE_MSG_TelemetryHeader_t TelemetryHeader; + CFE_TEST_TestPayload64_t Payload; +} CFE_TEST_TestTlmMessage64_t; + +/* A simple command message with a 32 bit payload */ +typedef struct +{ + CFE_MSG_CommandHeader_t CommandHeader; + CFE_TEST_TestPayload32_t Payload; +} CFE_TEST_TestCmdMessage32_t; + +/* A simple telemetry message with a 32 bit payload */ +typedef struct +{ + CFE_MSG_TelemetryHeader_t TelemetryHeader; + CFE_TEST_TestPayload32_t Payload; +} CFE_TEST_TestTlmMessage32_t; + +#endif diff --git a/modules/cfe_testcase/config/default_cfe_test_tbl.h b/modules/cfe_testcase/config/default_cfe_test_tbl.h index 5deeeeeec..c5fb7a60e 100644 --- a/modules/cfe_testcase/config/default_cfe_test_tbl.h +++ b/modules/cfe_testcase/config/default_cfe_test_tbl.h @@ -25,13 +25,6 @@ #ifndef CFE_TEST_TBL_H #define CFE_TEST_TBL_H -/* - * Test table structure - */ -typedef struct -{ - uint16 Int1; - uint16 Int2; -} TBL_TEST_Table_t; +#include "cfe_test_tblstruct.h" #endif /* CFE_TEST_TBL_H */ diff --git a/modules/cfe_testcase/config/default_cfe_test_tblstruct.h b/modules/cfe_testcase/config/default_cfe_test_tblstruct.h new file mode 100644 index 000000000..22fd62773 --- /dev/null +++ b/modules/cfe_testcase/config/default_cfe_test_tblstruct.h @@ -0,0 +1,39 @@ +/************************************************************************ + * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * + * Copyright (c) 2020 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 Table struct definition + */ + +#ifndef CFE_TEST_TBLSTRUCT_H +#define CFE_TEST_TBLSTRUCT_H + +#include "common_types.h" + +/* + * Test table structure + */ +typedef struct +{ + uint16 Int1; + uint16 Int2; +} CFE_TEST_TestTable_t; + +#endif /* CFE_TEST_TBLSTRUCT_H */ diff --git a/modules/cfe_testcase/mission_build.cmake b/modules/cfe_testcase/mission_build.cmake index fd1df0bc0..b0e6d8d81 100644 --- a/modules/cfe_testcase/mission_build.cmake +++ b/modules/cfe_testcase/mission_build.cmake @@ -9,18 +9,22 @@ ########################################################### # The list of header files that control the TEST configuration -set(TEST_MISSION_CONFIG_FILE_LIST +set(TESTCASE_MISSION_CONFIG_FILE_LIST + cfe_test_msg.h + cfe_test_msgdefs.h + cfe_test_msgstruct.h cfe_test_tbl.h + cfe_test_tblstruct.h cfe_test_topicids.h ) # Create wrappers around the all the config header files # This makes them individually overridable by the missions, without modifying # the distribution default copies -foreach(TEST_CFGFILE ${TEST_MISSION_CONFIG_FILE_LIST}) +foreach(TEST_CFGFILE ${TESTCASE_MISSION_CONFIG_FILE_LIST}) get_filename_component(CFGKEY "${TEST_CFGFILE}" NAME_WE) - if (DEFINED TEST_CFGFILE_SRC_${CFGKEY}) - set(DEFAULT_SOURCE GENERATED_FILE "${TEST_CFGFILE_SRC_${CFGKEY}}") + if (DEFINED TESTCASE_CFGFILE_SRC_${CFGKEY}) + set(DEFAULT_SOURCE GENERATED_FILE "${TESTCASE_CFGFILE_SRC_${CFGKEY}}") else() set(DEFAULT_SOURCE FALLBACK_FILE "${CMAKE_CURRENT_LIST_DIR}/config/default_${TEST_CFGFILE}") endif() diff --git a/modules/cfe_testcase/src/cfe_test_table.c b/modules/cfe_testcase/src/cfe_test_table.c index b4841152d..312ef9cfd 100644 --- a/modules/cfe_testcase/src/cfe_test_table.c +++ b/modules/cfe_testcase/src/cfe_test_table.c @@ -32,7 +32,7 @@ /* Setup function to register a table */ void RegisterTestTable(void) { - UtAssert_INT32_EQ(CFE_TBL_Register(&CFE_FT_Global.TblHandle, CFE_FT_Global.TblName, sizeof(TBL_TEST_Table_t), + UtAssert_INT32_EQ(CFE_TBL_Register(&CFE_FT_Global.TblHandle, CFE_FT_Global.TblName, sizeof(CFE_TEST_TestTable_t), CFE_TBL_OPT_DEFAULT, NULL), CFE_SUCCESS); } diff --git a/modules/cfe_testcase/src/sb_performance_test.c b/modules/cfe_testcase/src/sb_performance_test.c index c24e9f61d..fc3135543 100644 --- a/modules/cfe_testcase/src/sb_performance_test.c +++ b/modules/cfe_testcase/src/sb_performance_test.c @@ -32,24 +32,11 @@ #include "cfe_test.h" #include "cfe_msgids.h" #include "cfe_test_msgids.h" +#include "cfe_test_msg.h" /* Number of messages to send during test */ uint32_t UT_BulkTestDuration = 1000; -/* A simple command message */ -typedef struct -{ - CFE_MSG_CommandHeader_t CommandHeader; - uint32 CmdPayload; -} CFE_FT_TestCmdMessage_t; - -/* A simple telemetry message */ -typedef struct -{ - CFE_MSG_TelemetryHeader_t TelemetryHeader; - uint32 TlmPayload; -} CFE_FT_TestTlmMessage_t; - /* State structure for multicore test - shared between threads */ typedef struct UT_BulkMultiCoreSharedState { @@ -74,23 +61,23 @@ UT_BulkMultiCoreSharedState_t BulkTlm; * This test procedure should be agnostic to specific MID values, but it should * not overlap/interfere with real MIDs used by other apps. */ -static const CFE_SB_MsgId_t CFE_FT_CMD_MSGID = CFE_SB_MSGID_WRAP_VALUE(CFE_TEST_CMD_MID); -static const CFE_SB_MsgId_t CFE_FT_TLM_MSGID = CFE_SB_MSGID_WRAP_VALUE(CFE_TEST_HK_TLM_MID); +static CFE_SB_MsgId_t CFE_FT_CMD_MSGID; +static CFE_SB_MsgId_t CFE_FT_TLM_MSGID; void TestBulkTransferSingle(void) { - CFE_SB_PipeId_t PipeId1 = CFE_SB_INVALID_PIPE; - CFE_SB_PipeId_t PipeId2 = CFE_SB_INVALID_PIPE; - CFE_FT_TestCmdMessage_t CmdMsg; - CFE_FT_TestTlmMessage_t TlmMsg; - CFE_SB_Buffer_t * MsgBuf; - const CFE_FT_TestCmdMessage_t *CmdPtr; - const CFE_FT_TestTlmMessage_t *TlmPtr; - uint32 SendCount; - OS_time_t StartTime; - OS_time_t ElapsedTime; - int64 AvgRate; - uint32_t PrintMask; + CFE_SB_PipeId_t PipeId1 = CFE_SB_INVALID_PIPE; + CFE_SB_PipeId_t PipeId2 = CFE_SB_INVALID_PIPE; + CFE_TEST_TestCmdMessage32_t CmdMsg; + CFE_TEST_TestTlmMessage32_t TlmMsg; + CFE_SB_Buffer_t * MsgBuf; + const CFE_TEST_TestCmdMessage32_t *CmdPtr; + const CFE_TEST_TestTlmMessage32_t *TlmPtr; + uint32 SendCount; + OS_time_t StartTime; + OS_time_t ElapsedTime; + int64 AvgRate; + uint32_t PrintMask; memset(&CmdMsg, 0, sizeof(CmdMsg)); memset(&TlmMsg, 0, sizeof(TlmMsg)); @@ -118,8 +105,8 @@ void TestBulkTransferSingle(void) for (SendCount = 0; SendCount < UT_BulkTestDuration; ++SendCount) { - CmdMsg.CmdPayload = SendCount; - TlmMsg.TlmPayload = ~SendCount; + CmdMsg.Payload.Value = SendCount; + TlmMsg.Payload.Value = ~SendCount; /* In order to not "flood" with test results, this should be silent unless a failure occurs */ CFE_Assert_STATUS_STORE(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), true)); @@ -142,9 +129,9 @@ void TestBulkTransferSingle(void) /* As above, to avoid flooding of test cases, only report mismatch here */ CmdPtr = (const void *)MsgBuf; - if (CmdPtr->CmdPayload != CmdMsg.CmdPayload) + if (CmdPtr->Payload.Value != CmdMsg.Payload.Value) { - UtAssert_UINT32_EQ(CmdPtr->CmdPayload, CmdMsg.CmdPayload); + UtAssert_UINT32_EQ(CmdPtr->Payload.Value, CmdMsg.Payload.Value); break; } @@ -155,9 +142,9 @@ void TestBulkTransferSingle(void) } TlmPtr = (const void *)MsgBuf; - if (TlmPtr->TlmPayload != TlmMsg.TlmPayload) + if (TlmPtr->Payload.Value != TlmMsg.Payload.Value) { - UtAssert_UINT32_EQ(TlmPtr->TlmPayload, TlmMsg.TlmPayload); + UtAssert_UINT32_EQ(TlmPtr->Payload.Value, TlmMsg.Payload.Value); break; } @@ -186,9 +173,9 @@ void TestBulkTransferSingle(void) void RunSingleCmdSendRecv(void) { - CFE_FT_TestCmdMessage_t CmdMsg; - CFE_SB_Buffer_t * MsgBuf; - const CFE_FT_TestCmdMessage_t *CmdPtr; + CFE_TEST_TestCmdMessage32_t CmdMsg; + CFE_SB_Buffer_t * MsgBuf; + const CFE_TEST_TestCmdMessage32_t *CmdPtr; UtAssert_INT32_EQ(CFE_MSG_Init(CFE_MSG_PTR(CmdMsg.CommandHeader), CFE_FT_CMD_MSGID, sizeof(CmdMsg)), CFE_SUCCESS); @@ -196,7 +183,7 @@ void RunSingleCmdSendRecv(void) while (BulkCmd.SendCount < UT_BulkTestDuration) { - CmdMsg.CmdPayload = BulkCmd.SendCount; + CmdMsg.Payload.Value = BulkCmd.SendCount; /* In order to not "flood" with test results, this should be silent unless a failure occurs */ CFE_Assert_STATUS_STORE(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), true)); @@ -217,9 +204,9 @@ void RunSingleCmdSendRecv(void) /* As above, to avoid flooding of test cases, only report mismatch here */ CmdPtr = (const void *)MsgBuf; - if (CmdPtr->CmdPayload != CmdMsg.CmdPayload) + if (CmdPtr->Payload.Value != CmdMsg.Payload.Value) { - UtAssert_UINT32_EQ(CmdPtr->CmdPayload, CmdMsg.CmdPayload); + UtAssert_UINT32_EQ(CmdPtr->Payload.Value, CmdMsg.Payload.Value); break; } } @@ -232,9 +219,9 @@ void RunSingleCmdSendRecv(void) void RunSingleTlmSendRecv(void) { - CFE_FT_TestTlmMessage_t TlmMsg; - CFE_SB_Buffer_t * MsgBuf; - const CFE_FT_TestTlmMessage_t *TlmPtr; + CFE_TEST_TestTlmMessage32_t TlmMsg; + CFE_SB_Buffer_t * MsgBuf; + const CFE_TEST_TestTlmMessage32_t *TlmPtr; UtAssert_INT32_EQ(CFE_MSG_Init(CFE_MSG_PTR(TlmMsg.TelemetryHeader), CFE_FT_TLM_MSGID, sizeof(TlmMsg)), CFE_SUCCESS); @@ -242,7 +229,7 @@ void RunSingleTlmSendRecv(void) while (BulkTlm.SendCount < UT_BulkTestDuration) { - TlmMsg.TlmPayload = BulkTlm.SendCount; + TlmMsg.Payload.Value = BulkTlm.SendCount; /* In order to not "flood" with test results, this should be silent unless a failure occurs */ CFE_Assert_STATUS_STORE(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmMsg.TelemetryHeader), true)); @@ -263,9 +250,9 @@ void RunSingleTlmSendRecv(void) /* As above, to avoid flooding of test cases, only report mismatch here */ TlmPtr = (const void *)MsgBuf; - if (TlmPtr->TlmPayload != TlmMsg.TlmPayload) + if (TlmPtr->Payload.Value != TlmMsg.Payload.Value) { - UtAssert_UINT32_EQ(TlmPtr->TlmPayload, TlmMsg.TlmPayload); + UtAssert_UINT32_EQ(TlmPtr->Payload.Value, TlmMsg.Payload.Value); break; } } @@ -372,8 +359,8 @@ void TestBulkTransferMulti2(void) void UT_CommandTransmitterTask(void) { - CFE_SB_Buffer_t * BufPtr; - CFE_FT_TestCmdMessage_t *CmdMsgPtr; + CFE_SB_Buffer_t * BufPtr; + CFE_TEST_TestCmdMessage32_t *CmdMsgPtr; CFE_PSP_GetTime(&BulkCmd.StartTime); @@ -386,14 +373,14 @@ void UT_CommandTransmitterTask(void) break; } - BufPtr = CFE_SB_AllocateMessageBuffer(sizeof(CFE_FT_TestCmdMessage_t)); + BufPtr = CFE_SB_AllocateMessageBuffer(sizeof(CFE_TEST_TestCmdMessage32_t)); CmdMsgPtr = (void *)&BufPtr->Msg; /* Initialize the message content */ CFE_MSG_Init(CFE_MSG_PTR(CmdMsgPtr->CommandHeader), CFE_FT_CMD_MSGID, sizeof(*CmdMsgPtr)); - CmdMsgPtr->CmdPayload = BulkCmd.SendCount; + CmdMsgPtr->Payload.Value = BulkCmd.SendCount; CFE_Assert_STATUS_STORE(CFE_SB_TransmitBuffer(BufPtr, true)); if (!CFE_Assert_STATUS_SILENTCHECK(CFE_SUCCESS)) @@ -408,8 +395,8 @@ void UT_CommandTransmitterTask(void) void UT_TelemtryTransmitterTask(void) { - CFE_SB_Buffer_t * BufPtr; - CFE_FT_TestTlmMessage_t *TlmMsgPtr; + CFE_SB_Buffer_t * BufPtr; + CFE_TEST_TestTlmMessage32_t *TlmMsgPtr; CFE_PSP_GetTime(&BulkTlm.StartTime); @@ -422,14 +409,14 @@ void UT_TelemtryTransmitterTask(void) break; } - BufPtr = CFE_SB_AllocateMessageBuffer(sizeof(CFE_FT_TestTlmMessage_t)); + BufPtr = CFE_SB_AllocateMessageBuffer(sizeof(CFE_TEST_TestTlmMessage32_t)); TlmMsgPtr = (void *)&BufPtr->Msg; /* Initialize the message content */ CFE_MSG_Init(CFE_MSG_PTR(TlmMsgPtr->TelemetryHeader), CFE_FT_TLM_MSGID, sizeof(*TlmMsgPtr)); - TlmMsgPtr->TlmPayload = BulkTlm.SendCount; + TlmMsgPtr->Payload.Value = BulkTlm.SendCount; CFE_Assert_STATUS_STORE(CFE_SB_TransmitBuffer(BufPtr, true)); if (!CFE_Assert_STATUS_SILENTCHECK(CFE_SUCCESS)) @@ -444,8 +431,8 @@ void UT_TelemtryTransmitterTask(void) void UT_CommandReceiverTask(void) { - CFE_SB_Buffer_t * MsgBuf; - const CFE_FT_TestCmdMessage_t *CmdPtr; + CFE_SB_Buffer_t * MsgBuf; + const CFE_TEST_TestCmdMessage32_t *CmdPtr; for (BulkCmd.RecvCount = 0; BulkCmd.RecvCount < UT_BulkTestDuration; ++BulkCmd.RecvCount) { @@ -458,9 +445,9 @@ void UT_CommandReceiverTask(void) /* As above, to avoid flooding of test cases, only report mismatch here */ CmdPtr = (const void *)MsgBuf; - if (CmdPtr->CmdPayload != BulkCmd.RecvCount) + if (CmdPtr->Payload.Value != BulkCmd.RecvCount) { - UtAssert_UINT32_EQ(CmdPtr->CmdPayload, BulkCmd.RecvCount); + UtAssert_UINT32_EQ(CmdPtr->Payload.Value, BulkCmd.RecvCount); break; } @@ -478,8 +465,8 @@ void UT_CommandReceiverTask(void) void UT_TelemetryReceiverTask(void) { - CFE_SB_Buffer_t * MsgBuf; - const CFE_FT_TestTlmMessage_t *TlmPtr; + CFE_SB_Buffer_t * MsgBuf; + const CFE_TEST_TestTlmMessage32_t *TlmPtr; for (BulkTlm.RecvCount = 0; BulkTlm.RecvCount < UT_BulkTestDuration; ++BulkTlm.RecvCount) { @@ -492,9 +479,9 @@ void UT_TelemetryReceiverTask(void) /* As above, to avoid flooding of test cases, only report mismatch here */ TlmPtr = (const void *)MsgBuf; - if (TlmPtr->TlmPayload != BulkTlm.RecvCount) + if (TlmPtr->Payload.Value != BulkTlm.RecvCount) { - UtAssert_UINT32_EQ(TlmPtr->TlmPayload, BulkTlm.RecvCount); + UtAssert_UINT32_EQ(TlmPtr->Payload.Value, BulkTlm.RecvCount); break; } @@ -615,6 +602,13 @@ void SBPerformanceTestSetup(void) UtAssert_MIR("Configured to execute %lu message transfers", (unsigned long)UT_BulkTestDuration); + /* + * This test procedure should be agnostic to specific MID values, but it should + * not overlap/interfere with real MIDs used by other apps. + */ + CFE_FT_CMD_MSGID = CFE_SB_ValueToMsgId(CFE_TEST_CMD_MID); + CFE_FT_TLM_MSGID = CFE_SB_ValueToMsgId(CFE_TEST_HK_TLM_MID); + UtTest_Add(TestBulkTransferSingle, NULL, NULL, "Single Thread Bulk Transfer"); UtTest_Add(TestBulkTransferMulti2, NULL, NULL, "2 Thread Bulk Transfer"); UtTest_Add(TestBulkTransferMulti4, NULL, NULL, "4 Thread Bulk Transfer"); diff --git a/modules/cfe_testcase/src/sb_sendrecv_test.c b/modules/cfe_testcase/src/sb_sendrecv_test.c index c404a0abb..846f9bb86 100644 --- a/modules/cfe_testcase/src/sb_sendrecv_test.c +++ b/modules/cfe_testcase/src/sb_sendrecv_test.c @@ -30,23 +30,10 @@ #include "cfe_test.h" #include "cfe_msgids.h" #include "cfe_test_msgids.h" +#include "cfe_test_msg.h" #define CFE_FT_STRINGBUF_SIZE 12 -/* A simple command message */ -typedef struct -{ - CFE_MSG_CommandHeader_t CommandHeader; - uint64 CmdPayload; -} CFE_FT_TestCmdMessage_t; - -/* A simple telemetry message */ -typedef struct -{ - CFE_MSG_TelemetryHeader_t TelemetryHeader; - uint64 TlmPayload; -} CFE_FT_TestTlmMessage_t; - /* A message intended to be (overall) larger than the CFE_MISSION_SB_MAX_SB_MSG_SIZE */ typedef union { @@ -61,22 +48,22 @@ typedef union * This test procedure should be agnostic to specific MID values, but it should * not overlap/interfere with real MIDs used by other apps. */ -static const CFE_SB_MsgId_t CFE_FT_CMD_MSGID = CFE_SB_MSGID_WRAP_VALUE(CFE_TEST_CMD_MID); -static const CFE_SB_MsgId_t CFE_FT_TLM_MSGID = CFE_SB_MSGID_WRAP_VALUE(CFE_TEST_HK_TLM_MID); +static CFE_SB_MsgId_t CFE_FT_CMD_MSGID; +static CFE_SB_MsgId_t CFE_FT_TLM_MSGID; static CFE_FT_TestBigMessage_t CFE_FT_BigMsg; void TestBasicTransmitRecv(void) { - CFE_SB_PipeId_t PipeId1 = CFE_SB_INVALID_PIPE; - CFE_SB_PipeId_t PipeId2 = CFE_SB_INVALID_PIPE; - CFE_FT_TestCmdMessage_t CmdMsg; - CFE_FT_TestTlmMessage_t TlmMsg; - CFE_SB_MsgId_t MsgId; - CFE_MSG_SequenceCount_t Seq1, Seq2; - CFE_SB_Buffer_t * MsgBuf; - const CFE_FT_TestCmdMessage_t *CmdPtr; - const CFE_FT_TestTlmMessage_t *TlmPtr; + CFE_SB_PipeId_t PipeId1 = CFE_SB_INVALID_PIPE; + CFE_SB_PipeId_t PipeId2 = CFE_SB_INVALID_PIPE; + CFE_TEST_TestCmdMessage64_t CmdMsg; + CFE_TEST_TestTlmMessage64_t TlmMsg; + CFE_SB_MsgId_t MsgId; + CFE_MSG_SequenceCount_t Seq1, Seq2; + CFE_SB_Buffer_t * MsgBuf; + const CFE_TEST_TestCmdMessage64_t *CmdPtr; + const CFE_TEST_TestTlmMessage64_t *TlmPtr; memset(&CmdMsg, 0, sizeof(CmdMsg)); memset(&TlmMsg, 0, sizeof(TlmMsg)); @@ -97,25 +84,25 @@ void TestBasicTransmitRecv(void) CFE_MSG_SetSequenceCount(CFE_MSG_PTR(TlmMsg.TelemetryHeader), 21); /* Sending with sequence update should ignore the sequence in the msg struct */ - CmdMsg.CmdPayload = 0x0c0ffee; - TlmMsg.TlmPayload = 0x0d00d1e; + CmdMsg.Payload.Value = 0x0c0ffee; + TlmMsg.Payload.Value = 0x0d00d1e; UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), true), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmMsg.TelemetryHeader), true), CFE_SUCCESS); - CmdMsg.CmdPayload = 0x1c0ffee; - TlmMsg.TlmPayload = 0x1d00d1e; + CmdMsg.Payload.Value = 0x1c0ffee; + TlmMsg.Payload.Value = 0x1d00d1e; UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), true), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmMsg.TelemetryHeader), true), CFE_SUCCESS); /* Sending without sequence update should use the sequence in the msg struct */ - CmdMsg.CmdPayload = 0x2c0ffee; - TlmMsg.TlmPayload = 0x2d00d1e; + CmdMsg.Payload.Value = 0x2c0ffee; + TlmMsg.Payload.Value = 0x2d00d1e; UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), false), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmMsg.TelemetryHeader), false), CFE_SUCCESS); /* Sending again should trigger MsgLimit errors on the pipe, however the call still returns CFE_SUCCESS */ - CmdMsg.CmdPayload = 0x3c0ffee; - TlmMsg.TlmPayload = 0x3d00d1e; + CmdMsg.Payload.Value = 0x3c0ffee; + TlmMsg.Payload.Value = 0x3d00d1e; UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), true), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmMsg.TelemetryHeader), true), CFE_SUCCESS); @@ -156,24 +143,24 @@ void TestBasicTransmitRecv(void) UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&MsgBuf->Msg, &MsgId), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_GetSequenceCount(&MsgBuf->Msg, &Seq1), CFE_SUCCESS); CFE_Assert_MSGID_EQ(MsgId, CFE_FT_CMD_MSGID); - CmdPtr = (const CFE_FT_TestCmdMessage_t *)MsgBuf; - UtAssert_UINT32_EQ(CmdPtr->CmdPayload, 0x0c0ffee); + CmdPtr = (const CFE_TEST_TestCmdMessage64_t *)MsgBuf; + UtAssert_UINT32_EQ(CmdPtr->Payload.Value, 0x0c0ffee); UtAssert_UINT32_EQ(Seq1, 1); UtAssert_INT32_EQ(CFE_SB_ReceiveBuffer(&MsgBuf, PipeId1, CFE_SB_PEND_FOREVER), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&MsgBuf->Msg, &MsgId), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_GetSequenceCount(&MsgBuf->Msg, &Seq1), CFE_SUCCESS); CFE_Assert_MSGID_EQ(MsgId, CFE_FT_CMD_MSGID); - CmdPtr = (const CFE_FT_TestCmdMessage_t *)MsgBuf; - UtAssert_UINT32_EQ(CmdPtr->CmdPayload, 0x1c0ffee); + CmdPtr = (const CFE_TEST_TestCmdMessage64_t *)MsgBuf; + UtAssert_UINT32_EQ(CmdPtr->Payload.Value, 0x1c0ffee); UtAssert_UINT32_EQ(Seq1, 2); UtAssert_INT32_EQ(CFE_SB_ReceiveBuffer(&MsgBuf, PipeId1, CFE_SB_PEND_FOREVER), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&MsgBuf->Msg, &MsgId), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_GetSequenceCount(&MsgBuf->Msg, &Seq1), CFE_SUCCESS); CFE_Assert_MSGID_EQ(MsgId, CFE_FT_CMD_MSGID); - CmdPtr = (const CFE_FT_TestCmdMessage_t *)MsgBuf; - UtAssert_UINT32_EQ(CmdPtr->CmdPayload, 0x2c0ffee); + CmdPtr = (const CFE_TEST_TestCmdMessage64_t *)MsgBuf; + UtAssert_UINT32_EQ(CmdPtr->Payload.Value, 0x2c0ffee); UtAssert_UINT32_EQ(Seq1, 11); /* Final should not be in the pipe, should have been rejected due to MsgLim */ @@ -188,23 +175,23 @@ void TestBasicTransmitRecv(void) UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&MsgBuf->Msg, &MsgId), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_GetSequenceCount(&MsgBuf->Msg, &Seq1), CFE_SUCCESS); CFE_Assert_MSGID_EQ(MsgId, CFE_FT_TLM_MSGID); - TlmPtr = (const CFE_FT_TestTlmMessage_t *)MsgBuf; - UtAssert_UINT32_EQ(TlmPtr->TlmPayload, 0x0d00d1e); + TlmPtr = (const CFE_TEST_TestTlmMessage64_t *)MsgBuf; + UtAssert_UINT32_EQ(TlmPtr->Payload.Value, 0x0d00d1e); UtAssert_INT32_EQ(CFE_SB_ReceiveBuffer(&MsgBuf, PipeId2, 100), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&MsgBuf->Msg, &MsgId), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_GetSequenceCount(&MsgBuf->Msg, &Seq2), CFE_SUCCESS); CFE_Assert_MSGID_EQ(MsgId, CFE_FT_TLM_MSGID); - TlmPtr = (const CFE_FT_TestTlmMessage_t *)MsgBuf; - UtAssert_UINT32_EQ(TlmPtr->TlmPayload, 0x1d00d1e); + TlmPtr = (const CFE_TEST_TestTlmMessage64_t *)MsgBuf; + UtAssert_UINT32_EQ(TlmPtr->Payload.Value, 0x1d00d1e); UtAssert_UINT32_EQ(Seq2, CFE_MSG_GetNextSequenceCount(Seq1)); UtAssert_INT32_EQ(CFE_SB_ReceiveBuffer(&MsgBuf, PipeId2, 100), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&MsgBuf->Msg, &MsgId), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_GetSequenceCount(&MsgBuf->Msg, &Seq2), CFE_SUCCESS); CFE_Assert_MSGID_EQ(MsgId, CFE_FT_TLM_MSGID); - TlmPtr = (const CFE_FT_TestTlmMessage_t *)MsgBuf; - UtAssert_UINT32_EQ(TlmPtr->TlmPayload, 0x2d00d1e); + TlmPtr = (const CFE_TEST_TestTlmMessage64_t *)MsgBuf; + UtAssert_UINT32_EQ(TlmPtr->Payload.Value, 0x2d00d1e); UtAssert_UINT32_EQ(Seq2, 21); /* Final should not be in the pipe, should have been rejected due to MsgLim */ @@ -223,17 +210,17 @@ void TestBasicTransmitRecv(void) */ void TestMsgBroadcast(void) { - CFE_SB_PipeId_t PipeId1 = CFE_SB_INVALID_PIPE; - CFE_SB_PipeId_t PipeId2 = CFE_SB_INVALID_PIPE; - CFE_SB_PipeId_t PipeId3 = CFE_SB_INVALID_PIPE; - CFE_SB_PipeId_t PipeId4 = CFE_SB_INVALID_PIPE; - CFE_FT_TestCmdMessage_t CmdMsg; - CFE_SB_MsgId_t MsgId = CFE_SB_INVALID_MSG_ID; - CFE_SB_Buffer_t * MsgBuf1; - CFE_SB_Buffer_t * MsgBuf2; - CFE_SB_Buffer_t * MsgBuf3; - CFE_SB_Buffer_t * MsgBuf4; - const CFE_FT_TestCmdMessage_t *CmdPtr; + CFE_SB_PipeId_t PipeId1 = CFE_SB_INVALID_PIPE; + CFE_SB_PipeId_t PipeId2 = CFE_SB_INVALID_PIPE; + CFE_SB_PipeId_t PipeId3 = CFE_SB_INVALID_PIPE; + CFE_SB_PipeId_t PipeId4 = CFE_SB_INVALID_PIPE; + CFE_TEST_TestCmdMessage64_t CmdMsg; + CFE_SB_MsgId_t MsgId = CFE_SB_INVALID_MSG_ID; + CFE_SB_Buffer_t * MsgBuf1; + CFE_SB_Buffer_t * MsgBuf2; + CFE_SB_Buffer_t * MsgBuf3; + CFE_SB_Buffer_t * MsgBuf4; + const CFE_TEST_TestCmdMessage64_t *CmdPtr; memset(&CmdMsg, 0, sizeof(CmdMsg)); @@ -253,13 +240,13 @@ void TestMsgBroadcast(void) UtAssert_INT32_EQ(CFE_MSG_Init(CFE_MSG_PTR(CmdMsg.CommandHeader), CFE_FT_CMD_MSGID, sizeof(CmdMsg)), CFE_SUCCESS); /* Make unique content in each message. Sending should always be successful. */ - CmdMsg.CmdPayload = 0xbabb1e00; + CmdMsg.Payload.Value = 0xbabb1e00; UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), true), CFE_SUCCESS); - CmdMsg.CmdPayload = 0xbabb1e01; + CmdMsg.Payload.Value = 0xbabb1e01; UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), true), CFE_SUCCESS); - CmdMsg.CmdPayload = 0xbabb1e02; + CmdMsg.Payload.Value = 0xbabb1e02; UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), true), CFE_SUCCESS); - CmdMsg.CmdPayload = 0xbabb1e03; + CmdMsg.Payload.Value = 0xbabb1e03; UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), true), CFE_SUCCESS); /* Now receive 1st message from Pipes, actual msg should appear on all (no limit violations here) */ @@ -276,8 +263,8 @@ void TestMsgBroadcast(void) /* Confirm content */ UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&MsgBuf1->Msg, &MsgId), CFE_SUCCESS); CFE_Assert_MSGID_EQ(MsgId, CFE_FT_CMD_MSGID); - CmdPtr = (const CFE_FT_TestCmdMessage_t *)MsgBuf1; - UtAssert_UINT32_EQ(CmdPtr->CmdPayload, 0xbabb1e00); + CmdPtr = (const CFE_TEST_TestCmdMessage64_t *)MsgBuf1; + UtAssert_UINT32_EQ(CmdPtr->Payload.Value, 0xbabb1e00); /* Now receive 2nd message from Pipes, should not appear on PipeId 1 due to MsgLimit */ UtAssert_INT32_EQ(CFE_SB_ReceiveBuffer(&MsgBuf1, PipeId1, CFE_SB_POLL), CFE_SB_NO_MESSAGE); @@ -292,8 +279,8 @@ void TestMsgBroadcast(void) /* Confirm content */ UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&MsgBuf2->Msg, &MsgId), CFE_SUCCESS); CFE_Assert_MSGID_EQ(MsgId, CFE_FT_CMD_MSGID); - CmdPtr = (const CFE_FT_TestCmdMessage_t *)MsgBuf2; - UtAssert_UINT32_EQ(CmdPtr->CmdPayload, 0xbabb1e01); + CmdPtr = (const CFE_TEST_TestCmdMessage64_t *)MsgBuf2; + UtAssert_UINT32_EQ(CmdPtr->Payload.Value, 0xbabb1e01); /* Now receive 3rd message from Pipes, should not appear on PipeId 1 or 2 due to MsgLimit */ UtAssert_INT32_EQ(CFE_SB_ReceiveBuffer(&MsgBuf1, PipeId1, CFE_SB_POLL), CFE_SB_NO_MESSAGE); @@ -307,8 +294,8 @@ void TestMsgBroadcast(void) /* Confirm content */ UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&MsgBuf3->Msg, &MsgId), CFE_SUCCESS); CFE_Assert_MSGID_EQ(MsgId, CFE_FT_CMD_MSGID); - CmdPtr = (const CFE_FT_TestCmdMessage_t *)MsgBuf3; - UtAssert_UINT32_EQ(CmdPtr->CmdPayload, 0xbabb1e02); + CmdPtr = (const CFE_TEST_TestCmdMessage64_t *)MsgBuf3; + UtAssert_UINT32_EQ(CmdPtr->Payload.Value, 0xbabb1e02); /* Now receive 4th message from Pipes, should only appear on PipeId4 due PipeDepth limit on 3 */ UtAssert_INT32_EQ(CFE_SB_ReceiveBuffer(&MsgBuf1, PipeId1, CFE_SB_POLL), CFE_SB_NO_MESSAGE); @@ -319,8 +306,8 @@ void TestMsgBroadcast(void) /* Confirm content */ UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&MsgBuf4->Msg, &MsgId), CFE_SUCCESS); CFE_Assert_MSGID_EQ(MsgId, CFE_FT_CMD_MSGID); - CmdPtr = (const CFE_FT_TestCmdMessage_t *)MsgBuf4; - UtAssert_UINT32_EQ(CmdPtr->CmdPayload, 0xbabb1e03); + CmdPtr = (const CFE_TEST_TestCmdMessage64_t *)MsgBuf4; + UtAssert_UINT32_EQ(CmdPtr->Payload.Value, 0xbabb1e03); UtPrintf("Testing: Unsubscribe single pipe"); @@ -328,9 +315,9 @@ void TestMsgBroadcast(void) UtAssert_INT32_EQ(CFE_SB_Unsubscribe(CFE_FT_CMD_MSGID, PipeId2), CFE_SUCCESS); /* Send two more messages */ - CmdMsg.CmdPayload = 0xbabb1e04; + CmdMsg.Payload.Value = 0xbabb1e04; UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), true), CFE_SUCCESS); - CmdMsg.CmdPayload = 0xbabb1e05; + CmdMsg.Payload.Value = 0xbabb1e05; UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), true), CFE_SUCCESS); /* poll all pipes again, message should appear on all except PipeId2 (Unsubscribed) */ @@ -346,8 +333,8 @@ void TestMsgBroadcast(void) /* Confirm content */ UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&MsgBuf1->Msg, &MsgId), CFE_SUCCESS); CFE_Assert_MSGID_EQ(MsgId, CFE_FT_CMD_MSGID); - CmdPtr = (const CFE_FT_TestCmdMessage_t *)MsgBuf1; - UtAssert_UINT32_EQ(CmdPtr->CmdPayload, 0xbabb1e04); + CmdPtr = (const CFE_TEST_TestCmdMessage64_t *)MsgBuf1; + UtAssert_UINT32_EQ(CmdPtr->Payload.Value, 0xbabb1e04); /* poll all pipes again, message should appear on all except PipeId1 (MsgLim) or PipeId2 (Unsubscribed) */ UtAssert_INT32_EQ(CFE_SB_ReceiveBuffer(&MsgBuf1, PipeId1, CFE_SB_POLL), CFE_SB_NO_MESSAGE); @@ -361,8 +348,8 @@ void TestMsgBroadcast(void) /* Confirm content */ UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&MsgBuf3->Msg, &MsgId), CFE_SUCCESS); CFE_Assert_MSGID_EQ(MsgId, CFE_FT_CMD_MSGID); - CmdPtr = (const CFE_FT_TestCmdMessage_t *)MsgBuf3; - UtAssert_UINT32_EQ(CmdPtr->CmdPayload, 0xbabb1e05); + CmdPtr = (const CFE_TEST_TestCmdMessage64_t *)MsgBuf3; + UtAssert_UINT32_EQ(CmdPtr->Payload.Value, 0xbabb1e05); /* poll all pipes again, all should be empty now */ UtAssert_INT32_EQ(CFE_SB_ReceiveBuffer(&MsgBuf1, PipeId1, CFE_SB_POLL), CFE_SB_NO_MESSAGE); @@ -403,8 +390,8 @@ void TestZeroCopyTransmitRecv(void) UtAssert_NULL(CFE_SB_AllocateMessageBuffer(CFE_MISSION_SB_MAX_SB_MSG_SIZE + 1)); /* Nominal */ - UtAssert_NOT_NULL(CmdBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_FT_TestCmdMessage_t))); - UtAssert_NOT_NULL(TlmBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_FT_TestTlmMessage_t))); + UtAssert_NOT_NULL(CmdBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_TEST_TestCmdMessage64_t))); + UtAssert_NOT_NULL(TlmBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_TEST_TestTlmMessage64_t))); UtPrintf("Testing: CFE_SB_ReleaseMessageBuffer"); @@ -421,8 +408,8 @@ void TestZeroCopyTransmitRecv(void) UtPrintf("Testing: CFE_SB_TransmitBuffer"); /* Initialize the message content */ - UtAssert_INT32_EQ(CFE_MSG_Init(&CmdBuf->Msg, CFE_FT_CMD_MSGID, sizeof(CFE_FT_TestCmdMessage_t)), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_MSG_Init(&TlmBuf->Msg, CFE_FT_TLM_MSGID, sizeof(CFE_FT_TestTlmMessage_t)), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_Init(&CmdBuf->Msg, CFE_FT_CMD_MSGID, sizeof(CFE_TEST_TestCmdMessage64_t)), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_Init(&TlmBuf->Msg, CFE_FT_TLM_MSGID, sizeof(CFE_TEST_TestTlmMessage64_t)), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_SB_TransmitBuffer(CmdBuf, true), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_SB_TransmitBuffer(TlmBuf, true), CFE_SUCCESS); @@ -469,10 +456,10 @@ void TestZeroCopyTransmitRecv(void) UtPrintf("Testing: CFE_SB_TransmitBuffer sequence number updates"); /* Send a set of messages with and without sequence number update flag */ - UtAssert_NOT_NULL(CmdBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_FT_TestCmdMessage_t))); - UtAssert_NOT_NULL(TlmBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_FT_TestTlmMessage_t))); - UtAssert_INT32_EQ(CFE_MSG_Init(&CmdBuf->Msg, CFE_FT_CMD_MSGID, sizeof(CFE_FT_TestCmdMessage_t)), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_MSG_Init(&TlmBuf->Msg, CFE_FT_TLM_MSGID, sizeof(CFE_FT_TestTlmMessage_t)), CFE_SUCCESS); + UtAssert_NOT_NULL(CmdBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_TEST_TestCmdMessage64_t))); + UtAssert_NOT_NULL(TlmBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_TEST_TestTlmMessage64_t))); + UtAssert_INT32_EQ(CFE_MSG_Init(&CmdBuf->Msg, CFE_FT_CMD_MSGID, sizeof(CFE_TEST_TestCmdMessage64_t)), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_Init(&TlmBuf->Msg, CFE_FT_TLM_MSGID, sizeof(CFE_TEST_TestTlmMessage64_t)), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_SetSequenceCount(&CmdBuf->Msg, 1234), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_SetSequenceCount(&TlmBuf->Msg, 5678), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_SB_TransmitBuffer(CmdBuf, true), CFE_SUCCESS); @@ -486,10 +473,10 @@ void TestZeroCopyTransmitRecv(void) UtAssert_INT32_EQ(CFE_MSG_GetSequenceCount(&MsgBuf->Msg, &SeqTlm1), CFE_SUCCESS); /* Send a second message also with increment = true and confirm value */ - UtAssert_NOT_NULL(CmdBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_FT_TestCmdMessage_t))); - UtAssert_NOT_NULL(TlmBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_FT_TestTlmMessage_t))); - UtAssert_INT32_EQ(CFE_MSG_Init(&CmdBuf->Msg, CFE_FT_CMD_MSGID, sizeof(CFE_FT_TestCmdMessage_t)), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_MSG_Init(&TlmBuf->Msg, CFE_FT_TLM_MSGID, sizeof(CFE_FT_TestTlmMessage_t)), CFE_SUCCESS); + UtAssert_NOT_NULL(CmdBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_TEST_TestCmdMessage64_t))); + UtAssert_NOT_NULL(TlmBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_TEST_TestTlmMessage64_t))); + UtAssert_INT32_EQ(CFE_MSG_Init(&CmdBuf->Msg, CFE_FT_CMD_MSGID, sizeof(CFE_TEST_TestCmdMessage64_t)), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_Init(&TlmBuf->Msg, CFE_FT_TLM_MSGID, sizeof(CFE_TEST_TestTlmMessage64_t)), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_SetSequenceCount(&CmdBuf->Msg, 1234), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_SetSequenceCount(&TlmBuf->Msg, 5678), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_SB_TransmitBuffer(CmdBuf, true), CFE_SUCCESS); @@ -504,10 +491,10 @@ void TestZeroCopyTransmitRecv(void) UtAssert_UINT32_EQ(SeqTlm2, CFE_MSG_GetNextSequenceCount(SeqTlm1)); /* should be +1 from the previous */ /* Send a third message also with increment = false and confirm value */ - UtAssert_NOT_NULL(CmdBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_FT_TestCmdMessage_t))); - UtAssert_NOT_NULL(TlmBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_FT_TestTlmMessage_t))); - UtAssert_INT32_EQ(CFE_MSG_Init(&CmdBuf->Msg, CFE_FT_CMD_MSGID, sizeof(CFE_FT_TestCmdMessage_t)), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_MSG_Init(&TlmBuf->Msg, CFE_FT_TLM_MSGID, sizeof(CFE_FT_TestTlmMessage_t)), CFE_SUCCESS); + UtAssert_NOT_NULL(CmdBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_TEST_TestCmdMessage64_t))); + UtAssert_NOT_NULL(TlmBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_TEST_TestTlmMessage64_t))); + UtAssert_INT32_EQ(CFE_MSG_Init(&CmdBuf->Msg, CFE_FT_CMD_MSGID, sizeof(CFE_TEST_TestCmdMessage64_t)), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_Init(&TlmBuf->Msg, CFE_FT_TLM_MSGID, sizeof(CFE_TEST_TestTlmMessage64_t)), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_SetSequenceCount(&CmdBuf->Msg, 1234), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_SetSequenceCount(&TlmBuf->Msg, 5678), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_SB_TransmitBuffer(CmdBuf, false), CFE_SUCCESS); @@ -526,6 +513,38 @@ void TestZeroCopyTransmitRecv(void) UtAssert_INT32_EQ(CFE_SB_DeletePipe(PipeId2), CFE_SUCCESS); } +void TestMessageUserDataAccess(void) +{ + CFE_TEST_TestCmdMessage64_t CmdMsg; + CFE_TEST_TestTlmMessage64_t TlmMsg; + + /* Test CFE_SB_GetUserData */ + UtAssert_INT32_EQ( + CFE_MSG_Init(CFE_MSG_PTR(CmdMsg.CommandHeader), CFE_FT_CMD_MSGID, sizeof(CFE_TEST_TestCmdMessage64_t)), + CFE_SUCCESS); + UtAssert_INT32_EQ( + CFE_MSG_Init(CFE_MSG_PTR(TlmMsg.TelemetryHeader), CFE_FT_TLM_MSGID, sizeof(CFE_TEST_TestTlmMessage64_t)), + CFE_SUCCESS); + + UtAssert_ADDRESS_EQ(CFE_SB_GetUserData(CFE_MSG_PTR(CmdMsg.CommandHeader)), &CmdMsg.Payload); + UtAssert_ADDRESS_EQ(CFE_SB_GetUserData(CFE_MSG_PTR(TlmMsg.TelemetryHeader)), &TlmMsg.Payload); + + UtAssert_UINT32_EQ(CFE_SB_GetUserDataLength(CFE_MSG_PTR(CmdMsg.CommandHeader)), sizeof(CmdMsg.Payload)); + UtAssert_UINT32_EQ(CFE_SB_GetUserDataLength(CFE_MSG_PTR(TlmMsg.TelemetryHeader)), sizeof(TlmMsg.Payload)); + + /* The size should be settable to something less, if necessary */ + CFE_SB_SetUserDataLength(CFE_MSG_PTR(CmdMsg.CommandHeader), sizeof(CmdMsg.Payload) - 2); + CFE_SB_SetUserDataLength(CFE_MSG_PTR(TlmMsg.TelemetryHeader), sizeof(TlmMsg.Payload) - 2); + UtAssert_UINT32_EQ(CFE_SB_GetUserDataLength(CFE_MSG_PTR(CmdMsg.CommandHeader)), sizeof(CmdMsg.Payload) - 2); + UtAssert_UINT32_EQ(CFE_SB_GetUserDataLength(CFE_MSG_PTR(TlmMsg.TelemetryHeader)), sizeof(TlmMsg.Payload) - 2); + + /* Bad inputs */ + UtAssert_NULL(CFE_SB_GetUserData(NULL)); + UtAssert_NULL(CFE_SB_GetUserData(NULL)); + UtAssert_ZERO(CFE_SB_GetUserDataLength(NULL)); + UtAssert_ZERO(CFE_SB_GetUserDataLength(NULL)); +} + void TestMiscMessageUtils(void) { char TestString[CFE_FT_STRINGBUF_SIZE + 4]; @@ -600,8 +619,12 @@ void TestMiscMessageUtils(void) void SBSendRecvTestSetup(void) { + CFE_FT_CMD_MSGID = CFE_SB_ValueToMsgId(CFE_TEST_CMD_MID); + CFE_FT_TLM_MSGID = CFE_SB_ValueToMsgId(CFE_TEST_HK_TLM_MID); + UtTest_Add(TestBasicTransmitRecv, NULL, NULL, "Test Basic Transmit/Receive"); UtTest_Add(TestZeroCopyTransmitRecv, NULL, NULL, "Test Zero Copy Transmit/Receive"); UtTest_Add(TestMsgBroadcast, NULL, NULL, "Test Msg Broadcast"); UtTest_Add(TestMiscMessageUtils, NULL, NULL, "Test Miscellaneous Message Utility APIs"); + UtTest_Add(TestMessageUserDataAccess, NULL, NULL, "Test Message UserData APIs"); } diff --git a/modules/cfe_testcase/src/sb_subscription_test.c b/modules/cfe_testcase/src/sb_subscription_test.c index 12cf51eb3..d50cab735 100644 --- a/modules/cfe_testcase/src/sb_subscription_test.c +++ b/modules/cfe_testcase/src/sb_subscription_test.c @@ -35,8 +35,8 @@ * This test procedure should be agnostic to specific MID values, but it should * not overlap/interfere with real MIDs used by other apps. */ -static const CFE_SB_MsgId_t CFE_FT_CMD_MSGID = CFE_SB_MSGID_WRAP_VALUE(CFE_TEST_CMD_MID); -static const CFE_SB_MsgId_t CFE_FT_TLM_MSGID = CFE_SB_MSGID_WRAP_VALUE(CFE_TEST_HK_TLM_MID); +static CFE_SB_MsgId_t CFE_FT_CMD_MSGID; +static CFE_SB_MsgId_t CFE_FT_TLM_MSGID; void TestSubscribeUnsubscribe(void) { @@ -276,6 +276,9 @@ void TestSBMaxDestinations(void) void SBSubscriptionTestSetup(void) { + CFE_FT_CMD_MSGID = CFE_SB_ValueToMsgId(CFE_TEST_CMD_MID); + CFE_FT_TLM_MSGID = CFE_SB_ValueToMsgId(CFE_TEST_HK_TLM_MID); + UtTest_Add(TestSubscribeUnsubscribe, NULL, NULL, "Test SB Subscribe/Unsubscribe"); UtTest_Add(TestSubscribeUnsubscribeLocal, NULL, NULL, "Test SB SubscribeLocal/UnsubscribeLocal"); UtTest_Add(TestSubscribeEx, NULL, NULL, "Test SB SubscribeEx"); diff --git a/modules/cfe_testcase/src/tbl_content_access_test.c b/modules/cfe_testcase/src/tbl_content_access_test.c index c36223616..4a18b0b3d 100644 --- a/modules/cfe_testcase/src/tbl_content_access_test.c +++ b/modules/cfe_testcase/src/tbl_content_access_test.c @@ -33,16 +33,16 @@ /* * Helper function to attempt to load the test table with data and assert with the provided CFE_Status_t */ -void LoadTable(TBL_TEST_Table_t *TestTable, CFE_Status_t ExpectedStatus) +void LoadTable(CFE_TEST_TestTable_t *TestTable, CFE_Status_t ExpectedStatus) { UtAssert_INT32_EQ(CFE_TBL_Load(CFE_FT_Global.TblHandle, CFE_TBL_SRC_ADDRESS, TestTable), ExpectedStatus); } void TestGetAddress(void) { - void * TblPtr; - TBL_TEST_Table_t *TestTblPtr; - TBL_TEST_Table_t TestTable = {1, 2}; + void * TblPtr; + CFE_TEST_TestTable_t *TestTblPtr; + CFE_TEST_TestTable_t TestTable = {1, 2}; CFE_TBL_Handle_t SharedTblHandle = CFE_TBL_BAD_TABLE_HANDLE; const char * SharedTblName = CFE_ASSERT_SHARED_TBL_NAME; @@ -60,7 +60,7 @@ void TestGetAddress(void) UtAssert_INT32_EQ(CFE_TBL_GetAddress(&TblPtr, CFE_FT_Global.TblHandle), CFE_SUCCESS); /* Check table contents */ - TestTblPtr = (TBL_TEST_Table_t *)TblPtr; + TestTblPtr = (CFE_TEST_TestTable_t *)TblPtr; UtAssert_INT32_EQ(TestTblPtr->Int1, TestTable.Int1); UtAssert_INT32_EQ(TestTblPtr->Int2, TestTable.Int2); @@ -78,8 +78,8 @@ void TestGetAddress(void) void TestReleaseAddress(void) { UtPrintf("Testing: CFE_TBL_GetAddress"); - void * TblPtr; - TBL_TEST_Table_t TestTable = {1, 2}; + void * TblPtr; + CFE_TEST_TestTable_t TestTable = {1, 2}; /* Never loaded */ UtAssert_INT32_EQ(CFE_TBL_ReleaseAddress(CFE_FT_Global.TblHandle), CFE_TBL_ERR_NEVER_LOADED); UtAssert_INT32_EQ(CFE_TBL_ReleaseAddress(CFE_TBL_BAD_TABLE_HANDLE), CFE_TBL_ERR_INVALID_HANDLE); @@ -106,12 +106,12 @@ void TestReleaseAddress(void) void TestGetReleaseAddresses(void) { - int numValidTbls = 5; - char TblName[10]; - CFE_TBL_Handle_t TblHandles[numValidTbls + 1]; - void * TblPtrs[numValidTbls + 1]; - TBL_TEST_Table_t TblPtrsList[numValidTbls + 1]; - TBL_TEST_Table_t TestTable = {1, 2}; + int numValidTbls = 5; + char TblName[10]; + CFE_TBL_Handle_t TblHandles[numValidTbls + 1]; + void * TblPtrs[numValidTbls + 1]; + CFE_TEST_TestTable_t TblPtrsList[numValidTbls + 1]; + CFE_TEST_TestTable_t TestTable = {1, 2}; /* Put an invalid handle at the start*/ TblHandles[0] = CFE_TBL_BAD_TABLE_HANDLE; @@ -120,7 +120,7 @@ void TestGetReleaseAddresses(void) { sprintf(TblName, "%d", i); UtAssert_INT32_EQ( - CFE_TBL_Register(&TblHandles[i], TblName, sizeof(TBL_TEST_Table_t), CFE_TBL_OPT_DEFAULT, NULL), + CFE_TBL_Register(&TblHandles[i], TblName, sizeof(CFE_TEST_TestTable_t), CFE_TBL_OPT_DEFAULT, NULL), CFE_SUCCESS); TblPtrs[i] = TblPtrsList + i; } diff --git a/modules/cfe_testcase/src/tbl_content_mang_test.c b/modules/cfe_testcase/src/tbl_content_mang_test.c index ec1135980..d488acf01 100644 --- a/modules/cfe_testcase/src/tbl_content_mang_test.c +++ b/modules/cfe_testcase/src/tbl_content_mang_test.c @@ -55,25 +55,25 @@ static const char TESTTBL_PARTIAL_FILE[] = void TestLoad(void) { - CFE_TBL_Handle_t BadTblHandle; - const char * BadTblName = "BadTableName"; - CFE_TBL_Handle_t DumpTblHandle; - const char * DumpTblName = "DumpOnlyTable"; - CFE_TBL_Handle_t SharedTblHandle; - const char * SharedTblName = CFE_FT_Global.RegisteredTblName; - TBL_TEST_Table_t TestTable = {0xd00d, 0xdad}; - TBL_TEST_Table_t *TablePtr; - CFE_TBL_Handle_t OtherHandle; - void * TempPtr; + CFE_TBL_Handle_t BadTblHandle; + const char * BadTblName = "BadTableName"; + CFE_TBL_Handle_t DumpTblHandle; + const char * DumpTblName = "DumpOnlyTable"; + CFE_TBL_Handle_t SharedTblHandle; + const char * SharedTblName = CFE_FT_Global.RegisteredTblName; + CFE_TEST_TestTable_t TestTable = {0xd00d, 0xdad}; + CFE_TEST_TestTable_t *TablePtr; + CFE_TBL_Handle_t OtherHandle; + void * TempPtr; UtPrintf("Testing: CFE_TBL_Load"); UtAssert_INT32_EQ( - CFE_TBL_Register(&BadTblHandle, BadTblName, sizeof(TBL_TEST_Table_t), CFE_TBL_OPT_DBL_BUFFER, NULL), + CFE_TBL_Register(&BadTblHandle, BadTblName, sizeof(CFE_TEST_TestTable_t), CFE_TBL_OPT_DBL_BUFFER, NULL), CFE_SUCCESS); /* Create a second table handle, to keep things interesting */ - UtAssert_INT32_EQ(CFE_TBL_Register(&OtherHandle, TESTTBL_OTHER_NAME, sizeof(TBL_TEST_Table_t), 0, NULL), + UtAssert_INT32_EQ(CFE_TBL_Register(&OtherHandle, TESTTBL_OTHER_NAME, sizeof(CFE_TEST_TestTable_t), 0, NULL), CFE_SUCCESS); /* Some basic failure checks */ @@ -200,7 +200,7 @@ void TestLoad(void) /* Attempt to load a dump only table */ UtAssert_INT32_EQ( - CFE_TBL_Register(&DumpTblHandle, DumpTblName, sizeof(TBL_TEST_Table_t), CFE_TBL_OPT_DUMP_ONLY, NULL), + CFE_TBL_Register(&DumpTblHandle, DumpTblName, sizeof(CFE_TEST_TestTable_t), CFE_TBL_OPT_DUMP_ONLY, NULL), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_TBL_Load(DumpTblHandle, CFE_TBL_SRC_FILE, TESTTBL_NOMINAL_FILE), CFE_TBL_ERR_DUMP_ONLY); @@ -283,12 +283,12 @@ void TblTest_GenerateTblFiles(void) uint32 PartialSize; union { - uint8 u8; - uint16 u16; - uint32 u32; - CFE_FS_Header_t FsHdr; - CFE_TBL_File_Hdr_t TblHdr; - TBL_TEST_Table_t Content; + uint8 u8; + uint16 u16; + uint32 u32; + CFE_FS_Header_t FsHdr; + CFE_TBL_File_Hdr_t TblHdr; + CFE_TEST_TestTable_t Content; } buf; /* Open the original (correct) table image file for reference */ @@ -443,7 +443,7 @@ void TblTest_GenerateTblFiles(void) UtAssert_INT32_EQ(OS_write(fh2, &buf, sizeof(buf.FsHdr)), sizeof(buf.FsHdr)); UtAssert_INT32_EQ(OS_read(fh1, &buf, sizeof(buf.TblHdr)), sizeof(buf.TblHdr)); PartialOffset = 0; - PartialSize = offsetof(TBL_TEST_Table_t, Int2); + PartialSize = offsetof(CFE_TEST_TestTable_t, Int2); TblTest_UpdateOffset(&buf.TblHdr.Offset, PartialOffset); TblTest_UpdateOffset(&buf.TblHdr.NumBytes, PartialSize); UtAssert_INT32_EQ(OS_write(fh2, &buf, sizeof(buf.TblHdr)), sizeof(buf.TblHdr)); @@ -463,8 +463,8 @@ void TblTest_GenerateTblFiles(void) UtAssert_INT32_EQ(OS_read(fh1, &buf, sizeof(buf.FsHdr)), sizeof(buf.FsHdr)); UtAssert_INT32_EQ(OS_write(fh2, &buf, sizeof(buf.FsHdr)), sizeof(buf.FsHdr)); UtAssert_INT32_EQ(OS_read(fh1, &buf, sizeof(buf.TblHdr)), sizeof(buf.TblHdr)); - PartialOffset = offsetof(TBL_TEST_Table_t, Int2); - PartialSize = sizeof(buf.Content) - offsetof(TBL_TEST_Table_t, Int2); + PartialOffset = offsetof(CFE_TEST_TestTable_t, Int2); + PartialSize = sizeof(buf.Content) - offsetof(CFE_TEST_TestTable_t, Int2); TblTest_UpdateOffset(&buf.TblHdr.Offset, PartialOffset); TblTest_UpdateOffset(&buf.TblHdr.NumBytes, PartialSize); UtAssert_INT32_EQ(OS_write(fh2, &buf, sizeof(buf.TblHdr)), sizeof(buf.TblHdr)); diff --git a/modules/cfe_testcase/src/tbl_information_test.c b/modules/cfe_testcase/src/tbl_information_test.c index 1d530688e..5a57e6e4c 100644 --- a/modules/cfe_testcase/src/tbl_information_test.c +++ b/modules/cfe_testcase/src/tbl_information_test.c @@ -58,7 +58,7 @@ void TestGetInfo(void) UtAssert_INT32_EQ(CFE_TBL_GetInfo(&TblInfo, NULL), CFE_TBL_BAD_ARGUMENT); /* This is only checking some parts of the TblInfo struct */ - size_t expectedSize = sizeof(TBL_TEST_Table_t); + size_t expectedSize = sizeof(CFE_TEST_TestTable_t); uint32 expectedNumUsers = 1; bool expectedTableLoaded = false; bool expectedDumpOnly = false; diff --git a/modules/cfe_testcase/src/tbl_registration_test.c b/modules/cfe_testcase/src/tbl_registration_test.c index 84f848b0a..294f642e8 100644 --- a/modules/cfe_testcase/src/tbl_registration_test.c +++ b/modules/cfe_testcase/src/tbl_registration_test.c @@ -49,23 +49,23 @@ void TestTableRegistration(void) /* invalid table handle arg */ UtAssert_INT32_EQ( - CFE_TBL_Register(NULL, CFE_FT_Global.TblName, sizeof(TBL_TEST_Table_t), CFE_TBL_OPT_DEFAULT, &CallbackFunc), + CFE_TBL_Register(NULL, CFE_FT_Global.TblName, sizeof(CFE_TEST_TestTable_t), CFE_TBL_OPT_DEFAULT, &CallbackFunc), CFE_TBL_BAD_ARGUMENT); /* Successfully create table */ - UtAssert_INT32_EQ(CFE_TBL_Register(&CFE_FT_Global.TblHandle, CFE_FT_Global.TblName, sizeof(TBL_TEST_Table_t), + UtAssert_INT32_EQ(CFE_TBL_Register(&CFE_FT_Global.TblHandle, CFE_FT_Global.TblName, sizeof(CFE_TEST_TestTable_t), CFE_TBL_OPT_DEFAULT, &CallbackFunc), CFE_SUCCESS); /* Duplicate table (should return the same handle) */ - UtAssert_INT32_EQ(CFE_TBL_Register(&OtherHandle, CFE_FT_Global.TblName, sizeof(TBL_TEST_Table_t), + UtAssert_INT32_EQ(CFE_TBL_Register(&OtherHandle, CFE_FT_Global.TblName, sizeof(CFE_TEST_TestTable_t), CFE_TBL_OPT_DEFAULT, &CallbackFunc), CFE_TBL_WARN_DUPLICATE); UtAssert_INT32_EQ(OtherHandle, CFE_FT_Global.TblHandle); /* Duplicate table with different size */ - UtAssert_INT32_EQ(CFE_TBL_Register(&OtherHandle, CFE_FT_Global.TblName, sizeof(TBL_TEST_Table_t) / 2, + UtAssert_INT32_EQ(CFE_TBL_Register(&OtherHandle, CFE_FT_Global.TblName, sizeof(CFE_TEST_TestTable_t) / 2, CFE_TBL_OPT_DEFAULT, &CallbackFunc), CFE_TBL_ERR_DUPLICATE_DIFF_SIZE); @@ -76,10 +76,10 @@ void TestTableRegistration(void) /* Invalid Name */ UtAssert_INT32_EQ( - CFE_TBL_Register(&CFE_FT_Global.TblHandle, BadTblName, sizeof(TBL_TEST_Table_t), CFE_TBL_OPT_DEFAULT, NULL), + CFE_TBL_Register(&CFE_FT_Global.TblHandle, BadTblName, sizeof(CFE_TEST_TestTable_t), CFE_TBL_OPT_DEFAULT, NULL), CFE_TBL_ERR_INVALID_NAME); UtAssert_INT32_EQ( - CFE_TBL_Register(&CFE_FT_Global.TblHandle, "", sizeof(TBL_TEST_Table_t), CFE_TBL_OPT_DEFAULT, NULL), + CFE_TBL_Register(&CFE_FT_Global.TblHandle, "", sizeof(CFE_TEST_TestTable_t), CFE_TBL_OPT_DEFAULT, NULL), CFE_TBL_ERR_INVALID_NAME); /* Invalid Table Size */ @@ -93,13 +93,13 @@ void TestTableRegistration(void) CFE_TBL_ERR_INVALID_SIZE); /* Invalid Table Options */ - UtAssert_INT32_EQ(CFE_TBL_Register(&CFE_FT_Global.TblHandle, CFE_FT_Global.TblName, sizeof(TBL_TEST_Table_t), + UtAssert_INT32_EQ(CFE_TBL_Register(&CFE_FT_Global.TblHandle, CFE_FT_Global.TblName, sizeof(CFE_TEST_TestTable_t), CFE_TBL_OPT_DBL_BUFFER | CFE_TBL_OPT_USR_DEF_ADDR, NULL), CFE_TBL_ERR_INVALID_OPTIONS); - UtAssert_INT32_EQ(CFE_TBL_Register(&CFE_FT_Global.TblHandle, CFE_FT_Global.TblName, sizeof(TBL_TEST_Table_t), + UtAssert_INT32_EQ(CFE_TBL_Register(&CFE_FT_Global.TblHandle, CFE_FT_Global.TblName, sizeof(CFE_TEST_TestTable_t), CFE_TBL_OPT_CRITICAL | CFE_TBL_OPT_DUMP_ONLY, NULL), CFE_TBL_ERR_INVALID_OPTIONS); - UtAssert_INT32_EQ(CFE_TBL_Register(&CFE_FT_Global.TblHandle, CFE_FT_Global.TblName, sizeof(TBL_TEST_Table_t), + UtAssert_INT32_EQ(CFE_TBL_Register(&CFE_FT_Global.TblHandle, CFE_FT_Global.TblName, sizeof(CFE_TEST_TestTable_t), CFE_TBL_OPT_CRITICAL | CFE_TBL_OPT_USR_DEF_ADDR, NULL), CFE_TBL_ERR_INVALID_OPTIONS); } @@ -119,8 +119,8 @@ void TestTableMaxLimits(void) while (numTblsCreated <= CFE_PLATFORM_TBL_MAX_NUM_HANDLES) { snprintf(TblName, sizeof(TblName), "Tbl%u", (unsigned int)numTblsCreated); - CFE_Assert_STATUS_STORE( - CFE_TBL_Register(&Handles[numTblsCreated], TblName, sizeof(TBL_TEST_Table_t), CFE_TBL_OPT_DEFAULT, NULL)); + CFE_Assert_STATUS_STORE(CFE_TBL_Register(&Handles[numTblsCreated], TblName, sizeof(CFE_TEST_TestTable_t), + CFE_TBL_OPT_DEFAULT, NULL)); if (CFE_Assert_STATUS_MAY_BE(CFE_TBL_ERR_REGISTRY_FULL)) { break; @@ -175,7 +175,7 @@ void TestTableMaxLimits(void) /* also confirm not able to register a new table, either */ snprintf(TblName, sizeof(TblName), "Tbl%u", (unsigned int)numTblsCreated); UtAssert_INT32_EQ( - CFE_TBL_Register(&Handles[numTblsCreated], TblName, sizeof(TBL_TEST_Table_t), CFE_TBL_OPT_DEFAULT, NULL), + CFE_TBL_Register(&Handles[numTblsCreated], TblName, sizeof(CFE_TEST_TestTable_t), CFE_TBL_OPT_DEFAULT, NULL), CFE_TBL_ERR_HANDLES_FULL); /* Unregister all table handles */ @@ -206,7 +206,7 @@ void TestTblNonAppContext(void) /* Attempt to register another table */ UtAssert_INT32_EQ( - CFE_TBL_Register(&Handle, "OtherTable", sizeof(TBL_TEST_Table_t), CFE_TBL_OPT_DEFAULT, &CallbackFunc), + CFE_TBL_Register(&Handle, "OtherTable", sizeof(CFE_TEST_TestTable_t), CFE_TBL_OPT_DEFAULT, &CallbackFunc), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Calling any other API (with a valid handle) should be rejected from this context */ @@ -235,7 +235,7 @@ void TestTableBadContext(void) OS_task_prop_t TaskProp; /* Create one (good) handle first from this task */ - UtAssert_INT32_EQ(CFE_TBL_Register(&CFE_FT_Global.TblHandle, CFE_FT_Global.TblName, sizeof(TBL_TEST_Table_t), + UtAssert_INT32_EQ(CFE_TBL_Register(&CFE_FT_Global.TblHandle, CFE_FT_Global.TblName, sizeof(CFE_TEST_TestTable_t), CFE_TBL_OPT_DEFAULT, &CallbackFunc), CFE_SUCCESS); diff --git a/modules/cfe_testcase/tables/cfe_test_tbl.c b/modules/cfe_testcase/tables/cfe_test_tbl.c index 757f5aba1..dd71344d7 100644 --- a/modules/cfe_testcase/tables/cfe_test_tbl.c +++ b/modules/cfe_testcase/tables/cfe_test_tbl.c @@ -33,6 +33,6 @@ * so any issues with paritial loading/byteswapping are morely likely * to be detected. */ -TBL_TEST_Table_t TestTable = {0xf007, 0xba11}; +CFE_TEST_TestTable_t TestTable = {0xf007, 0xba11}; CFE_TBL_FILEDEF(TestTable, CFE_TEST_APP.TestTable, Table Test Table, cfe_test_tbl.tbl) diff --git a/modules/es/arch_build.cmake b/modules/es/arch_build.cmake index 28707caa0..fcae78251 100644 --- a/modules/es/arch_build.cmake +++ b/modules/es/arch_build.cmake @@ -15,9 +15,6 @@ set(ES_PLATFORM_CONFIG_FILE_LIST cfe_es_platform_cfg.h ) -message("ES_CFGFILE_SRC_cfe_es_msgids = ${ES_CFGFILE_SRC_cfe_es_msgids}") - - # Create wrappers around the all the config header files # This makes them individually overridable by the missions, without modifying # the distribution default copies