Browse Source

Merge pull request #1036 from open62541/hotfix/discovery_unit_tests

Only enable multicast unit tests if multicast is enabled
Stefan Profanter 7 years ago
parent
commit
ab1b7dc1b0
2 changed files with 10 additions and 3 deletions
  1. 5 3
      tests/CMakeLists.txt
  2. 5 0
      tests/check_discovery.c

+ 5 - 3
tests/CMakeLists.txt

@@ -110,9 +110,11 @@ add_executable(check_server_userspace check_server_userspace.c $<TARGET_OBJECTS:
 target_link_libraries(check_server_userspace ${LIBS})
 add_test_valgrind(check_server_userspace ${TESTS_BINARY_DIR}/check_server_userspace)
 
-add_executable(check_discovery check_discovery.c $<TARGET_OBJECTS:open62541-object>)
-target_link_libraries(check_discovery ${LIBS})
-add_test_valgrind(discovery ${TESTS_BINARY_DIR}/check_discovery)
+if(UA_ENABLE_DISCOVERY)
+    add_executable(check_discovery check_discovery.c $<TARGET_OBJECTS:open62541-object>)
+    target_link_libraries(check_discovery ${LIBS})
+    add_test_valgrind(discovery ${TESTS_BINARY_DIR}/check_discovery)
+endif()
 
 # Test server with network dumps from files
 

+ 5 - 0
tests/check_discovery.c

@@ -510,6 +510,7 @@ static Suite* testSuite_Client(void) {
 
     suite_add_tcase(s,tc_register_retry);
 
+#ifdef UA_ENABLE_DISCOVERY_MULTICAST
     TCase *tc_register_find = tcase_create("RegisterServer and FindServers");
     tcase_add_unchecked_fixture(tc_register_find, setup_lds, teardown_lds);
     tcase_add_unchecked_fixture(tc_register_find, setup_register, teardown_register);
@@ -525,6 +526,8 @@ static Suite* testSuite_Client(void) {
     tcase_add_test(tc_register_find, Client_find_discovery);
     tcase_add_test(tc_register_find, Client_filter_discovery);
     suite_add_tcase(s,tc_register_find);
+#endif
+
 
     // register server again, then wait for timeout and auto unregister
     TCase *tc_register_timeout = tcase_create("RegisterServer timeout");
@@ -535,12 +538,14 @@ static Suite* testSuite_Client(void) {
     tcase_add_test(tc_register_timeout, Client_find_registered);
     tcase_add_test(tc_register_timeout, Util_wait_timeout);
     tcase_add_test(tc_register_timeout, Client_find_discovery);
+#ifdef UA_ENABLE_DISCOVERY_SEMAPHORE
     // now check if semaphore file works
     tcase_add_test(tc_register_timeout, Server_register_semaphore);
     tcase_add_test(tc_register_timeout, Client_find_registered);
     tcase_add_test(tc_register_timeout, Server_unregister_semaphore);
     tcase_add_test(tc_register_timeout, Util_wait_timeout);
     tcase_add_test(tc_register_timeout, Client_find_discovery);
+#endif
     suite_add_tcase(s,tc_register_timeout);
     return s;
 }