CMakeLists.txt 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. # Load CMake Packages
  2. find_package(Check REQUIRED)
  3. set(LIBS ${CHECK_LIBRARIES} ${open62541_LIBRARIES})
  4. include_directories(${CHECK_INCLUDE_DIRS})
  5. find_package(Threads REQUIRED)
  6. if(NOT MSVC AND UA_ENABLE_UNIT_TESTS_MEMCHECK)
  7. find_package(Valgrind REQUIRED)
  8. endif()
  9. include_directories(${PROJECT_SOURCE_DIR}/include)
  10. include_directories(${PROJECT_SOURCE_DIR}/deps)
  11. include_directories(${PROJECT_SOURCE_DIR}/src)
  12. include_directories(${PROJECT_SOURCE_DIR}/src/server)
  13. include_directories(${PROJECT_SOURCE_DIR}/plugins)
  14. include_directories(${PROJECT_BINARY_DIR}/src_generated)
  15. include_directories(${PROJECT_SOURCE_DIR}/tests/testing-plugins)
  16. #############################
  17. # Compiled binaries folders #
  18. #############################
  19. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/tests)
  20. if (MSVC)
  21. set(TESTS_BINARY_DIR ${CMAKE_BINARY_DIR}/bin/tests/${CMAKE_BUILD_TYPE})
  22. else()
  23. set(TESTS_BINARY_DIR ${CMAKE_BINARY_DIR}/bin/tests)
  24. endif()
  25. # Use different plugins for testing
  26. set(test_plugin_sources ${PROJECT_SOURCE_DIR}/plugins/ua_network_tcp.c
  27. ${PROJECT_SOURCE_DIR}/tests/testing-plugins/testing_clock.c
  28. ${PROJECT_SOURCE_DIR}/plugins/ua_log_stdout.c
  29. ${PROJECT_SOURCE_DIR}/plugins/ua_config_default.c
  30. ${PROJECT_SOURCE_DIR}/plugins/ua_accesscontrol_default.c
  31. ${PROJECT_SOURCE_DIR}/plugins/ua_pki_certificate.c
  32. ${PROJECT_SOURCE_DIR}/plugins/ua_nodestore_default.c
  33. ${PROJECT_SOURCE_DIR}/tests/testing-plugins/testing_clock.c
  34. ${PROJECT_SOURCE_DIR}/plugins/ua_securitypolicy_none.c
  35. ${PROJECT_SOURCE_DIR}/tests/testing-plugins/testing_policy.c
  36. ${PROJECT_SOURCE_DIR}/tests/testing-plugins/testing_networklayers.c)
  37. if(UA_ENABLE_ENCRYPTION)
  38. set(test_plugin_sources ${test_plugin_sources}
  39. ${PROJECT_SOURCE_DIR}/plugins/ua_securitypolicy_basic128rsa15.c)
  40. endif()
  41. add_library(open62541-testplugins OBJECT ${test_plugin_sources})
  42. add_dependencies(open62541-testplugins open62541)
  43. target_compile_definitions(open62541-testplugins PRIVATE -DUA_DYNAMIC_LINKING_EXPORT)
  44. if(NOT MSVC)
  45. add_definitions(-Wno-deprecated-declarations)
  46. endif()
  47. # Workaround some clang warnings in the uni tests
  48. if((NOT ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") AND (CMAKE_COMPILER_IS_GNUCC OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang"))
  49. add_definitions(-Wno-sign-conversion)
  50. endif()
  51. # Unit Test Definition Macro
  52. # For now we need to disable the libc freeres. See https://github.com/open62541/open62541/pull/1003#issuecomment-315045143
  53. # This also requires to disable the phtread cache with no-nptl-pthread-stackcache
  54. set(VALGRIND_FLAGS --quiet --trace-children=yes --leak-check=full --run-libc-freeres=no --sim-hints=no-nptl-pthread-stackcache --track-fds=yes)
  55. macro(add_test_valgrind TEST_NAME)
  56. if(UA_ENABLE_UNIT_TESTS_MEMCHECK)
  57. if(MSVC)
  58. add_test(${TEST_NAME} drmemory -batch -exit_code_if_errors 1 -results_to_stderr -summary -- ${ARGN})
  59. else()
  60. set(VALGRIND_LOG ${TESTS_BINARY_DIR}/${TEST_NAME}.log)
  61. set(VALGRIND_CMD valgrind --error-exitcode=1 --suppressions=${PROJECT_SOURCE_DIR}/tools/valgrind_suppressions.supp ${VALGRIND_FLAGS} --log-file=${VALGRIND_LOG} ${ARGN})
  62. add_test(${TEST_NAME} ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/valgrind_check_error.py ${VALGRIND_LOG} ${VALGRIND_CMD})
  63. endif()
  64. else()
  65. add_test(${TEST_NAME} ${ARGN})
  66. endif()
  67. if (UA_BUILD_FUZZING_CORPUS)
  68. target_sources(check_${TEST_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/tests/fuzz/ua_debug_dump_pkgs_file.c)
  69. file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/corpus/${TEST_NAME})
  70. target_compile_definitions(check_${TEST_NAME} PRIVATE UA_CORPUS_OUTPUT_DIR="${PROJECT_BINARY_DIR}/corpus/${TEST_NAME}")
  71. endif()
  72. endmacro()
  73. add_custom_target(test-verbose COMMAND ${CMAKE_CTEST_COMMAND} --verbose)
  74. # the unit test are built directly on the open62541 object files. so they can
  75. # access symbols that are hidden/not exported to the shared library
  76. add_executable(check_types_builtin check_types_builtin.c $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  77. target_link_libraries(check_types_builtin ${LIBS})
  78. add_test_valgrind(types_builtin ${TESTS_BINARY_DIR}/check_types_builtin)
  79. add_executable(check_types_memory check_types_memory.c $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  80. target_link_libraries(check_types_memory ${LIBS})
  81. add_test_valgrind(types_memory ${TESTS_BINARY_DIR}/check_types_memory)
  82. add_executable(check_types_range check_types_range.c $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  83. target_link_libraries(check_types_range ${LIBS})
  84. add_test_valgrind(types_range ${TESTS_BINARY_DIR}/check_types_range)
  85. add_executable(check_types_custom check_types_custom.c $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  86. target_link_libraries(check_types_custom ${LIBS})
  87. add_test_valgrind(types_custom ${TESTS_BINARY_DIR}/check_types_custom)
  88. add_executable(check_chunking check_chunking.c $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  89. target_link_libraries(check_chunking ${LIBS})
  90. add_test_valgrind(chunking ${TESTS_BINARY_DIR}/check_chunking)
  91. add_executable(check_utils check_utils.c $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  92. target_link_libraries(check_utils ${LIBS})
  93. add_test_valgrind(utils ${TESTS_BINARY_DIR}/check_utils)
  94. add_executable(check_securechannel check_securechannel.c $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  95. target_link_libraries(check_securechannel ${LIBS})
  96. add_test_valgrind(securechannel ${TESTS_BINARY_DIR}/check_securechannel)
  97. # Test Server
  98. add_executable(check_accesscontrol server/check_accesscontrol.c $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  99. target_link_libraries(check_accesscontrol ${LIBS})
  100. add_test_valgrind(accesscontrol ${TESTS_BINARY_DIR}/check_accesscontrol)
  101. add_executable(check_services_view server/check_services_view.c $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  102. target_link_libraries(check_services_view ${LIBS})
  103. add_test_valgrind(services_view ${TESTS_BINARY_DIR}/check_services_view)
  104. add_executable(check_services_attributes server/check_services_attributes.c $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  105. target_link_libraries(check_services_attributes ${LIBS})
  106. add_test_valgrind(services_attributes ${TESTS_BINARY_DIR}/check_services_attributes)
  107. add_executable(check_services_nodemanagement server/check_services_nodemanagement.c $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  108. target_link_libraries(check_services_nodemanagement ${LIBS})
  109. add_test_valgrind(services_nodemanagement ${TESTS_BINARY_DIR}/check_services_nodemanagement)
  110. add_executable(check_services_subscriptions server/check_services_subscriptions.c $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  111. target_link_libraries(check_services_subscriptions ${LIBS})
  112. add_test_valgrind(services_subscriptions ${TESTS_BINARY_DIR}/check_services_subscriptions)
  113. add_executable(check_nodestore server/check_nodestore.c $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  114. target_link_libraries(check_nodestore ${LIBS})
  115. add_test_valgrind(nodestore ${TESTS_BINARY_DIR}/check_nodestore)
  116. add_executable(check_session server/check_session.c $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  117. target_link_libraries(check_session ${LIBS})
  118. add_test_valgrind(session ${TESTS_BINARY_DIR}/check_session)
  119. add_executable(check_server_jobs server/check_server_jobs.c $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  120. target_link_libraries(check_server_jobs ${LIBS})
  121. add_test_valgrind(server_jobs ${TESTS_BINARY_DIR}/check_server_jobs)
  122. add_executable(check_server_userspace server/check_server_userspace.c $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  123. target_link_libraries(check_server_userspace ${LIBS})
  124. add_test_valgrind(server_userspace ${TESTS_BINARY_DIR}/check_server_userspace)
  125. add_executable(check_node_inheritance server/check_node_inheritance.c $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  126. target_link_libraries(check_node_inheritance ${LIBS})
  127. add_test_valgrind(node_inheritance ${TESTS_BINARY_DIR}/check_node_inheritance)
  128. if(UA_ENABLE_DISCOVERY)
  129. add_executable(check_discovery server/check_discovery.c $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  130. target_link_libraries(check_discovery ${LIBS})
  131. add_test_valgrind(discovery ${TESTS_BINARY_DIR}/check_discovery)
  132. endif()
  133. add_executable(check_server_readspeed server/check_server_readspeed.c $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  134. target_link_libraries(check_server_readspeed ${LIBS})
  135. add_test_valgrind(server_readspeed ${TESTS_BINARY_DIR}/check_server_readspeed)
  136. # Test Client
  137. add_executable(check_client client/check_client.c $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  138. target_link_libraries(check_client ${LIBS})
  139. add_test_valgrind(client ${TESTS_BINARY_DIR}/check_client)
  140. add_executable(check_client_securechannel client/check_client_securechannel.c $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  141. target_link_libraries(check_client_securechannel ${LIBS})
  142. add_test_valgrind(client_securechannel ${TESTS_BINARY_DIR}/check_client_securechannel)
  143. add_executable(check_client_async client/check_client_async.c $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  144. target_link_libraries(check_client_async ${LIBS})
  145. add_test_valgrind(client_async ${TESTS_BINARY_DIR}/check_client_async)
  146. add_executable(check_client_subscriptions client/check_client_subscriptions.c $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  147. target_link_libraries(check_client_subscriptions ${LIBS})
  148. add_test_valgrind(client_subscriptions ${TESTS_BINARY_DIR}/check_client_subscriptions)
  149. add_executable(check_client_subscriptions_deprecated client/check_client_subscriptions_deprecated.c $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  150. target_link_libraries(check_client_subscriptions_deprecated ${LIBS})
  151. add_test_valgrind(client_subscriptions_deprecated ${TESTS_BINARY_DIR}/check_client_subscriptions_deprecated)
  152. add_executable(check_client_highlevel client/check_client_highlevel.c $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  153. target_link_libraries(check_client_highlevel ${LIBS})
  154. add_test_valgrind(client_highlevel ${TESTS_BINARY_DIR}/check_client_highlevel)
  155. #############################
  156. # #
  157. # Test for Nodeset Compiler #
  158. # #
  159. #############################
  160. # can only be tested if UA_ENABLE_FULL_NS0
  161. if (UA_ENABLE_FULL_NS0)
  162. file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/src_generated/tests")
  163. # Generate types for DI namespace
  164. set(UA_TYPES_OUT "ua_types_di")
  165. add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src_generated/tests/${UA_TYPES_OUT}_generated.c
  166. ${PROJECT_BINARY_DIR}/src_generated/tests/${UA_TYPES_OUT}_generated.h
  167. ${PROJECT_BINARY_DIR}/src_generated/tests/${UA_TYPES_OUT}_generated_handling.h
  168. ${PROJECT_BINARY_DIR}/src_generated/tests/${UA_TYPES_OUT}_generated_encoding_binary.h
  169. PRE_BUILD
  170. COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/generate_datatypes.py
  171. --namespace=2
  172. --type-csv=${PROJECT_SOURCE_DIR}/deps/ua-nodeset/DI/OpcUaDiModel.csv
  173. --type-bsd=${PROJECT_SOURCE_DIR}/deps/ua-nodeset/DI/Opc.Ua.Di.Types.bsd
  174. --no-builtin
  175. ${PROJECT_BINARY_DIR}/src_generated/tests/${UA_TYPES_OUT}
  176. DEPENDS ${PROJECT_SOURCE_DIR}/tools/generate_datatypes.py
  177. ${PROJECT_SOURCE_DIR}/deps/ua-nodeset/DI/OpcUaDiModel.csv
  178. ${PROJECT_SOURCE_DIR}/deps/ua-nodeset/DI/Opc.Ua.Di.Types.bsd)
  179. add_custom_target(open62541-generator-tests-types-di DEPENDS ${PROJECT_BINARY_DIR}/src_generated/tests/${UA_TYPES_OUT}_generated.c)
  180. # Generate types for ADI namespace
  181. set(UA_TYPES_OUT "ua_types_adi")
  182. add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src_generated/tests/${UA_TYPES_OUT}_generated.c
  183. ${PROJECT_BINARY_DIR}/src_generated/tests/${UA_TYPES_OUT}_generated.h
  184. ${PROJECT_BINARY_DIR}/src_generated/tests/${UA_TYPES_OUT}_generated_handling.h
  185. ${PROJECT_BINARY_DIR}/src_generated/tests/${UA_TYPES_OUT}_generated_encoding_binary.h
  186. PRE_BUILD
  187. COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/generate_datatypes.py
  188. --namespace=3
  189. --type-csv=${PROJECT_SOURCE_DIR}/deps/ua-nodeset/ADI/OpcUaAdiModel.csv
  190. --type-bsd=${PROJECT_SOURCE_DIR}/deps/ua-nodeset/ADI/Opc.Ua.Adi.Types.bsd
  191. --no-builtin
  192. ${PROJECT_BINARY_DIR}/src_generated/tests/${UA_TYPES_OUT}
  193. DEPENDS ${PROJECT_SOURCE_DIR}/tools/generate_datatypes.py
  194. ${PROJECT_SOURCE_DIR}/deps/ua-nodeset/ADI/OpcUaAdiModel.csv
  195. ${PROJECT_SOURCE_DIR}/deps/ua-nodeset/ADI/Opc.Ua.Adi.Types.bsd)
  196. add_custom_target(open62541-generator-tests-types-adi DEPENDS ${PROJECT_BINARY_DIR}/src_generated/tests/${UA_TYPES_OUT}_generated.c)
  197. # generate DI namespace
  198. add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src_generated/tests/ua_namespace_di.c
  199. ${PROJECT_BINARY_DIR}/src_generated/tests/ua_namespace_di.h
  200. PRE_BUILD
  201. COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/nodeset_compiler/nodeset_compiler.py
  202. --internal-headers
  203. --types-array=UA_TYPES
  204. --types-array=UA_TYPES_DI
  205. --existing ${PROJECT_SOURCE_DIR}/deps/ua-nodeset/Schema/Opc.Ua.NodeSet2.xml
  206. --xml ${PROJECT_SOURCE_DIR}/deps/ua-nodeset/DI/Opc.Ua.Di.NodeSet2.xml
  207. ${PROJECT_BINARY_DIR}/src_generated/tests/ua_namespace_di
  208. DEPENDS ${UA_NAMESPACE0_XML}
  209. ${PROJECT_SOURCE_DIR}/tools/nodeset_compiler/nodeset_compiler.py
  210. ${PROJECT_SOURCE_DIR}/tools/nodeset_compiler/nodes.py
  211. ${PROJECT_SOURCE_DIR}/tools/nodeset_compiler/nodeset.py
  212. ${PROJECT_SOURCE_DIR}/tools/nodeset_compiler/datatypes.py
  213. ${PROJECT_SOURCE_DIR}/tools/nodeset_compiler/backend_open62541.py
  214. ${PROJECT_SOURCE_DIR}/tools/nodeset_compiler/backend_open62541_nodes.py
  215. ${PROJECT_SOURCE_DIR}/tools/nodeset_compiler/backend_open62541_datatypes.py
  216. ${PROJECT_SOURCE_DIR}/deps/ua-nodeset/Schema/Opc.Ua.NodeSet2.xml
  217. ${PROJECT_SOURCE_DIR}/deps/ua-nodeset/DI/Opc.Ua.Di.NodeSet2.xml
  218. )
  219. add_custom_target(open62541-generator-tests-ns-di DEPENDS ${PROJECT_BINARY_DIR}/src_generated/tests/ua_namespace_di.c)
  220. add_dependencies(open62541-generator-tests-ns-di open62541-generator-tests-types-di)
  221. # generate ADI namespace which is using DI
  222. add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src_generated/tests/ua_namespace_adi.c
  223. ${PROJECT_BINARY_DIR}/src_generated/tests/ua_namespace_adi.h
  224. PRE_BUILD
  225. COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/nodeset_compiler/nodeset_compiler.py
  226. --internal-headers
  227. --types-array=UA_TYPES
  228. --types-array=UA_TYPES_DI
  229. --types-array=UA_TYPES_ADI
  230. --existing ${PROJECT_SOURCE_DIR}/deps/ua-nodeset/Schema/Opc.Ua.NodeSet2.xml
  231. --existing ${PROJECT_SOURCE_DIR}/deps/ua-nodeset/DI/Opc.Ua.Di.NodeSet2.xml
  232. --xml ${PROJECT_SOURCE_DIR}/deps/ua-nodeset/ADI/Opc.Ua.Adi.NodeSet2.xml
  233. ${PROJECT_BINARY_DIR}/src_generated/tests/ua_namespace_adi
  234. DEPENDS ${UA_NAMESPACE0_XML}
  235. ${PROJECT_SOURCE_DIR}/tools/nodeset_compiler/nodeset_compiler.py
  236. ${PROJECT_SOURCE_DIR}/tools/nodeset_compiler/nodes.py
  237. ${PROJECT_SOURCE_DIR}/tools/nodeset_compiler/nodeset.py
  238. ${PROJECT_SOURCE_DIR}/tools/nodeset_compiler/datatypes.py
  239. ${PROJECT_SOURCE_DIR}/tools/nodeset_compiler/backend_open62541.py
  240. ${PROJECT_SOURCE_DIR}/tools/nodeset_compiler/backend_open62541_nodes.py
  241. ${PROJECT_SOURCE_DIR}/tools/nodeset_compiler/backend_open62541_datatypes.py
  242. ${PROJECT_SOURCE_DIR}/deps/ua-nodeset/Schema/Opc.Ua.NodeSet2.xml
  243. ${PROJECT_SOURCE_DIR}/deps/ua-nodeset/DI/Opc.Ua.Di.NodeSet2.xml
  244. ${PROJECT_SOURCE_DIR}/deps/ua-nodeset/ADI/Opc.Ua.Adi.NodeSet2.xml
  245. )
  246. add_custom_target(open62541-generator-tests-ns-adi DEPENDS ${PROJECT_BINARY_DIR}/src_generated/tests/ua_namespace_adi.c)
  247. add_dependencies(open62541-generator-tests-ns-adi open62541-generator-tests-types-adi open62541-generator-tests-ns-di)
  248. # generate PLCopen namespace which is using DI
  249. add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src_generated/tests/ua_namespace_plc.c
  250. ${PROJECT_BINARY_DIR}/src_generated/tests/ua_namespace_plc.h
  251. PRE_BUILD
  252. COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/nodeset_compiler/nodeset_compiler.py
  253. --internal-headers
  254. --types-array=UA_TYPES
  255. --types-array=UA_TYPES_DI
  256. # PLCopen has no specific type definition, thus use the default UA_TYPES to ignore it
  257. --types-array=UA_TYPES
  258. --existing ${PROJECT_SOURCE_DIR}/deps/ua-nodeset/Schema/Opc.Ua.NodeSet2.xml
  259. --existing ${PROJECT_SOURCE_DIR}/deps/ua-nodeset/DI/Opc.Ua.Di.NodeSet2.xml
  260. --xml ${PROJECT_SOURCE_DIR}/deps/ua-nodeset/PLCopen/Opc.Ua.Plc.NodeSet2.xml
  261. ${PROJECT_BINARY_DIR}/src_generated/tests/ua_namespace_plc
  262. DEPENDS ${UA_NAMESPACE0_XML}
  263. ${PROJECT_SOURCE_DIR}/tools/nodeset_compiler/nodeset_compiler.py
  264. ${PROJECT_SOURCE_DIR}/tools/nodeset_compiler/nodes.py
  265. ${PROJECT_SOURCE_DIR}/tools/nodeset_compiler/nodeset.py
  266. ${PROJECT_SOURCE_DIR}/tools/nodeset_compiler/datatypes.py
  267. ${PROJECT_SOURCE_DIR}/tools/nodeset_compiler/backend_open62541.py
  268. ${PROJECT_SOURCE_DIR}/tools/nodeset_compiler/backend_open62541_nodes.py
  269. ${PROJECT_SOURCE_DIR}/tools/nodeset_compiler/backend_open62541_datatypes.py
  270. ${PROJECT_SOURCE_DIR}/deps/ua-nodeset/DI/Opc.Ua.Di.NodeSet2.xml
  271. ${PROJECT_SOURCE_DIR}/deps/ua-nodeset/PLCopen/Opc.Ua.Plc.NodeSet2.xml
  272. )
  273. add_custom_target(open62541-generator-tests-ns-plc DEPENDS ${PROJECT_BINARY_DIR}/src_generated/tests/ua_namespace_plc.c)
  274. add_dependencies(open62541-generator-tests-ns-plc open62541-generator-tests-ns-di)
  275. add_executable(check_nodeset_compiler_adi
  276. server/check_nodeset_compiler_adi.c
  277. ${PROJECT_BINARY_DIR}/src_generated/tests/ua_types_di_generated.c
  278. ${PROJECT_BINARY_DIR}/src_generated/tests/ua_namespace_di.c
  279. ${PROJECT_BINARY_DIR}/src_generated/tests/ua_types_adi_generated.c
  280. ${PROJECT_BINARY_DIR}/src_generated/tests/ua_namespace_adi.c
  281. $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  282. add_dependencies(check_nodeset_compiler_adi open62541-generator-tests-ns-adi)
  283. target_link_libraries(check_nodeset_compiler_adi ${LIBS})
  284. add_test_valgrind(nodeset_compiler_adi ${TESTS_BINARY_DIR}/check_nodeset_compiler_adi)
  285. add_executable(check_nodeset_compiler_plc
  286. server/check_nodeset_compiler_plc.c
  287. ${PROJECT_BINARY_DIR}/src_generated/tests/ua_types_di_generated.c
  288. ${PROJECT_BINARY_DIR}/src_generated/tests/ua_namespace_di.c
  289. ${PROJECT_BINARY_DIR}/src_generated/tests/ua_namespace_plc.c
  290. $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
  291. add_dependencies(check_nodeset_compiler_plc open62541-generator-tests-ns-plc)
  292. target_link_libraries(check_nodeset_compiler_plc ${LIBS})
  293. add_test_valgrind(nodeset_compiler_plc ${TESTS_BINARY_DIR}/check_nodeset_compiler_plc)
  294. endif()