tests CHANGE speedup building

Instead of including C source files and bilding each test from the
sources, use shared library objects and link them into the resulting
test executable.

Maintaining list of included C source files was unmaintainable with the
increasing number of source files and dependencies between them.
diff --git a/tests/src/test_tree_schema.c b/tests/src/test_tree_schema.c
index 0f00bbc..bcee581 100644
--- a/tests/src/test_tree_schema.c
+++ b/tests/src/test_tree_schema.c
@@ -12,27 +12,14 @@
  *     https://opensource.org/licenses/BSD-3-Clause
  */
 
-#include "../../src/common.c"
-#include "../../src/compat.c"
-#include "../../src/log.c"
-#include "../../src/set.c"
-#include "../../src/parser_yang.c"
-#include "../../src/tree_schema.c"
-#include "../../src/tree_schema_compile.c"
-#include "../../src/tree_schema_free.c"
-#include "../../src/tree_schema_helpers.c"
-#include "../../src/plugins_types.c"
-#include "../../src/hash_table.c"
-#include "../../src/xpath.c"
-#include "../../src/context.c"
-
 #include <stdarg.h>
 #include <stddef.h>
 #include <stdio.h>
 #include <setjmp.h>
 #include <cmocka.h>
 
-#include "libyang.h"
+#include "../../src/common.h"
+#include "../../src/tree_schema.h"
 
 #define BUFSIZE 1024
 char logbuf[BUFSIZE] = {0};