From 1f461fe2eb3cfee26737264384572174d170a0dd Mon Sep 17 00:00:00 2001 From: "Gerardo E. Cruz-Ortiz" <59618057+astrogeco@users.noreply.github.com> Date: Mon, 9 Aug 2021 14:25:05 -0400 Subject: [PATCH] Fix #1780, RTEMS CFE_FT_Global build failure Fixes RTEMS compilation error. Moves the assignment of the TBL related elements of `CFE_FT_Global` from 'cfe_test_table' to `cfe_test` to avoid duplicate definitions error. Makes `cfe_test.c` first in CMakeLists dependency list Co-authored-by: Niall Mullane --- modules/cfe_testcase/CMakeLists.txt | 4 ++-- modules/cfe_testcase/src/cfe_test.c | 5 +++++ modules/cfe_testcase/src/cfe_test_table.c | 5 +---- modules/cfe_testcase/src/cfe_test_table.h | 2 -- modules/cfe_testcase/src/tbl_content_access_test.c | 2 +- modules/cfe_testcase/src/tbl_content_mang_test.c | 2 +- modules/cfe_testcase/src/tbl_registration_test.c | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/cfe_testcase/CMakeLists.txt b/modules/cfe_testcase/CMakeLists.txt index 844980844..7ba48d9a3 100644 --- a/modules/cfe_testcase/CMakeLists.txt +++ b/modules/cfe_testcase/CMakeLists.txt @@ -2,9 +2,9 @@ include_directories(inc) # Filenames based on doxygen groups. # Create the app module -add_cfe_app(cfe_testcase - src/cfe_test_table.c +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 diff --git a/modules/cfe_testcase/src/cfe_test.c b/modules/cfe_testcase/src/cfe_test.c index c2555d841..a0bdae2db 100644 --- a/modules/cfe_testcase/src/cfe_test.c +++ b/modules/cfe_testcase/src/cfe_test.c @@ -41,6 +41,11 @@ CFE_FT_Global_t CFE_FT_Global; */ 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 * diff --git a/modules/cfe_testcase/src/cfe_test_table.c b/modules/cfe_testcase/src/cfe_test_table.c index b0fcc8cc5..b8659f4cf 100644 --- a/modules/cfe_testcase/src/cfe_test_table.c +++ b/modules/cfe_testcase/src/cfe_test_table.c @@ -33,13 +33,10 @@ #include "cfe_test.h" #include "cfe_test_table.h" -/* Constant Table information used by all table tests */ -CFE_FT_Global_t CFE_FT_Global = { - .TblName = "TestTable", .RegisteredTblName = "CFE_TEST_APP.TestTable", .TblFilename = "test_tbl.tbl"}; - /* 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); diff --git a/modules/cfe_testcase/src/cfe_test_table.h b/modules/cfe_testcase/src/cfe_test_table.h index 1e28b06e8..c37539e01 100644 --- a/modules/cfe_testcase/src/cfe_test_table.h +++ b/modules/cfe_testcase/src/cfe_test_table.h @@ -39,8 +39,6 @@ */ #include "cfe_test.h" -CFE_FT_Global_t CFE_FT_Global; - void RegisterTestTable(void); void UnregisterTestTable(void); diff --git a/modules/cfe_testcase/src/tbl_content_access_test.c b/modules/cfe_testcase/src/tbl_content_access_test.c index 08c60e868..a7b911c2b 100644 --- a/modules/cfe_testcase/src/tbl_content_access_test.c +++ b/modules/cfe_testcase/src/tbl_content_access_test.c @@ -160,7 +160,7 @@ void TestGetReleaseAddresses(void) } 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"); diff --git a/modules/cfe_testcase/src/tbl_content_mang_test.c b/modules/cfe_testcase/src/tbl_content_mang_test.c index 93a4b22e6..165735d25 100644 --- a/modules/cfe_testcase/src/tbl_content_mang_test.c +++ b/modules/cfe_testcase/src/tbl_content_mang_test.c @@ -122,7 +122,7 @@ void TestModified(void) } 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"); diff --git a/modules/cfe_testcase/src/tbl_registration_test.c b/modules/cfe_testcase/src/tbl_registration_test.c index abe7160f6..b4ebb72c0 100644 --- a/modules/cfe_testcase/src/tbl_registration_test.c +++ b/modules/cfe_testcase/src/tbl_registration_test.c @@ -132,7 +132,7 @@ void TestTableShare(void) } void TBLRegistrationTestSetup(void) -{ +{ UtTest_Add(TestTableRegistration, NULL, NULL, "Test Table Registration"); UtTest_Add(TestTableShare, NULL, NULL, "Test Table Sharing"); }