diff --git a/.github/workflows/codeql-build.yml b/.github/workflows/codeql-build.yml index 1c86e725d..59d500c16 100644 --- a/.github/workflows/codeql-build.yml +++ b/.github/workflows/codeql-build.yml @@ -11,7 +11,7 @@ on: jobs: codeql: uses: nasa/cFS/.github/workflows/codeql-reusable.yml@main - with: + with: component-path: cfe make: make -j8 test: true diff --git a/cmake/sample_defs/eds/config.xml b/cmake/sample_defs/eds/config.xml index ea7acf3bb..7af559ea6 100644 --- a/cmake/sample_defs/eds/config.xml +++ b/cmake/sample_defs/eds/config.xml @@ -58,7 +58,7 @@ - + diff --git a/cmake/sample_defs/example_mission_cfg.h b/cmake/sample_defs/example_mission_cfg.h index 07600e81f..758609763 100644 --- a/cmake/sample_defs/example_mission_cfg.h +++ b/cmake/sample_defs/example_mission_cfg.h @@ -21,22 +21,22 @@ * * This header file contains the mission configuration parameters and * typedefs with mission scope. - * + * * This provides values for configurable items that affect * the interface(s) of this module. This includes the CMD/TLM message * interface, tables definitions, and any other data products that * serve to exchange information with other entities. - * + * * @note It is no longer necessary to provide this file directly in the defs - * directory, but if present, this file is still supported/usable for backward + * directory, but if present, this file is still supported/usable for backward * compatibility. To use this file, is should be called "cfe_mission_cfg.h". - * + * * Going forward, more fine-grained (module/purposes-specific) header files are * included with each submodule. These may be overridden as necessary, but only * if a definition within that file needs to be changed from the default. This - * approach will reduce the amount of duplicate/cloned definitions and better + * approach will reduce the amount of duplicate/cloned definitions and better * support alternative build configurations in the future. - * + * * Note that if this file is present, the fine-grained header files noted above * will _not_ be used. */ @@ -310,7 +310,7 @@ #define CFE_FS_HDR_DESC_MAX_LEN 32 /**< \brief Max length of description field in a standard cFE File Header */ -#define CFE_FS_FILE_CONTENT_ID 0x63464531 /**< \brief Magic Number for cFE compliant files (= 'cFE1') */ +#define CFE_FS_FILE_CONTENT_ID 0x63464531 /**< \brief Magic Number for cFE-compliant files (= 'cFE1') */ /****************************************************************************** diff --git a/docs/cFE Application Developers Guide.md b/docs/cFE Application Developers Guide.md index a75cafc25..e76f1d84a 100644 --- a/docs/cFE Application Developers Guide.md +++ b/docs/cFE Application Developers Guide.md @@ -3224,7 +3224,7 @@ typedef struct The `ContentType` element is a magic number that identifies this file as conforming to the cFE standard header type. At the release of this -document, the magic number on all cFE compliant files is `0x63464531` +document, the magic number on all cFE-compliant files is `0x63464531` which appears as 'cFE1' when seen in ASCII. The `SubType` is an indication of the contents/format of the file. There @@ -3241,7 +3241,7 @@ to determine the version of the header type as well as where the user data is relative to the beginning of the file. The `SpacecraftID`, `ProcessorID` and `ApplicationID` are all automatically -filled by cFE File Services routines when creating a cFE compliant file. +filled by cFE File Services routines when creating a cFE-compliant file. These fields help identify where and how the file was created. The `TimeSeconds` and `TimeSubSeconds` elements contain the Spacecraft Time diff --git a/docs/src/cfe_sb.dox b/docs/src/cfe_sb.dox index 243b8f4b0..09817bf0b 100644 --- a/docs/src/cfe_sb.dox +++ b/docs/src/cfe_sb.dox @@ -95,7 +95,7 @@ The Pipe IDs are specific to a particular processor (that is, the same ID number may refer to a different pipe on each processor). The pipe information for all - pipes that have been created, may be requested at anytime by sending the + pipes that have been created, may be requested at any time by sending the \link #CFE_SB_WRITE_PIPE_INFO_CC 'Write Pipe Info' SB command \endlink. The software bus also provides a set of figures regarding capacity, current utilization and high water marks relevant to pipes. This information may be requested by sending the diff --git a/modules/cfe_testcase/CMakeLists.txt b/modules/cfe_testcase/CMakeLists.txt index 6c83749ca..15121970f 100644 --- a/modules/cfe_testcase/CMakeLists.txt +++ b/modules/cfe_testcase/CMakeLists.txt @@ -20,9 +20,10 @@ add_cfe_app(cfe_testcase src/evs_send_test.c src/fs_header_test.c src/fs_util_test.c - src/message_id_test.c src/msg_api_test.c + src/msg_msg_id_test.c src/resource_id_misc_test.c + src/sb_msg_id_test.c src/sb_performance_test.c src/sb_pipe_mang_test.c src/sb_sendrecv_test.c diff --git a/modules/cfe_testcase/src/cfe_test.c b/modules/cfe_testcase/src/cfe_test.c index 388a289bf..aa391d158 100644 --- a/modules/cfe_testcase/src/cfe_test.c +++ b/modules/cfe_testcase/src/cfe_test.c @@ -75,6 +75,7 @@ void CFE_TestMain(void) MessageIdTestSetup(); MsgApiTestSetup(); ResourceIdMiscTestSetup(); + SBMsgIdTestSetup(); SBPipeMangSetup(); SBSendRecvTestSetup(); SBSubscriptionTestSetup(); diff --git a/modules/cfe_testcase/src/cfe_test.h b/modules/cfe_testcase/src/cfe_test.h index a7864c370..454585e8b 100644 --- a/modules/cfe_testcase/src/cfe_test.h +++ b/modules/cfe_testcase/src/cfe_test.h @@ -89,6 +89,7 @@ void FSUtilTestSetup(void); void MessageIdTestSetup(void); void MsgApiTestSetup(void); void ResourceIdMiscTestSetup(void); +void SBMsgIdTestSetup(void); void SBPerformanceTestSetup(void); void SBPipeMangSetup(void); void SBSendRecvTestSetup(void); diff --git a/modules/cfe_testcase/src/message_id_test.c b/modules/cfe_testcase/src/msg_msg_id_test.c similarity index 100% rename from modules/cfe_testcase/src/message_id_test.c rename to modules/cfe_testcase/src/msg_msg_id_test.c diff --git a/modules/cfe_testcase/src/sb_msg_id_test.c b/modules/cfe_testcase/src/sb_msg_id_test.c new file mode 100644 index 000000000..4ef367bf5 --- /dev/null +++ b/modules/cfe_testcase/src/sb_msg_id_test.c @@ -0,0 +1,92 @@ +/************************************************************************ + * 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 + * Functional test of the Software Bus Message ID APIs + */ + +/* + * Includes + */ +#include "cfe_test.h" + +void TestCheckIfValidMsgId(void) +{ + UtPrintf("Testing: CFE_SB_IsValidMsgId"); + bool Result; + CFE_SB_MsgId_t ValidMsgId = CFE_SB_ValueToMsgId(1); + CFE_SB_MsgId_t highestValidMsgId = CFE_SB_ValueToMsgId(CFE_PLATFORM_SB_HIGHEST_VALID_MSGID); + CFE_SB_MsgId_t TooHighMsgId = CFE_SB_ValueToMsgId(CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1); + + /* Test for true result with a valid MsgId */ + Result = CFE_SB_IsValidMsgId(ValidMsgId); + UtAssert_True(Result == true, "Result == true"); + + /* Test for false result with an invalid MsgId (utilizing CFE_SB_INVALID_MSG_ID) */ + Result = CFE_SB_IsValidMsgId(CFE_SB_INVALID_MSG_ID); + UtAssert_True(Result == false, "Result == false"); + + /* Test for true result with the highest valid MsgId (as defined by CFE_PLATFORM_SB_HIGHEST_VALID_MSGID) */ + Result = CFE_SB_IsValidMsgId(highestValidMsgId); + UtAssert_True(Result == true, "Result == true"); + + /* + * Test for false result with a MsgId that is too high (i.e. above the value + * set for CFE_PLATFORM_SB_HIGHEST_VALID_MSGID in the platform config). + */ + Result = CFE_SB_IsValidMsgId(TooHighMsgId); + UtAssert_True(Result == false, "Result == false"); +} + +void TestCheckIfMsgIdEqual(void) +{ + UtPrintf("Testing: CFE_SB_MsgId_Equal"); + bool Result; + CFE_SB_MsgId_t MsgId1 = CFE_SB_ValueToMsgId(1); + CFE_SB_MsgId_t MsgId2 = CFE_SB_ValueToMsgId(1); + CFE_SB_MsgId_t MsgId3 = CFE_SB_ValueToMsgId(2); + + /* Test for true result with equal MsgId's */ + Result = CFE_SB_MsgId_Equal(MsgId1, MsgId2); + UtAssert_True(Result == true, "Result == true"); + + /* Test for false result with unequal MsgId's */ + Result = CFE_SB_MsgId_Equal(MsgId2, MsgId3); + UtAssert_True(Result == false, "Result == false"); +} + +void TestConvertValueToMsgAndBack(void) +{ + UtPrintf("Testing: CFE_SB_ValueToMsgId, CFE_SB_MsgIdToValue"); + uint32 Value = 10; + CFE_SB_MsgId_t MsgIdResult; + CFE_SB_MsgId_Atom_t ValueResult; + + /* Test integer value -> MsgId -> integer value */ + MsgIdResult = CFE_SB_ValueToMsgId(Value); + ValueResult = CFE_SB_MsgIdToValue(MsgIdResult); + UtAssert_INT32_EQ(ValueResult, Value); +} + +void SBMsgIdTestSetup(void) +{ + UtTest_Add(TestCheckIfValidMsgId, NULL, NULL, "Test Check if a MsgId is valid"); + UtTest_Add(TestCheckIfMsgIdEqual, NULL, NULL, "Test Check if two MsgId's are equal"); + UtTest_Add(TestConvertValueToMsgAndBack, NULL, NULL, "Test Convert a value to MsgId and back"); +} diff --git a/modules/fs/config/default_cfe_fs_interface_cfg.h b/modules/fs/config/default_cfe_fs_interface_cfg.h index 3f02853d3..312889fa3 100644 --- a/modules/fs/config/default_cfe_fs_interface_cfg.h +++ b/modules/fs/config/default_cfe_fs_interface_cfg.h @@ -36,6 +36,6 @@ #define CFE_FS_HDR_DESC_MAX_LEN 32 /**< \brief Max length of description field in a standard cFE File Header */ -#define CFE_FS_FILE_CONTENT_ID 0x63464531 /**< \brief Magic Number for cFE compliant files (= 'cFE1') */ +#define CFE_FS_FILE_CONTENT_ID 0x63464531 /**< \brief Magic Number for cFE-compliant files (= 'cFE1') */ #endif /* CFE_FS_INTERFACE_CFG_H */