tests CHANGE wrapping functions on OSX

OSX's linker does not support --wrap option to wrap a function. We use
it for testing, so disable such tests on OSX.
diff --git a/src/config.h.in b/src/config.h.in
index 2a2af23..0d9284b 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -15,6 +15,8 @@
 #ifndef LY_CONFIG_H_
 #define LY_CONFIG_H_
 
+#cmakedefine APPLE
+
 /**
  * @brief Compiler flag for unused function attributes
  */
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 68761ac..e8e1395 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -27,9 +27,11 @@
 # Set common attributes of all tests
 foreach(test_name IN LISTS tests)
     target_link_libraries(${test_name} ${CMOCKA_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${PCRE_LIBRARIES} m)
-    list(GET tests_wraps 0 test_wrap)
-    set_target_properties(${test_name} PROPERTIES LINK_FLAGS "${test_wrap}")
-    list(REMOVE_AT tests_wraps 0)
+    if (NOT APPLE)
+        list(GET tests_wraps 0 test_wrap)
+        set_target_properties(${test_name} PROPERTIES LINK_FLAGS "${test_wrap}")
+        list(REMOVE_AT tests_wraps 0)
+    endif()
     add_test(NAME ${test_name} COMMAND ${test_name})
 #    set_property(TEST ${test_name} PROPERTY ENVIRONMENT "LIBYANG_EXTENSIONS_PLUGINS_DIR=${CMAKE_BINARY_DIR}/src/extensions")
 #    set_property(TEST ${test_name} APPEND PROPERTY ENVIRONMENT "LIBYANG_USER_TYPES_PLUGINS_DIR=${CMAKE_BINARY_DIR}/src/user_types")
diff --git a/tests/src/test_common.c b/tests/src/test_common.c
index af839da..13da39b 100644
--- a/tests/src/test_common.c
+++ b/tests/src/test_common.c
@@ -83,6 +83,7 @@
     assert_int_equal(LY_EINVAL, ly_getutf8(&str, &c, &len));
 }
 
+#ifndef APPLE
 void *__real_realloc(void *ptr, size_t size);
 void *__wrap_realloc(void *ptr, size_t size)
 {
@@ -119,12 +120,15 @@
 
     /* ptr should be freed by ly_realloc() */
 }
+#endif /* not APPLE */
 
 int main(void)
 {
     const struct CMUnitTest tests[] = {
         cmocka_unit_test_setup(test_utf8, logger_setup),
+#ifndef APPLE
         cmocka_unit_test(test_lyrealloc),
+#endif
     };
 
     return cmocka_run_group_tests(tests, NULL, NULL);