Tweak lib/dns/tests/tkey_test requirements

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.
This commit is contained in:
Michał Kępień
2019-09-12 14:25:57 +02:00
parent 119f3e0c2e
commit 154f2ca6f6

View 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 */