diff --git a/CMakeLists.txt b/CMakeLists.txt index 4fc396826..a43e59215 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -951,16 +951,15 @@ if(UA_ENABLE_XML_ENCODING) unset(LIBXML2_LIBRARIES) set(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES_32BIT}) endif() - set(ua_architecture_directories_to_include - ${ua_architecture_directories_to_include} - ${LIBXML2_INCLUDE_DIRS}) list(APPEND open62541_LIBRARIES ${LIBXML2_LIBRARIES}) endif() if(NOT UA_ENABLE_JSON_ENCODING) list(APPEND lib_headers ${PROJECT_SOURCE_DIR}/deps/parse_num.h) list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/deps/parse_num.c) endif() + list(APPEND lib_headers ${PROJECT_SOURCE_DIR}/deps/yxml.h) list(APPEND lib_headers ${PROJECT_SOURCE_DIR}/src/ua_types_encoding_xml.h) + list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/deps/yxml.c) list(APPEND lib_sources ${PROJECT_SOURCE_DIR}/src/ua_types_encoding_xml.c) endif() @@ -1384,6 +1383,10 @@ endfunction() include_directories_private("${PROJECT_SOURCE_DIR}/deps") +if(UA_ENABLE_XML_ENCODING) + include_directories_private(${LIBXML2_INCLUDE_DIRS}) +endif() + if(UA_ENABLE_ENCRYPTION_MBEDTLS) include_directories_private(${MBEDTLS_INCLUDE_DIRS}) endif() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 1033d23d4..d272c7064 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -174,6 +174,7 @@ if(UA_ENABLE_JSON_ENCODING) endif() if(UA_ENABLE_XML_ENCODING) + ua_add_test(check_yxml.c) ua_add_test(check_types_builtin_xml.c) endif() diff --git a/tests/check_yxml.c b/tests/check_yxml.c new file mode 100644 index 000000000..c94731650 --- /dev/null +++ b/tests/check_yxml.c @@ -0,0 +1,33 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "ua_types_encoding_xml.h" +#include + +START_TEST(parseElement) { + const char *xml = "my-content"; + xml_token tokens[32]; + xml_result r = xml_tokenize(xml, (unsigned int)strlen(xml), tokens, 32); + ck_assert(r.error == XML_ERROR_NONE); +} END_TEST + +static Suite *testSuite_yxml(void) { + TCase *tc_parse= tcase_create("yxml_parse"); + tcase_add_test(tc_parse, parseElement); + + Suite *s = suite_create("Test XML decoding with the yxml library"); + suite_add_tcase(s, tc_parse); + return s; +} + +int main(void) { + int number_failed = 0; + Suite *s = testSuite_yxml(); + SRunner *sr = srunner_create(s); + srunner_set_fork_status(sr, CK_NOFORK); + srunner_run_all(sr, CK_NORMAL); + number_failed += srunner_ntests_failed(sr); + srunner_free(sr); + return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; +}