This is an automated email from the ASF dual-hosted git repository.

pengzheng pushed a commit to branch hotfix/debug_only_ei_tests
in repository https://gitbox.apache.org/repos/asf/celix.git

commit dc0e0aebb282ce05b51631dd5c53b14783b856ba
Author: PengZheng <[email protected]>
AuthorDate: Sun Sep 24 11:02:05 2023 +0800

    Run error injector tests only for Debug build.
---
 CMakeLists.txt                                                      | 6 ++++++
 bundles/components_ready_check/gtest/CMakeLists.txt                 | 2 +-
 bundles/logging/log_helper/CMakeLists.txt                           | 2 +-
 .../pubsub/pubsub_protocol/pubsub_protocol_lib/gtest/CMakeLists.txt | 2 +-
 bundles/remote_services/discovery_zeroconf/gtest/CMakeLists.txt     | 2 +-
 .../remote_service_admin_shm_v2/rsa_shm/gtest/CMakeLists.txt        | 2 +-
 .../remote_service_admin_shm_v2/shm_pool/gtest/CMakeLists.txt       | 2 +-
 bundles/remote_services/rsa_common/gtest/CMakeLists.txt             | 2 +-
 bundles/remote_services/rsa_rpc_json/gtest/CMakeLists.txt           | 2 +-
 documents/development/README.md                                     | 2 +-
 libs/CMakeLists.txt                                                 | 2 +-
 libs/dfi/CMakeLists.txt                                             | 2 +-
 libs/framework/CMakeLists.txt                                       | 2 +-
 libs/framework/gtest/CMakeLists.txt                                 | 2 +-
 libs/rcm/gtest/CMakeLists.txt                                       | 2 +-
 libs/utils/CMakeLists.txt                                           | 4 ++--
 libs/utils/gtest/CMakeLists.txt                                     | 2 +-
 17 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 38f1daec..955f61d4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -184,6 +184,12 @@ include(CheckLinkerFlag)
 check_linker_flag(CXX LINKER:--wrap,celix_nonexistent_symbol 
LINKER_WRAP_SUPPORTED)
 cmake_pop_check_state()
 
+if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" AND LINKER_WRAP_SUPPORTED)
+    set(EI_TESTS ON)
+else ()
+    set(EI_TESTS OFF)
+endif()
+
 # avoid unknown export "celix" error when building nothing
 add_library(celix INTERFACE)
 add_library(Celix::celix ALIAS celix)
diff --git a/bundles/components_ready_check/gtest/CMakeLists.txt 
b/bundles/components_ready_check/gtest/CMakeLists.txt
index 67b2b745..3425ffaf 100644
--- a/bundles/components_ready_check/gtest/CMakeLists.txt
+++ b/bundles/components_ready_check/gtest/CMakeLists.txt
@@ -38,7 +38,7 @@ celix_target_bundle_set_definition(test_components_ready NAME 
INACTIVE_CMP_TEST_
 add_test(NAME test_components_ready COMMAND test_components_ready)
 setup_target_for_coverage(test_components_ready SCAN_DIR ..)
 
-if (LINKER_WRAP_SUPPORTED)
+if (EI_TESTS)
     add_executable(test_components_ready_with_ei 
src/ComponentsReadyWithErrorInjectionTestSuite.cc)
     target_link_libraries(test_components_ready_with_ei PRIVATE
             framework_cut
diff --git a/bundles/logging/log_helper/CMakeLists.txt 
b/bundles/logging/log_helper/CMakeLists.txt
index ddec3e49..2fa17133 100644
--- a/bundles/logging/log_helper/CMakeLists.txt
+++ b/bundles/logging/log_helper/CMakeLists.txt
@@ -48,7 +48,7 @@ if (LOG_HELPER)
     add_library(Celix::log_helper ALIAS log_helper)
 
     if (ENABLE_TESTING)
-        if (LINKER_WRAP_SUPPORTED)
+        if (EI_TESTS)
             add_subdirectory(error_injector)
         endif ()
         add_subdirectory(gtest)
diff --git 
a/bundles/pubsub/pubsub_protocol/pubsub_protocol_lib/gtest/CMakeLists.txt 
b/bundles/pubsub/pubsub_protocol/pubsub_protocol_lib/gtest/CMakeLists.txt
index 1116e29a..cb84dca0 100644
--- a/bundles/pubsub/pubsub_protocol/pubsub_protocol_lib/gtest/CMakeLists.txt
+++ b/bundles/pubsub/pubsub_protocol/pubsub_protocol_lib/gtest/CMakeLists.txt
@@ -22,7 +22,7 @@ target_link_libraries(celix_pswp_common_tests PRIVATE 
celix_pubsub_protocol_lib
 add_test(NAME celix_pswp_common_tests COMMAND celix_pswp_common_tests)
 setup_target_for_coverage(celix_pswp_common_tests SCAN_DIR ..)
 
-if (LINKER_WRAP_SUPPORTED)
+if (EI_TESTS)
     add_executable(celix_pswp_common_ei_tests src/PS_WP_common_ei_tests.cc)
     target_include_directories(celix_pswp_common_ei_tests PRIVATE 
${CMAKE_CURRENT_SOURCE_DIR}/../src)
     target_link_libraries(celix_pswp_common_ei_tests PRIVATE 
celix_pubsub_protocol_lib GTest::gtest Celix::pubsub_spi GTest::gtest_main 
Celix::malloc_ei Celix::properties_ei)
diff --git a/bundles/remote_services/discovery_zeroconf/gtest/CMakeLists.txt 
b/bundles/remote_services/discovery_zeroconf/gtest/CMakeLists.txt
index 44b23a05..fe911954 100644
--- a/bundles/remote_services/discovery_zeroconf/gtest/CMakeLists.txt
+++ b/bundles/remote_services/discovery_zeroconf/gtest/CMakeLists.txt
@@ -40,7 +40,7 @@ 
target_compile_definitions(integration_test_discovery_zeroconf PRIVATE -DDISCOVE
 add_test(NAME run_integration_test_discovery_zeroconf COMMAND 
integration_test_discovery_zeroconf)
 setup_target_for_coverage(integration_test_discovery_zeroconf SCAN_DIR ..)
 
-if (LINKER_WRAP_SUPPORTED)
+if (EI_TESTS)
     ####unit test
     add_executable(unit_test_discovery_zeroconf
             src/DiscoveryZeroconfAnnouncerTestSuite.cc
diff --git 
a/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/gtest/CMakeLists.txt
 
b/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/gtest/CMakeLists.txt
index 4ab5b376..84eee9ab 100644
--- 
a/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/gtest/CMakeLists.txt
+++ 
b/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/gtest/CMakeLists.txt
@@ -39,7 +39,7 @@ add_celix_bundle_dependencies(integration_test_rsa_shm 
Celix::rsa_shm)
 add_test(NAME run_integration_test_rsa_shm COMMAND integration_test_rsa_shm)
 setup_target_for_coverage(integration_test_rsa_shm SCAN_DIR ..)
 
-if (LINKER_WRAP_SUPPORTED AND BUILD_RSA_JSON_RPC)
+if (EI_TESTS AND BUILD_RSA_JSON_RPC)
     ####unit test
     add_executable(unit_test_rsa_shm
             src/RsaShmImplUnitTestSuite.cc
diff --git 
a/bundles/remote_services/remote_service_admin_shm_v2/shm_pool/gtest/CMakeLists.txt
 
b/bundles/remote_services/remote_service_admin_shm_v2/shm_pool/gtest/CMakeLists.txt
index dc2e113a..23c42621 100644
--- 
a/bundles/remote_services/remote_service_admin_shm_v2/shm_pool/gtest/CMakeLists.txt
+++ 
b/bundles/remote_services/remote_service_admin_shm_v2/shm_pool/gtest/CMakeLists.txt
@@ -15,7 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
-if (LINKER_WRAP_SUPPORTED)
+if (EI_TESTS)
     add_executable(test_shm_pool
             src/ShmPoolTestSuite.cc
             src/ShmCacheTestSuite.cc
diff --git a/bundles/remote_services/rsa_common/gtest/CMakeLists.txt 
b/bundles/remote_services/rsa_common/gtest/CMakeLists.txt
index 0cd82925..ee45e824 100644
--- a/bundles/remote_services/rsa_common/gtest/CMakeLists.txt
+++ b/bundles/remote_services/rsa_common/gtest/CMakeLists.txt
@@ -14,7 +14,7 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-if (LINKER_WRAP_SUPPORTED)
+if (EI_TESTS)
     ####unit test
     add_executable(unit_test_rsa_common
             src/EndpointDescriptionUnitTestSuite.cc
diff --git a/bundles/remote_services/rsa_rpc_json/gtest/CMakeLists.txt 
b/bundles/remote_services/rsa_rpc_json/gtest/CMakeLists.txt
index c9499055..822db007 100644
--- a/bundles/remote_services/rsa_rpc_json/gtest/CMakeLists.txt
+++ b/bundles/remote_services/rsa_rpc_json/gtest/CMakeLists.txt
@@ -36,7 +36,7 @@ target_compile_definitions(integration_test_rsa_json_rpc 
PRIVATE -DRSA_JSON_RPC_
 add_test(NAME run_integration_test_rsa_json_rpc COMMAND 
integration_test_rsa_json_rpc)
 setup_target_for_coverage(integration_test_rsa_json_rpc SCAN_DIR ..)
 
-if (LINKER_WRAP_SUPPORTED)
+if (EI_TESTS)
     ####unit test
     add_executable(unit_test_rsa_json_rpc
             src/RsaJsonRpcUnitTestSuite.cc
diff --git a/documents/development/README.md b/documents/development/README.md
index 806694d4..cc13d304 100644
--- a/documents/development/README.md
+++ b/documents/development/README.md
@@ -422,7 +422,7 @@ void celix_foo_destroy(celix_foo_t* foo) {
 ## Error Injection
 
 - Use the Apache Celix error_injector libraries to inject errors in unit tests 
in a controlled way.
-- Create a separate test suite for error injection tests and place them under 
a `LINKER_WRAP_SUPPORTED` cmake condition.
+- Create a separate test suite for error injection tests and place them under 
a `EI_TESTS` cmake condition.
 - Reset error injection setup on the `TearDown` function or destructor of the 
test fixture.
 - If an - internal or external - function is missing error injection support, 
add it to the error_injector library.
   - Try to create small error injector libraries for specific functionality.
diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt
index cb8481a2..7c712776 100644
--- a/libs/CMakeLists.txt
+++ b/libs/CMakeLists.txt
@@ -36,7 +36,7 @@ if (CELIX_CXX14)
 endif ()
 
 # Error Injectors
-if (ENABLE_TESTING AND LINKER_WRAP_SUPPORTED)
+if (ENABLE_TESTING AND EI_TESTS)
     add_subdirectory(error_injector)
 endif ()
 
diff --git a/libs/dfi/CMakeLists.txt b/libs/dfi/CMakeLists.txt
index affed988..b43a1d21 100644
--- a/libs/dfi/CMakeLists.txt
+++ b/libs/dfi/CMakeLists.txt
@@ -60,7 +60,7 @@ if (CELIX_DFI)
        #Alias setup to match external usage
        add_library(Celix::dfi ALIAS dfi)
 
-       if (ENABLE_TESTING AND LINKER_WRAP_SUPPORTED)
+       if (ENABLE_TESTING AND EI_TESTS)
                add_subdirectory(error_injector)
        endif ()
        if (ENABLE_TESTING)
diff --git a/libs/framework/CMakeLists.txt b/libs/framework/CMakeLists.txt
index d6fd2177..64d7d2f6 100644
--- a/libs/framework/CMakeLists.txt
+++ b/libs/framework/CMakeLists.txt
@@ -83,7 +83,7 @@ if (FRAMEWORK)
     #Alias setup to match external usage
     add_library(Celix::framework ALIAS framework)
 
-    if (ENABLE_TESTING AND LINKER_WRAP_SUPPORTED)
+    if (ENABLE_TESTING AND EI_TESTS)
         add_subdirectory(error_injector)
     endif ()
     if (ENABLE_TESTING AND CELIX_CXX17) #framework tests are C++17
diff --git a/libs/framework/gtest/CMakeLists.txt 
b/libs/framework/gtest/CMakeLists.txt
index 19c73f81..f822270e 100644
--- a/libs/framework/gtest/CMakeLists.txt
+++ b/libs/framework/gtest/CMakeLists.txt
@@ -131,7 +131,7 @@ endif ()
 add_test(NAME test_framework COMMAND test_framework)
 setup_target_for_coverage(test_framework SCAN_DIR ..)
 
-if (LINKER_WRAP_SUPPORTED)
+if (EI_TESTS)
     add_executable(test_framework_with_ei
             src/BundleArchiveWithErrorInjectionTestSuite.cc
             src/CelixFrameworkUtilsErrorInjectionTestSuite.cc
diff --git a/libs/rcm/gtest/CMakeLists.txt b/libs/rcm/gtest/CMakeLists.txt
index 943747c8..ce44e5b7 100644
--- a/libs/rcm/gtest/CMakeLists.txt
+++ b/libs/rcm/gtest/CMakeLists.txt
@@ -25,7 +25,7 @@ target_link_libraries(test_rcm PRIVATE Celix::rcm 
GTest::gtest GTest::gtest_main
 add_test(NAME test_rcm COMMAND test_rcm)
 setup_target_for_coverage(test_rcm SCAN_DIR ..)
 
-if (LINKER_WRAP_SUPPORTED)
+if (EI_TESTS)
     add_executable(test_rcm_with_error_injection
         src/RequirementCapabilityModelWithErrorInjectionTestSuite.cc
     )
diff --git a/libs/utils/CMakeLists.txt b/libs/utils/CMakeLists.txt
index 9ee10c32..aec9403a 100644
--- a/libs/utils/CMakeLists.txt
+++ b/libs/utils/CMakeLists.txt
@@ -112,7 +112,7 @@ if (UTILS)
     #Alias setup to match external usage
     add_library(Celix::utils ALIAS utils)
 
-    if (ENABLE_TESTING AND LINKER_WRAP_SUPPORTED)
+    if (ENABLE_TESTING AND EI_TESTS)
         add_subdirectory(error_injector)
     endif ()
 
@@ -163,7 +163,7 @@ if (UTILS)
             target_link_libraries(version_test CppUTest utils_cut pthread)
 
 
-            if (LINKER_WRAP_SUPPORTED)
+            if (EI_TESTS)
                 add_executable(version_ei_test private/test/version_ei_test.cc)
                 target_include_directories(version_ei_test PRIVATE 
include_deprecated)
                 target_link_libraries(version_ei_test CppUTest utils_cut 
Celix::malloc_ei Celix::utils_ei pthread)
diff --git a/libs/utils/gtest/CMakeLists.txt b/libs/utils/gtest/CMakeLists.txt
index 3d74bb39..c6ae1cff 100644
--- a/libs/utils/gtest/CMakeLists.txt
+++ b/libs/utils/gtest/CMakeLists.txt
@@ -82,7 +82,7 @@ add_test(NAME test_utils COMMAND test_utils)
 setup_target_for_coverage(test_utils SCAN_DIR ..)
 
 
-if (LINKER_WRAP_SUPPORTED)
+if (EI_TESTS)
     add_executable(test_utils_with_ei
             src/FileUtilsErrorInjectionTestSuite.cc
             src/ConvertUtilsErrorInjectionTestSuite.cc

Reply via email to