]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Tweak lib/dns/tests/tkey_test requirements
authorMichał Kępień <michal@isc.org>
Thu, 12 Sep 2019 12:25:57 +0000 (14:25 +0200)
committerMichał Kępień <michal@isc.org>
Thu, 12 Sep 2019 12:25:57 +0000 (14:25 +0200)
Currently, the lib/dns/tests/tkey_test unit test is only run when the
linker supports the --wrap option.  However, linker support for that
option is only needed for static builds.  As a result, the unit test
mentioned before is not being run everywhere it can be run as even for
builds done using --with-libtool, the test is not run unless the linker
supports the --wrap option.

Tweak preprocessor directives in lib/dns/tests/tkey_test.c so that this
test is run:

  - for all builds using --with-libtool,
  - for static builds done using a linker supporting the --wrap option.

lib/dns/tests/tkey_test.c

index 5b91aa0a02e75cf39ebe8cd940bb4b23a0345113..f89611206e96078e996fed06ada12eff0549cedf 100644 (file)
@@ -27,7 +27,7 @@
 
 #include <dns/tkey.h>
 
-#if LD_WRAP
+#if defined(USE_LIBTOOL) || LD_WRAP
 static isc_mem_t mock_mctx = {
        .impmagic = 0,
        .magic = ISCAPI_MCTX_MAGIC,
@@ -167,11 +167,11 @@ dns_tkeyctx_destroy_test(void **state) {
        assert_non_null(tctx);
        dns_tkeyctx_destroy(&tctx);
 }
-#endif /* LD_WRAP */
+#endif /* defined(USE_LIBTOOL) || LD_WRAP */
 
 int
 main(void) {
-#if LD_WRAP
+#if defined(USE_LIBTOOL) || LD_WRAP
        const struct CMUnitTest tkey_tests[] = {
                cmocka_unit_test_teardown(dns_tkeyctx_create_test, _teardown),
                cmocka_unit_test_setup(dns_tkeyctx_destroy_test, _setup),
@@ -187,9 +187,9 @@ main(void) {
 #endif
        };
        return (cmocka_run_group_tests(tkey_tests, NULL, NULL));
-#else /* LD_WRAP */
-       print_message("1..0 # Skip tkey_test requires LD_WRAP\n");
-#endif /* LD_WRAP */
+#else /* defined(USE_LIBTOOL) || LD_WRAP */
+       print_message("1..0 # Skip tkey_test requires libtool or LD_WRAP\n");
+#endif /* defined(USE_LIBTOOL) || LD_WRAP */
 }
 
 #else /* CMOCKA */