diff --git a/README.md b/README.md index 193d0ad04..c6724eb20 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,22 @@ The detailed cFE user's guide can be viewed at ### Development Build: v6.8.0-rc1+dev392 -- Fix #665, update pipe name documentation. -- Fix #1165, remove configs about shells -- Fix #1094, Update CRC documentation -- Fix #979, add stack size and priority to task info … -- Fix #1170, refactor target config objects … -- Fix #1207, Add wrapper targets to simplify app builds … -- Fix #1211, Add Testing Tools to the Security Policy +- update pipe name documentation. +- remove configs about shells +- Update CRC documentation +- add stack size and priority to task info … +- refactor target config objects … +- Add wrapper targets to simplify app builds … +- Add Testing Tools to the Security Policy - See ### Development Build: v6.8.0-rc1+dev382 diff --git a/modules/cfe_assert/src/cfe_assert_init.c b/modules/cfe_assert/src/cfe_assert_init.c index 9d77196a3..83822bf96 100644 --- a/modules/cfe_assert/src/cfe_assert_init.c +++ b/modules/cfe_assert/src/cfe_assert_init.c @@ -18,7 +18,7 @@ ** See the License for the specific language governing permissions and ** limitations under the License. ** -** File: cfe_assert_main.c +** File: cfe_assert_init.c ** ** Purpose: ** Implementation of the CFE assert (UT assert wrapper) functions. diff --git a/modules/cfe_assert/src/cfe_assert_priv.h b/modules/cfe_assert/src/cfe_assert_priv.h index 33a2da2a6..c90539eb5 100644 --- a/modules/cfe_assert/src/cfe_assert_priv.h +++ b/modules/cfe_assert/src/cfe_assert_priv.h @@ -18,7 +18,7 @@ ** See the License for the specific language governing permissions and ** limitations under the License. ** -** File: cfe_assert.h +** File: cfe_assert_priv.h ** ** Purpose: ** Specification for the CFE assert (UT assert wrapper) functions. diff --git a/modules/cfe_assert/src/cfe_assert_runner.c b/modules/cfe_assert/src/cfe_assert_runner.c index cb8ff5796..879b37d78 100644 --- a/modules/cfe_assert/src/cfe_assert_runner.c +++ b/modules/cfe_assert/src/cfe_assert_runner.c @@ -18,7 +18,7 @@ ** See the License for the specific language governing permissions and ** limitations under the License. ** -** File: cfe_testrunner_main.c +** File: cfe_assert_runner.c ** ** Purpose: ** Implementation of the CFE testrunner (UT testrunner wrapper) functions. diff --git a/modules/cfe_testcase/CMakeLists.txt b/modules/cfe_testcase/CMakeLists.txt index 8189dba9b..c5abc909e 100644 --- a/modules/cfe_testcase/CMakeLists.txt +++ b/modules/cfe_testcase/CMakeLists.txt @@ -1,21 +1,34 @@ +include_directories(inc) + # Filenames based on doxygen groups. # Create the app module -add_cfe_app(cfe_testcase +add_cfe_app(cfe_testcase src/cfe_test.c + src/cfe_test_table.c + src/es_application_control_test.c src/es_info_test.c src/es_task_test.c src/es_cds_test.c + src/es_counter_test.c src/es_misc_test.c src/es_mempool_test.c + src/es_resource_id_test.c + src/evs_filters_test.c src/evs_send_test.c src/fs_header_test.c src/fs_util_test.c src/message_id_test.c src/sb_pipe_mang_test.c + src/tbl_content_access_test.c + src/tbl_content_mang_test.c + src/tbl_information_test.c + src/tbl_registration_test.c src/time_arithmetic_test.c src/time_current_test.c src/time_conversion_test.c + src/time_misc_test.c ) # register the dependency on cfe_assert add_cfe_app_dependency(cfe_testcase cfe_assert) +add_cfe_tables(cfeTestAppTable tables/cfe_test_tbl.c) diff --git a/modules/cfe_testcase/inc/cfe_test_tbl.h b/modules/cfe_testcase/inc/cfe_test_tbl.h new file mode 100644 index 000000000..d8c01898d --- /dev/null +++ b/modules/cfe_testcase/inc/cfe_test_tbl.h @@ -0,0 +1,46 @@ +/************************************************************************* +** +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +** +** File: cfe_test_table.h +** +** Purpose: +** CFE Test Table struct definition +** +*************************************************************************/ + +/** + * @file + * + * CFE Test Table struct definition + */ + +#ifndef CFE_TEST_TBL_H +#define CFE_TEST_TBL_H + +/* + * Test table structure + */ +typedef struct +{ + uint16 Int1; + uint16 Int2; +} TBL_TEST_Table_t; + +#endif /* CFE_TEST_TBL_H */ diff --git a/modules/cfe_testcase/src/cfe_test.c b/modules/cfe_testcase/src/cfe_test.c index b1dbe4767..580074d4f 100644 --- a/modules/cfe_testcase/src/cfe_test.c +++ b/modules/cfe_testcase/src/cfe_test.c @@ -33,12 +33,19 @@ #include "cfe_assert.h" #include "cfe_test.h" +CFE_FT_Global_t CFE_FT_Global; + /* * Test main function * Register this test routine with CFE Assert */ void CFE_TestMain(void) { + /* Constant Table information used by all table tests */ + CFE_FT_Global.TblName = "TestTable"; + CFE_FT_Global.RegisteredTblName = "CFE_TEST_APP.TestTable"; + CFE_FT_Global.TblFilename = "test_tbl.tbl"; + /* * Register this test app with CFE assert * @@ -51,19 +58,28 @@ void CFE_TestMain(void) /* * Register test cases in UtAssert */ + ESApplicationControlTestSetup(); ESCDSTestSetup(); + ESCounterTestSetup(); ESInfoTestSetup(); ESMemPoolTestSetup(); ESMiscTestSetup(); + ESResourceIDTestSetup(); ESTaskTestSetup(); + EVSFiltersTestSetup(); EVSSendTestSetup(); FSHeaderTestSetup(); FSUtilTestSetup(); MessageIdTestSetup(); SBPipeMangSetup(); + TBLContentAccessTestSetup(); + TBLContentMangTestSetup(); + TBLInformationTestSetup(); + TBLRegistrationTestSetup(); TimeArithmeticTestSetup(); TimeCurrentTestSetup(); TimeConversionTestSetup(); + TimeMiscTestSetup(); /* * Execute the tests diff --git a/modules/cfe_testcase/src/cfe_test.h b/modules/cfe_testcase/src/cfe_test.h index 558b0a1f6..09614a2c5 100644 --- a/modules/cfe_testcase/src/cfe_test.h +++ b/modules/cfe_testcase/src/cfe_test.h @@ -18,7 +18,7 @@ ** See the License for the specific language governing permissions and ** limitations under the License. ** -** File: cfe_test.c +** File: cfe_test.h ** ** Purpose: ** Initialization routine for CFE functional test @@ -39,6 +39,7 @@ * Includes */ #include "cfe.h" +#include "cfe_test_tbl.h" #include "uttest.h" #include "utassert.h" @@ -46,8 +47,19 @@ typedef struct { CFE_FS_FileWriteMetaData_t FuncTestState; + + /* Generic utility counter */ + int Count; + + /* Table information used by all table tests */ + CFE_TBL_Handle_t TblHandle; + const char * TblName; + const char * RegisteredTblName; + const char * TblFilename; } CFE_FT_Global_t; +extern CFE_FT_Global_t CFE_FT_Global; + /** * Name of log file to write * @@ -74,24 +86,30 @@ typedef struct UtAssert_True(rcact < CFE_SUCCESS, "%s == (%ld) ", #actual, (long)rcact); \ } while (0) -/* Log calls to void functions */ -#define cFE_FTAssert_VOIDCALL(func) (func, UtAssert(true, #func, __FILE__, __LINE__)) - bool TimeInRange(CFE_TIME_SysTime_t Time, CFE_TIME_SysTime_t Target, OS_time_t difference); void CFE_TestMain(void); +void ESApplicationControlTestSetup(void); void ESCDSTestSetup(void); +void ESCounterTestSetup(void); void ESInfoTestSetup(void); void ESMemPoolTestSetup(void); void ESMiscTestSetup(void); +void ESResourceIDTestSetup(void); void ESTaskTestSetup(void); +void EVSFiltersTestSetup(void); void EVSSendTestSetup(void); void FSHeaderTestSetup(void); void FSUtilTestSetup(void); void MessageIdTestSetup(void); void SBPipeMangSetup(void); +void TBLContentAccessTestSetup(void); +void TBLContentMangTestSetup(void); +void TBLInformationTestSetup(void); +void TBLRegistrationTestSetup(void); void TimeArithmeticTestSetup(void); void TimeCurrentTestSetup(void); void TimeConversionTestSetup(void); +void TimeMiscTestSetup(void); #endif /* CFE_TEST_H */ diff --git a/modules/cfe_testcase/src/cfe_test_table.c b/modules/cfe_testcase/src/cfe_test_table.c new file mode 100644 index 000000000..b8659f4cf --- /dev/null +++ b/modules/cfe_testcase/src/cfe_test_table.c @@ -0,0 +1,49 @@ +/************************************************************************* +** +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +** +** File: cfe_test_table.c +** +** Purpose: +** Initialization of variables used by table functional tests and +** function definitions for setup and teardown table functions +** +*************************************************************************/ + +/* + * Includes + */ + +#include "cfe_test.h" +#include "cfe_test_table.h" + +/* 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), + CFE_TBL_OPT_DEFAULT, NULL), + CFE_SUCCESS); +} + +/* Teardown function to unregister a table */ +void UnregisterTestTable(void) +{ + UtAssert_INT32_EQ(CFE_TBL_Unregister(CFE_FT_Global.TblHandle), CFE_SUCCESS); +} \ No newline at end of file diff --git a/modules/cfe_testcase/src/cfe_test_table.h b/modules/cfe_testcase/src/cfe_test_table.h new file mode 100644 index 000000000..c37539e01 --- /dev/null +++ b/modules/cfe_testcase/src/cfe_test_table.h @@ -0,0 +1,45 @@ +/************************************************************************* +** +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +** +** File: cfe_test_table.h +** +** Purpose: +** Declare global struct variable and function prototypes for table tests +** +*************************************************************************/ + +/** + * @file + * + * Declarations and prototypes for cfe_test module table tests + */ + +#ifndef CFE_TEST_TABLE_H +#define CFE_TEST_TABLE_H + +/* + * Includes + */ +#include "cfe_test.h" + +void RegisterTestTable(void); +void UnregisterTestTable(void); + +#endif /* CFE_TEST_TABLE_H */ diff --git a/modules/cfe_testcase/src/es_application_control_test.c b/modules/cfe_testcase/src/es_application_control_test.c new file mode 100644 index 000000000..22fa4c1e2 --- /dev/null +++ b/modules/cfe_testcase/src/es_application_control_test.c @@ -0,0 +1,62 @@ +/************************************************************************* +** +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +** +** File: es_application_control_test.c +** +** Purpose: +** Functional test of ES Application Control APIs +** +** Tests only invalid calls to the application control functions. +** +** Demonstration of how to register and use the UT assert functions. +** +*************************************************************************/ + +/* + * Includes + */ + +#include "cfe_test.h" + +void TestApplicationControl(void) +{ + UtPrintf("Testing: CFE_ES_RestartApp, CFE_ES_ReloadApp, CFE_ES_DeleteApp"); + CFE_ES_AppId_t TestAppId; + UtAssert_INT32_EQ(CFE_ES_GetAppID(&TestAppId), CFE_SUCCESS); + + UtAssert_UINT32_EQ(CFE_ES_RestartApp(CFE_ES_APPID_UNDEFINED), CFE_ES_ERR_RESOURCEID_NOT_VALID); + /* + * This seems a bit strange that it throws a file io error + * CFE_ES_ReloadApp calls OS_stat with the null filename + * OS_stat should return OS_INVALID_POINTER, but the exact + * error is ignored in CFE_ES_ReloadApp and file io error is returned + * most other functions return a CFE_ES_BAD_ARGUMENT in this situation + */ + UtAssert_UINT32_EQ(CFE_ES_ReloadApp(TestAppId, NULL), CFE_ES_FILE_IO_ERR); + UtAssert_UINT32_EQ(CFE_ES_ReloadApp(TestAppId, "/cf/NOT_cfe_testcase.so"), CFE_ES_FILE_IO_ERR); + UtAssert_UINT32_EQ(CFE_ES_ReloadApp(CFE_ES_APPID_UNDEFINED, "/cf/cfe_testcase.so"), + CFE_ES_ERR_RESOURCEID_NOT_VALID); + UtAssert_UINT32_EQ(CFE_ES_DeleteApp(CFE_ES_APPID_UNDEFINED), CFE_ES_ERR_RESOURCEID_NOT_VALID); +} + +void ESApplicationControlTestSetup(void) +{ + UtTest_Add(TestApplicationControl, NULL, NULL, "Test Application Control API"); +} diff --git a/modules/cfe_testcase/src/es_cds_test.c b/modules/cfe_testcase/src/es_cds_test.c index 8520dd4fb..95ffe7e68 100644 --- a/modules/cfe_testcase/src/es_cds_test.c +++ b/modules/cfe_testcase/src/es_cds_test.c @@ -18,7 +18,7 @@ ** See the License for the specific language governing permissions and ** limitations under the License. ** -** File: es_info_test.c +** File: es_cds_test.c ** ** Purpose: ** Functional test of basic ES Critical Data Store APIs diff --git a/modules/cfe_testcase/src/es_counter_test.c b/modules/cfe_testcase/src/es_counter_test.c new file mode 100644 index 000000000..e28ef2f92 --- /dev/null +++ b/modules/cfe_testcase/src/es_counter_test.c @@ -0,0 +1,166 @@ +/************************************************************************* +** +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +** +*************************************************************************/ + +/** + * @file + * + * Functional test of ES Generic Counter APIs + */ + +#include "cfe_test.h" + +void TestCounterCreateDelete(void) +{ + CFE_ES_CounterId_t Ids[CFE_PLATFORM_ES_MAX_GEN_COUNTERS]; + CFE_ES_CounterId_t TestId; + CFE_ES_CounterId_t CheckId; + char CounterName[CFE_MISSION_MAX_API_LEN]; + char CheckName[CFE_MISSION_MAX_API_LEN]; + CFE_Status_t Status; + uint32 NumCounters; + uint32 Idx; + + UtPrintf("Testing: CFE_ES_RegisterGenCounter"); + + snprintf(CounterName, sizeof(CounterName), "ut"); + + /* Confirm proper bad argument rejection */ + UtAssert_INT32_EQ(CFE_ES_RegisterGenCounter(&Ids[0], NULL), CFE_ES_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_ES_RegisterGenCounter(NULL, CounterName), CFE_ES_BAD_ARGUMENT); + + /* Create up to CFE_PLATFORM_ES_MAX_GEN_COUNTERS and confirm success */ + for (NumCounters = 0; NumCounters < CFE_PLATFORM_ES_MAX_GEN_COUNTERS; ++NumCounters) + { + snprintf(CounterName, sizeof(CounterName), "C%u", (unsigned int)NumCounters); + Status = CFE_ES_RegisterGenCounter(&Ids[NumCounters], CounterName); + if (Status != CFE_SUCCESS) + { + break; + } + } + + /* Confirm that the expected number of counters were created */ + UtAssert_UINT32_EQ(NumCounters, CFE_PLATFORM_ES_MAX_GEN_COUNTERS); + + /* Attempt to create one too many */ + snprintf(CounterName, sizeof(CounterName), "extra"); + UtAssert_INT32_EQ(CFE_ES_RegisterGenCounter(&TestId, CounterName), CFE_ES_NO_RESOURCE_IDS_AVAILABLE); + + /* pick a single counter ID from the middle of the set for more detail testing of support APIs */ + TestId = Ids[NumCounters / 2]; + snprintf(CounterName, sizeof(CounterName), "C%u", (unsigned int)NumCounters / 2); + + UtPrintf("Testing: CFE_ES_CounterID_ToIndex"); + + /* Confirm CFE_ES_CounterID_ToIndex works (nominal) */ + Idx = UINT32_MAX; + UtAssert_INT32_EQ(CFE_ES_CounterID_ToIndex(TestId, &Idx), CFE_SUCCESS); + UtAssert_UINT32_LT(Idx, CFE_PLATFORM_ES_MAX_GEN_COUNTERS); + + /* Confirm proper rejection of bad args in CFE_ES_CounterID_ToIndex */ + UtAssert_INT32_EQ(CFE_ES_CounterID_ToIndex(CFE_ES_COUNTERID_UNDEFINED, &Idx), CFE_ES_ERR_RESOURCEID_NOT_VALID); + UtAssert_INT32_EQ(CFE_ES_CounterID_ToIndex(TestId, NULL), CFE_ES_BAD_ARGUMENT); + + UtPrintf("Testing: CFE_ES_GetGenCounterIDByName, CFE_ES_GetGenCounterName"); + + /* Confirm conversion To/From Name */ + UtAssert_INT32_EQ(CFE_ES_GetGenCounterIDByName(&CheckId, CounterName), CFE_SUCCESS); + cFE_FTAssert_ResourceID_EQ(CheckId, TestId); + UtAssert_INT32_EQ(CFE_ES_GetGenCounterName(CheckName, TestId, sizeof(CheckName)), CFE_SUCCESS); + UtAssert_STRINGBUF_EQ(CheckName, sizeof(CheckName), CounterName, sizeof(CounterName)); + + UtAssert_INT32_EQ(CFE_ES_GetGenCounterIDByName(&CheckId, "na"), CFE_ES_ERR_NAME_NOT_FOUND); + + /* Confirm proper rejection of bad args in conversion To/From Name */ + UtAssert_INT32_EQ(CFE_ES_GetGenCounterIDByName(NULL, CounterName), CFE_ES_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_ES_GetGenCounterIDByName(&CheckId, NULL), CFE_ES_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_ES_GetGenCounterName(CheckName, CFE_ES_COUNTERID_UNDEFINED, sizeof(CounterName)), + CFE_ES_ERR_RESOURCEID_NOT_VALID); + UtAssert_INT32_EQ(CFE_ES_GetGenCounterName(CheckName, TestId, 0), CFE_ES_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_ES_GetGenCounterName(NULL, TestId, sizeof(CounterName)), CFE_ES_BAD_ARGUMENT); + + UtPrintf("Testing: CFE_ES_DeleteGenCounter"); + + /* Confirm proper rejection of bad args in CFE_ES_DeleteGenCounter (this returns CFE_ES_BAD_ARGUMENT instead) */ + UtAssert_INT32_EQ(CFE_ES_DeleteGenCounter(CFE_ES_COUNTERID_UNDEFINED), CFE_ES_BAD_ARGUMENT); + + /* Delete last counter to test duplicate name rejection (needs a free slot) */ + --NumCounters; + UtAssert_INT32_EQ(CFE_ES_DeleteGenCounter(Ids[NumCounters]), CFE_SUCCESS); + snprintf(CounterName, sizeof(CounterName), "C%u", (unsigned int)0); + UtAssert_INT32_EQ(CFE_ES_RegisterGenCounter(&TestId, CounterName), CFE_ES_ERR_DUPLICATE_NAME); + + /* Delete remainder of counters */ + while (NumCounters > 0) + { + Status = CFE_ES_DeleteGenCounter(Ids[NumCounters - 1]); + if (Status != CFE_SUCCESS) + { + break; + } + + --NumCounters; + } + + UtAssert_ZERO(NumCounters); +} + +void TestCounterGetSet(void) +{ + CFE_ES_CounterId_t TestId; + uint32 CountVal; + + UtPrintf("Testing: CFE_ES_GetGenCount, CFE_ES_SetGenCount, CFE_ES_IncrementGenCounter"); + + /* Setup - create a single counter */ + UtAssert_INT32_EQ(CFE_ES_RegisterGenCounter(&TestId, "ut"), CFE_SUCCESS); + + /* Get and set its count - should be initially 0 */ + CountVal = UINT32_MAX; + UtAssert_INT32_EQ(CFE_ES_GetGenCount(TestId, &CountVal), CFE_SUCCESS); + UtAssert_ZERO(CountVal); + UtAssert_INT32_EQ(CFE_ES_SetGenCount(TestId, 5), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_ES_GetGenCount(TestId, &CountVal), CFE_SUCCESS); + UtAssert_UINT32_EQ(CountVal, 5); + UtAssert_INT32_EQ(CFE_ES_IncrementGenCounter(TestId), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_ES_GetGenCount(TestId, &CountVal), CFE_SUCCESS); + UtAssert_UINT32_EQ(CountVal, 6); + + /* + * Confirm bad arg rejection in Get/Set/Increment + * Note these APIs return CFE_ES_BAD_ARGUMENT rather than + * CFE_ES_ERR_RESOURCEID_NOT_VALID on a bad ID (historical) + */ + UtAssert_INT32_EQ(CFE_ES_GetGenCount(TestId, NULL), CFE_ES_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_ES_GetGenCount(CFE_ES_COUNTERID_UNDEFINED, &CountVal), CFE_ES_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_ES_IncrementGenCounter(CFE_ES_COUNTERID_UNDEFINED), CFE_ES_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_ES_SetGenCount(CFE_ES_COUNTERID_UNDEFINED, 0), CFE_ES_BAD_ARGUMENT); + + /* Teardown - delete the counter */ + UtAssert_INT32_EQ(CFE_ES_DeleteGenCounter(TestId), CFE_SUCCESS); +} + +void ESCounterTestSetup(void) +{ + UtTest_Add(TestCounterCreateDelete, NULL, NULL, "Test Counter Create/Delete"); + UtTest_Add(TestCounterGetSet, NULL, NULL, "Test Counter Get/Set"); +} diff --git a/modules/cfe_testcase/src/es_mempool_test.c b/modules/cfe_testcase/src/es_mempool_test.c index f6542eaf6..02d90c35e 100644 --- a/modules/cfe_testcase/src/es_mempool_test.c +++ b/modules/cfe_testcase/src/es_mempool_test.c @@ -18,7 +18,7 @@ ** See the License for the specific language governing permissions and ** limitations under the License. ** -** File: es_info_test.c +** File: es_mempool_test.c ** ** Purpose: ** Functional test of basic ES Mempool APIs diff --git a/modules/cfe_testcase/src/es_misc_test.c b/modules/cfe_testcase/src/es_misc_test.c index 61073a2e1..18af9c48b 100644 --- a/modules/cfe_testcase/src/es_misc_test.c +++ b/modules/cfe_testcase/src/es_misc_test.c @@ -67,8 +67,15 @@ void TestWriteToSysLog(void) UtAssert_MIR("MIR (Manual Inspection Required) for CFE_ES_WriteToSysLog"); } +void TestProcessAsyncEvent(void) +{ + UtPrintf("Testing: CFE_ES_ProcessAsyncEvent"); + UtAssert_VOIDCALL(CFE_ES_ProcessAsyncEvent()); +} + void ESMiscTestSetup(void) { UtTest_Add(TestCalculateCRC, NULL, NULL, "Test Calculate CRC"); UtTest_Add(TestWriteToSysLog, NULL, NULL, "Test Write To Sys Log"); + UtTest_Add(TestProcessAsyncEvent, NULL, NULL, "Test Process Async Event"); } diff --git a/modules/cfe_testcase/src/es_resource_id_test.c b/modules/cfe_testcase/src/es_resource_id_test.c new file mode 100644 index 000000000..4283d8e93 --- /dev/null +++ b/modules/cfe_testcase/src/es_resource_id_test.c @@ -0,0 +1,105 @@ +/************************************************************************* +** +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +** +** File: es_resource_id_test.c +** +** Purpose: +** Functional test of ES Resource ID APIs +** +** Demonstration of how to register and use the UT assert functions. +** +*************************************************************************/ + +/* + * Includes + */ + +#include "cfe_test.h" + +void TestAppIDToIndex(void) +{ + UtPrintf("Testing: CFE_ES_AppID_ToIndex"); + CFE_ES_AppId_t TestAppId; + uint32 TestAppIdx; + uint32 idx; + UtAssert_INT32_EQ(CFE_ES_GetAppID(&TestAppId), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_ES_AppID_ToIndex(TestAppId, &TestAppIdx), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_ES_AppID_ToIndex(TestAppId, &idx), CFE_SUCCESS); + UtAssert_UINT32_EQ(idx, TestAppIdx); + + UtAssert_INT32_EQ(CFE_ES_AppID_ToIndex(TestAppId, NULL), CFE_ES_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_ES_AppID_ToIndex(CFE_ES_APPID_UNDEFINED, &TestAppIdx), CFE_ES_ERR_RESOURCEID_NOT_VALID); +} + +void TestLibIDToIndex(void) +{ + UtPrintf("Testing: CFE_ES_LibID_ToIndex"); + const char * LibName = "ASSERT_LIB"; + CFE_ES_LibId_t LibId; + uint32 LibIdx; + uint32 idx; + UtAssert_INT32_EQ(CFE_ES_GetLibIDByName(&LibId, LibName), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_ES_LibID_ToIndex(LibId, &LibIdx), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_ES_LibID_ToIndex(LibId, &idx), CFE_SUCCESS); + UtAssert_UINT32_EQ(idx, LibIdx); + + UtAssert_INT32_EQ(CFE_ES_LibID_ToIndex(LibId, NULL), CFE_ES_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_ES_LibID_ToIndex(CFE_ES_LIBID_UNDEFINED, &LibIdx), CFE_ES_ERR_RESOURCEID_NOT_VALID); +} + +void TestTaskIDToIndex(void) +{ + UtPrintf("Testing: CFE_ES_TaskID_ToIndex"); + CFE_ES_TaskId_t TaskId; + uint32 TaskIdx; + uint32 idx; + UtAssert_INT32_EQ(CFE_ES_GetTaskID(&TaskId), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_ES_TaskID_ToIndex(TaskId, &TaskIdx), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_ES_TaskID_ToIndex(TaskId, &idx), CFE_SUCCESS); + UtAssert_UINT32_EQ(idx, TaskIdx); + + UtAssert_INT32_EQ(CFE_ES_TaskID_ToIndex(TaskId, NULL), CFE_ES_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_ES_TaskID_ToIndex(CFE_ES_TASKID_UNDEFINED, &TaskIdx), CFE_ES_ERR_RESOURCEID_NOT_VALID); +} + +void TestCounterIDToIndex(void) +{ + UtPrintf("Testing: CFE_ES_CounterID_ToIndex"); + const char * CounterName = "TEST_COUNTER"; + CFE_ES_CounterId_t CounterId; + uint32 CounterIdx; + uint32 idx; + UtAssert_UINT32_EQ(CFE_ES_RegisterGenCounter(&CounterId, CounterName), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_ES_CounterID_ToIndex(CounterId, &CounterIdx), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_ES_CounterID_ToIndex(CounterId, &idx), CFE_SUCCESS); + UtAssert_UINT32_EQ(idx, CounterIdx); + + UtAssert_INT32_EQ(CFE_ES_CounterID_ToIndex(CounterId, NULL), CFE_ES_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_ES_CounterID_ToIndex(CFE_ES_COUNTERID_UNDEFINED, &CounterIdx), + CFE_ES_ERR_RESOURCEID_NOT_VALID); +} + +void ESResourceIDTestSetup(void) +{ + UtTest_Add(TestAppIDToIndex, NULL, NULL, "Test Obtaining indices from App ID"); + UtTest_Add(TestLibIDToIndex, NULL, NULL, "Test Obtaining indices from Lib ID"); + UtTest_Add(TestTaskIDToIndex, NULL, NULL, "Test Obtaining indices from Task ID"); + UtTest_Add(TestCounterIDToIndex, NULL, NULL, "Test Obtaining indices from Counter ID"); +} diff --git a/modules/cfe_testcase/src/es_task_test.c b/modules/cfe_testcase/src/es_task_test.c index 0f5c210c2..187961ab2 100644 --- a/modules/cfe_testcase/src/es_task_test.c +++ b/modules/cfe_testcase/src/es_task_test.c @@ -33,13 +33,11 @@ #include "cfe_test.h" -uint32 count = 0; - void TaskFunction(void) { - while (count < 200) + while (CFE_FT_Global.Count < 200) { - count += 1; + CFE_FT_Global.Count += 1; OS_TaskDelay(100); } return; @@ -47,9 +45,9 @@ void TaskFunction(void) void TaskExitFunction(void) { - while (count < 200) + while (CFE_FT_Global.Count < 200) { - count += 1; + CFE_FT_Global.Count += 1; CFE_ES_ExitChildTask(); } return; @@ -68,12 +66,14 @@ void TestCreateChild(void) uint32 Flags = 0; int ExpectedCount = 5; + CFE_FT_Global.Count = 0; + UtAssert_INT32_EQ(CFE_ES_CreateChildTask(&TaskId, TaskName, TaskFunction, StackPointer, StackSize, Priority, Flags), CFE_SUCCESS); OS_TaskDelay(500); - UtAssert_True(ExpectedCount >= count - 1 && ExpectedCount <= count + 1, "countCopy (%d) == count (%d)", - (int)ExpectedCount, (int)count); + UtAssert_True(ExpectedCount >= CFE_FT_Global.Count - 1 && ExpectedCount <= CFE_FT_Global.Count + 1, + "countCopy (%d) == count (%d)", (int)ExpectedCount, (int)CFE_FT_Global.Count); UtAssert_INT32_EQ( CFE_ES_CreateChildTask(&TaskId2, TaskName, TaskFunction, StackPointer, StackSize, Priority, Flags), @@ -130,29 +130,30 @@ void TestChildTaskDelete(void) UtPrintf("Testing: CFE_ES_DeleteChildTask"); CFE_ES_TaskId_t TaskId; - const char * TaskName = "CHILD_TASK_1"; - CFE_ES_StackPointer_t StackPointer = CFE_ES_TASK_STACK_ALLOCATE; - size_t StackSize = CFE_PLATFORM_ES_PERF_CHILD_STACK_SIZE; - CFE_ES_TaskPriority_Atom_t Priority = CFE_PLATFORM_ES_PERF_CHILD_PRIORITY; - uint32 Flags = 0; - count = 0; - int ExpectedCount = 5; + const char * TaskName = "CHILD_TASK_1"; + CFE_ES_StackPointer_t StackPointer = CFE_ES_TASK_STACK_ALLOCATE; + size_t StackSize = CFE_PLATFORM_ES_PERF_CHILD_STACK_SIZE; + CFE_ES_TaskPriority_Atom_t Priority = CFE_PLATFORM_ES_PERF_CHILD_PRIORITY; + uint32 Flags = 0; + int ExpectedCount = 5; + + CFE_FT_Global.Count = 0; UtAssert_INT32_EQ(CFE_ES_CreateChildTask(&TaskId, TaskName, TaskFunction, StackPointer, StackSize, Priority, Flags), CFE_SUCCESS); OS_TaskDelay(500); - UtAssert_True(ExpectedCount >= count - 1 && ExpectedCount <= count + 1, "countCopy (%d) == count (%d)", - (int)ExpectedCount, (int)count); + UtAssert_True(ExpectedCount >= CFE_FT_Global.Count - 1 && ExpectedCount <= CFE_FT_Global.Count + 1, + "countCopy (%d) == count (%d)", (int)ExpectedCount, (int)CFE_FT_Global.Count); - ExpectedCount = count; + ExpectedCount = CFE_FT_Global.Count; UtAssert_INT32_EQ(CFE_ES_DeleteChildTask(TaskId), CFE_SUCCESS); OS_TaskDelay(500); - UtAssert_True(ExpectedCount == count || ExpectedCount == count + 1, "ExpectedCount (%d) == count (%d)", - (int)ExpectedCount, (int)count); + UtAssert_True(ExpectedCount == CFE_FT_Global.Count || ExpectedCount == CFE_FT_Global.Count + 1, + "ExpectedCount (%d) == count (%d)", (int)ExpectedCount, (int)CFE_FT_Global.Count); UtAssert_INT32_EQ(CFE_ES_DeleteChildTask(CFE_ES_TASKID_UNDEFINED), CFE_ES_ERR_RESOURCEID_NOT_VALID); } @@ -162,13 +163,12 @@ void TestExitChild(void) UtPrintf("Testing: CFE_ES_ExitChildTask"); CFE_ES_TaskId_t TaskId; - const char * TaskName = "CHILD_TASK_1"; - CFE_ES_StackPointer_t StackPointer = CFE_ES_TASK_STACK_ALLOCATE; - size_t StackSize = CFE_PLATFORM_ES_PERF_CHILD_STACK_SIZE; - CFE_ES_TaskPriority_Atom_t Priority = CFE_PLATFORM_ES_PERF_CHILD_PRIORITY; - uint32 Flags = 0; - count = 0; - int ExpectedCount = 1; + const char * TaskName = "CHILD_TASK_1"; + CFE_ES_StackPointer_t StackPointer = CFE_ES_TASK_STACK_ALLOCATE; + size_t StackSize = CFE_PLATFORM_ES_PERF_CHILD_STACK_SIZE; + CFE_ES_TaskPriority_Atom_t Priority = CFE_PLATFORM_ES_PERF_CHILD_PRIORITY; + uint32 Flags = 0; + int ExpectedCount = 1; UtAssert_INT32_EQ( CFE_ES_CreateChildTask(&TaskId, TaskName, TaskExitFunction, StackPointer, StackSize, Priority, Flags), diff --git a/modules/cfe_testcase/src/evs_filters_test.c b/modules/cfe_testcase/src/evs_filters_test.c new file mode 100644 index 000000000..1a7fe121a --- /dev/null +++ b/modules/cfe_testcase/src/evs_filters_test.c @@ -0,0 +1,54 @@ +/************************************************************************* +** +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +** +** File: evs_filters_test.c +** +** Purpose: +** Functional test of basic EVS Reset Filters APIs +** +** Demonstration of how to register and use the UT assert functions. +** +*************************************************************************/ + +/* + * Includes + */ + +#include "cfe_test.h" + +void TestResetFilters(void) +{ + UtPrintf("Testing: CFE_EVS_ResetFilter, CFE_EVS_ResetAllFilters"); + + /* Test logic below depends on the test case registering an EID of 1 and not registering 0, and the resets in theory + * could impact test behavior/management related to events. Although the expectation is either all or none of an EID + * would be filtered (no use case for a "counting" filter within the test app) so for normal use this is no impact. + */ + + UtAssert_INT32_EQ(CFE_EVS_ResetFilter(1), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_EVS_ResetAllFilters(), CFE_SUCCESS); + + UtAssert_INT32_EQ(CFE_EVS_ResetFilter(0), CFE_EVS_EVT_NOT_REGISTERED); +} + +void EVSFiltersTestSetup(void) +{ + UtTest_Add(TestResetFilters, NULL, NULL, "Test Reset Filters"); +} diff --git a/modules/cfe_testcase/src/fs_header_test.c b/modules/cfe_testcase/src/fs_header_test.c index cf89387e7..34d5048d5 100644 --- a/modules/cfe_testcase/src/fs_header_test.c +++ b/modules/cfe_testcase/src/fs_header_test.c @@ -18,7 +18,7 @@ ** See the License for the specific language governing permissions and ** limitations under the License. ** -** File: es_info_test.c +** File: fs_header_test.c ** ** Purpose: ** Functional test of basic FS Header APIs @@ -54,16 +54,16 @@ void TestCreateHeader(void) UtPrintf("Testing: CFE_FS_InitHeader, CFE_FS_WriteHeader"); - cFE_FTAssert_VOIDCALL(CFE_FS_InitHeader(&Header, TestDescription, CFE_FS_SubType_ES_ERLOG)); + UtAssert_VOIDCALL(CFE_FS_InitHeader(&Header, TestDescription, CFE_FS_SubType_ES_ERLOG)); UtAssert_INT32_EQ(CFE_FS_WriteHeader(fd, &Header), sizeof(CFE_FS_Header_t)); UtAssert_INT32_EQ(OS_lseek(fd, 0, OS_SEEK_CUR), sizeof(CFE_FS_Header_t)); UtAssert_INT32_EQ(CFE_FS_WriteHeader(fd, NULL), CFE_FS_BAD_ARGUMENT); cFE_FTAssert_NOT_CFE_SUCCESS(CFE_FS_WriteHeader(OS_OBJECT_ID_UNDEFINED, &Header)); - cFE_FTAssert_VOIDCALL(CFE_FS_InitHeader(NULL, TestDescription, CFE_FS_SubType_ES_ERLOG)); - cFE_FTAssert_VOIDCALL(CFE_FS_InitHeader(&HeaderFail, NULL, CFE_FS_SubType_ES_ERLOG)); - cFE_FTAssert_VOIDCALL(CFE_FS_InitHeader(&HeaderFail, TestDescription, 256)); + UtAssert_VOIDCALL(CFE_FS_InitHeader(NULL, TestDescription, CFE_FS_SubType_ES_ERLOG)); + UtAssert_VOIDCALL(CFE_FS_InitHeader(&HeaderFail, NULL, CFE_FS_SubType_ES_ERLOG)); + UtAssert_VOIDCALL(CFE_FS_InitHeader(&HeaderFail, TestDescription, 256)); OS_close(fd); OS_remove(OS_TEST_HEADER_FILENAME); @@ -78,7 +78,7 @@ void TestReadHeader(void) UtPrintf("Testing: CFE_FS_ReadHeader"); - cFE_FTAssert_VOIDCALL(CFE_FS_InitHeader(&Header, TestDescription, CFE_FS_SubType_ES_ERLOG)); + UtAssert_VOIDCALL(CFE_FS_InitHeader(&Header, TestDescription, CFE_FS_SubType_ES_ERLOG)); UtAssert_INT32_EQ(CFE_FS_WriteHeader(fd, &Header), sizeof(CFE_FS_Header_t)); UtAssert_INT32_EQ(CFE_FS_ReadHeader(&ReadHeader, fd), sizeof(CFE_FS_Header_t)); UtAssert_INT32_EQ(OS_lseek(fd, 0, OS_SEEK_CUR), sizeof(CFE_FS_Header_t)); @@ -104,7 +104,7 @@ void TestTimeStamp(void) UtPrintf("Testing: CFE_FS_SetTimestamp"); - cFE_FTAssert_VOIDCALL(CFE_FS_InitHeader(&Header, TestDescription, CFE_FS_SubType_ES_ERLOG)); + UtAssert_VOIDCALL(CFE_FS_InitHeader(&Header, TestDescription, CFE_FS_SubType_ES_ERLOG)); UtAssert_INT32_EQ(CFE_FS_WriteHeader(fd, &Header), sizeof(CFE_FS_Header_t)); UtAssert_INT32_EQ(CFE_FS_SetTimestamp(fd, NewTimestamp), CFE_SUCCESS); UtAssert_INT32_EQ(OS_lseek(fd, 0, OS_SEEK_CUR), (offsetof(CFE_FS_Header_t, TimeSeconds) + sizeof(NewTimestamp))); diff --git a/modules/cfe_testcase/src/fs_util_test.c b/modules/cfe_testcase/src/fs_util_test.c index 8e7d865c0..dbce2c893 100644 --- a/modules/cfe_testcase/src/fs_util_test.c +++ b/modules/cfe_testcase/src/fs_util_test.c @@ -33,8 +33,6 @@ #include "cfe_test.h" -CFE_FT_Global_t CFE_FT_Global; - void TestFileCategory(void) { UtPrintf("Testing: CFE_FS_GetDefaultMountPoint, CFE_FS_GetDefaultExtension"); @@ -138,7 +136,6 @@ void TestFileDump(void) UtAssert_INT32_EQ(CFE_FS_BackgroundFileDumpIsPending(&CFE_FT_Global.FuncTestState), false); UtAssert_INT32_EQ(CFE_FS_BackgroundFileDumpRequest(&CFE_FT_Global.FuncTestState), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_FS_BackgroundFileDumpIsPending(&CFE_FT_Global.FuncTestState), true); /* Wait for background task to complete */ while (CFE_FS_BackgroundFileDumpIsPending(&CFE_FT_Global.FuncTestState) && count < MaxWait) diff --git a/modules/cfe_testcase/src/sb_pipe_mang_test.c b/modules/cfe_testcase/src/sb_pipe_mang_test.c index ab8d8963c..3ca613df5 100644 --- a/modules/cfe_testcase/src/sb_pipe_mang_test.c +++ b/modules/cfe_testcase/src/sb_pipe_mang_test.c @@ -18,7 +18,7 @@ ** See the License for the specific language governing permissions and ** limitations under the License. ** -** File: es_info_test.c +** File: sb_pipe_mang_test.c ** ** Purpose: ** Functional test of Sb Pipe Managment APIs diff --git a/modules/cfe_testcase/src/tbl_content_access_test.c b/modules/cfe_testcase/src/tbl_content_access_test.c new file mode 100644 index 000000000..08c60e868 --- /dev/null +++ b/modules/cfe_testcase/src/tbl_content_access_test.c @@ -0,0 +1,167 @@ +/************************************************************************* +** +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +** +** File: tbl_content_access_test.c +** +** Purpose: +** Functional test of Table Access Content APIs +** +** Demonstration of how to register and use the UT assert functions. +** +*************************************************************************/ + +/* + * Includes + */ + +#include "cfe_test.h" +#include "cfe_test_table.h" + +/* + * 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) +{ + UtAssert_INT32_EQ(CFE_TBL_Load(CFE_FT_Global.TblHandle, CFE_TBL_SRC_ADDRESS, TestTable), ExpectedStatus); +} + +void TestGetAddress(void) +{ + UtPrintf("Testing: CFE_TBL_GetAddress"); + void * TblPtr; + TBL_TEST_Table_t *TestTblPtr; + TBL_TEST_Table_t TestTable = {1, 2}; + /* Never loaded */ + UtAssert_INT32_EQ(CFE_TBL_GetAddress(&TblPtr, CFE_FT_Global.TblHandle), CFE_TBL_ERR_NEVER_LOADED); + UtAssert_INT32_EQ(CFE_TBL_GetAddress(&TblPtr, CFE_TBL_BAD_TABLE_HANDLE), CFE_TBL_ERR_INVALID_HANDLE); + UtAssert_INT32_EQ(CFE_TBL_GetAddress(NULL, CFE_TBL_BAD_TABLE_HANDLE), CFE_TBL_BAD_ARGUMENT); + + /* Returns CFE_TBL_INFO_UPDATED since it was just loaded */ + LoadTable(&TestTable, CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_TBL_GetAddress(&TblPtr, CFE_FT_Global.TblHandle), CFE_TBL_INFO_UPDATED); + UtAssert_INT32_EQ(CFE_TBL_GetAddress(&TblPtr, CFE_FT_Global.TblHandle), CFE_SUCCESS); + + /* Check table contents */ + TestTblPtr = (TBL_TEST_Table_t *)TblPtr; + UtAssert_INT32_EQ(TestTblPtr->Int1, TestTable.Int1); + UtAssert_INT32_EQ(TestTblPtr->Int2, TestTable.Int2); + + /* Unregistered table */ + UnregisterTestTable(); + UtAssert_INT32_EQ(CFE_TBL_GetAddress(&TblPtr, CFE_FT_Global.TblHandle), CFE_TBL_ERR_INVALID_HANDLE); + + /* Access a shared table */ + CFE_TBL_Handle_t SharedTblHandle; + const char * SharedTblName = "SAMPLE_APP.SampleAppTable"; + UtAssert_INT32_EQ(CFE_TBL_Share(&SharedTblHandle, SharedTblName), CFE_SUCCESS); + /* Returns CFE_TBL_INFO_UPDATED since it hasn't been touched since it was loaded */ + UtAssert_INT32_EQ(CFE_TBL_GetAddress(&TblPtr, SharedTblHandle), CFE_TBL_INFO_UPDATED); + UtAssert_INT32_EQ(CFE_TBL_Unregister(SharedTblHandle), CFE_SUCCESS); +} + +void TestReleaseAddress(void) +{ + UtPrintf("Testing: CFE_TBL_GetAddress"); + void * TblPtr; + TBL_TEST_Table_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); + /* Successful load and release */ + LoadTable(&TestTable, CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_TBL_ReleaseAddress(CFE_FT_Global.TblHandle), CFE_TBL_INFO_UPDATED); + + /* Attempt to load while address is locked */ + LoadTable(&TestTable, CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_TBL_GetAddress(&TblPtr, CFE_FT_Global.TblHandle), CFE_TBL_INFO_UPDATED); + LoadTable(&TestTable, CFE_TBL_INFO_TABLE_LOCKED); + + /* Release and try again */ + UtAssert_INT32_EQ(CFE_TBL_ReleaseAddress(CFE_FT_Global.TblHandle), CFE_SUCCESS); + /* It is necessary to call CFE_TBL_Manage because the table still thinks there is a load in progress from the failed + load while the table was locked. This call shouldn't be necesssary. */ + UtAssert_INT32_EQ(CFE_TBL_Manage(CFE_FT_Global.TblHandle), CFE_TBL_INFO_UPDATED); + LoadTable(&TestTable, CFE_SUCCESS); + + /* Attempt to release an unregistered table */ + UnregisterTestTable(); + UtAssert_INT32_EQ(CFE_TBL_ReleaseAddress(CFE_FT_Global.TblHandle), CFE_TBL_ERR_INVALID_HANDLE); +} + +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}; + + /* Put an invalid handle at the start*/ + TblHandles[0] = CFE_TBL_BAD_TABLE_HANDLE; + TblPtrs[0] = TblPtrsList; + for (int i = 1; i < numValidTbls + 1; i++) + { + sprintf(TblName, "%d", i); + UtAssert_INT32_EQ( + CFE_TBL_Register(&TblHandles[i], TblName, sizeof(TBL_TEST_Table_t), CFE_TBL_OPT_DEFAULT, NULL), + CFE_SUCCESS); + TblPtrs[i] = TblPtrsList + i; + } + + UtAssert_INT32_EQ(CFE_TBL_GetAddresses(NULL, numValidTbls, TblHandles), CFE_TBL_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_TBL_GetAddresses((void ***)&TblPtrs, numValidTbls, NULL), CFE_TBL_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_TBL_GetAddresses((void ***)&TblPtrs, numValidTbls, TblHandles), CFE_TBL_ERR_INVALID_HANDLE); + /* Skip the first table handle to only consider valid handles */ + UtAssert_INT32_EQ(CFE_TBL_GetAddresses((void ***)&TblPtrs, numValidTbls, TblHandles + 1), CFE_TBL_ERR_NEVER_LOADED); + + /* Load data and then get addresses */ + for (int i = 1; i < numValidTbls + 1; i++) + { + if (CFE_TBL_Load(TblHandles[i], CFE_TBL_SRC_ADDRESS, &TestTable) != CFE_SUCCESS) + { + UtAssert_Failed("Failed to load data for table number %d", i); + } + } + /* First time returns status message of CFE_TBL_INFO_UPDATED */ + UtAssert_INT32_EQ(CFE_TBL_GetAddresses((void ***)&TblPtrs, numValidTbls, TblHandles + 1), CFE_TBL_INFO_UPDATED); + UtAssert_INT32_EQ(CFE_TBL_GetAddresses((void ***)&TblPtrs, numValidTbls, TblHandles + 1), CFE_SUCCESS); + /* Attempt to release the invalid handle at the start of the array */ + UtAssert_INT32_EQ(CFE_TBL_ReleaseAddresses(numValidTbls, TblHandles), CFE_TBL_ERR_INVALID_HANDLE); + UtAssert_INT32_EQ(CFE_TBL_ReleaseAddresses(numValidTbls, NULL), CFE_TBL_BAD_ARGUMENT); + /* Skip the invalid handle */ + UtAssert_INT32_EQ(CFE_TBL_ReleaseAddresses(numValidTbls, TblHandles + 1), CFE_SUCCESS); + + /* Unregister all tables */ + for (int i = 1; i < numValidTbls + 1; i++) + { + if (CFE_TBL_Unregister(TblHandles[i]) != CFE_SUCCESS) + { + UtAssert_Failed("Failed to unregister table number %d", i); + } + } +} + +void TBLContentAccessTestSetup(void) +{ + UtTest_Add(TestGetAddress, RegisterTestTable, NULL, "Test Table Get Address"); + UtTest_Add(TestReleaseAddress, RegisterTestTable, NULL, "Test Table Release Address"); + UtTest_Add(TestGetReleaseAddresses, NULL, NULL, "Test Table Get and Release Addresses"); +} \ No newline at end of file diff --git a/modules/cfe_testcase/src/tbl_content_mang_test.c b/modules/cfe_testcase/src/tbl_content_mang_test.c new file mode 100644 index 000000000..93a4b22e6 --- /dev/null +++ b/modules/cfe_testcase/src/tbl_content_mang_test.c @@ -0,0 +1,132 @@ +/************************************************************************* +** +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +** +** File: tbl_content_mang_test.c +** +** Purpose: +** Functional test of Table Manage Content APIs +** +** Demonstration of how to register and use the UT assert functions. +** +*************************************************************************/ + +/* + * Includes + */ + +#include "cfe_test.h" +#include "cfe_test_table.h" + +/* Does not test partial loads */ +void TestLoad(void) +{ + UtPrintf("Testing: CFE_TBL_Load"); + CFE_TBL_Handle_t BadTblHandle; + const char * BadTblName = "BadTableName"; + UtAssert_INT32_EQ( + CFE_TBL_Register(&BadTblHandle, BadTblName, sizeof(TBL_TEST_Table_t), CFE_TBL_OPT_DBL_BUFFER, NULL), + CFE_SUCCESS); + + /* Load from file */ + UtAssert_INT32_EQ(CFE_TBL_Load(CFE_FT_Global.TblHandle, CFE_TBL_SRC_FILE, "/cf/cfe_test_tbl.tbl"), CFE_SUCCESS); + /* Load again */ + UtAssert_INT32_EQ(CFE_TBL_Load(CFE_FT_Global.TblHandle, CFE_TBL_SRC_FILE, "/cf/cfe_test_tbl.tbl"), CFE_SUCCESS); + /* Table name mismatches */ + UtAssert_INT32_EQ(CFE_TBL_Load(BadTblHandle, CFE_TBL_SRC_FILE, "/cf/cfe_test_tbl.tbl"), + CFE_TBL_ERR_FILE_FOR_WRONG_TABLE); + UtAssert_INT32_EQ(CFE_TBL_Load(CFE_FT_Global.TblHandle, CFE_TBL_SRC_FILE, "/cf/sample_app_tbl.tbl"), + CFE_TBL_ERR_FILE_FOR_WRONG_TABLE); + /* This is a very unintuitive error message. CFE_TBL_ERR_FILE_NOT_FOUND would be more accurate */ + UtAssert_INT32_EQ(CFE_TBL_Load(CFE_FT_Global.TblHandle, CFE_TBL_SRC_FILE, "/cf/not_cfe_test_tbl.tbl"), + CFE_TBL_ERR_ACCESS); + + UtAssert_INT32_EQ(CFE_TBL_Load(CFE_TBL_BAD_TABLE_HANDLE, CFE_TBL_SRC_FILE, "/cf/cfe_test_tbl.tbl"), + CFE_TBL_ERR_INVALID_HANDLE); + + /* Load from memory */ + TBL_TEST_Table_t TestTable = {1, 2}; + UtAssert_INT32_EQ(CFE_TBL_Load(CFE_FT_Global.TblHandle, CFE_TBL_SRC_ADDRESS, &TestTable), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_TBL_Load(CFE_FT_Global.TblHandle, CFE_TBL_SRC_ADDRESS, NULL), CFE_TBL_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_TBL_Load(CFE_TBL_BAD_TABLE_HANDLE, CFE_TBL_SRC_ADDRESS, &TestTable), + CFE_TBL_ERR_INVALID_HANDLE); + + /* Attempt to load a dump only table */ + CFE_TBL_Handle_t DumpTblHandle; + const char * DumpTblName = "DumpOnlyTable"; + UtAssert_INT32_EQ( + CFE_TBL_Register(&DumpTblHandle, DumpTblName, sizeof(TBL_TEST_Table_t), CFE_TBL_OPT_DUMP_ONLY, NULL), + CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_TBL_Load(DumpTblHandle, CFE_TBL_SRC_FILE, "/cf/cfe_test_tbl.tbl"), CFE_TBL_ERR_DUMP_ONLY); + + /* Load a shared table */ + CFE_TBL_Handle_t SharedTblHandle; + const char * SharedTblName = "SAMPLE_APP.SampleAppTable"; + UtAssert_INT32_EQ(CFE_TBL_Share(&SharedTblHandle, SharedTblName), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_TBL_Load(SharedTblHandle, CFE_TBL_SRC_FILE, "/cf/sample_app_tbl.tbl"), CFE_SUCCESS); +} + +void TestUpdate(void) +{ + UtPrintf("Testing: CFE_TBL_Update"); + /* Haven't figured out how to get an update pending */ + UtAssert_INT32_EQ(CFE_TBL_Update(CFE_FT_Global.TblHandle), CFE_TBL_INFO_NO_UPDATE_PENDING); + UtAssert_INT32_EQ(CFE_TBL_Update(CFE_TBL_BAD_TABLE_HANDLE), CFE_TBL_ERR_INVALID_HANDLE); +} + +void TestValidate(void) +{ + UtPrintf("Testing: CFE_TBL_Validate"); + /* Haven't figured out how to get a validation pending */ + UtAssert_INT32_EQ(CFE_TBL_Validate(CFE_FT_Global.TblHandle), CFE_TBL_INFO_NO_VALIDATION_PENDING); + UtAssert_INT32_EQ(CFE_TBL_Validate(CFE_TBL_BAD_TABLE_HANDLE), CFE_TBL_ERR_INVALID_HANDLE); +} + +void TestManage(void) +{ + UtPrintf("Testing: CFE_TBL_Manage"); + UtAssert_INT32_EQ(CFE_TBL_Manage(CFE_FT_Global.TblHandle), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_TBL_Manage(CFE_TBL_BAD_TABLE_HANDLE), CFE_TBL_ERR_INVALID_HANDLE); +} + +void TestDumpToBuffer(void) +{ + UtPrintf("Testing: CFE_TBL_DumpToBuffer"); + /* This should at least return an info code such as CFE_TBL_INFO_NO_UPDATE_PENDING when CFE_TBL_Update is called + * with no pending update instead of returning CFE_SUCCESS whether or not it actually dumped*/ + UtAssert_INT32_EQ(CFE_TBL_DumpToBuffer(CFE_FT_Global.TblHandle), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_TBL_DumpToBuffer(CFE_TBL_BAD_TABLE_HANDLE), CFE_TBL_ERR_INVALID_HANDLE); +} + +void TestModified(void) +{ + UtPrintf("Testing: CFE_TBL_Modified"); + UtAssert_INT32_EQ(CFE_TBL_Modified(CFE_FT_Global.TblHandle), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_TBL_Modified(CFE_TBL_BAD_TABLE_HANDLE), CFE_TBL_ERR_INVALID_HANDLE); +} + +void TBLContentMangTestSetup(void) +{ + UtTest_Add(TestLoad, RegisterTestTable, UnregisterTestTable, "Test Table Load"); + UtTest_Add(TestUpdate, RegisterTestTable, UnregisterTestTable, "Test Table Update"); + UtTest_Add(TestValidate, RegisterTestTable, UnregisterTestTable, "Test Table Validate"); + UtTest_Add(TestManage, RegisterTestTable, UnregisterTestTable, "Test Table Manage"); + UtTest_Add(TestDumpToBuffer, RegisterTestTable, UnregisterTestTable, "Test Table Dump to Buffer"); + UtTest_Add(TestModified, RegisterTestTable, UnregisterTestTable, "Test Table Modified"); +} diff --git a/modules/cfe_testcase/src/tbl_information_test.c b/modules/cfe_testcase/src/tbl_information_test.c new file mode 100644 index 000000000..6adcbd541 --- /dev/null +++ b/modules/cfe_testcase/src/tbl_information_test.c @@ -0,0 +1,96 @@ +/************************************************************************* +** +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +** +** File: tbl_information_test.c +** +** Purpose: +** Functional test of Table Information APIs +** +** Demonstration of how to register and use the UT assert functions. +** +*************************************************************************/ + +/* + * Includes + */ + +#include "cfe_test.h" +#include "cfe_test_table.h" + +void TestGetStatus(void) +{ + UtPrintf("Testing: CFE_TBL_GetStatus"); + /* + * This assert assumes there are no pending actions for this table + * Since manage has never been called, I think this is a safe assumption + */ + UtAssert_INT32_EQ(CFE_TBL_GetStatus(CFE_FT_Global.TblHandle), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_TBL_GetStatus(CFE_TBL_BAD_TABLE_HANDLE), CFE_TBL_ERR_INVALID_HANDLE); +} + +void TestGetInfo(void) +{ + UtPrintf("Testing: CFE_TBL_GetInfo"); + CFE_TBL_Info_t TblInfo; + const char * BadTblName = "BadTable"; + UtAssert_INT32_EQ(CFE_TBL_GetInfo(&TblInfo, CFE_FT_Global.RegisteredTblName), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_TBL_GetInfo(NULL, CFE_FT_Global.TblName), CFE_TBL_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_TBL_GetInfo(&TblInfo, BadTblName), CFE_TBL_ERR_INVALID_NAME); + + /* This is only checking some parts of the TblInfo struct */ + size_t expectedSize = sizeof(TBL_TEST_Table_t); + uint32 expectedNumUsers = 1; + bool expectedTableLoaded = false; + bool expectedDumpOnly = false; + bool expectedDoubleBuf = false; + bool expectedUserDefAddr = false; + bool expectedCritical = false; + UtAssert_UINT32_EQ(TblInfo.Size, expectedSize); + UtAssert_UINT32_EQ(TblInfo.NumUsers, expectedNumUsers); + UtAssert_INT32_EQ(TblInfo.TableLoadedOnce, expectedTableLoaded); + UtAssert_INT32_EQ(TblInfo.DumpOnly, expectedDumpOnly); + UtAssert_INT32_EQ(TblInfo.DoubleBuffered, expectedDoubleBuf); + UtAssert_INT32_EQ(TblInfo.UserDefAddr, expectedUserDefAddr); + UtAssert_INT32_EQ(TblInfo.Critical, expectedCritical); +} + +void TestNotifyByMessage(void) +{ + UtPrintf("Testing: CFE_TBL_NotifyByMessage"); + CFE_TBL_Handle_t SharedTblHandle; + const char * SharedTblName = "SAMPLE_APP.SampleAppTable"; + CFE_SB_MsgId_t TestMsgId = 0x9999; + CFE_MSG_FcnCode_t TestCmdCode = 0x9999; + uint32 TestParameter = 0; + UtAssert_INT32_EQ(CFE_TBL_NotifyByMessage(CFE_FT_Global.TblHandle, TestMsgId, TestCmdCode, TestParameter), + CFE_SUCCESS); + + /* Attempt on table not owned by this app */ + UtAssert_INT32_EQ(CFE_TBL_Share(&SharedTblHandle, SharedTblName), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_TBL_NotifyByMessage(SharedTblHandle, TestMsgId, TestCmdCode, TestParameter), + CFE_TBL_ERR_NO_ACCESS); +} + +void TBLInformationTestSetup(void) +{ + UtTest_Add(TestGetStatus, RegisterTestTable, UnregisterTestTable, "Test Table Get Status"); + UtTest_Add(TestGetInfo, RegisterTestTable, UnregisterTestTable, "Test Table Get Info"); + UtTest_Add(TestNotifyByMessage, RegisterTestTable, UnregisterTestTable, "Test Table Notify by Message"); +} diff --git a/modules/cfe_testcase/src/tbl_registration_test.c b/modules/cfe_testcase/src/tbl_registration_test.c new file mode 100644 index 000000000..abe7160f6 --- /dev/null +++ b/modules/cfe_testcase/src/tbl_registration_test.c @@ -0,0 +1,138 @@ +/************************************************************************* +** +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +** +** File: tbl_registration_test.c +** +** Purpose: +** Functional test of Table Registration APIs +** +** Demonstration of how to register and use the UT assert functions. +** +*************************************************************************/ + +/* + * Includes + */ + +#include "cfe_test.h" +#include "cfe_test_table.h" + +int32 CallbackFunc(void *TblPtr) +{ + return 1; +} + +void TestTableRegistration(void) +{ + UtPrintf("Testing: CFE_TBL_Register, CFE_TBL_Unregister"); + char BadTblName[CFE_TBL_MAX_FULL_NAME_LEN + 2]; + BadTblName[CFE_TBL_MAX_FULL_NAME_LEN + 1] = '\0'; + memset(BadTblName, 'a', sizeof(BadTblName) - 1); + + /* Successfully create table */ + UtAssert_INT32_EQ(CFE_TBL_Register(&CFE_FT_Global.TblHandle, CFE_FT_Global.TblName, sizeof(TBL_TEST_Table_t), + CFE_TBL_OPT_DEFAULT, &CallbackFunc), + CFE_SUCCESS); + + /* Duplicate table */ + UtAssert_INT32_EQ(CFE_TBL_Register(&CFE_FT_Global.TblHandle, CFE_FT_Global.TblName, sizeof(TBL_TEST_Table_t), + CFE_TBL_OPT_DEFAULT, &CallbackFunc), + CFE_TBL_WARN_DUPLICATE); + + /* Unregister the table */ + UtAssert_INT32_EQ(CFE_TBL_Unregister(CFE_FT_Global.TblHandle), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_TBL_Unregister(CFE_FT_Global.TblHandle), CFE_TBL_ERR_INVALID_HANDLE); + + /* 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_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_ERR_INVALID_NAME); + + /* Invalid Table Size */ + UtAssert_INT32_EQ(CFE_TBL_Register(&CFE_FT_Global.TblHandle, CFE_FT_Global.TblName, 0, CFE_TBL_OPT_DEFAULT, NULL), + CFE_TBL_ERR_INVALID_SIZE); + UtAssert_INT32_EQ(CFE_TBL_Register(&CFE_FT_Global.TblHandle, CFE_FT_Global.TblName, + CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE + 1, CFE_TBL_OPT_SNGL_BUFFER, NULL), + CFE_TBL_ERR_INVALID_SIZE); + UtAssert_INT32_EQ(CFE_TBL_Register(&CFE_FT_Global.TblHandle, CFE_FT_Global.TblName, + CFE_PLATFORM_TBL_MAX_DBL_TABLE_SIZE + 1, CFE_TBL_OPT_DBL_BUFFER, NULL), + 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), + 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), + 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), + CFE_TBL_OPT_CRITICAL | CFE_TBL_OPT_USR_DEF_ADDR, NULL), + CFE_TBL_ERR_INVALID_OPTIONS); + + /* + * Create the maximum number of tables + * There are already some tables in this system, so this will + * stop succeeding before it reaches the end of the loop + * Check that after the loop no more tables can be created + */ + CFE_TBL_Handle_t TblHandles[CFE_PLATFORM_TBL_MAX_NUM_TABLES]; + char TblName2[10]; + int numTblsCreated = 0; /* Track num created to unregister them all */ + for (int i = 0; i < CFE_PLATFORM_TBL_MAX_NUM_TABLES; i++) + { + sprintf(TblName2, "%d", i); + if (CFE_TBL_Register(&TblHandles[i], TblName2, sizeof(TBL_TEST_Table_t), CFE_TBL_OPT_DEFAULT, NULL) == + CFE_SUCCESS) + { + numTblsCreated++; + } + } + UtAssert_INT32_EQ(CFE_TBL_Register(&TblHandles[numTblsCreated], CFE_FT_Global.TblName, sizeof(TBL_TEST_Table_t), + CFE_TBL_OPT_DEFAULT, &CallbackFunc), + CFE_TBL_ERR_REGISTRY_FULL); + /* Unregister the tables */ + for (int i = 0; i < numTblsCreated; i++) + { + if (CFE_TBL_Unregister(TblHandles[i]) != CFE_SUCCESS) + { + UtAssert_Failed("Failed to unregister table number %d", i); + } + } +} + +void TestTableShare(void) +{ + UtPrintf("Testing: CFE_TBL_Share"); + CFE_TBL_Handle_t SharedTblHandle; + const char * SharedTblName = "SAMPLE_APP.SampleAppTable"; + const char * BadTblName = "SampleAppTable"; + UtAssert_INT32_EQ(CFE_TBL_Share(&SharedTblHandle, SharedTblName), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_TBL_Share(&SharedTblHandle, NULL), CFE_TBL_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_TBL_Share(&SharedTblHandle, BadTblName), CFE_TBL_ERR_INVALID_NAME); +} + +void TBLRegistrationTestSetup(void) +{ + UtTest_Add(TestTableRegistration, NULL, NULL, "Test Table Registration"); + UtTest_Add(TestTableShare, NULL, NULL, "Test Table Sharing"); +} diff --git a/modules/cfe_testcase/src/time_current_test.c b/modules/cfe_testcase/src/time_current_test.c index e37ec7fad..901e6ca7c 100644 --- a/modules/cfe_testcase/src/time_current_test.c +++ b/modules/cfe_testcase/src/time_current_test.c @@ -18,7 +18,7 @@ ** See the License for the specific language governing permissions and ** limitations under the License. ** -** File: es_info_test.c +** File: time_current_test.c ** ** Purpose: ** Functional test of basic Time Current APIs diff --git a/modules/cfe_testcase/src/time_misc_test.c b/modules/cfe_testcase/src/time_misc_test.c new file mode 100644 index 000000000..2a84b3bad --- /dev/null +++ b/modules/cfe_testcase/src/time_misc_test.c @@ -0,0 +1,58 @@ +/************************************************************************* +** +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +** +** File: time_misc_test.c +** +** Purpose: +** Functional test of miscelaneous Time APIs +** +** Demonstration of how to register and use the UT assert functions. +** +*************************************************************************/ + +/* + * Includes + */ + +#include "cfe_test.h" + +void TestTimePrint(void) +{ + UtPrintf("Testing: CFE_TIME_Print"); + char timeBuf1[sizeof("yyyy-ddd-hh:mm:ss.xxxxx_")]; + CFE_TIME_SysTime_t time1 = {0, 0}; + /* 365 days */ + CFE_TIME_SysTime_t time2 = {31536000, 0}; + /* 366 days */ + CFE_TIME_SysTime_t time3 = {31622400, 0}; + + UtAssert_VOIDCALL(CFE_TIME_Print(NULL, time1)); + UtAssert_VOIDCALL(CFE_TIME_Print(timeBuf1, time1)); + UtPrintf("%s", timeBuf1); + UtAssert_VOIDCALL(CFE_TIME_Print(timeBuf1, time2)); + UtPrintf("%s", timeBuf1); + UtAssert_VOIDCALL(CFE_TIME_Print(timeBuf1, time3)); + UtPrintf("%s", timeBuf1); +} + +void TimeMiscTestSetup(void) +{ + UtTest_Add(TestTimePrint, NULL, NULL, "Test Time Print"); +} diff --git a/modules/cfe_testcase/tables/cfe_test_tbl.c b/modules/cfe_testcase/tables/cfe_test_tbl.c new file mode 100644 index 000000000..81116b796 --- /dev/null +++ b/modules/cfe_testcase/tables/cfe_test_tbl.c @@ -0,0 +1,36 @@ +/************************************************************************* +** +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +** +** File: cfe_test_tbl.c +** +** Purpose: +** Create a file containing a CFE Test Table +** +*************************************************************************/ + +/* + * Includes + */ + +#include "cfe_tbl_filedef.h" +#include "cfe_test_tbl.h" + +TBL_TEST_Table_t TestTable = {1, 2}; +CFE_TBL_FILEDEF(TestTable, CFE_TEST_APP.TestTable, Table Test Table, cfe_test_tbl.tbl) \ No newline at end of file diff --git a/modules/core_api/fsw/inc/cfe_es.h b/modules/core_api/fsw/inc/cfe_es.h index 53061b4a3..2fcb96603 100644 --- a/modules/core_api/fsw/inc/cfe_es.h +++ b/modules/core_api/fsw/inc/cfe_es.h @@ -163,7 +163,7 @@ CFE_Status_t CFE_ES_TaskID_ToIndex(CFE_ES_TaskId_t TaskID, uint32 *Idx); * for future use. * * @param[in] CounterId Counter ID to convert - * @param[out] Idx Buffer where the calculated index will be stored + * @param[out] Idx Buffer where the calculated index will be stored @nonnull * * @return Execution status, see @ref CFEReturnCodes * @retval #CFE_SUCCESS @copybrief CFE_SUCCESS @@ -1494,15 +1494,16 @@ void CFE_ES_PerfLogAdd(uint32 Marker, uint32 EntryExit); ** can be used for inter-task management. ** ** \par Assumptions, External Events, and Notes: -** None. +** The initial value of all newly registered counters is 0. ** -** \param[in] *CounterName The Name of the generic counter. +** \param[out] CounterIdPtr Buffer to store the Counter Id of the newly created counter @nonnull. +** \param[in] CounterName The Name of the generic counter @nonnull. ** -** \param[out] *CounterIdPtr The Counter Id of the newly created counter. ** ** \return Execution status, see \ref CFEReturnCodes -** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS -** \retval #CFE_ES_BAD_ARGUMENT \copybrief CFE_ES_BAD_ARGUMENT +** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS +** \retval #CFE_ES_BAD_ARGUMENT \copybrief CFE_ES_BAD_ARGUMENT +** \retval #CFE_ES_ERR_DUPLICATE_NAME \copybrief CFE_ES_ERR_DUPLICATE_NAME ** ** \sa #CFE_ES_IncrementGenCounter, #CFE_ES_DeleteGenCounter, #CFE_ES_SetGenCount, #CFE_ES_GetGenCount, *#CFE_ES_GetGenCounterIDByName @@ -1588,9 +1589,9 @@ CFE_Status_t CFE_ES_SetGenCount(CFE_ES_CounterId_t CounterId, uint32 Count); ** \par Assumptions, External Events, and Notes: ** None. ** -** \param[in] CounterId The Counter to get the value from. +** \param[in] CounterId The Counter to get the value from. ** -** \param[in] *Count The value of the Counter. +** \param[out] Count Buffer to store value of the Counter @nonnull. ** ** \return Execution status, see \ref CFEReturnCodes ** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS @@ -1612,8 +1613,8 @@ CFE_Status_t CFE_ES_GetGenCount(CFE_ES_CounterId_t CounterId, uint32 *Count); ** \par Assumptions, External Events, and Notes: ** None. ** -** \param[out] CounterIdPtr Pointer to variable that is to receive the Counter's ID. -** \param[in] CounterName Pointer to null terminated character string containing a Counter name. +** \param[out] CounterIdPtr Pointer to variable that is to receive the Counter's ID @nonnull. +** \param[in] CounterName Pointer to null terminated character string containing a Counter name @nonnull. ** ** \return Execution status, see \ref CFEReturnCodes ** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS @@ -1636,12 +1637,12 @@ CFE_Status_t CFE_ES_GetGenCounterIDByName(CFE_ES_CounterId_t *CounterIdPtr, cons ** \par Assumptions, External Events, and Notes: ** In the case of a failure (#CFE_ES_ERR_RESOURCEID_NOT_VALID), an empty string is returned. ** -** \param[out] CounterName Pointer to a character array of at least \c BufferLength in size that will +** \param[out] CounterName Pointer to a character array @nonnull of at least \c BufferLength in size that will ** be filled with the Counter name. ** ** \param[in] CounterId ID of Counter whose name is being requested. ** -** \param[in] BufferLength The maximum number of characters, including the null terminator, that can be put +** \param[in] BufferLength The maximum number of characters, including the null terminator @nonzero, that can be put ** into the \c CounterName buffer. This routine will truncate the name to this length, ** if necessary. ** diff --git a/modules/core_api/fsw/inc/cfe_version.h b/modules/core_api/fsw/inc/cfe_version.h index 763966e2e..4e2bad40d 100644 --- a/modules/core_api/fsw/inc/cfe_version.h +++ b/modules/core_api/fsw/inc/cfe_version.h @@ -28,7 +28,7 @@ #define CFE_VERSION_H /* Development Build Macro Definitions */ -#define CFE_BUILD_NUMBER 810 /**< @brief Development: Number of development commits since baseline */ +#define CFE_BUILD_NUMBER 844 /**< @brief Development: Number of development commits since baseline */ #define CFE_BUILD_BASELINE "v6.8.0-rc1" /**< @brief Development: Reference git tag for build number */ /* Version Macro Definitions updated for official releases only */ diff --git a/modules/core_private/ut-stubs/inc/ut_support.h b/modules/core_private/ut-stubs/inc/ut_support.h index fa4683ba2..03e6d10a2 100644 --- a/modules/core_private/ut-stubs/inc/ut_support.h +++ b/modules/core_private/ut-stubs/inc/ut_support.h @@ -138,27 +138,6 @@ typedef struct } UT_TaskPipeDispatchId_t; -/** - * \brief Comparison types for generic value asserts - * - * These constants are used with the generic value assert functions - * - * \sa CFE_UtAssert_GenericSignedCompare_Impl - * \sa CFE_UtAssert_GenericUnsignedCompare_Impl - */ -typedef enum -{ - CFE_UtAssert_Compare_NONE, /**< invalid/not used, always false */ - CFE_UtAssert_Compare_EQ, /**< actual equals reference value */ - CFE_UtAssert_Compare_NEQ, /**< actual does not non equal reference value */ - CFE_UtAssert_Compare_LT, /**< actual less than reference (exclusive) */ - CFE_UtAssert_Compare_GT, /**< actual greater than reference (exclusive) */ - CFE_UtAssert_Compare_LTEQ, /**< actual less than or equal to reference (inclusive) */ - CFE_UtAssert_Compare_GTEQ, /**< actual greater than reference (inclusive) */ - CFE_UtAssert_Compare_BOOL, /**< interpret as logical boolean values (0=false, nonzero=true) */ - CFE_UtAssert_Compare_MAX /**< placeholder, not used */ -} CFE_UtAssert_Compare_t; - /* ** Functions */ @@ -561,25 +540,6 @@ void UT_DisplayPkt(CFE_MSG_Message_t *MsgPtr, size_t size); ******************************************************************************/ CFE_ES_ResetData_t *UT_GetResetDataPtr(void); -/*****************************************************************************/ -/** -** \brief Add a test as a member of a subgroup. -** -** \par Description -** Allow tests to be grouped together -** -** This is just a wrapper around UtTest_Add() that registers -** a test with a "GroupName.TestName" convention. Purely an -** organizational/identification helper for units which have -** lots of tests. -** -** \par Assumptions, External Events, and Notes: -** None -** -******************************************************************************/ -void UT_AddSubTest(void (*Test)(void), void (*Setup)(void), void (*Teardown)(void), const char *GroupName, - const char *TestName); - /* ** Assert Helper Functions ** Wrappers around the UtAssert functions to tune them for CFE use. @@ -630,65 +590,6 @@ bool CFE_UtAssert_SuccessCheck_Impl(CFE_Status_t Status, UtAssert_CaseType_t Cas bool CFE_UtAssert_MessageCheck_Impl(bool Status, const char *File, uint32 Line, const char *Desc, const char *FormatString); -/*****************************************************************************/ -/** -** \brief Helper function for string buffer check verifications -** -** \par Description -** This helper function wraps the normal UtAssert function, intended for verifying -** the contents of string buffer(s). This also includes the actual message in the log, -** but scrubs it for newlines and other items that may affect the ability to parse -** the log file via a script. -** -** \par Assumptions, External Events, and Notes: -** None -** -** \returns Test pass status, returns true if status was successful, false if it failed. -** -******************************************************************************/ -bool CFE_UtAssert_StringBufCheck_Impl(const char *String1, size_t String1Max, const char *String2, size_t String2Max, - const char *File, uint32 Line); - -/*****************************************************************************/ -/** -** \brief Helper function for generic unsigned integer value checks -** -** \par Description -** This helper function wraps the normal UtAssertEx() function, to compare two -** integer values in an unsigned context. The comparison is performed as two -** 32 bit unsigned integers and the numeric values are printed to the test log -** in hexadecimal notation (base-16). -** -** \par Assumptions, External Events, and Notes: -** None -** -** \returns Test pass status, returns true if status was successful, false if it failed. -** -******************************************************************************/ -bool CFE_UtAssert_GenericUnsignedCompare_Impl(uint32 ActualValue, CFE_UtAssert_Compare_t CompareType, - uint32 ReferenceValue, const char *File, uint32 Line, const char *Desc, - const char *ActualText, const char *ReferenceText); - -/*****************************************************************************/ -/** -** \brief Helper function for generic signed integer value checks -** -** \par Description -** This helper function wraps the normal UtAssertEx() function, to compare two -** integer values in a signed context. The comparison is performed as two -** 32 bit signed integers and the numeric values are printed to the test log -** in standard decimal notation (base-10). -** -** \par Assumptions, External Events, and Notes: -** None -** -** \returns Test pass status, returns true if status was successful, false if it failed. -** -******************************************************************************/ -bool CFE_UtAssert_GenericSignedCompare_Impl(int32 ActualValue, CFE_UtAssert_Compare_t CompareType, int32 ReferenceValue, - const char *File, uint32 Line, const char *Desc, const char *ActualText, - const char *ReferenceText); - /*****************************************************************************/ /** ** \brief Checks the successful execution of a setup function. @@ -719,66 +620,6 @@ bool CFE_UtAssert_GenericSignedCompare_Impl(int32 ActualValue, CFE_UtAssert_Comp ******************************************************************************/ #define CFE_UtAssert_SUCCESS(FN) CFE_UtAssert_SuccessCheck_Impl(FN, UTASSERT_CASETYPE_FAILURE, __FILE__, __LINE__, #FN) -/*****************************************************************************/ -/** -** \brief Asserts the expression/function evaluates as logically true -** -** \par Description -** The core of each unit test is the execution of the function being tested. -** This function and macro should be used to test for a function or value/expression -** that should evaluate as logically true -** -** \par Assumptions, External Events, and Notes: -** None -** -******************************************************************************/ -#define CFE_UtAssert_TRUE(FN) \ - CFE_UtAssert_GenericSignedCompare_Impl(FN, CFE_UtAssert_Compare_BOOL, true, __FILE__, __LINE__, "", #FN, "true") - -/*****************************************************************************/ -/** -** \brief Asserts the expression/function evaluates as logically false -** -** \par Description -** The core of each unit test is the execution of the function being tested. -** This function and macro should be used to test for a function or value/expression -** that should evaluate as logically false -** -** \par Assumptions, External Events, and Notes: -** None -** -******************************************************************************/ -#define CFE_UtAssert_FALSE(FN) \ - CFE_UtAssert_GenericSignedCompare_Impl(FN, CFE_UtAssert_Compare_BOOL, false, __FILE__, __LINE__, "", #FN, "false") - -/*****************************************************************************/ -/** -** \brief Asserts the minimum value of a given function or expression -** -** \par Description -** This macro confirms that the given expression is at least the minimum value (inclusive) -** -** \par Assumptions, External Events, and Notes: -** None -** -******************************************************************************/ -#define CFE_UtAssert_ATLEAST(FN, MIN) \ - CFE_UtAssert_GenericSignedCompare_Impl(FN, CFE_UtAssert_Compare_GTEQ, MIN, __FILE__, __LINE__, "", #FN, #MIN) - -/*****************************************************************************/ -/** -** \brief Asserts the maximum value of a given function or expression -** -** \par Description -** This macro confirms that the given expression is at most the maximum value (inclusive) -** -** \par Assumptions, External Events, and Notes: -** None -** -******************************************************************************/ -#define CFE_UtAssert_ATMOST(FN, MAX) \ - CFE_UtAssert_GenericSignedCompare_Impl(FN, CFE_UtAssert_Compare_LTEQ, MAX, __FILE__, __LINE__, "", #FN, #MAX) - /*****************************************************************************/ /** ** \brief Ensures that the test generated the expected number of events. @@ -792,9 +633,9 @@ bool CFE_UtAssert_GenericSignedCompare_Impl(int32 ActualValue, CFE_UtAssert_Comp ** None ** ******************************************************************************/ -#define CFE_UtAssert_EVENTCOUNT(EXP) \ - CFE_UtAssert_GenericSignedCompare_Impl(UT_GetNumEventsSent(), CFE_UtAssert_Compare_EQ, EXP, __FILE__, __LINE__, \ - "Event Count: ", "Sent", "Expected") +#define CFE_UtAssert_EVENTCOUNT(EXP) \ + UtAssert_GenericUnsignedCompare(UT_GetNumEventsSent(), UtAssert_Compare_EQ, EXP, UtAssert_Radix_DECIMAL, __FILE__, \ + __LINE__, "Event Count: ", "Sent", "Expected") /*****************************************************************************/ /** @@ -810,9 +651,9 @@ bool CFE_UtAssert_GenericSignedCompare_Impl(int32 ActualValue, CFE_UtAssert_Comp ** \sa #CFE_UtAssert_EVENTNOTSENT ** ******************************************************************************/ -#define CFE_UtAssert_EVENTSENT(EVT) \ - CFE_UtAssert_GenericSignedCompare_Impl(UT_EventIsInHistory(EVT), CFE_UtAssert_Compare_GT, 0, __FILE__, __LINE__, \ - "Event Generated: ", #EVT, "") +#define CFE_UtAssert_EVENTSENT(EVT) \ + UtAssert_GenericUnsignedCompare(UT_EventIsInHistory(EVT), UtAssert_Compare_NEQ, 0, UtAssert_Radix_DECIMAL, \ + __FILE__, __LINE__, "Event Generated: ", #EVT, "") /*****************************************************************************/ /** @@ -829,9 +670,9 @@ bool CFE_UtAssert_GenericSignedCompare_Impl(int32 ActualValue, CFE_UtAssert_Comp ** \sa #CFE_UtAssert_EVENTSENT ** ******************************************************************************/ -#define CFE_UtAssert_EVENTNOTSENT(EVT) \ - CFE_UtAssert_GenericSignedCompare_Impl(UT_EventIsInHistory(EVT), CFE_UtAssert_Compare_EQ, 0, __FILE__, __LINE__, \ - "Event Not Generated: ", #EVT, "") +#define CFE_UtAssert_EVENTNOTSENT(EVT) \ + UtAssert_GenericUnsignedCompare(UT_EventIsInHistory(EVT), UtAssert_Compare_EQ, 0, UtAssert_Radix_DECIMAL, \ + __FILE__, __LINE__, "Event Not Generated: ", #EVT, "") /*****************************************************************************/ /** @@ -878,21 +719,6 @@ bool CFE_UtAssert_GenericSignedCompare_Impl(int32 ActualValue, CFE_UtAssert_Comp ******************************************************************************/ #define CFE_UtAssert_TEARDOWN(FN) CFE_UtAssert_SuccessCheck_Impl(FN, UTASSERT_CASETYPE_TTF, __FILE__, __LINE__, #FN) -/*****************************************************************************/ -/** -** \brief Macro for logging calls to a "void" function -** -** \par Description -** A macro that invokes a function with no return value. This should be used when -** no actual condition/result to check for/assert on, but the call should still be -** logged to the output to record the fact that the function was invoked. -** -** \par Assumptions, External Events, and Notes: -** None -** -******************************************************************************/ -#define CFE_UtAssert_VOIDCALL(func) (func, UtAssert(true, #func, __FILE__, __LINE__)) - /*****************************************************************************/ /** ** \brief Macro to check CFE resource ID for equality @@ -905,10 +731,9 @@ bool CFE_UtAssert_GenericSignedCompare_Impl(int32 ActualValue, CFE_UtAssert_Comp ** and integers may not be interchangable with strict type checking. ** ******************************************************************************/ -#define CFE_UtAssert_RESOURCEID_EQ(id1, id2) \ - CFE_UtAssert_GenericUnsignedCompare_Impl(CFE_RESOURCEID_TO_ULONG(id1), CFE_UtAssert_Compare_EQ, \ - CFE_RESOURCEID_TO_ULONG(id2), __FILE__, __LINE__, \ - "Resource ID Check: ", #id1, #id2) +#define CFE_UtAssert_RESOURCEID_EQ(id1, id2) \ + UtAssert_GenericUnsignedCompare(CFE_RESOURCEID_TO_ULONG(id1), UtAssert_Compare_EQ, CFE_RESOURCEID_TO_ULONG(id2), \ + UtAssert_Radix_HEX, __FILE__, __LINE__, "Resource ID Check: ", #id1, #id2) /*****************************************************************************/ /** @@ -921,9 +746,9 @@ bool CFE_UtAssert_GenericSignedCompare_Impl(int32 ActualValue, CFE_UtAssert_Comp ** This is a simple unsigned comparison which logs the values as hexadecimal ** ******************************************************************************/ -#define CFE_UtAssert_MEMOFFSET_EQ(off1, off2) \ - CFE_UtAssert_GenericUnsignedCompare_Impl(off1, CFE_UtAssert_Compare_EQ, off2, __FILE__, __LINE__, \ - "Offset Check: ", #off1, #off2) +#define CFE_UtAssert_MEMOFFSET_EQ(off1, off2) \ + UtAssert_GenericUnsignedCompare(off1, UtAssert_Compare_EQ, off2, UtAssert_Radix_HEX, __FILE__, __LINE__, \ + "Offset Check: ", #off1, #off2) /*****************************************************************************/ /** @@ -937,29 +762,8 @@ bool CFE_UtAssert_GenericSignedCompare_Impl(int32 ActualValue, CFE_UtAssert_Comp ** and integers may not be interchangable with strict type checking. ** ******************************************************************************/ -#define CFE_UtAssert_MSGID_EQ(mid1, mid2) \ - CFE_UtAssert_GenericUnsignedCompare_Impl(CFE_SB_MsgIdToValue(mid1), CFE_UtAssert_Compare_EQ, \ - CFE_SB_MsgIdToValue(mid2), __FILE__, __LINE__, "MsgId Check: ", #mid1, \ - #mid2) - -/*****************************************************************************/ -/** -** \brief Macro to check string buffers for equality -** -** \par Description -** A macro that checks two string buffers for equality. Both buffer maximum sizes are explicitly -** specified, so that strings may reside in a fixed length buffer. The function will never -** check beyond the specified length, regardless of termination. -** -** \par Assumptions, External Events, and Notes: -** The generic #UtAssert_StrCmp macro requires both arguments to be NULL terminated. This also -** includes the actual string in the log, but filters embedded newlines to keep the log clean. -** -** If the string arguments are guaranteed to be NULL terminated and/or the max size is -** not known, then the SIZE_MAX constant may be passed for the respective string. -** -******************************************************************************/ -#define CFE_UtAssert_STRINGBUF_EQ(str1, size1, str2, size2) \ - CFE_UtAssert_StringBufCheck_Impl(str1, size1, str2, size2, __FILE__, __LINE__) +#define CFE_UtAssert_MSGID_EQ(mid1, mid2) \ + UtAssert_GenericUnsignedCompare(CFE_SB_MsgIdToValue(mid1), UtAssert_Compare_EQ, CFE_SB_MsgIdToValue(mid2), \ + UtAssert_Radix_HEX, __FILE__, __LINE__, "MsgId Check: ", #mid1, #mid2) #endif /* UT_SUPPORT_H */ diff --git a/modules/core_private/ut-stubs/src/cfe_es_core_internal_handlers.c b/modules/core_private/ut-stubs/src/cfe_es_core_internal_handlers.c index b4830665e..7905f1f61 100644 --- a/modules/core_private/ut-stubs/src/cfe_es_core_internal_handlers.c +++ b/modules/core_private/ut-stubs/src/cfe_es_core_internal_handlers.c @@ -19,7 +19,7 @@ */ /* -** File: ut_es_stubs.c +** File: cfe_es_core_internal_handlers.c ** ** Purpose: ** Unit test stubs for Executive Service routines diff --git a/modules/core_private/ut-stubs/src/cfe_fs_core_internal_handlers.c b/modules/core_private/ut-stubs/src/cfe_fs_core_internal_handlers.c index c4dd9a96b..8d8dd46ea 100644 --- a/modules/core_private/ut-stubs/src/cfe_fs_core_internal_handlers.c +++ b/modules/core_private/ut-stubs/src/cfe_fs_core_internal_handlers.c @@ -19,7 +19,7 @@ */ /* -** File: ut_es_stubs.c +** File: cfe_fs_core_internal_handlers.c ** ** Purpose: ** Unit test stubs for Executive Service routines diff --git a/modules/core_private/ut-stubs/src/ut_support.c b/modules/core_private/ut-stubs/src/ut_support.c index 030789a7b..5f50655fa 100644 --- a/modules/core_private/ut-stubs/src/ut_support.c +++ b/modules/core_private/ut-stubs/src/ut_support.c @@ -632,93 +632,6 @@ uint32 UT_PrintfIsInHistory(const char *MsgToSearchFor) return UT_GetMessageCount(MsgToSearchFor, &UT_PrintfBuffer, UT_StrCmpFormatStr); } -void UT_AddSubTest(void (*Test)(void), void (*Setup)(void), void (*Teardown)(void), const char *GroupName, - const char *TestName) -{ - char CompleteTestName[128]; - const char *GroupPtr; - const char *TestPtr; - - /* Remove any common prefix between the two names. - * They are often function names that all start with "Test_XXX" - * and this repetitive information just becomes clutter. - */ - GroupPtr = GroupName; - TestPtr = TestName; - while (*GroupPtr != 0 && *GroupPtr == *TestPtr) - { - ++GroupPtr; - ++TestPtr; - } - - /* - * Only break at an underscore(_) to avoid weird effects - */ - while (TestPtr > TestName && *TestPtr != '_') - { - --TestPtr; - } - if (*TestPtr == '_') - { - ++TestPtr; - } - - /* - * Remove a remaining "Test_" prefix on the group name. - * Again just to remove common repetitive content - */ - GroupPtr = GroupName; - if (strncmp(GroupPtr, "Test_", 5) == 0) - { - GroupPtr += 5; - } - - (void)snprintf(CompleteTestName, sizeof(CompleteTestName), "%s.%s", GroupPtr, TestPtr); - - /* - * Note that UtTest_Add() does not copy the string - it retains the passed-in pointer. - * Therefore it must be duplicated. - * - * This isn't an issue on Linux as the memory is freed when the process exits, but - * might be an issue on VxWorks. - */ - - UtTest_Add(Test, Setup, Teardown, strdup(CompleteTestName)); -} - -const char *CFE_UtAssert_GetOpText(CFE_UtAssert_Compare_t CompareType) -{ - const char *OpText; - - switch (CompareType) - { - case CFE_UtAssert_Compare_EQ: /* actual equals reference value */ - case CFE_UtAssert_Compare_BOOL: /* actual and reference are logical boolean values */ - OpText = "=="; - break; - case CFE_UtAssert_Compare_NEQ: /* actual does not non equal reference value */ - OpText = "!="; - break; - case CFE_UtAssert_Compare_LT: /* actual less than reference (exclusive) */ - OpText = "<"; - break; - case CFE_UtAssert_Compare_GT: /* actual greater than reference (exclusive) */ - OpText = ">"; - break; - case CFE_UtAssert_Compare_LTEQ: /* actual less than or equal to reference (inclusive) */ - OpText = "<="; - break; - case CFE_UtAssert_Compare_GTEQ: /* actual greater than reference (inclusive) */ - OpText = ">="; - break; - default: /* should never happen */ - OpText = "??"; - break; - } - - return OpText; -} - bool CFE_UtAssert_SuccessCheck_Impl(CFE_Status_t Status, UtAssert_CaseType_t CaseType, const char *File, uint32 Line, const char *Text) { @@ -732,93 +645,6 @@ bool CFE_UtAssert_SuccessCheck_Impl(CFE_Status_t Status, UtAssert_CaseType_t Cas return Result; } -bool CFE_UtAssert_GenericUnsignedCompare_Impl(uint32 ActualValue, CFE_UtAssert_Compare_t CompareType, - uint32 ReferenceValue, const char *File, uint32 Line, const char *Desc, - const char *ActualText, const char *ReferenceText) -{ - bool Result; - - switch (CompareType) - { - case CFE_UtAssert_Compare_EQ: /* actual equals reference value */ - Result = (ActualValue == ReferenceValue); - break; - case CFE_UtAssert_Compare_NEQ: /* actual does not non equal reference value */ - Result = (ActualValue != ReferenceValue); - break; - case CFE_UtAssert_Compare_LT: /* actual less than reference (exclusive) */ - Result = (ActualValue < ReferenceValue); - break; - case CFE_UtAssert_Compare_GT: /* actual greater than reference (exclusive) */ - Result = (ActualValue > ReferenceValue); - break; - case CFE_UtAssert_Compare_LTEQ: /* actual less than or equal to reference (inclusive) */ - Result = (ActualValue <= ReferenceValue); - break; - case CFE_UtAssert_Compare_GTEQ: /* actual greater than reference (inclusive) */ - Result = (ActualValue >= ReferenceValue); - break; - case CFE_UtAssert_Compare_BOOL: /* actual and reference are logical boolean values */ - Result = ActualValue; - if (!ReferenceValue) - { - /* Invert the result if reference is false */ - Result = !Result; - } - break; - default: /* should never happen */ - Result = false; - break; - } - - return UtAssertEx(Result, UTASSERT_CASETYPE_FAILURE, File, Line, "%s%s (0x%lx) %s %s (0x%lx)", Desc, ActualText, - (unsigned long)ActualValue, CFE_UtAssert_GetOpText(CompareType), ReferenceText, - (unsigned long)ReferenceValue); -} - -bool CFE_UtAssert_GenericSignedCompare_Impl(int32 ActualValue, CFE_UtAssert_Compare_t CompareType, int32 ReferenceValue, - const char *File, uint32 Line, const char *Desc, const char *ActualText, - const char *ReferenceText) -{ - bool Result; - - switch (CompareType) - { - case CFE_UtAssert_Compare_EQ: /* actual equals reference value */ - Result = (ActualValue == ReferenceValue); - break; - case CFE_UtAssert_Compare_NEQ: /* actual does not non equal reference value */ - Result = (ActualValue != ReferenceValue); - break; - case CFE_UtAssert_Compare_LT: /* actual less than reference (exclusive) */ - Result = (ActualValue < ReferenceValue); - break; - case CFE_UtAssert_Compare_GT: /* actual greater than reference (exclusive) */ - Result = (ActualValue > ReferenceValue); - break; - case CFE_UtAssert_Compare_LTEQ: /* actual less than or equal to reference (inclusive) */ - Result = (ActualValue <= ReferenceValue); - break; - case CFE_UtAssert_Compare_GTEQ: /* actual greater than reference (inclusive) */ - Result = (ActualValue >= ReferenceValue); - break; - case CFE_UtAssert_Compare_BOOL: /* actual and reference are logical boolean values */ - Result = ActualValue; - if (!ReferenceValue) - { - /* Invert the result if reference is false */ - Result = !Result; - } - break; - default: /* should never happen */ - Result = false; - break; - } - - return UtAssertEx(Result, UTASSERT_CASETYPE_FAILURE, File, Line, "%s%s (%ld) %s %s (%ld)", Desc, ActualText, - (long)ActualValue, CFE_UtAssert_GetOpText(CompareType), ReferenceText, (long)ReferenceValue); -} - bool CFE_UtAssert_MessageCheck_Impl(bool Status, const char *File, uint32 Line, const char *Desc, const char *FormatString) { @@ -828,7 +654,7 @@ bool CFE_UtAssert_MessageCheck_Impl(bool Status, const char *File, uint32 Line, /* Locate the actual end of the string, but limited to length of local buffer */ /* Reserve two extra chars for quotes */ - EndPtr = memchr(FormatString, 0, sizeof(ScrubbedFormat) - 2); + EndPtr = memchr(FormatString, 0, sizeof(ScrubbedFormat) - 3); if (EndPtr != NULL) { FormatLen = EndPtr - FormatString; @@ -848,102 +674,9 @@ bool CFE_UtAssert_MessageCheck_Impl(bool Status, const char *File, uint32 Line, /* Need to make a copy, as the input string is "const" */ ScrubbedFormat[0] = '\''; memcpy(&ScrubbedFormat[1], FormatString, FormatLen); - ScrubbedFormat[FormatLen] = '\''; - ScrubbedFormat[FormatLen + 1] = 0; - - return CFE_UtAssert_GenericSignedCompare_Impl(Status, CFE_UtAssert_Compare_GT, 0, File, Line, Desc, ScrubbedFormat, - ""); -} - -bool CFE_UtAssert_StringBufCheck_Impl(const char *String1, size_t String1Max, const char *String2, size_t String2Max, - const char *File, uint32 Line) -{ - char ScrubbedString1[256]; - char ScrubbedString2[256]; - const char *EndPtr1; - const char *EndPtr2; - size_t FormatLen1; - size_t FormatLen2; - bool Result; - - /* Locate the actual end of both strings */ - if (String1 == NULL) - { - EndPtr1 = NULL; - } - else - { - EndPtr1 = memchr(String1, 0, String1Max); - } - - if (EndPtr1 != NULL) - { - FormatLen1 = EndPtr1 - String1; - } - else - { - FormatLen1 = String1Max; - } - - if (String2 == NULL) - { - EndPtr2 = NULL; - } - else - { - EndPtr2 = memchr(String2, 0, String2Max); - } - - if (EndPtr2 != NULL) - { - FormatLen2 = EndPtr2 - String2; - } - else - { - FormatLen2 = String2Max; - } - - if (FormatLen1 != FormatLen2) - { - /* This means the strings have different termination/length, and therefore must not be equal (content doesn't - * matter) */ - Result = false; - } - else if (FormatLen1 == 0) - { - /* Two empty strings are considered equal */ - Result = true; - } - else - { - /* If the effective lengths are the same, use memcmp to check content */ - Result = (memcmp(String1, String2, FormatLen1) == 0); - } - - /* Now make "safe" copies of the strings */ - /* Check for a newline within the string, and if present, end the string there instead */ - if (FormatLen1 > 0) - { - EndPtr1 = memchr(String1, '\n', FormatLen1); - if (EndPtr1 != NULL) - { - FormatLen1 = EndPtr1 - String1; - } - memcpy(ScrubbedString1, String1, FormatLen1); - } - ScrubbedString1[FormatLen1] = 0; - - if (FormatLen2 > 0) - { - EndPtr2 = memchr(String2, '\n', FormatLen2); - if (EndPtr2 != NULL) - { - FormatLen2 = EndPtr2 - String2; - } - memcpy(ScrubbedString2, String2, FormatLen2); - } - ScrubbedString2[FormatLen2] = 0; + ScrubbedFormat[FormatLen + 1] = '\''; + ScrubbedFormat[FormatLen + 2] = 0; - return UtAssertEx(Result, UTASSERT_CASETYPE_FAILURE, File, Line, "String: \'%s\' == \'%s\'", ScrubbedString1, - ScrubbedString2); + return UtAssert_GenericSignedCompare(Status, UtAssert_Compare_GT, 0, UtAssert_Radix_DECIMAL, File, Line, Desc, + ScrubbedFormat, ""); } diff --git a/modules/es/ut-coverage/es_UT.c b/modules/es/ut-coverage/es_UT.c index ca7156b5c..34a0cebfe 100644 --- a/modules/es/ut-coverage/es_UT.c +++ b/modules/es/ut-coverage/es_UT.c @@ -1143,8 +1143,8 @@ void TestApps(void) /* Check operation of the CFE_ES_CheckAppIdSlotUsed() helper function */ CFE_ES_Global.AppTable[1].AppId = CFE_ES_APPID_C(ES_UT_MakeAppIdForIndex(1)); CFE_ES_Global.AppTable[2].AppId = CFE_ES_APPID_UNDEFINED; - CFE_UtAssert_TRUE(CFE_ES_CheckAppIdSlotUsed(ES_UT_MakeAppIdForIndex(1))); - CFE_UtAssert_FALSE(CFE_ES_CheckAppIdSlotUsed(ES_UT_MakeAppIdForIndex(2))); + UtAssert_BOOL_TRUE(CFE_ES_CheckAppIdSlotUsed(ES_UT_MakeAppIdForIndex(1))); + UtAssert_BOOL_FALSE(CFE_ES_CheckAppIdSlotUsed(ES_UT_MakeAppIdForIndex(2))); /* Test application loading and creation where the entry point symbol * cannot be found @@ -1237,7 +1237,7 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppControlRequest = 0x12345; AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); CFE_UtAssert_EVENTSENT(CFE_ES_PCR_ERR2_EID); /* Test a successful control action request to exit an application */ @@ -1246,7 +1246,7 @@ void TestApps(void) ES_UT_SetupAppStartParams(&UtAppRecPtr->StartParams, "/ram/Filename", "NotNULL", 8192, 255, 0); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_EXIT; AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); CFE_UtAssert_EVENTSENT(CFE_ES_EXIT_APP_INF_EID); /* Test a control action request to exit an application where the @@ -1257,7 +1257,7 @@ void TestApps(void) UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_EXIT; UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); CFE_UtAssert_EVENTSENT(CFE_ES_EXIT_APP_ERR_EID); /* Test a control action request to stop an application where the @@ -1268,7 +1268,7 @@ void TestApps(void) UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_DELETE; UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); CFE_UtAssert_EVENTSENT(CFE_ES_STOP_ERR3_EID); /* Test a control action request to restart an application where the @@ -1279,7 +1279,7 @@ void TestApps(void) UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RESTART; UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); CFE_UtAssert_EVENTSENT(CFE_ES_RESTART_APP_ERR4_EID); /* Test a control action request to restart an application where the @@ -1291,7 +1291,7 @@ void TestApps(void) OS_ModuleLoad(&UtAppRecPtr->LoadStatus.ModuleId, NULL, NULL, 0); UT_SetDefaultReturnValue(UT_KEY(OS_TaskCreate), OS_ERROR); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); CFE_UtAssert_EVENTSENT(CFE_ES_RESTART_APP_ERR3_EID); /* Test a control action request to reload an application where the @@ -1302,7 +1302,7 @@ void TestApps(void) UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RELOAD; UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); CFE_UtAssert_EVENTSENT(CFE_ES_RELOAD_APP_ERR4_EID); /* Test a control action request to reload an application where the @@ -1314,7 +1314,7 @@ void TestApps(void) OS_ModuleLoad(&UtAppRecPtr->LoadStatus.ModuleId, NULL, NULL, 0); UT_SetDefaultReturnValue(UT_KEY(OS_TaskCreate), OS_ERROR); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); CFE_UtAssert_EVENTSENT(CFE_ES_RELOAD_APP_ERR3_EID); /* Test a successful control action request to exit an application that @@ -1326,7 +1326,7 @@ void TestApps(void) UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_ERROR; AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); CFE_UtAssert_EVENTSENT(CFE_ES_ERREXIT_APP_INF_EID); /* Test a control action request to exit an application that @@ -1337,7 +1337,7 @@ void TestApps(void) UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_ERROR; AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); CFE_UtAssert_EVENTSENT(CFE_ES_ERREXIT_APP_ERR_EID); /* Test a successful control action request to stop an application */ @@ -1346,7 +1346,7 @@ void TestApps(void) ES_UT_SetupAppStartParams(&UtAppRecPtr->StartParams, "/ram/FileName", "NULL", 8192, 255, 0); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_DELETE; AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); CFE_UtAssert_EVENTSENT(CFE_ES_STOP_INF_EID); /* Test a successful control action request to restart an application */ @@ -1355,7 +1355,7 @@ void TestApps(void) ES_UT_SetupAppStartParams(&UtAppRecPtr->StartParams, "/ram/FileName", "NULL", 8192, 255, 0); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RESTART; AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); CFE_UtAssert_EVENTSENT(CFE_ES_RESTART_APP_INF_EID); /* Test a successful control action request to reload an application */ @@ -1364,7 +1364,7 @@ void TestApps(void) ES_UT_SetupAppStartParams(&UtAppRecPtr->StartParams, "/ram/FileName", "NULL", 8192, 255, 0); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RELOAD; AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); CFE_UtAssert_EVENTSENT(CFE_ES_RELOAD_APP_INF_EID); /* Test a control action request for an application that has an invalid @@ -1375,7 +1375,7 @@ void TestApps(void) ES_UT_SetupAppStartParams(&UtAppRecPtr->StartParams, "/ram/FileName", "NULL", 8192, 255, 0); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_EXCEPTION; AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); CFE_UtAssert_EVENTSENT(CFE_ES_PCR_ERR1_EID); /* Test populating the application information structure with data */ @@ -1609,8 +1609,8 @@ void TestApps(void) ES_UT_SetupChildTaskId(UtAppRecPtr, NULL, NULL); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_UtAssert_SUCCESS(CFE_ES_CleanUpApp(AppId)); - CFE_UtAssert_TRUE(CFE_ES_TaskRecordIsUsed(UtTaskRecPtr)); - CFE_UtAssert_FALSE(CFE_ES_MemPoolRecordIsUsed(UtPoolRecPtr)); + UtAssert_BOOL_TRUE(CFE_ES_TaskRecordIsUsed(UtTaskRecPtr)); + UtAssert_BOOL_FALSE(CFE_ES_MemPoolRecordIsUsed(UtPoolRecPtr)); /* Test deleting an application and cleaning up its resources where the * main task and child task need to be swapped @@ -1636,7 +1636,7 @@ void TestApps(void) UtPoolRecPtr->PoolID = CFE_ES_MEMHANDLE_C(CFE_ResourceId_FromInteger(99999)); /* Mismatch */ AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); UtAssert_INT32_EQ(CFE_ES_CleanUpApp(AppId), CFE_ES_APP_CLEANUP_ERR); - CFE_UtAssert_TRUE(CFE_ES_MemPoolRecordIsUsed(UtPoolRecPtr)); + UtAssert_BOOL_TRUE(CFE_ES_MemPoolRecordIsUsed(UtPoolRecPtr)); /* Test deleting an application and cleaning up its resources where the * application ID doesn't match the main task ID @@ -1656,7 +1656,7 @@ void TestApps(void) UT_SetDefaultReturnValue(UT_KEY(OS_TaskDelete), OS_ERROR); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); UtAssert_INT32_EQ(CFE_ES_CleanUpApp(AppId), CFE_ES_APP_CLEANUP_ERR); - CFE_UtAssert_TRUE(CFE_ES_TaskRecordIsUsed(UtTaskRecPtr)); + UtAssert_BOOL_TRUE(CFE_ES_TaskRecordIsUsed(UtTaskRecPtr)); /* Test deleting an application and cleaning up its resources where the * application ID doesn't match and the application is a core application @@ -1675,7 +1675,7 @@ void TestApps(void) CFE_UtAssert_SUCCESS(CFE_ES_CleanUpApp(AppId)); - CFE_UtAssert_TRUE(CFE_ES_TaskRecordIsUsed(UtTaskRecPtr)); + UtAssert_BOOL_TRUE(CFE_ES_TaskRecordIsUsed(UtTaskRecPtr)); UtAssert_UINT32_EQ(CFE_ES_Global.RegisteredExternalApps, 1); /* Test successfully deleting an application and cleaning up its resources @@ -1687,7 +1687,7 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, &UtTaskRecPtr); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_UtAssert_SUCCESS(CFE_ES_CleanUpApp(AppId)); - CFE_UtAssert_FALSE(CFE_ES_TaskRecordIsUsed(UtTaskRecPtr)); + UtAssert_BOOL_FALSE(CFE_ES_TaskRecordIsUsed(UtTaskRecPtr)); UtAssert_UINT32_EQ(CFE_ES_Global.RegisteredExternalApps, 0); /* Test cleaning up the OS resources for a task with failure to @@ -1767,7 +1767,7 @@ void TestLibs(void) UtLibRecPtr = CFE_ES_LocateLibRecordByID(Id); UtAssert_NOT_NULL(UtLibRecPtr); - CFE_UtAssert_TRUE(CFE_ES_LibRecordIsUsed(UtLibRecPtr)); + UtAssert_BOOL_TRUE(CFE_ES_LibRecordIsUsed(UtLibRecPtr)); /* Try loading same library again, should return the DUPLICATE code */ UtAssert_INT32_EQ(CFE_ES_LoadLibrary(&Id, "TST_LIB", &LoadParams), CFE_ES_ERR_DUPLICATE_NAME); @@ -1827,8 +1827,8 @@ void TestLibs(void) /* check operation of the CFE_ES_CheckLibIdSlotUsed() function */ CFE_ES_Global.LibTable[1].LibId = CFE_ES_LIBID_C(ES_UT_MakeLibIdForIndex(1)); CFE_ES_Global.LibTable[2].LibId = CFE_ES_LIBID_UNDEFINED; - CFE_UtAssert_TRUE(CFE_ES_CheckLibIdSlotUsed(ES_UT_MakeLibIdForIndex(1))); - CFE_UtAssert_FALSE(CFE_ES_CheckLibIdSlotUsed(ES_UT_MakeLibIdForIndex(2))); + UtAssert_BOOL_TRUE(CFE_ES_CheckLibIdSlotUsed(ES_UT_MakeLibIdForIndex(1))); + UtAssert_BOOL_FALSE(CFE_ES_CheckLibIdSlotUsed(ES_UT_MakeLibIdForIndex(2))); /* * Test public Name+ID query/lookup API */ @@ -1861,9 +1861,9 @@ void TestERLog(void) CFE_ES_Global.ResetDataPtr->ERLogIndex = CFE_PLATFORM_ES_ER_LOG_ENTRIES + 1; CFE_UtAssert_SUCCESS(CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, 1, NULL)); UtAssert_UINT32_EQ(CFE_ES_Global.ResetDataPtr->ERLogIndex, 1); - CFE_UtAssert_STRINGBUF_EQ(CFE_ES_Global.ResetDataPtr->ERLog[0].BaseInfo.Description, - sizeof(CFE_ES_Global.ResetDataPtr->ERLog[0].BaseInfo.Description), - "No Description String Given.", SIZE_MAX); + UtAssert_STRINGBUF_EQ(CFE_ES_Global.ResetDataPtr->ERLog[0].BaseInfo.Description, + sizeof(CFE_ES_Global.ResetDataPtr->ERLog[0].BaseInfo.Description), + "No Description String Given.", SIZE_MAX); /* Test non-rolling over log entry, * null description, @@ -1880,18 +1880,18 @@ void TestERLog(void) LocalBufSize = 0; UT_SetDeferredRetcode(UT_KEY(CFE_PSP_Exception_CopyContext), 1, 128); - CFE_UtAssert_FALSE(CFE_ES_BackgroundERLogFileDataGetter(&State, 0, &LocalBuffer, &LocalBufSize)); + UtAssert_BOOL_FALSE(CFE_ES_BackgroundERLogFileDataGetter(&State, 0, &LocalBuffer, &LocalBufSize)); CFE_UtAssert_MEMOFFSET_EQ(State.EntryBuffer.ContextSize, 128); UtAssert_NOT_NULL(LocalBuffer); UtAssert_NONZERO(LocalBufSize); memset(&State.EntryBuffer, 0xEE, sizeof(State.EntryBuffer)); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_Exception_CopyContext), 1, -1); - CFE_UtAssert_TRUE( + UtAssert_BOOL_TRUE( CFE_ES_BackgroundERLogFileDataGetter(&State, CFE_PLATFORM_ES_ER_LOG_ENTRIES - 1, &LocalBuffer, &LocalBufSize)); UtAssert_ZERO(State.EntryBuffer.ContextSize); - CFE_UtAssert_TRUE( + UtAssert_BOOL_TRUE( CFE_ES_BackgroundERLogFileDataGetter(&State, CFE_PLATFORM_ES_ER_LOG_ENTRIES, &LocalBuffer, &LocalBufSize)); UtAssert_NULL(LocalBuffer); UtAssert_ZERO(LocalBufSize); @@ -1962,19 +1962,19 @@ void TestGenericPool(void) /* Allocate buffers until no space left */ CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool1, &Offset1, 44)); UtAssert_NONZERO(Offset1); - CFE_UtAssert_ATMOST(Offset1, OffsetEnd - 44); + UtAssert_UINT32_LTEQ(Offset1, OffsetEnd - 44); UtAssert_True((Offset1 & 0x1F) == 0, "Offset1(%lu) 32 byte alignment", (unsigned long)Offset1); CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool1, &Offset2, 72)); - CFE_UtAssert_ATLEAST(Offset2, Offset1 + 44); - CFE_UtAssert_ATMOST(Offset2, OffsetEnd - 72); + UtAssert_UINT32_GTEQ(Offset2, Offset1 + 44); + UtAssert_UINT32_LTEQ(Offset2, OffsetEnd - 72); UtAssert_True((Offset2 & 0x1F) == 0, "Offset2(%lu) 32 byte alignment", (unsigned long)Offset2); UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool1, &Offset3, 72), CFE_ES_ERR_MEM_BLOCK_SIZE); CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool1, &Offset3, 6)); - CFE_UtAssert_ATLEAST(Offset3, Offset2 + 72); - CFE_UtAssert_ATMOST(Offset3, OffsetEnd - 6); + UtAssert_UINT32_GTEQ(Offset3, Offset2 + 72); + UtAssert_UINT32_LTEQ(Offset3, OffsetEnd - 6); UtAssert_True((Offset3 & 0x1F) == 0, "Offset3(%lu) 32 byte alignment", (unsigned long)Offset3); /* Free a buffer and attempt to reallocate */ @@ -2118,10 +2118,10 @@ void TestGenericPool(void) * Check other validation */ UtAssert_INT32_EQ(CFE_ES_GenPoolPutBlock(&Pool1, &BlockSize, 0), CFE_ES_BUFFER_NOT_IN_POOL); - CFE_UtAssert_TRUE(CFE_ES_GenPoolValidateState(&Pool1)); + UtAssert_BOOL_TRUE(CFE_ES_GenPoolValidateState(&Pool1)); Pool1.TailPosition = 0xFFFFFF; - CFE_UtAssert_FALSE(CFE_ES_GenPoolValidateState(&Pool1)); + UtAssert_BOOL_FALSE(CFE_ES_GenPoolValidateState(&Pool1)); } void TestTask(void) @@ -2174,13 +2174,13 @@ void TestTask(void) /* Set up buffer for first cycle, pipe failure is on 2nd */ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - CFE_UtAssert_VOIDCALL(CFE_ES_TaskMain()); + UtAssert_VOIDCALL(CFE_ES_TaskMain()); CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_COMMAND_PIPE]); /* Test task main process with a CFE_ES_TaskInit() error */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_EVS_Register), 1, -1); - CFE_UtAssert_VOIDCALL(CFE_ES_TaskMain()); + UtAssert_VOIDCALL(CFE_ES_TaskMain()); CFE_UtAssert_PRINTF("Application Init Failed"); /* Test task main process loop with bad checksum information */ @@ -3093,7 +3093,7 @@ void TestTask(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, NULL, NULL, NULL); CFE_ES_Global.ResetDataPtr->ResetVars.ResetType = 1; UT_SetDeferredRetcode(UT_KEY(CFE_EVS_SendEvent), 3, CFE_EVS_INVALID_PARAMETER); - CFE_UtAssert_VOIDCALL(CFE_ES_TaskInit()); + UtAssert_VOIDCALL(CFE_ES_TaskInit()); CFE_UtAssert_PRINTF("Error sending mission version event"); } /* end TestTask */ @@ -3599,21 +3599,21 @@ void TestAPI(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); RunStatus = CFE_ES_RunStatus_APP_RUN; UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; - CFE_UtAssert_TRUE(CFE_ES_RunLoop(&RunStatus)); + UtAssert_BOOL_TRUE(CFE_ES_RunLoop(&RunStatus)); /* Test successful run loop app stop request */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); RunStatus = CFE_ES_RunStatus_APP_RUN; UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_EXIT; - CFE_UtAssert_FALSE(CFE_ES_RunLoop(&RunStatus)); + UtAssert_BOOL_FALSE(CFE_ES_RunLoop(&RunStatus)); /* Test successful run loop app exit request */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); RunStatus = CFE_ES_RunStatus_APP_EXIT; UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_EXIT; - CFE_UtAssert_FALSE(CFE_ES_RunLoop(&RunStatus)); + UtAssert_BOOL_FALSE(CFE_ES_RunLoop(&RunStatus)); /* Test run loop with bad app ID */ ES_ResetUnitTest(); @@ -3621,27 +3621,27 @@ void TestAPI(void) RunStatus = CFE_ES_RunStatus_APP_RUN; UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; CFE_ES_TaskRecordSetFree(UtTaskRecPtr); /* make it so task ID is bad */ - CFE_UtAssert_FALSE(CFE_ES_RunLoop(&RunStatus)); + UtAssert_BOOL_FALSE(CFE_ES_RunLoop(&RunStatus)); /* Test run loop with an invalid run status */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); RunStatus = 1000; UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_EXIT; - CFE_UtAssert_FALSE(CFE_ES_RunLoop(&RunStatus)); + UtAssert_BOOL_FALSE(CFE_ES_RunLoop(&RunStatus)); /* Test run loop with a NULL run status */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; - CFE_UtAssert_TRUE(CFE_ES_RunLoop(NULL)); + UtAssert_BOOL_TRUE(CFE_ES_RunLoop(NULL)); /* Test run loop with startup sync code */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_LATE_INIT, NULL, &UtAppRecPtr, NULL); RunStatus = CFE_ES_RunStatus_APP_RUN; UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; - CFE_UtAssert_TRUE(CFE_ES_RunLoop(&RunStatus)); + UtAssert_BOOL_TRUE(CFE_ES_RunLoop(&RunStatus)); UtAssert_UINT32_EQ(UtAppRecPtr->AppState, CFE_ES_AppState_RUNNING); /* Test getting the cFE application and task ID by context */ @@ -3921,7 +3921,7 @@ void TestAPI(void) /* Note - CFE_ES_WaitForStartupSync() returns void, nothing to check for * here. This is for code coverage */ - CFE_UtAssert_VOIDCALL(CFE_ES_WaitForStartupSync(99)); + UtAssert_VOIDCALL(CFE_ES_WaitForStartupSync(99)); /* Test waiting for apps to initialize as an external app */ @@ -3932,7 +3932,7 @@ void TestAPI(void) /* Note - CFE_ES_WaitForStartupSync() returns void, nothing to check for * here. This is for code coverage */ - CFE_UtAssert_VOIDCALL(CFE_ES_WaitForStartupSync(99)); + UtAssert_VOIDCALL(CFE_ES_WaitForStartupSync(99)); /* Test adding a time-stamped message to the system log using an invalid * log mode @@ -3958,14 +3958,14 @@ void TestAPI(void) CFE_ES_Global.ResetDataPtr->SystemLogEndIdx = CFE_ES_Global.ResetDataPtr->SystemLogWriteIdx; CFE_ES_Global.ResetDataPtr->SystemLogMode = CFE_ES_LogMode_OVERWRITE; CFE_UtAssert_SUCCESS(CFE_ES_WriteToSysLog("SysLogText")); - CFE_UtAssert_ATMOST(CFE_ES_Global.ResetDataPtr->SystemLogWriteIdx, CFE_PLATFORM_ES_SYSTEM_LOG_SIZE - 1); + UtAssert_UINT32_LTEQ(CFE_ES_Global.ResetDataPtr->SystemLogWriteIdx, CFE_PLATFORM_ES_SYSTEM_LOG_SIZE - 1); /* Test run loop with an application error status */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "UT", &UtAppRecPtr, NULL); RunStatus = CFE_ES_RunStatus_APP_ERROR; UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_ERROR; - CFE_UtAssert_FALSE(CFE_ES_RunLoop(&RunStatus)); + UtAssert_BOOL_FALSE(CFE_ES_RunLoop(&RunStatus)); /* * Test public Name+ID query/lookup API for tasks @@ -4023,8 +4023,8 @@ void TestGenericCounterAPI(void) /* Check operation of the CFE_ES_CheckCounterIdSlotUsed() helper function */ CFE_ES_Global.CounterTable[1].CounterId = CFE_ES_COUNTERID_C(ES_UT_MakeCounterIdForIndex(1)); CFE_ES_Global.CounterTable[2].CounterId = CFE_ES_COUNTERID_UNDEFINED; - CFE_UtAssert_TRUE(CFE_ES_CheckCounterIdSlotUsed(ES_UT_MakeCounterIdForIndex(1))); - CFE_UtAssert_FALSE(CFE_ES_CheckCounterIdSlotUsed(ES_UT_MakeCounterIdForIndex(2))); + UtAssert_BOOL_TRUE(CFE_ES_CheckCounterIdSlotUsed(ES_UT_MakeCounterIdForIndex(1))); + UtAssert_BOOL_FALSE(CFE_ES_CheckCounterIdSlotUsed(ES_UT_MakeCounterIdForIndex(2))); /* Test getting a registered generic counter that doesn't exist */ UtAssert_INT32_EQ(CFE_ES_GetGenCounterIDByName(&CounterId, "Counter999"), CFE_ES_ERR_NAME_NOT_FOUND); @@ -4206,8 +4206,8 @@ void TestCDS() /* Check operation of the CFE_ES_CheckCDSHandleSlotUsed() helper function */ CFE_ES_Global.CDSVars.Registry[1].BlockID = CFE_ES_CDSHANDLE_C(ES_UT_MakeCDSIdForIndex(1)); CFE_ES_Global.CDSVars.Registry[2].BlockID = CFE_ES_CDS_BAD_HANDLE; - CFE_UtAssert_TRUE(CFE_ES_CheckCDSHandleSlotUsed(ES_UT_MakeCDSIdForIndex(1))); - CFE_UtAssert_FALSE(CFE_ES_CheckCDSHandleSlotUsed(ES_UT_MakeCDSIdForIndex(2))); + UtAssert_BOOL_TRUE(CFE_ES_CheckCDSHandleSlotUsed(ES_UT_MakeCDSIdForIndex(1))); + UtAssert_BOOL_FALSE(CFE_ES_CheckCDSHandleSlotUsed(ES_UT_MakeCDSIdForIndex(2))); /* Test CDS registering using a bad app ID */ ES_ResetUnitTest(); @@ -4593,7 +4593,7 @@ void TestESMempool(void) /* Test handle validation using a handle with an invalid memory address */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_MemValidateRange), 1, -1); - CFE_UtAssert_FALSE(CFE_ES_ValidateHandle(PoolID2)); + UtAssert_BOOL_FALSE(CFE_ES_ValidateHandle(PoolID2)); /* Test handle validation using a handle where the first pool structure * field is not the pool start address @@ -4607,7 +4607,7 @@ void TestESMempool(void) */ *((uint32 *)&PoolPtr->PoolID) ^= 10; /* cause it to fail validation */ - CFE_UtAssert_FALSE(CFE_ES_ValidateHandle(PoolID2)); + UtAssert_BOOL_FALSE(CFE_ES_ValidateHandle(PoolID2)); /* Test allocating a pool buffer where the memory handle is not the pool * start address @@ -4678,8 +4678,8 @@ void TestESMempool(void) /* Check operation of the CFE_ES_CheckCounterIdSlotUsed() helper function */ CFE_ES_Global.MemPoolTable[1].PoolID = CFE_ES_MEMHANDLE_C(ES_UT_MakePoolIdForIndex(1)); CFE_ES_Global.MemPoolTable[2].PoolID = CFE_ES_MEMHANDLE_UNDEFINED; - CFE_UtAssert_TRUE(CFE_ES_CheckMemPoolSlotUsed(ES_UT_MakePoolIdForIndex(1))); - CFE_UtAssert_FALSE(CFE_ES_CheckMemPoolSlotUsed(ES_UT_MakePoolIdForIndex(2))); + UtAssert_BOOL_TRUE(CFE_ES_CheckMemPoolSlotUsed(ES_UT_MakePoolIdForIndex(1))); + UtAssert_BOOL_FALSE(CFE_ES_CheckMemPoolSlotUsed(ES_UT_MakePoolIdForIndex(2))); /* * Test creating a memory pool with a semaphore error @@ -4820,7 +4820,7 @@ void TestESMempool(void) UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp2, PoolID1, 99000), CFE_ES_ERR_MEM_BLOCK_SIZE); /* Test handle validation using a null handle */ - CFE_UtAssert_FALSE(CFE_ES_ValidateHandle(CFE_ES_MEMHANDLE_UNDEFINED)); + UtAssert_BOOL_FALSE(CFE_ES_ValidateHandle(CFE_ES_MEMHANDLE_UNDEFINED)); /* Test returning a pool buffer using a null handle */ UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(CFE_ES_MEMHANDLE_UNDEFINED, addressp2), CFE_ES_ERR_RESOURCEID_NOT_VALID); @@ -4865,7 +4865,7 @@ void TestESMempool(void) } UtAssert_NONZERO(i); - CFE_UtAssert_ATMOST(i, 20); + UtAssert_UINT32_LTEQ(i, 20); /* Test getting the size of a pool buffer that is not in the pool */ UtAssert_INT32_EQ(CFE_ES_GetPoolBufInfo(PoolID1, CFE_ES_MEMPOOLBUF_C((cpuaddr)addressp1 + 400)), @@ -4946,7 +4946,7 @@ void TestSysLog(void) CFE_ES_Global.ResetDataPtr->SystemLogWriteIdx = 0; CFE_ES_Global.ResetDataPtr->SystemLogEndIdx = sizeof(CFE_ES_Global.ResetDataPtr->SystemLog) - 1; - CFE_UtAssert_VOIDCALL(CFE_ES_SysLogDump("fakefilename")); + UtAssert_VOIDCALL(CFE_ES_SysLogDump("fakefilename")); /* Test "message got truncated" */ ES_ResetUnitTest(); diff --git a/modules/evs/ut-coverage/evs_UT.c b/modules/evs/ut-coverage/evs_UT.c index 9bedb5003..ea5720268 100644 --- a/modules/evs/ut-coverage/evs_UT.c +++ b/modules/evs/ut-coverage/evs_UT.c @@ -663,8 +663,8 @@ void Test_Format(void) /* Note implementation initializes both short and long message */ UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(CFE_MSG_Init)), 2); UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(CFE_SB_TransmitMsg)), 1); - CFE_UtAssert_TRUE(CFE_SB_MsgId_Equal(MsgData.MsgId, ShortFmtSnapshotData.MsgId)); - CFE_UtAssert_FALSE(CFE_SB_MsgId_Equal(MsgData.MsgId, LongFmtSnapshotData.MsgId)); + UtAssert_BOOL_TRUE(CFE_SB_MsgId_Equal(MsgData.MsgId, ShortFmtSnapshotData.MsgId)); + UtAssert_BOOL_FALSE(CFE_SB_MsgId_Equal(MsgData.MsgId, LongFmtSnapshotData.MsgId)); /* Confirm the right message was sent */ UtAssert_ADDRESS_EQ(MsgSend, MsgData.MsgPtr); @@ -868,7 +868,7 @@ void Test_Logging(void) } CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "Log overfill event discard"); - CFE_UtAssert_TRUE(CFE_EVS_Global.EVS_LogPtr->LogFullFlag); + UtAssert_BOOL_TRUE(CFE_EVS_Global.EVS_LogPtr->LogFullFlag); UtAssert_UINT32_EQ(CFE_EVS_Global.EVS_LogPtr->LogMode, CFE_EVS_LogMode_DISCARD); /* Test setting the logging mode to overwrite */ @@ -877,7 +877,7 @@ void Test_Logging(void) UT_EVS_DoDispatchCheckEvents(&CmdBuf.modecmd, sizeof(CmdBuf.modecmd), UT_TPID_CFE_EVS_CMD_SET_LOG_MODE_CC, &UT_EVS_EventBuf); CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "Log overfill event overwrite"); - CFE_UtAssert_TRUE(CFE_EVS_Global.EVS_LogPtr->LogFullFlag); + UtAssert_BOOL_TRUE(CFE_EVS_Global.EVS_LogPtr->LogFullFlag); UtAssert_UINT32_EQ(CFE_EVS_Global.EVS_LogPtr->LogMode, CFE_EVS_LogMode_OVERWRITE); /* Test sending a no op command */ @@ -890,7 +890,7 @@ void Test_Logging(void) UT_InitData(); CFE_EVS_Global.EVS_TlmPkt.Payload.LogEnabled = true; UT_EVS_DoDispatchCheckEvents(&CmdBuf.cmd, sizeof(CmdBuf.cmd), UT_TPID_CFE_EVS_CMD_CLEAR_LOG_CC, &UT_EVS_EventBuf); - CFE_UtAssert_FALSE(CFE_EVS_Global.EVS_LogPtr->LogFullFlag); + UtAssert_BOOL_FALSE(CFE_EVS_Global.EVS_LogPtr->LogFullFlag); /* Test setting the logging mode to overwrite */ UT_InitData(); diff --git a/modules/fs/ut-coverage/fs_UT.c b/modules/fs/ut-coverage/fs_UT.c index 79affdcf3..5fd87b2e5 100644 --- a/modules/fs/ut-coverage/fs_UT.c +++ b/modules/fs/ut-coverage/fs_UT.c @@ -266,8 +266,7 @@ void Test_CFE_FS_ParseInputFileNameEx(void) CFE_UtAssert_SUCCESS(CFE_FS_ParseInputFileNameEx(OutBuffer, TEST_XTRA_SEPARATOR_EXT, sizeof(OutBuffer), sizeof(TEST_XTRA_SEPARATOR_EXT) - 5, TEST_DEFAULT_INPUT, TEST_DEFAULT_PATH, TEST_DEFAULT_EXTENSION)); - CFE_UtAssert_STRINGBUF_EQ(OutBuffer, sizeof(OutBuffer), TEST_XTRA_SEPARATOR_EXT, - sizeof(TEST_XTRA_SEPARATOR_EXT) - 5); + UtAssert_STRINGBUF_EQ(OutBuffer, sizeof(OutBuffer), TEST_XTRA_SEPARATOR_EXT, sizeof(TEST_XTRA_SEPARATOR_EXT) - 5); /* Same but as a default input, rather than in the buffer */ /* tests 3 variations of "no input" - null ptr, zero size, empty string */ @@ -530,11 +529,11 @@ void Test_CFE_FS_BackgroundFileDump(void) memset(&CFE_FS_Global.FileDump, 0, sizeof(CFE_FS_Global.FileDump)); /* Nominal with nothing pending - should accumulate credit */ - CFE_UtAssert_FALSE(CFE_FS_RunBackgroundFileDump(1, NULL)); - CFE_UtAssert_ATLEAST(CFE_FS_Global.FileDump.Current.Credit, 1); - CFE_UtAssert_ATMOST(CFE_FS_Global.FileDump.Current.Credit, CFE_FS_BACKGROUND_MAX_CREDIT); + UtAssert_BOOL_FALSE(CFE_FS_RunBackgroundFileDump(1, NULL)); + UtAssert_INT32_GTEQ(CFE_FS_Global.FileDump.Current.Credit, 1); + UtAssert_INT32_LTEQ(CFE_FS_Global.FileDump.Current.Credit, CFE_FS_BACKGROUND_MAX_CREDIT); - CFE_UtAssert_FALSE(CFE_FS_RunBackgroundFileDump(100000, NULL)); + UtAssert_BOOL_FALSE(CFE_FS_RunBackgroundFileDump(100000, NULL)); UtAssert_INT32_EQ(CFE_FS_Global.FileDump.Current.Credit, CFE_FS_BACKGROUND_MAX_CREDIT); UtAssert_INT32_EQ(CFE_FS_BackgroundFileDumpRequest(NULL), CFE_FS_BAD_ARGUMENT); @@ -548,7 +547,7 @@ void Test_CFE_FS_BackgroundFileDump(void) State.OnEvent = UT_FS_OnEvent; UtAssert_INT32_EQ(CFE_FS_BackgroundFileDumpRequest(&State), CFE_FS_BAD_ARGUMENT); - CFE_UtAssert_FALSE(CFE_FS_BackgroundFileDumpIsPending(&State)); + UtAssert_BOOL_FALSE(CFE_FS_BackgroundFileDumpIsPending(&State)); UtAssert_STUB_COUNT(CFE_ES_BackgroundWakeup, 0); /* confirm CFE_ES_BackgroundWakeup() was not invoked */ /* Set the data except file name and description */ @@ -556,7 +555,7 @@ void Test_CFE_FS_BackgroundFileDump(void) State.GetData = UT_FS_DataGetter; State.OnEvent = UT_FS_OnEvent; UtAssert_INT32_EQ(CFE_FS_BackgroundFileDumpRequest(&State), CFE_FS_INVALID_PATH); - CFE_UtAssert_FALSE(CFE_FS_BackgroundFileDumpIsPending(&State)); + UtAssert_BOOL_FALSE(CFE_FS_BackgroundFileDumpIsPending(&State)); UtAssert_STUB_COUNT(CFE_ES_BackgroundWakeup, 0); /* confirm CFE_ES_BackgroundWakeup() was not invoked */ /* Set up remainder of fields, so entry is valid */ @@ -564,7 +563,7 @@ void Test_CFE_FS_BackgroundFileDump(void) strncpy(State.Description, "UT", sizeof(State.Description)); CFE_UtAssert_SUCCESS(CFE_FS_BackgroundFileDumpRequest(&State)); - CFE_UtAssert_TRUE(CFE_FS_BackgroundFileDumpIsPending(&State)); + UtAssert_BOOL_TRUE(CFE_FS_BackgroundFileDumpIsPending(&State)); UtAssert_STUB_COUNT(CFE_ES_BackgroundWakeup, 1); /* confirm CFE_ES_BackgroundWakeup() was invoked */ /* @@ -574,20 +573,20 @@ void Test_CFE_FS_BackgroundFileDump(void) MyBuffer[0] = 10; MyBuffer[1] = 20; UT_SetDataBuffer(UT_KEY(UT_FS_DataGetter), MyBuffer, sizeof(MyBuffer), false); - CFE_UtAssert_TRUE(CFE_FS_RunBackgroundFileDump(1, NULL)); + UtAssert_BOOL_TRUE(CFE_FS_RunBackgroundFileDump(1, NULL)); UtAssert_STUB_COUNT(OS_OpenCreate, 1); /* confirm OS_open() was invoked */ - CFE_UtAssert_ATMOST(CFE_FS_Global.FileDump.Current.Credit, 0); + UtAssert_INT32_LTEQ(CFE_FS_Global.FileDump.Current.Credit, 0); UtAssert_STUB_COUNT(OS_close, 0); /* confirm OS_close() was not invoked */ UT_SetDeferredRetcode(UT_KEY(UT_FS_DataGetter), 2, true); /* return EOF */ - CFE_UtAssert_FALSE(CFE_FS_RunBackgroundFileDump(100, NULL)); + UtAssert_BOOL_FALSE(CFE_FS_RunBackgroundFileDump(100, NULL)); UtAssert_STUB_COUNT(OS_OpenCreate, 1); /* confirm OS_open() was not invoked again */ UtAssert_STUB_COUNT(OS_close, 1); /* confirm OS_close() was invoked */ /* No more pending requests */ UtAssert_UINT32_EQ(CFE_FS_Global.FileDump.CompleteCount, CFE_FS_Global.FileDump.RequestCount); /* complete event was sent */ UtAssert_UINT32_EQ(UT_FS_FileWriteEventCount[CFE_FS_FileWriteEvent_COMPLETE], 1); - CFE_UtAssert_FALSE(CFE_FS_BackgroundFileDumpIsPending(&State)); + UtAssert_BOOL_FALSE(CFE_FS_BackgroundFileDumpIsPending(&State)); UT_ResetState(UT_KEY(UT_FS_DataGetter)); @@ -595,10 +594,10 @@ void Test_CFE_FS_BackgroundFileDump(void) CFE_UtAssert_SETUP(CFE_FS_BackgroundFileDumpRequest(&State)); UT_SetDeferredRetcode(UT_KEY(OS_OpenCreate), 1, OS_ERROR); - CFE_UtAssert_TRUE(CFE_FS_RunBackgroundFileDump(100, NULL)); + UtAssert_BOOL_TRUE(CFE_FS_RunBackgroundFileDump(100, NULL)); UtAssert_UINT32_EQ(UT_FS_FileWriteEventCount[CFE_FS_FileWriteEvent_CREATE_ERROR], 1); /* create error event was sent */ - CFE_UtAssert_FALSE(CFE_FS_BackgroundFileDumpIsPending(&State)); + UtAssert_BOOL_FALSE(CFE_FS_BackgroundFileDumpIsPending(&State)); /* No more pending requests */ UtAssert_UINT32_EQ(CFE_FS_Global.FileDump.CompleteCount, CFE_FS_Global.FileDump.RequestCount); @@ -606,10 +605,10 @@ void Test_CFE_FS_BackgroundFileDump(void) CFE_UtAssert_SETUP(CFE_FS_BackgroundFileDumpRequest(&State)); UT_SetDeferredRetcode(UT_KEY(OS_write), 1, OS_ERROR); - CFE_UtAssert_TRUE(CFE_FS_RunBackgroundFileDump(100, NULL)); + UtAssert_BOOL_TRUE(CFE_FS_RunBackgroundFileDump(100, NULL)); UtAssert_UINT32_EQ(UT_FS_FileWriteEventCount[CFE_FS_FileWriteEvent_HEADER_WRITE_ERROR], 1); /* header error event was sent */ - CFE_UtAssert_FALSE(CFE_FS_BackgroundFileDumpIsPending(&State)); + UtAssert_BOOL_FALSE(CFE_FS_BackgroundFileDumpIsPending(&State)); /* No more pending requests */ UtAssert_UINT32_EQ(CFE_FS_Global.FileDump.CompleteCount, CFE_FS_Global.FileDump.RequestCount); @@ -617,10 +616,10 @@ void Test_CFE_FS_BackgroundFileDump(void) CFE_UtAssert_SETUP(CFE_FS_BackgroundFileDumpRequest(&State)); UT_SetDeferredRetcode(UT_KEY(OS_write), 2, OS_ERROR); UT_SetDataBuffer(UT_KEY(UT_FS_DataGetter), MyBuffer, sizeof(MyBuffer), false); - CFE_UtAssert_TRUE(CFE_FS_RunBackgroundFileDump(100, NULL)); + UtAssert_BOOL_TRUE(CFE_FS_RunBackgroundFileDump(100, NULL)); /* record error event was sent */ UtAssert_UINT32_EQ(UT_FS_FileWriteEventCount[CFE_FS_FileWriteEvent_RECORD_WRITE_ERROR], 1); - CFE_UtAssert_FALSE(CFE_FS_BackgroundFileDumpIsPending(&State)); + UtAssert_BOOL_FALSE(CFE_FS_BackgroundFileDumpIsPending(&State)); /* No more pending requests */ UtAssert_UINT32_EQ(CFE_FS_Global.FileDump.CompleteCount, CFE_FS_Global.FileDump.RequestCount); @@ -642,15 +641,15 @@ void Test_CFE_FS_BackgroundFileDump(void) (CFE_FS_Global.FileDump.CompleteCount + CFE_FS_MAX_BACKGROUND_FILE_WRITES - 1)); /* Confirm null arg handling in CFE_FS_BackgroundFileDumpIsPending() */ - CFE_UtAssert_FALSE(CFE_FS_BackgroundFileDumpIsPending(NULL)); + UtAssert_BOOL_FALSE(CFE_FS_BackgroundFileDumpIsPending(NULL)); /* this catches the branch where Meta->IsPending is false */ - CFE_UtAssert_TRUE(CFE_FS_RunBackgroundFileDump(100, NULL)); - CFE_UtAssert_TRUE(CFE_FS_RunBackgroundFileDump(100, NULL)); - CFE_UtAssert_TRUE(CFE_FS_RunBackgroundFileDump(100, NULL)); - CFE_UtAssert_FALSE(CFE_FS_RunBackgroundFileDump(100, NULL)); + UtAssert_BOOL_TRUE(CFE_FS_RunBackgroundFileDump(100, NULL)); + UtAssert_BOOL_TRUE(CFE_FS_RunBackgroundFileDump(100, NULL)); + UtAssert_BOOL_TRUE(CFE_FS_RunBackgroundFileDump(100, NULL)); + UtAssert_BOOL_FALSE(CFE_FS_RunBackgroundFileDump(100, NULL)); CFE_UtAssert_SETUP(CFE_FS_BackgroundFileDumpRequest(&State)); UT_SetDeferredRetcode(UT_KEY(UT_FS_DataGetter), 2, true); /* avoid infinite loop */ - CFE_UtAssert_FALSE(CFE_FS_RunBackgroundFileDump(100, NULL)); + UtAssert_BOOL_FALSE(CFE_FS_RunBackgroundFileDump(100, NULL)); } diff --git a/modules/msg/ut-coverage/test_cfe_msg_ccsdspri.c b/modules/msg/ut-coverage/test_cfe_msg_ccsdspri.c index 4bafd46ad..2d78c3afe 100644 --- a/modules/msg/ut-coverage/test_cfe_msg_ccsdspri.c +++ b/modules/msg/ut-coverage/test_cfe_msg_ccsdspri.c @@ -233,7 +233,7 @@ void Test_MSG_HasSecondaryHeader(void) UtPrintf("Bad parameter tests, Null pointers"); memset(&msg, 0, sizeof(msg)); UtAssert_INT32_EQ(CFE_MSG_GetHasSecondaryHeader(NULL, &actual), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_TRUE(actual); + UtAssert_BOOL_TRUE(actual); UtAssert_INT32_EQ(CFE_MSG_GetHasSecondaryHeader(&msg, NULL), CFE_MSG_BAD_ARGUMENT); UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); UtAssert_INT32_EQ(CFE_MSG_SetHasSecondaryHeader(NULL, false), CFE_MSG_BAD_ARGUMENT); @@ -241,35 +241,35 @@ void Test_MSG_HasSecondaryHeader(void) UtPrintf("Set to all F's, true and false inputs"); memset(&msg, 0xFF, sizeof(msg)); CFE_UtAssert_SUCCESS(CFE_MSG_GetHasSecondaryHeader(&msg, &actual)); - CFE_UtAssert_TRUE(actual); + UtAssert_BOOL_TRUE(actual); CFE_UtAssert_SUCCESS(CFE_MSG_SetHasSecondaryHeader(&msg, true)); UT_DisplayPkt(&msg, sizeof(msg)); CFE_UtAssert_SUCCESS(CFE_MSG_GetHasSecondaryHeader(&msg, &actual)); - CFE_UtAssert_TRUE(actual); + UtAssert_BOOL_TRUE(actual); UtAssert_INT32_EQ(Test_MSG_NotF(&msg), 0); CFE_UtAssert_SUCCESS(CFE_MSG_SetHasSecondaryHeader(&msg, false)); UT_DisplayPkt(&msg, sizeof(msg)); CFE_UtAssert_SUCCESS(CFE_MSG_GetHasSecondaryHeader(&msg, &actual)); - CFE_UtAssert_FALSE(actual); + UtAssert_BOOL_FALSE(actual); UtAssert_INT32_EQ(Test_MSG_NotF(&msg), MSG_HASSEC_FLAG); UtPrintf("Set to all 0, true and false inputs"); memset(&msg, 0, sizeof(msg)); CFE_UtAssert_SUCCESS(CFE_MSG_GetHasSecondaryHeader(&msg, &actual)); - CFE_UtAssert_FALSE(actual); + UtAssert_BOOL_FALSE(actual); CFE_UtAssert_SUCCESS(CFE_MSG_SetHasSecondaryHeader(&msg, false)); UT_DisplayPkt(&msg, sizeof(msg)); CFE_UtAssert_SUCCESS(CFE_MSG_GetHasSecondaryHeader(&msg, &actual)); - CFE_UtAssert_FALSE(actual); + UtAssert_BOOL_FALSE(actual); UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); CFE_UtAssert_SUCCESS(CFE_MSG_SetHasSecondaryHeader(&msg, true)); UT_DisplayPkt(&msg, sizeof(msg)); CFE_UtAssert_SUCCESS(CFE_MSG_GetHasSecondaryHeader(&msg, &actual)); - CFE_UtAssert_TRUE(actual); + UtAssert_BOOL_TRUE(actual); UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), MSG_HASSEC_FLAG); } diff --git a/modules/msg/ut-coverage/test_cfe_msg_checksum.c b/modules/msg/ut-coverage/test_cfe_msg_checksum.c index e36e94144..3dd45579b 100644 --- a/modules/msg/ut-coverage/test_cfe_msg_checksum.c +++ b/modules/msg/ut-coverage/test_cfe_msg_checksum.c @@ -45,14 +45,14 @@ void Test_MSG_Checksum(void) actual = true; UtAssert_INT32_EQ(CFE_MSG_GenerateChecksum(NULL), CFE_MSG_BAD_ARGUMENT); UtAssert_INT32_EQ(CFE_MSG_ValidateChecksum(NULL, &actual), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_TRUE(actual); + UtAssert_BOOL_TRUE(actual); UtAssert_INT32_EQ(CFE_MSG_ValidateChecksum(msgptr, NULL), CFE_MSG_BAD_ARGUMENT); UtAssert_INT32_EQ(Test_MSG_NotZero(msgptr), 0); UtPrintf("Bad message, no secondary header"); CFE_UtAssert_SUCCESS(CFE_MSG_SetType(msgptr, CFE_MSG_Type_Cmd)); UtAssert_INT32_EQ(CFE_MSG_ValidateChecksum(msgptr, &actual), CFE_MSG_WRONG_MSG_TYPE); - CFE_UtAssert_TRUE(actual); + UtAssert_BOOL_TRUE(actual); UtAssert_INT32_EQ(CFE_MSG_GenerateChecksum(msgptr), CFE_MSG_WRONG_MSG_TYPE); UtAssert_INT32_EQ(Test_MSG_NotZero(msgptr), MSG_TYPE_FLAG); @@ -60,7 +60,7 @@ void Test_MSG_Checksum(void) CFE_UtAssert_SUCCESS(CFE_MSG_SetType(msgptr, CFE_MSG_Type_Tlm)); CFE_UtAssert_SUCCESS(CFE_MSG_SetHasSecondaryHeader(msgptr, true)); UtAssert_INT32_EQ(CFE_MSG_ValidateChecksum(msgptr, &actual), CFE_MSG_WRONG_MSG_TYPE); - CFE_UtAssert_TRUE(actual); + UtAssert_BOOL_TRUE(actual); UtAssert_INT32_EQ(CFE_MSG_GenerateChecksum(msgptr), CFE_MSG_WRONG_MSG_TYPE); UtAssert_INT32_EQ(Test_MSG_NotZero(msgptr), MSG_HASSEC_FLAG); @@ -68,11 +68,11 @@ void Test_MSG_Checksum(void) memset(&cmd, 0xFF, sizeof(cmd)); CFE_UtAssert_SUCCESS(CFE_MSG_SetSize(msgptr, sizeof(cmd))); CFE_UtAssert_SUCCESS(CFE_MSG_ValidateChecksum(msgptr, &actual)); - CFE_UtAssert_FALSE(actual); + UtAssert_BOOL_FALSE(actual); CFE_UtAssert_SUCCESS(CFE_MSG_GenerateChecksum(msgptr)); UT_DisplayPkt(msgptr, sizeof(cmd)); CFE_UtAssert_SUCCESS(CFE_MSG_ValidateChecksum(msgptr, &actual)); - CFE_UtAssert_TRUE(actual); + UtAssert_BOOL_TRUE(actual); UtAssert_INT32_EQ(Test_MSG_NotF(msgptr), MSG_LENGTH_FLAG); UtPrintf("Set to all 0 except secheader and type, validate/generate/validate"); @@ -81,10 +81,10 @@ void Test_MSG_Checksum(void) CFE_UtAssert_SUCCESS(CFE_MSG_SetType(msgptr, CFE_MSG_Type_Cmd)); CFE_UtAssert_SUCCESS(CFE_MSG_SetHasSecondaryHeader(msgptr, true)); CFE_UtAssert_SUCCESS(CFE_MSG_ValidateChecksum(msgptr, &actual)); - CFE_UtAssert_FALSE(actual); + UtAssert_BOOL_FALSE(actual); CFE_UtAssert_SUCCESS(CFE_MSG_GenerateChecksum(msgptr)); UT_DisplayPkt(msgptr, sizeof(cmd)); CFE_UtAssert_SUCCESS(CFE_MSG_ValidateChecksum(msgptr, &actual)); - CFE_UtAssert_TRUE(actual); + UtAssert_BOOL_TRUE(actual); UtAssert_INT32_EQ(Test_MSG_NotZero(msgptr), MSG_LENGTH_FLAG | MSG_HASSEC_FLAG | MSG_TYPE_FLAG); } diff --git a/modules/msg/ut-coverage/test_cfe_msg_init.c b/modules/msg/ut-coverage/test_cfe_msg_init.c index 2efeee5cf..4364c16d3 100644 --- a/modules/msg/ut-coverage/test_cfe_msg_init.c +++ b/modules/msg/ut-coverage/test_cfe_msg_init.c @@ -111,7 +111,7 @@ void Test_MSG_Init(void) CFE_UtAssert_SUCCESS(CFE_MSG_GetApId(&cmd.Msg, &apid)); CFE_UtAssert_SUCCESS(CFE_MSG_GetHeaderVersion(&cmd.Msg, &hdrver)); CFE_UtAssert_SUCCESS(CFE_MSG_GetHasSecondaryHeader(&cmd.Msg, &hassec)); - CFE_UtAssert_TRUE(hassec); + UtAssert_BOOL_TRUE(hassec); if (!is_v1) { UtAssert_INT32_EQ(apid & TEST_DEFAULT_APID_MASK, CFE_PLATFORM_DEFAULT_APID & TEST_DEFAULT_APID_MASK); diff --git a/modules/msg/ut-coverage/test_cfe_msg_msgid_v1.c b/modules/msg/ut-coverage/test_cfe_msg_msgid_v1.c index 8a0a6a5ae..b7616a27b 100644 --- a/modules/msg/ut-coverage/test_cfe_msg_msgid_v1.c +++ b/modules/msg/ut-coverage/test_cfe_msg_msgid_v1.c @@ -79,7 +79,7 @@ void Test_MSG_MsgId(void) CFE_UtAssert_SUCCESS(CFE_MSG_GetType(&msg, &type)); UtAssert_INT32_EQ(type, CFE_MSG_Type_Cmd); CFE_UtAssert_SUCCESS(CFE_MSG_GetHasSecondaryHeader(&msg, &hassec)); - CFE_UtAssert_TRUE(hassec); + UtAssert_BOOL_TRUE(hassec); UtPrintf("Set ApId msgid bits only and verify"); CFE_UtAssert_SUCCESS(CFE_MSG_SetMsgId(&msg, CFE_SB_ValueToMsgId(TEST_MAX_APID))); @@ -93,7 +93,7 @@ void Test_MSG_MsgId(void) CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(&msg, &msgid)); UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), MSG_HASSEC_FLAG); CFE_UtAssert_SUCCESS(CFE_MSG_GetHasSecondaryHeader(&msg, &hassec)); - CFE_UtAssert_TRUE(hassec); + UtAssert_BOOL_TRUE(hassec); UtPrintf("Set type msgid bit only and verify"); CFE_UtAssert_SUCCESS(CFE_MSG_SetMsgId(&msg, CFE_SB_ValueToMsgId(0x1000))); diff --git a/modules/msg/ut-coverage/test_msg_utils.h b/modules/msg/ut-coverage/test_msg_utils.h index 0e52773f3..1589cb113 100644 --- a/modules/msg/ut-coverage/test_msg_utils.h +++ b/modules/msg/ut-coverage/test_msg_utils.h @@ -37,6 +37,6 @@ */ /* Subtest macro */ -#define MSG_UT_ADD_SUBTEST(Func) UT_AddSubTest(Func, NULL, NULL, __func__, #Func) +#define MSG_UT_ADD_SUBTEST(Func) UtTest_AddSubTest(Func, NULL, NULL, __func__, #Func) #endif /* TEST_MSG_UTILS_H */ diff --git a/modules/resourceid/fsw/src/cfe_resourceid_api.c b/modules/resourceid/fsw/src/cfe_resourceid_api.c index 47e4f7403..022bb9b86 100644 --- a/modules/resourceid/fsw/src/cfe_resourceid_api.c +++ b/modules/resourceid/fsw/src/cfe_resourceid_api.c @@ -20,7 +20,7 @@ /* ** File: -** cfe_resource_api.c +** cfe_resource_api.c ** ** Purpose: ** Function definitions related to CFE resource management diff --git a/modules/sb/ut-coverage/sb_UT.c b/modules/sb/ut-coverage/sb_UT.c index 6e741708a..e01313969 100644 --- a/modules/sb/ut-coverage/sb_UT.c +++ b/modules/sb/ut-coverage/sb_UT.c @@ -51,7 +51,7 @@ * This also implicitly includes a call to SB_ResetUnitTest() as a setup function, * so the test routines do _not_ need to do this explictly on every test case. */ -#define SB_UT_ADD_SUBTEST(Func) UT_AddSubTest(Func, SB_ResetUnitTest, NULL, __func__, #Func) +#define SB_UT_ADD_SUBTEST(Func) UtTest_AddSubTest(Func, SB_ResetUnitTest, NULL, __func__, #Func) /* * MSG ID constants for unit testing: @@ -715,11 +715,11 @@ void Test_SB_Cmds_RoutingInfoDataGetter(void) LocalBuffer = NULL; LocalBufSize = 0; - CFE_UtAssert_FALSE(CFE_SB_WriteRouteInfoDataGetter(&State, 0, &LocalBuffer, &LocalBufSize)); + UtAssert_BOOL_FALSE(CFE_SB_WriteRouteInfoDataGetter(&State, 0, &LocalBuffer, &LocalBufSize)); UtAssert_NOT_NULL(LocalBuffer); UtAssert_NONZERO(LocalBufSize); - CFE_UtAssert_TRUE( + UtAssert_BOOL_TRUE( CFE_SB_WriteRouteInfoDataGetter(&State, CFE_PLATFORM_SB_MAX_MSG_IDS, &LocalBuffer, &LocalBufSize)); UtAssert_ZERO(LocalBufSize); @@ -837,18 +837,18 @@ void Test_SB_Cmds_PipeInfoDataGetter(void) LocalBufSize = 0; /* Note that CFE_SB_CreatePipe() fills entry 1 first, so entry 0 is unused */ - CFE_UtAssert_FALSE(CFE_SB_WritePipeInfoDataGetter(&State, 0, &LocalBuffer, &LocalBufSize)); + UtAssert_BOOL_FALSE(CFE_SB_WritePipeInfoDataGetter(&State, 0, &LocalBuffer, &LocalBufSize)); UtAssert_ZERO(LocalBufSize); - CFE_UtAssert_FALSE(CFE_SB_WritePipeInfoDataGetter(&State, 1, &LocalBuffer, &LocalBufSize)); + UtAssert_BOOL_FALSE(CFE_SB_WritePipeInfoDataGetter(&State, 1, &LocalBuffer, &LocalBufSize)); UtAssert_NOT_NULL(LocalBuffer); UtAssert_NONZERO(LocalBufSize); - CFE_UtAssert_TRUE( + UtAssert_BOOL_TRUE( CFE_SB_WritePipeInfoDataGetter(&State, CFE_PLATFORM_SB_MAX_PIPES - 1, &LocalBuffer, &LocalBufSize)); UtAssert_ZERO(LocalBufSize); - CFE_UtAssert_TRUE(CFE_SB_WritePipeInfoDataGetter(&State, CFE_PLATFORM_SB_MAX_PIPES, &LocalBuffer, &LocalBufSize)); + UtAssert_BOOL_TRUE(CFE_SB_WritePipeInfoDataGetter(&State, CFE_PLATFORM_SB_MAX_PIPES, &LocalBuffer, &LocalBufSize)); UtAssert_ZERO(LocalBufSize); CFE_UtAssert_TEARDOWN(CFE_SB_DeletePipe(PipeId1)); @@ -921,11 +921,11 @@ void Test_SB_Cmds_MapInfoDataGetter(void) LocalBuffer = NULL; LocalBufSize = 0; - CFE_UtAssert_FALSE(CFE_SB_WriteMsgMapInfoDataGetter(&State, 0, &LocalBuffer, &LocalBufSize)); + UtAssert_BOOL_FALSE(CFE_SB_WriteMsgMapInfoDataGetter(&State, 0, &LocalBuffer, &LocalBufSize)); UtAssert_NOT_NULL(LocalBuffer); UtAssert_NONZERO(LocalBufSize); - CFE_UtAssert_TRUE( + UtAssert_BOOL_TRUE( CFE_SB_WriteMsgMapInfoDataGetter(&State, CFE_PLATFORM_SB_MAX_MSG_IDS, &LocalBuffer, &LocalBufSize)); UtAssert_NULL(LocalBuffer); UtAssert_ZERO(LocalBufSize); @@ -1494,7 +1494,7 @@ void Test_SB_Cmds_SendPrevSubs(void) /* Event count is only exact if there were no collisions */ if (UT_EventIsInHistory(CFE_SB_HASHCOLLISION_EID)) { - CFE_UtAssert_ATLEAST(UT_GetNumEventsSent(), NumEvts + 1); + UtAssert_UINT32_GTEQ(UT_GetNumEventsSent(), NumEvts + 1); } else { @@ -1536,7 +1536,7 @@ void Test_SB_Cmds_SendPrevSubs(void) /* Event count is only exact if there were no collisions */ if (UT_EventIsInHistory(CFE_SB_HASHCOLLISION_EID)) { - CFE_UtAssert_ATLEAST(UT_GetNumEventsSent(), NumEvts + 1); + UtAssert_UINT32_GTEQ(UT_GetNumEventsSent(), NumEvts + 1); } else { @@ -1869,8 +1869,8 @@ void Test_CreatePipe_MaxPipes(void) */ CFE_SB_Global.PipeTbl[1].PipeId = CFE_SB_PIPEID_C(UT_SB_MakePipeIdForIndex(1)); CFE_SB_Global.PipeTbl[2].PipeId = CFE_SB_INVALID_PIPE; - CFE_UtAssert_TRUE(CFE_SB_CheckPipeDescSlotUsed(UT_SB_MakePipeIdForIndex(1))); - CFE_UtAssert_FALSE(CFE_SB_CheckPipeDescSlotUsed(UT_SB_MakePipeIdForIndex(2))); + UtAssert_BOOL_TRUE(CFE_SB_CheckPipeDescSlotUsed(UT_SB_MakePipeIdForIndex(1))); + UtAssert_BOOL_FALSE(CFE_SB_CheckPipeDescSlotUsed(UT_SB_MakePipeIdForIndex(2))); } /* end Test_CreatePipe_MaxPipes */ @@ -3643,7 +3643,7 @@ void Test_TransmitMsgValidate_NoSubscribers(void) CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsgValidate(&TlmPkt.Hdr.Msg, &MsgIdRtn, &SizeRtn, &RouteIdRtn)); CFE_UtAssert_MSGID_EQ(MsgIdRtn, MsgId); UtAssert_INT32_EQ(SizeRtn, Size); - CFE_UtAssert_FALSE(CFE_SBR_IsValidRouteId(RouteIdRtn)); + UtAssert_BOOL_FALSE(CFE_SBR_IsValidRouteId(RouteIdRtn)); CFE_UtAssert_EVENTCOUNT(1); @@ -4006,7 +4006,7 @@ void Test_CFE_SB_MsgHdrSize(void) * The function is called for coverage, but the result is not verified * due to this mismatch. */ - CFE_UtAssert_VOIDCALL(CFE_SB_MsgHdrSize(NULL)); + UtAssert_VOIDCALL(CFE_SB_MsgHdrSize(NULL)); } /* end Test_CFE_SB_MsgHdrSize */ @@ -4130,15 +4130,15 @@ void Test_CFE_SB_SetGetUserDataLength(void) * The function is called for coverage, but the result is not verified * due to this mismatch. */ - CFE_UtAssert_VOIDCALL(CFE_SB_GetUserDataLength(NULL)); + UtAssert_VOIDCALL(CFE_SB_GetUserDataLength(NULL)); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetHasSecondaryHeader), &hassec, sizeof(hassec), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &type, sizeof(type), false); - CFE_UtAssert_VOIDCALL(CFE_SB_SetUserDataLength(&msg, 0)); - CFE_UtAssert_VOIDCALL(CFE_SB_SetUserDataLength(NULL, 0)); + UtAssert_VOIDCALL(CFE_SB_SetUserDataLength(&msg, 0)); + UtAssert_VOIDCALL(CFE_SB_SetUserDataLength(NULL, 0)); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetHasSecondaryHeader), &hassec, sizeof(hassec), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &type, sizeof(type), false); - CFE_UtAssert_VOIDCALL(CFE_SB_SetUserDataLength(&msg, CFE_MISSION_SB_MAX_SB_MSG_SIZE + 1)); + UtAssert_VOIDCALL(CFE_SB_SetUserDataLength(&msg, CFE_MISSION_SB_MAX_SB_MSG_SIZE + 1)); } /* end Util_CFE_SB_SetGetUserDataLength */ @@ -4251,7 +4251,7 @@ void Test_ReqToSendEvent_ErrLogic(void) /* if called from an invalid task ID, should be denied */ UT_SetDefaultReturnValue(UT_KEY(CFE_ES_TaskID_ToIndex), -1); UtAssert_INT32_EQ(CFE_SB_RequestToSendEvent(TaskId, Bit), CFE_SB_DENIED); - CFE_UtAssert_VOIDCALL(CFE_SB_FinishSendEvent(TaskId, Bit)); /* should be no-op */ + UtAssert_VOIDCALL(CFE_SB_FinishSendEvent(TaskId, Bit)); /* should be no-op */ UT_ClearDefaultReturnValue(UT_KEY(CFE_ES_TaskID_ToIndex)); CFE_UtAssert_EVENTCOUNT(0); @@ -4639,50 +4639,50 @@ void Test_MessageString(void) /* Test setting string where the destination size > source string size */ CFE_SB_MessageStringSet(DestString, SrcString, sizeof(DestString), sizeof(SrcString)); - CFE_UtAssert_STRINGBUF_EQ(DestString, sizeof(DestString), SrcString, sizeof(SrcString)); + UtAssert_STRINGBUF_EQ(DestString, sizeof(DestString), SrcString, sizeof(SrcString)); /* Test setting string where the source string is empty */ memset(SrcString, 0, sizeof(SrcString)); memset(DestString, 'q', sizeof(DestString)); CFE_SB_MessageStringSet(DestString, SrcString, sizeof(DestString), sizeof(SrcString)); - CFE_UtAssert_STRINGBUF_EQ(DestString, sizeof(DestString), SrcString, sizeof(SrcString)); + UtAssert_STRINGBUF_EQ(DestString, sizeof(DestString), SrcString, sizeof(SrcString)); SrcString[0] = 'a'; CFE_SB_MessageStringSet(DestString, SrcString, sizeof(DestString), 1); - CFE_UtAssert_STRINGBUF_EQ(DestString, sizeof(DestString), SrcString, sizeof(SrcString)); + UtAssert_STRINGBUF_EQ(DestString, sizeof(DestString), SrcString, sizeof(SrcString)); /* Test setting string where the destination size < source string size */ strcpy(SrcString, "abcdefg"); memset(DestString, 'q', sizeof(DestString)); CFE_SB_MessageStringSet(DestString, SrcString, 4, sizeof(SrcString)); - CFE_UtAssert_STRINGBUF_EQ(DestString, 4, SrcString, 4); + UtAssert_STRINGBUF_EQ(DestString, 4, SrcString, 4); /* Test getting string where the destination size > source string size */ strcpy(SrcString, "abcdefg"); memset(DestString, 'q', sizeof(DestString)); CFE_SB_MessageStringGet(DestString, SrcString, DefString, sizeof(DestString), 5); - CFE_UtAssert_STRINGBUF_EQ(DestString, sizeof(DestString), SrcString, 5); + UtAssert_STRINGBUF_EQ(DestString, sizeof(DestString), SrcString, 5); /* Test getting string where the destination size is zero */ memset(DestString, 'q', sizeof(DestString)); memset(SrcString, 'k', sizeof(SrcString)); CFE_SB_MessageStringGet(DestString, SrcString, DefString, 0, sizeof(SrcString)); memset(SrcString, 'q', sizeof(SrcString)); - CFE_UtAssert_STRINGBUF_EQ(DestString, sizeof(DestString), SrcString, sizeof(SrcString)); + UtAssert_STRINGBUF_EQ(DestString, sizeof(DestString), SrcString, sizeof(SrcString)); /* Test getting string where the default string is NULL */ memset(DestString, 'q', sizeof(DestString)); CFE_SB_MessageStringGet(DestString, SrcString, NULL, sizeof(DestString), 0); - CFE_UtAssert_STRINGBUF_EQ(DestString, sizeof(DestString), "", 0); + UtAssert_STRINGBUF_EQ(DestString, sizeof(DestString), "", 0); /* Test getting string where the source string size is zero */ CFE_SB_MessageStringGet(DestString, SrcString, DefString, sizeof(DestString), 0); - CFE_UtAssert_STRINGBUF_EQ(DestString, sizeof(DestString), DefString, sizeof(DefString)); + UtAssert_STRINGBUF_EQ(DestString, sizeof(DestString), DefString, sizeof(DefString)); CFE_SB_MessageStringGet(DestString, "", DefString, sizeof(DestString), 1); - CFE_UtAssert_STRINGBUF_EQ(DestString, sizeof(DestString), DefString, sizeof(DefString)); + UtAssert_STRINGBUF_EQ(DestString, sizeof(DestString), DefString, sizeof(DefString)); /* Test getting string where the destination size < source string size */ strcpy(SrcString, "abcdefg"); memset(DestString, 'q', sizeof(DestString)); CFE_SB_MessageStringGet(DestString, SrcString, DefString, 4, sizeof(SrcString)); - CFE_UtAssert_STRINGBUF_EQ(DestString, 4, SrcString, 3); + UtAssert_STRINGBUF_EQ(DestString, 4, SrcString, 3); } /* end Test_MessageString */ diff --git a/modules/sbr/ut-coverage/test_cfe_sbr_map_direct.c b/modules/sbr/ut-coverage/test_cfe_sbr_map_direct.c index 38800a178..0cc2f8fbb 100644 --- a/modules/sbr/ut-coverage/test_cfe_sbr_map_direct.c +++ b/modules/sbr/ut-coverage/test_cfe_sbr_map_direct.c @@ -42,7 +42,7 @@ void Test_SBR_Map_Direct(void) UtPrintf("Invalid msg checks"); UtAssert_INT32_EQ(CFE_SBR_SetRouteId(CFE_SB_ValueToMsgId(0), CFE_SBR_ValueToRouteId(0)), 0); - CFE_UtAssert_FALSE(CFE_SBR_IsValidRouteId(CFE_SBR_GetRouteId(CFE_SB_ValueToMsgId(0)))); + UtAssert_BOOL_FALSE(CFE_SBR_IsValidRouteId(CFE_SBR_GetRouteId(CFE_SB_ValueToMsgId(0)))); UtPrintf("Initialize map"); CFE_SBR_Init_Map(); @@ -87,7 +87,7 @@ void Test_SBR_Map_Direct(void) routeid = CFE_SBR_INVALID_ROUTE_ID; UtAssert_INT32_EQ(CFE_SBR_SetRouteId(msgid, routeid), 0); UtAssert_INT32_EQ(CFE_SBR_GetRouteId(msgid).RouteId, routeid.RouteId); - CFE_UtAssert_FALSE(CFE_SBR_IsValidRouteId(CFE_SBR_GetRouteId(msgid))); + UtAssert_BOOL_FALSE(CFE_SBR_IsValidRouteId(CFE_SBR_GetRouteId(msgid))); /* Performance check, 0xFFFFFF on 3.2GHz linux box is around 8-9 seconds */ count = 0; diff --git a/modules/sbr/ut-coverage/test_cfe_sbr_map_hash.c b/modules/sbr/ut-coverage/test_cfe_sbr_map_hash.c index 1f173584a..dd8d4e3ed 100644 --- a/modules/sbr/ut-coverage/test_cfe_sbr_map_hash.c +++ b/modules/sbr/ut-coverage/test_cfe_sbr_map_hash.c @@ -61,7 +61,7 @@ void Test_SBR_Map_Hash(void) UtPrintf("Invalid msg checks"); UtAssert_INT32_EQ(CFE_SBR_SetRouteId(CFE_SB_ValueToMsgId(0), CFE_SBR_ValueToRouteId(0)), 0); - CFE_UtAssert_FALSE(CFE_SBR_IsValidRouteId(CFE_SBR_GetRouteId(CFE_SB_ValueToMsgId(0)))); + UtAssert_BOOL_FALSE(CFE_SBR_IsValidRouteId(CFE_SBR_GetRouteId(CFE_SB_ValueToMsgId(0)))); UtPrintf("Initialize routing and map"); CFE_SBR_Init(); diff --git a/modules/sbr/ut-coverage/test_cfe_sbr_route_unsorted.c b/modules/sbr/ut-coverage/test_cfe_sbr_route_unsorted.c index 0b654041c..c16ddecb4 100644 --- a/modules/sbr/ut-coverage/test_cfe_sbr_route_unsorted.c +++ b/modules/sbr/ut-coverage/test_cfe_sbr_route_unsorted.c @@ -51,8 +51,8 @@ void Test_SBR_Route_Unsort_General(void) CFE_SBR_Init(); UtPrintf("Invalid msg checks"); - CFE_UtAssert_FALSE(CFE_SBR_IsValidRouteId(CFE_SBR_AddRoute(CFE_SB_ValueToMsgId(0), NULL))); - CFE_UtAssert_FALSE(CFE_SBR_IsValidRouteId(CFE_SBR_AddRoute(CFE_SB_ValueToMsgId(0), &collisions))); + UtAssert_BOOL_FALSE(CFE_SBR_IsValidRouteId(CFE_SBR_AddRoute(CFE_SB_ValueToMsgId(0), NULL))); + UtAssert_BOOL_FALSE(CFE_SBR_IsValidRouteId(CFE_SBR_AddRoute(CFE_SB_ValueToMsgId(0), &collisions))); UtAssert_INT32_EQ(collisions, 0); /* @@ -71,7 +71,7 @@ void Test_SBR_Route_Unsort_General(void) msgid = CFE_SB_ValueToMsgId(CFE_PLATFORM_SB_HIGHEST_VALID_MSGID); routeid = CFE_SBR_AddRoute(msgid, &collisions); UtAssert_INT32_EQ(collisions, 0); - CFE_UtAssert_TRUE(CFE_SBR_IsValidRouteId(routeid)); + UtAssert_BOOL_TRUE(CFE_SBR_IsValidRouteId(routeid)); UtPrintf("Callback test with one route"); count = 0; @@ -89,7 +89,7 @@ void Test_SBR_Route_Unsort_General(void) UtAssert_INT32_EQ(count + 1, CFE_PLATFORM_SB_MAX_MSG_IDS); /* Try one more for good luck */ - CFE_UtAssert_FALSE(CFE_SBR_IsValidRouteId(CFE_SBR_AddRoute(CFE_SB_ValueToMsgId(count), NULL))); + UtAssert_BOOL_FALSE(CFE_SBR_IsValidRouteId(CFE_SBR_AddRoute(CFE_SB_ValueToMsgId(count), NULL))); /* Check that maximum msgid is still in the table */ UtAssert_INT32_EQ(CFE_SB_MsgIdToValue(CFE_SBR_GetMsgId(routeid)), CFE_PLATFORM_SB_HIGHEST_VALID_MSGID); @@ -128,7 +128,7 @@ void Test_SBR_Route_Unsort_GetSet(void) routeid[1] = CFE_SBR_ValueToRouteId(CFE_PLATFORM_SB_MAX_MSG_IDS); for (i = 0; i < 2; i++) { - CFE_UtAssert_TRUE(CFE_SB_MsgId_Equal(CFE_SBR_GetMsgId(routeid[i]), CFE_SB_INVALID_MSG_ID)); + UtAssert_BOOL_TRUE(CFE_SB_MsgId_Equal(CFE_SBR_GetMsgId(routeid[i]), CFE_SB_INVALID_MSG_ID)); UtAssert_ADDRESS_EQ(CFE_SBR_GetDestListHeadPtr(routeid[i]), NULL); UtAssert_INT32_EQ(CFE_SBR_GetSequenceCounter(routeid[i]), 0); } @@ -171,7 +171,7 @@ void Test_SBR_Route_Unsort_GetSet(void) UT_SetDefaultReturnValue(UT_KEY(CFE_MSG_GetNextSequenceCount), seqcntexpected[0]); for (i = 0; i < 3; i++) { - CFE_UtAssert_TRUE(CFE_SB_MsgId_Equal(msgid[i], CFE_SBR_GetMsgId(routeid[i]))); + UtAssert_BOOL_TRUE(CFE_SB_MsgId_Equal(msgid[i], CFE_SBR_GetMsgId(routeid[i]))); CFE_SBR_IncrementSequenceCounter(routeid[0]); } UtAssert_STUB_COUNT(CFE_MSG_GetNextSequenceCount, 3); diff --git a/modules/tbl/ut-coverage/tbl_UT.c b/modules/tbl/ut-coverage/tbl_UT.c index de0ebf422..72ae5d5e2 100644 --- a/modules/tbl/ut-coverage/tbl_UT.c +++ b/modules/tbl/ut-coverage/tbl_UT.c @@ -504,7 +504,7 @@ void Test_CFE_TBL_AbortLoadCmd(void) CFE_TBL_Global.Registry[0].DoubleBuffered = true; CFE_TBL_Global.LoadBuffs[0].Taken = true; CFE_TBL_AbortLoad(&CFE_TBL_Global.Registry[0]); - CFE_UtAssert_TRUE(CFE_TBL_Global.LoadBuffs[0].Taken); + UtAssert_BOOL_TRUE(CFE_TBL_Global.LoadBuffs[0].Taken); /* Restore values for subsequent tests */ CFE_TBL_Global.Registry[0].LoadInProgress = load; @@ -940,7 +940,7 @@ void Test_CFE_TBL_DumpRegCmd(void) CFE_TBL_Global.Registry[0].DoubleBuffered = true; LocalBuf = NULL; LocalSize = 0; - CFE_UtAssert_FALSE(CFE_TBL_DumpRegistryGetter(&CFE_TBL_Global.RegDumpState, 0, &LocalBuf, &LocalSize)); + UtAssert_BOOL_FALSE(CFE_TBL_DumpRegistryGetter(&CFE_TBL_Global.RegDumpState, 0, &LocalBuf, &LocalSize)); UtAssert_NOT_NULL(LocalBuf); UtAssert_NONZERO(LocalSize); @@ -949,14 +949,14 @@ void Test_CFE_TBL_DumpRegCmd(void) CFE_TBL_Global.Handles[2].NextLink = CFE_TBL_END_OF_LIST; LocalBuf = NULL; LocalSize = 0; - CFE_UtAssert_TRUE(CFE_TBL_DumpRegistryGetter(&CFE_TBL_Global.RegDumpState, CFE_PLATFORM_TBL_MAX_NUM_TABLES - 1, - &LocalBuf, &LocalSize)); + UtAssert_BOOL_TRUE(CFE_TBL_DumpRegistryGetter(&CFE_TBL_Global.RegDumpState, CFE_PLATFORM_TBL_MAX_NUM_TABLES - 1, + &LocalBuf, &LocalSize)); UtAssert_NOT_NULL(LocalBuf); UtAssert_NONZERO(LocalSize); /* Test with record numb beyond EOF (should be ignored, return null) */ - CFE_UtAssert_TRUE(CFE_TBL_DumpRegistryGetter(&CFE_TBL_Global.RegDumpState, CFE_PLATFORM_TBL_MAX_NUM_TABLES + 1, - &LocalBuf, &LocalSize)); + UtAssert_BOOL_TRUE(CFE_TBL_DumpRegistryGetter(&CFE_TBL_Global.RegDumpState, CFE_PLATFORM_TBL_MAX_NUM_TABLES + 1, + &LocalBuf, &LocalSize)); UtAssert_NULL(LocalBuf); UtAssert_ZERO(LocalSize); } @@ -1813,7 +1813,7 @@ void Test_CFE_TBL_Register(void) CFE_SEVERITY_ERROR); AccessDescPtr = &CFE_TBL_Global.Handles[TblHandle2]; RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; - CFE_UtAssert_FALSE(RegRecPtr->DoubleBuffered); + UtAssert_BOOL_FALSE(RegRecPtr->DoubleBuffered); UtAssert_ZERO(RegRecPtr->ActiveBufferIndex); CFE_TBL_Global.Handles[0].UsedFlag = true; } @@ -3417,7 +3417,7 @@ void Test_CFE_TBL_Internal(void) CFE_TBL_CleanUpApp(UT_TBL_APPID_1); UtAssert_INT32_EQ(CFE_TBL_Global.DumpControlBlocks[3].State, CFE_TBL_DUMP_FREE); CFE_UtAssert_RESOURCEID_EQ(RegRecPtr->OwnerAppId, CFE_TBL_NOT_OWNED); - CFE_UtAssert_FALSE(CFE_TBL_Global.LoadBuffs[RegRecPtr->LoadInProgress].Taken); + UtAssert_BOOL_FALSE(CFE_TBL_Global.LoadBuffs[RegRecPtr->LoadInProgress].Taken); UtAssert_INT32_EQ(RegRecPtr->LoadInProgress, CFE_TBL_NO_LOAD_IN_PROGRESS); /* Test response to an attempt to use an invalid table handle */ diff --git a/modules/time/ut-coverage/time_UT.c b/modules/time/ut-coverage/time_UT.c index 931eb45e7..39b3d4f8a 100644 --- a/modules/time/ut-coverage/time_UT.c +++ b/modules/time/ut-coverage/time_UT.c @@ -844,7 +844,7 @@ void Test_Print(void) if (usingDefaultEpoch) { strcpy(expectedBuf, "1980-001-00:00:00.00000"); - CFE_UtAssert_STRINGBUF_EQ(timeBuf, sizeof(timeBuf), expectedBuf, sizeof(expectedBuf)); + UtAssert_STRINGBUF_EQ(timeBuf, sizeof(timeBuf), expectedBuf, sizeof(expectedBuf)); } else { @@ -862,7 +862,7 @@ void Test_Print(void) if (usingDefaultEpoch) { strcpy(expectedBuf, "1980-001-00:00:59.00000"); - CFE_UtAssert_STRINGBUF_EQ(timeBuf, sizeof(timeBuf), expectedBuf, sizeof(expectedBuf)); + UtAssert_STRINGBUF_EQ(timeBuf, sizeof(timeBuf), expectedBuf, sizeof(expectedBuf)); } else { @@ -878,7 +878,7 @@ void Test_Print(void) if (usingDefaultEpoch) { strcpy(expectedBuf, "2013-001-02:03:04.00005"); - CFE_UtAssert_STRINGBUF_EQ(timeBuf, sizeof(timeBuf), expectedBuf, sizeof(expectedBuf)); + UtAssert_STRINGBUF_EQ(timeBuf, sizeof(timeBuf), expectedBuf, sizeof(expectedBuf)); } else { @@ -894,7 +894,7 @@ void Test_Print(void) if (usingDefaultEpoch) { strcpy(expectedBuf, "2116-038-06:28:15.99999"); - CFE_UtAssert_STRINGBUF_EQ(timeBuf, sizeof(timeBuf), expectedBuf, sizeof(expectedBuf)); + UtAssert_STRINGBUF_EQ(timeBuf, sizeof(timeBuf), expectedBuf, sizeof(expectedBuf)); } else { @@ -2241,7 +2241,7 @@ void Test_1Hz(void) CFE_TIME_Global.MaxLocalClock.Seconds = CFE_PLATFORM_TIME_CFG_LATCH_FLY - 1; CFE_TIME_Global.MaxLocalClock.Subseconds = 0; CFE_TIME_Local1HzStateMachine(); - CFE_UtAssert_TRUE(CFE_TIME_Global.AutoStartFly); + UtAssert_BOOL_TRUE(CFE_TIME_Global.AutoStartFly); /* Test local 1Hz interrupt when enough time has elapsed since receiving a * time update to automatically update the MET @@ -2278,7 +2278,7 @@ void Test_1Hz(void) CFE_TIME_Global.ToneSignalLatch.Seconds = 1; CFE_TIME_Global.ToneSignalLatch.Subseconds = 0; CFE_TIME_Tone1HzISR(); - CFE_UtAssert_FALSE(CFE_TIME_Global.IsToneGood); + UtAssert_BOOL_FALSE(CFE_TIME_Global.IsToneGood); /* Test the tone signal ISR call to the application synch callback * function by verifying the number of callbacks made matches the number @@ -2330,7 +2330,7 @@ void Test_1Hz(void) CFE_TIME_Global.ToneSignalLatch.Seconds = 0; CFE_TIME_Global.ToneSignalLatch.Subseconds = 0; CFE_TIME_Tone1HzISR(); - CFE_UtAssert_FALSE(CFE_TIME_Global.IsToneGood); + UtAssert_BOOL_FALSE(CFE_TIME_Global.IsToneGood); /* Test the tone 1Hz task with the tone signal within the time limits */ UT_InitData(); @@ -2339,7 +2339,7 @@ void Test_1Hz(void) CFE_TIME_Global.ToneSignalLatch.Seconds = 0; CFE_TIME_Global.ToneSignalLatch.Subseconds = 0; CFE_TIME_Tone1HzISR(); - CFE_UtAssert_TRUE(CFE_TIME_Global.IsToneGood); + UtAssert_BOOL_TRUE(CFE_TIME_Global.IsToneGood); /* Test the tone 1Hz task with the tone signal under the time limit */ UT_InitData(); @@ -2348,7 +2348,7 @@ void Test_1Hz(void) CFE_TIME_Global.ToneSignalLatch.Seconds = 0; CFE_TIME_Global.ToneSignalLatch.Subseconds = 0; CFE_TIME_Tone1HzISR(); - CFE_UtAssert_FALSE(CFE_TIME_Global.IsToneGood); + UtAssert_BOOL_FALSE(CFE_TIME_Global.IsToneGood); /* Test local 1Hz interrupt when enough time has elapsed (subseconds) since * receiving a time update to automatically change the state to flywheel @@ -2364,7 +2364,7 @@ void Test_1Hz(void) CFE_TIME_FinishReferenceUpdate(RefState); UT_SetBSP_Time(0, 0); CFE_TIME_Local1HzStateMachine(); - CFE_UtAssert_TRUE(CFE_TIME_Global.AutoStartFly); + UtAssert_BOOL_TRUE(CFE_TIME_Global.AutoStartFly); /* Test local 1Hz interrupt when enough time has not elapsed since * receiving a time update to automatically change the state to flywheel