diff options
| author | songyanchao <[email protected]> | 2024-08-14 02:25:08 +0000 |
|---|---|---|
| committer | songyanchao <[email protected]> | 2024-08-14 02:25:08 +0000 |
| commit | baa980bc0f0446ca199fc81e494dfcc13afbfa99 (patch) | |
| tree | 6343c55dd80acdbee966c6757cd673a88716a2af | |
| parent | 247069cfb3bd5ecd14839348e1375ff4b9d9b2a0 (diff) | |
🧪 test(DPISDN-52): Integrate BFD and Etherfabric test cases with CTestfeat-cmocka-tests-for-all-nodes
Integrate BFD and Etherfabric test cases with CTest
| -rw-r--r-- | service/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | service/test/test_node_bfd.c | 18 | ||||
| -rw-r--r-- | service/test/test_node_ef.c | 25 | ||||
| -rw-r--r-- | service/test/test_sc_metrics.c | 6 |
4 files changed, 30 insertions, 22 deletions
diff --git a/service/CMakeLists.txt b/service/CMakeLists.txt index ca506a9..9681377 100644 --- a/service/CMakeLists.txt +++ b/service/CMakeLists.txt @@ -51,6 +51,7 @@ target_link_libraries(test_node_bfd MESA_prof_load_static ${SYSTEMD_LIBRARIES} l target_link_libraries(test_node_bfd libcmocka rt pthread dl infra z elf) target_link_options(test_node_bfd PRIVATE --coverage -fprofile-arcs -ftest-coverage) target_include_directories(test_node_bfd PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include/") +add_test(NAME test_node_bfd COMMAND test_node_bfd) add_executable(test_sc_metrics test/test_node_mocks.c test/test_sc_metrics.c ${MRZCPD_SERVICE_SOURCE_FILES}) @@ -59,6 +60,7 @@ target_link_libraries(test_sc_metrics MESA_prof_load_static ${SYSTEMD_LIBRARIES} target_link_libraries(test_sc_metrics libcmocka rt pthread dl infra z elf) target_link_options(test_sc_metrics PRIVATE --coverage -fprofile-arcs -ftest-coverage) target_include_directories(test_sc_metrics PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include/") +add_test(NAME test_sc_metrics COMMAND test_sc_metrics) add_executable(test_node_ef test/test_node_mocks.c test/test_node_ef.c test/test_common.c ${MRZCPD_SERVICE_SOURCE_FILES}) @@ -69,3 +71,4 @@ target_link_options(test_node_ef PRIVATE --coverage -fprofile-arcs -ftest-covera target_include_directories(test_node_ef PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include/") target_link_libraries(test_node_ef -Wl,--wrap=mr_dev_desc_lookup) target_link_libraries(test_node_ef -Wl,--wrap=port_adapter_mapping_insert) +add_test(NAME test_node_ef COMMAND test_node_ef) diff --git a/service/test/test_node_bfd.c b/service/test/test_node_bfd.c index 650ec70..e8a56c1 100644 --- a/service/test/test_node_bfd.c +++ b/service/test/test_node_bfd.c @@ -965,14 +965,16 @@ int main(int argc, char * argv[]) cmocka_unit_test(testcase_bfd_discriminator_method_flipping), }; - cmocka_run_group_tests(group_bfd_node_main, NULL, NULL); - cmocka_run_group_tests(group_bfd_session_handle, NULL, NULL); - cmocka_run_group_tests(group_bfd_init, testgroup_bfd_init_setup, testgroup_bfd_init_teardown); - cmocka_run_group_tests(group_bfd_discriminator_method_rfc, testgroup_bfd_discriminator_method_rfc_setup, - testgroup_bfd_discriminator_method_rfc_teardown); - cmocka_run_group_tests(group_bfd_discriminator_method_flipping, testgroup_bfd_discriminator_method_flipping_setup, - testgroup_bfd_discriminator_method_flipping_teardown); + ret = cmocka_run_group_tests(group_bfd_node_main, NULL, NULL); + ret += cmocka_run_group_tests(group_bfd_session_handle, NULL, NULL); + ret += cmocka_run_group_tests(group_bfd_init, testgroup_bfd_init_setup, testgroup_bfd_init_teardown); + ret += cmocka_run_group_tests(group_bfd_discriminator_method_rfc, testgroup_bfd_discriminator_method_rfc_setup, + testgroup_bfd_discriminator_method_rfc_teardown); + ret += cmocka_run_group_tests(group_bfd_discriminator_method_flipping, + testgroup_bfd_discriminator_method_flipping_setup, + testgroup_bfd_discriminator_method_flipping_teardown); rte_eal_cleanup(); - return 0; + + return ret; } diff --git a/service/test/test_node_ef.c b/service/test/test_node_ef.c index ff2cb08..2aaf4b3 100644 --- a/service/test/test_node_ef.c +++ b/service/test/test_node_ef.c @@ -3185,17 +3185,17 @@ int main(int argc, char * argv[]) cmocka_unit_test(testgroup_ef_egress_tap_mode), }; - cmocka_run_group_tests(group_ef_config_handle, testgroup_common_setup, testgroup_common_teardown); - cmocka_run_group_tests(group_ef_adapter_handle, testgroup_common_setup, testgroup_common_teardown); - cmocka_run_group_tests(group_ef_peer_handle, NULL, NULL); - cmocka_run_group_tests(group_tl_to_ef_peer_map_handle, NULL, NULL); - cmocka_run_group_tests(group_ef_node_main, testgroup_common_setup, testgroup_common_teardown); - cmocka_run_group_tests(group_ef_init, testgroup_common_setup, testgroup_common_teardown); - cmocka_run_group_tests(group_ef_ingress, testgroup_ef_ingress_setup, testgroup_ef_ingress_teardown); - cmocka_run_group_tests(group_ef_egress_vwire_mode, testgroup_ef_egress_vwire_mode_setup, - testgroup_ef_egress_common_teardown); - cmocka_run_group_tests(group_ef_egress_tap_mode, testgroup_ef_egress_tap_mode_setup, - testgroup_ef_egress_common_teardown); + ret = cmocka_run_group_tests(group_ef_config_handle, testgroup_common_setup, testgroup_common_teardown); + ret += cmocka_run_group_tests(group_ef_adapter_handle, testgroup_common_setup, testgroup_common_teardown); + ret += cmocka_run_group_tests(group_ef_peer_handle, NULL, NULL); + ret += cmocka_run_group_tests(group_tl_to_ef_peer_map_handle, NULL, NULL); + ret += cmocka_run_group_tests(group_ef_node_main, testgroup_common_setup, testgroup_common_teardown); + ret += cmocka_run_group_tests(group_ef_init, testgroup_common_setup, testgroup_common_teardown); + ret += cmocka_run_group_tests(group_ef_ingress, testgroup_ef_ingress_setup, testgroup_ef_ingress_teardown); + ret += cmocka_run_group_tests(group_ef_egress_vwire_mode, testgroup_ef_egress_vwire_mode_setup, + testgroup_ef_egress_common_teardown); + ret += cmocka_run_group_tests(group_ef_egress_tap_mode, testgroup_ef_egress_tap_mode_setup, + testgroup_ef_egress_common_teardown); /* free the memory */ rte_free(mock_cfgfile_content); @@ -3208,5 +3208,6 @@ int main(int argc, char * argv[]) rte_mempool_free(mock_pktmbuf_pool); rte_eal_cleanup(); - return 0; + + return ret; } diff --git a/service/test/test_sc_metrics.c b/service/test/test_sc_metrics.c index b0e7d51..fed1025 100644 --- a/service/test/test_sc_metrics.c +++ b/service/test/test_sc_metrics.c @@ -122,7 +122,9 @@ int main(int argc, char * argv[]) cmocka_unit_test(testcase_sc_metrics_api_failure), }; - cmocka_run_group_tests(group_sc_metrics, NULL, NULL); + ret = cmocka_run_group_tests(group_sc_metrics, NULL, NULL); + rte_eal_cleanup(); - return 0; + + return ret; } |
