tests CHANGE headers includes cleanup
Set necessary include directories instead of including library headers
in tests via relative path (which cause problems when building in
some nonstandard build directories).
diff --git a/tests/utests/data/test_new.c b/tests/utests/data/test_new.c
index 766bbff..8d96df1 100644
--- a/tests/utests/data/test_new.c
+++ b/tests/utests/data/test_new.c
@@ -18,7 +18,7 @@
#include <setjmp.h>
#include <cmocka.h>
-#include "../../src/libyang.h"
+#include "libyang.h"
#define BUFSIZE 1024
char logbuf[BUFSIZE] = {0};
diff --git a/tests/utests/data/test_parser_xml.c b/tests/utests/data/test_parser_xml.c
index 460eaa0..3671b32 100644
--- a/tests/utests/data/test_parser_xml.c
+++ b/tests/utests/data/test_parser_xml.c
@@ -12,8 +12,6 @@
* https://opensource.org/licenses/BSD-3-Clause
*/
-#include "tests/config.h"
-
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
@@ -22,11 +20,12 @@
#include <stdio.h>
#include <string.h>
-#include "../../src/context.h"
-#include "../../src/tree_data_internal.h"
-#include "../../src/tree_schema.h"
-#include "../../src/printer.h"
-#include "../../src/printer_data.h"
+#include "context.h"
+#include "printer.h"
+#include "printer_data.h"
+#include "tests/config.h"
+#include "tree_data_internal.h"
+#include "tree_schema.h"
#define BUFSIZE 1024
char logbuf[BUFSIZE] = {0};
diff --git a/tests/utests/data/test_printer_xml.c b/tests/utests/data/test_printer_xml.c
index 9e46a33..b1df7ab 100644
--- a/tests/utests/data/test_printer_xml.c
+++ b/tests/utests/data/test_printer_xml.c
@@ -21,12 +21,11 @@
#include <stdlib.h>
#include <string.h>
+#include "context.h"
+#include "printer.h"
+#include "printer_data.h"
#include "tests/config.h"
-
-#include "../../src/context.h"
-#include "../../src/printer.h"
-#include "../../src/printer_data.h"
-#include "../../src/tree_schema.h"
+#include "tree_schema.h"
#define BUFSIZE 1024
char logbuf[BUFSIZE] = {0};
diff --git a/tests/utests/data/test_tree_data.c b/tests/utests/data/test_tree_data.c
index 0a1075c..9c38db0 100644
--- a/tests/utests/data/test_tree_data.c
+++ b/tests/utests/data/test_tree_data.c
@@ -18,7 +18,7 @@
#include <setjmp.h>
#include <cmocka.h>
-#include "../../src/libyang.h"
+#include "libyang.h"
#define BUFSIZE 1024
char logbuf[BUFSIZE] = {0};
diff --git a/tests/utests/data/test_types.c b/tests/utests/data/test_types.c
index 59368fa..7775abd 100644
--- a/tests/utests/data/test_types.c
+++ b/tests/utests/data/test_types.c
@@ -20,8 +20,8 @@
#include <stdio.h>
#include <string.h>
-#include "../../src/libyang.h"
-#include "../../src/path.h"
+#include "libyang.h"
+#include "path.h"
#define BUFSIZE 1024
char logbuf[BUFSIZE] = {0};
diff --git a/tests/utests/data/test_validation.c b/tests/utests/data/test_validation.c
index f183eca..ce0a9a4 100644
--- a/tests/utests/data/test_validation.c
+++ b/tests/utests/data/test_validation.c
@@ -12,8 +12,6 @@
* https://opensource.org/licenses/BSD-3-Clause
*/
-#include "tests/config.h"
-
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
@@ -22,11 +20,12 @@
#include <stdio.h>
#include <string.h>
-#include "../../src/context.h"
-#include "../../src/tree_schema.h"
-#include "../../src/tree_data_internal.h"
-#include "../../src/printer.h"
-#include "../../src/printer_data.h"
+#include "context.h"
+#include "printer.h"
+#include "printer_data.h"
+#include "tests/config.h"
+#include "tree_schema.h"
+#include "tree_data_internal.h"
#define BUFSIZE 1024
char logbuf[BUFSIZE] = {0};
diff --git a/tests/utests/extensions/test_metadata.c b/tests/utests/extensions/test_metadata.c
index a97db00..f8353d2 100644
--- a/tests/utests/extensions/test_metadata.c
+++ b/tests/utests/extensions/test_metadata.c
@@ -12,8 +12,6 @@
* https://opensource.org/licenses/BSD-3-Clause
*/
-#include "tests/config.h"
-
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
@@ -22,8 +20,8 @@
#include <stdio.h>
#include <string.h>
-#include "../../src/libyang.h"
-#include "../../src/plugins_exts_metadata.h"
+#include "libyang.h"
+#include "plugins_exts_metadata.h"
#define BUFSIZE 1024
char logbuf[BUFSIZE] = {0};
diff --git a/tests/utests/extensions/test_nacm.c b/tests/utests/extensions/test_nacm.c
index 449d163..c95afaa 100644
--- a/tests/utests/extensions/test_nacm.c
+++ b/tests/utests/extensions/test_nacm.c
@@ -12,8 +12,6 @@
* https://opensource.org/licenses/BSD-3-Clause
*/
-#include "tests/config.h"
-
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
@@ -22,7 +20,8 @@
#include <stdio.h>
#include <string.h>
-#include "../../src/libyang.h"
+#include "libyang.h"
+#include "tests/config.h"
#define BUFSIZE 1024
char logbuf[BUFSIZE] = {0};
diff --git a/tests/utests/schema/test_parser_yang.c b/tests/utests/schema/test_parser_yang.c
index 31b9c34..c51bafe 100644
--- a/tests/utests/schema/test_parser_yang.c
+++ b/tests/utests/schema/test_parser_yang.c
@@ -20,10 +20,10 @@
#include <stdio.h>
#include <string.h>
-#include "../../../src/common.h"
-#include "../../../src/tree_schema.h"
-#include "../../../src/tree_schema_internal.h"
-#include "../../../src/parser_internal.h"
+#include "common.h"
+#include "parser_internal.h"
+#include "tree_schema.h"
+#include "tree_schema_internal.h"
/* originally static functions from tree_schema_free.c and parser_yang.c */
void lysp_ext_instance_free(struct ly_ctx *ctx, struct lysp_ext_instance *ext);
diff --git a/tests/utests/schema/test_parser_yin.c b/tests/utests/schema/test_parser_yin.c
index d2576b9..737d2d5 100644
--- a/tests/utests/schema/test_parser_yin.c
+++ b/tests/utests/schema/test_parser_yin.c
@@ -21,13 +21,13 @@
#include <string.h>
#include <stdbool.h>
-#include "../../../src/common.h"
-#include "../../../src/tree_schema.h"
-#include "../../../src/tree_schema_internal.h"
-#include "../../../src/parser_internal.h"
-#include "../../../src/parser_yin.h"
-#include "../../../src/xml.h"
-#include "../../../src/xpath.h"
+#include "common.h"
+#include "parser_internal.h"
+#include "parser_yin.h"
+#include "tree_schema.h"
+#include "tree_schema_internal.h"
+#include "xml.h"
+#include "xpath.h"
/* prototypes of static functions */
void lysp_ext_instance_free(struct ly_ctx *ctx, struct lysp_ext_instance *ext);
diff --git a/tests/utests/schema/test_printer_yang.c b/tests/utests/schema/test_printer_yang.c
index feea18e..24e8b31 100644
--- a/tests/utests/schema/test_printer_yang.c
+++ b/tests/utests/schema/test_printer_yang.c
@@ -20,9 +20,9 @@
#include <stdio.h>
#include <string.h>
-#include "../../src/context.h"
-#include "../../src/printer.h"
-#include "../../src/printer_schema.h"
+#include "context.h"
+#include "printer.h"
+#include "printer_schema.h"
#define BUFSIZE 1024
char logbuf[BUFSIZE] = {0};
diff --git a/tests/utests/schema/test_printer_yin.c b/tests/utests/schema/test_printer_yin.c
index 8a1fee9..2d82f88 100644
--- a/tests/utests/schema/test_printer_yin.c
+++ b/tests/utests/schema/test_printer_yin.c
@@ -21,9 +21,9 @@
#include <stdlib.h>
#include <string.h>
-#include "../../src/context.h"
-#include "../../src/printer.h"
-#include "../../src/printer_schema.h"
+#include "context.h"
+#include "printer.h"
+#include "printer_schema.h"
#define BUFSIZE 1024
char logbuf[BUFSIZE] = {0};
diff --git a/tests/utests/schema/test_schema.c b/tests/utests/schema/test_schema.c
index ffb7195..9a03332 100644
--- a/tests/utests/schema/test_schema.c
+++ b/tests/utests/schema/test_schema.c
@@ -22,9 +22,9 @@
#include <string.h>
-#include "config.h"
#include "log.h"
#include "parser_schema.h"
+#include "tests/config.h"
#include "tree_schema.h"
#if ENABLE_LOGGER_CHECKING
diff --git a/tests/utests/schema/test_schema.h b/tests/utests/schema/test_schema.h
index b6f1929..d0212fb 100644
--- a/tests/utests/schema/test_schema.h
+++ b/tests/utests/schema/test_schema.h
@@ -14,9 +14,9 @@
#ifndef TESTS_UTESTS_SCHEMA_TEST_SCHEMA_H_
#define TESTS_UTESTS_SCHEMA_TEST_SCHEMA_H_
-#include "config.h"
#include "log.h"
#include "parser_schema.h"
+#include "tests/config.h"
/* set to 0 to printing error messages to stderr instead of checking them in code */
#define ENABLE_LOGGER_CHECKING 1
diff --git a/tests/utests/schema/test_tree_schema_compile.c b/tests/utests/schema/test_tree_schema_compile.c
index ea6166e..85dcf0e 100644
--- a/tests/utests/schema/test_tree_schema_compile.c
+++ b/tests/utests/schema/test_tree_schema_compile.c
@@ -20,11 +20,11 @@
#include <stdio.h>
#include <string.h>
-#include "../../../src/common.h"
-#include "../../../src/tree_schema_internal.h"
-#include "../../../src/parser_internal.h"
-#include "../../../src/xpath.h"
-#include "../../../src/plugins_types.h"
+#include "common.h"
+#include "parser_internal.h"
+#include "plugins_types.h"
+#include "tree_schema_internal.h"
+#include "xpath.h"
void lysc_feature_free(struct ly_ctx *ctx, struct lysc_feature *feat);
void yang_parser_ctx_free(struct lys_yang_parser_ctx *ctx);
diff --git a/tests/utests/test_common.c b/tests/utests/test_common.c
index 0984e1e..d6e9ca3 100644
--- a/tests/utests/test_common.c
+++ b/tests/utests/test_common.c
@@ -12,8 +12,6 @@
* https://opensource.org/licenses/BSD-3-Clause
*/
-
-
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
@@ -23,7 +21,7 @@
#include <stdlib.h>
#include <stdio.h>
-#include "../../src/common.h"
+#include "common.h"
#define BUFSIZE 1024
char logbuf[BUFSIZE] = {0};
diff --git a/tests/utests/test_context.c b/tests/utests/test_context.c
index d55e5b1..5f14972 100644
--- a/tests/utests/test_context.c
+++ b/tests/utests/test_context.c
@@ -12,8 +12,6 @@
* https://opensource.org/licenses/BSD-3-Clause
*/
-#include "tests/config.h"
-
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
@@ -22,9 +20,10 @@
#include <string.h>
#include <stdio.h>
-#include "../../src/common.h"
-#include "../../src/context.h"
-#include "../../src/tree_schema_internal.h"
+#include "common.h"
+#include "context.h"
+#include "tests/config.h"
+#include "tree_schema_internal.h"
#define BUFSIZE 1024
char logbuf[BUFSIZE] = {0};
diff --git a/tests/utests/test_hash_table.c b/tests/utests/test_hash_table.c
index 3e17552..cddec32 100644
--- a/tests/utests/test_hash_table.c
+++ b/tests/utests/test_hash_table.c
@@ -14,10 +14,6 @@
#define _GNU_SOURCE
-#include "common.h"
-
-#include "tests/config.h"
-
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
@@ -27,7 +23,8 @@
#include <stdlib.h>
#include <stdio.h>
-#include "../../src/hash_table.h"
+#include "common.h"
+#include "hash_table.h"
struct ht_rec *lyht_get_rec(unsigned char *recs, uint16_t rec_size, uint32_t idx);
diff --git a/tests/utests/test_inout.c b/tests/utests/test_inout.c
index cbec9c7..1542d0f 100644
--- a/tests/utests/test_inout.c
+++ b/tests/utests/test_inout.c
@@ -12,7 +12,7 @@
* https://opensource.org/licenses/BSD-3-Clause
*/
-#include "tests/config.h"
+#define _POSIX_C_SOURCE 200112L
#include <stdarg.h>
#include <stddef.h>
@@ -21,14 +21,15 @@
#include <errno.h>
#include <fcntl.h>
+#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
-#include "../../src/common.h"
-#include "../../src/log.h"
-#include "../../src/printer.h"
-#include "../../src/parser.h"
+#include "common.h"
+#include "log.h"
+#include "printer.h"
+#include "parser.h"
#define BUFSIZE 1024
diff --git a/tests/utests/test_set.c b/tests/utests/test_set.c
index 30a775d..d53d7c2 100644
--- a/tests/utests/test_set.c
+++ b/tests/utests/test_set.c
@@ -22,7 +22,7 @@
#include <cmocka.h>
-#include "../../src/set.h"
+#include "set.h"
#define BUFSIZE 1024
char logbuf[BUFSIZE] = {0};
diff --git a/tests/utests/test_xml.c b/tests/utests/test_xml.c
index 7710082..e9e22e1 100644
--- a/tests/utests/test_xml.c
+++ b/tests/utests/test_xml.c
@@ -24,8 +24,8 @@
#include <stdio.h>
#include <string.h>
-#include "../../src/xml.h"
-#include "../../src/context.h"
+#include "xml.h"
+#include "context.h"
LY_ERR lyxml_ns_add(struct lyxml_ctx *xmlctx, const char *prefix, size_t prefix_len, char *uri);
LY_ERR lyxml_ns_rm(struct lyxml_ctx *xmlctx);
diff --git a/tests/utests/test_xpath.c b/tests/utests/test_xpath.c
index 1552512..be70384 100644
--- a/tests/utests/test_xpath.c
+++ b/tests/utests/test_xpath.c
@@ -12,8 +12,6 @@
* https://opensource.org/licenses/BSD-3-Clause
*/
-#include "tests/config.h"
-
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
@@ -22,10 +20,11 @@
#include <stdio.h>
#include <string.h>
-#include "../../src/context.h"
-#include "../../src/set.h"
-#include "../../src/tree_data.h"
-#include "../../src/tree_schema.h"
+#include "context.h"
+#include "set.h"
+#include "tests/config.h"
+#include "tree_data.h"
+#include "tree_schema.h"
#define BUFSIZE 1024
char logbuf[BUFSIZE] = {0};
diff --git a/tests/utests/test_yanglib.c b/tests/utests/test_yanglib.c
index 15afc81..824f2c2 100644
--- a/tests/utests/test_yanglib.c
+++ b/tests/utests/test_yanglib.c
@@ -20,13 +20,12 @@
#include <cmocka.h>
+#include "context.h"
+#include "log.h"
+#include "set.h"
#include "tests/config.h"
-
-#include "../../src/context.h"
-#include "../../src/log.h"
-#include "../../src/set.h"
-#include "../../src/tree_data.h"
-#include "../../src/tree_schema.h"
+#include "tree_data.h"
+#include "tree_schema.h"
#define BUFSIZE 1024
char logbuf[BUFSIZE] = {0};