diff --git a/lib/dns/tests/dnstest.c b/lib/dns/tests/dnstest.c index 4b0923c5fc..51f425e3a4 100644 --- a/lib/dns/tests/dnstest.c +++ b/lib/dns/tests/dnstest.c @@ -115,8 +115,10 @@ dns_test_begin(FILE *logfile, bool start_managers) { isc_mem_debugging |= ISC_MEM_DEBUGRECORD; CHECK(isc_mem_create(0, 0, &mctx)); - CHECK(dst_lib_init(mctx, NULL)); - dst_active = true; + if (!dst_active) { + CHECK(dst_lib_init(mctx, NULL)); + dst_active = true; + } if (logfile != NULL) { isc_logdestination_t destination; @@ -145,12 +147,13 @@ dns_test_begin(FILE *logfile, bool start_managers) { CHECK(create_managers()); /* - * atf-run changes us to a /tmp directory, so tests + * The caller might run from another directory, so tests * that access test data files must first chdir to the proper * location. */ - if (chdir(TESTS) == -1) + if (chdir(TESTS) == -1) { CHECK(ISC_R_FAILURE); + } return (ISC_R_SUCCESS); diff --git a/lib/dns/tests/tkey_test.c b/lib/dns/tests/tkey_test.c index e2610f29a6..844a35289a 100644 --- a/lib/dns/tests/tkey_test.c +++ b/lib/dns/tests/tkey_test.c @@ -102,44 +102,37 @@ dns_tkeyctx_destroy_test(void **state) { dns_tkeyctx_destroy(&tctx); } -#else /* LD_WRAP */ - -#define _setup NULL -#define _teardown NULL - -static void -dns_tkeyctx_create_test(void **state __attribute__ ((unused))) { - skip(); -} - -static void -dns_tkeyctx_destroy_test(void **state __attribute__ ((unused))) { - skip(); -} - #endif /* LD_WRAP */ -int main(void) { +int +main(void) { +#if LD_WRAP const struct CMUnitTest tkey_tests[] = { cmocka_unit_test_teardown(dns_tkeyctx_create_test, _teardown), - /* cmocka_unit_test(dns_tkey_processquery_test), */ - /* cmocka_unit_test(dns_tkey_builddhquery_test), */ - /* cmocka_unit_test(dns_tkey_buildgssquery_test), */ - /* cmocka_unit_test(dns_tkey_builddeletequery_test), */ - /* cmocka_unit_test(dns_tkey_processdhresponse_test), */ - /* cmocka_unit_test(dns_tkey_processgssresponse_test), */ - /* cmocka_unit_test(dns_tkey_processdeleteresponse_test), */ - /* cmocka_unit_test(dns_tkey_gssnegotiate_test), */ cmocka_unit_test_setup(dns_tkeyctx_destroy_test, _setup), +#if 0 /* not yet */ + cmocka_unit_test(dns_tkey_processquery_test), + cmocka_unit_test(dns_tkey_builddhquery_test), + cmocka_unit_test(dns_tkey_buildgssquery_test), + cmocka_unit_test(dns_tkey_builddeletequery_test), + cmocka_unit_test(dns_tkey_processdhresponse_test), + cmocka_unit_test(dns_tkey_processgssresponse_test), + cmocka_unit_test(dns_tkey_processdeleteresponse_test), + cmocka_unit_test(dns_tkey_gssnegotiate_test), +#endif }; return (cmocka_run_group_tests(tkey_tests, NULL, NULL)); +#else + print_message("1..0 # Skip tkey_test requires LD_WRAP"); +#endif /* LD_WRAP */ } #else #include -int main(void) { +int +main(void) { printf("1..0 # Skipped: cmocka not available\n"); return (0); } diff --git a/lib/irs/tests/Makefile.in b/lib/irs/tests/Makefile.in index 80d37c98b9..db9816dbdb 100644 --- a/lib/irs/tests/Makefile.in +++ b/lib/irs/tests/Makefile.in @@ -33,6 +33,9 @@ IRSDEPLIBS = ../libirs.@A@ LIBS = ${IRSLIBS} ${CFGLIBS} ${DNSLIBS} ${ISCLIBS} @LIBS@ @ATFLIBS@ +CMOCKA_CFLAGS = @CMOCKA_CFLAGS@ +CMOCKA_LIBS = @CMOCKA_LIBS@ + OBJS = SRCS = resconf_test.c diff --git a/lib/isccc/tests/Makefile.in b/lib/isccc/tests/Makefile.in index a57261a113..0c0ac6978e 100644 --- a/lib/isccc/tests/Makefile.in +++ b/lib/isccc/tests/Makefile.in @@ -27,10 +27,8 @@ ISCDEPLIBS = ../../isc/libisc.@A@ ISCCCLIBS = ../libisccc.@A@ ISCCCDEPLIBS = ../libisccc.@A@ -LIBS = @LIBS@ @ATFLIBS@ - -CMOCKA_CFLAGS = @CMOCKA_CFLAGS@ -CMOCKA_LIBS = @CMOCKA_LIBS@ +CFLAGS = @CFLAGS@ @CMOCKA_CFLAGS@ +LIBS = @LIBS@ @CMOCKA_LIBS@ OBJS = SRCS = result_test.c @@ -40,9 +38,9 @@ TARGETS = result_test@EXEEXT@ @BIND9_MAKE_RULES@ result_test@EXEEXT@: result_test.@O@ ${ISCDEPLIBS} ${ISCCCDEPLIBS} - ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${CMOCKA_FLAGS} \ + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \ ${LDFLAGS} -o $@ result_test.@O@ \ - ${ISCCCLIBS} ${ISCLIBS} ${LIBS} ${CMOCKA_LIBS} + ${ISCCCLIBS} ${ISCLIBS} ${LIBS} unit:: sh ${top_builddir}/unit/unittest.sh diff --git a/lib/isccfg/tests/Makefile.in b/lib/isccfg/tests/Makefile.in index 2058396153..d8f7b29c2a 100644 --- a/lib/isccfg/tests/Makefile.in +++ b/lib/isccfg/tests/Makefile.in @@ -33,6 +33,9 @@ ISCCFGDEPLIBS = ../libisccfg.@A@ LIBS = @LIBS@ @ATFLIBS@ +CMOCKA_CFLAGS = @CMOCKA_CFLAGS@ +CMOCKA_LIBS = @CMOCKA_LIBS@ + OBJS = SRCS = parser_test.c diff --git a/lib/ns/tests/Makefile.in b/lib/ns/tests/Makefile.in index 930f0c509a..3e19770aa3 100644 --- a/lib/ns/tests/Makefile.in +++ b/lib/ns/tests/Makefile.in @@ -32,6 +32,9 @@ NSDEPLIBS = ../libns.@A@ LIBS = @LIBS@ @ATFLIBS@ +CMOCKA_CFLAGS = @CMOCKA_CFLAGS@ +CMOCKA_LIBS = @CMOCKA_LIBS@ + OBJS = nstest.@O@ SRCS = nstest.c \ listenlist_test.c \