]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix spurious lib/dns/tests/update_test errors on macOS
authorOndřej Surý <ondrej@sury.org>
Tue, 18 Jun 2019 12:48:00 +0000 (14:48 +0200)
committerOndřej Surý <ondrej@sury.org>
Wed, 19 Jun 2019 11:31:43 +0000 (13:31 +0200)
lib/dns/tests/update_test was failing on macOS on random occasions.  It
turned out this was a linker problem - it preferred isc_stdtime_get()
from libisc instead of the local version in lib/dns/tests/update_test.c.

Fix by including the original .c file in the unit test.  This has two
benefits:

 a) linking order may no longer cause issues as symbols found in the
    same compilation unit are always preferred,

 b) it allows writing tests for static functions in lib/dns/update.c.

lib/dns/tests/update_test.c

index 70d6a6cb9a2f51a84222c6cd2f6088ca25e653cc..168d1be99e5bae5b8c65d902357d02215a9b71ff 100644 (file)
 
 #include "dnstest.h"
 
+/*
+ * Fix the linking order problem for overridden isc_stdtime_get() by making
+ * everything local.  This also allows static functions from update.c to be
+ * tested.
+ */
+#include "../update.c"
+
 static int
 _setup(void **state) {
        isc_result_t result;