diff --git a/lib/dns/tests/rdata_test.c b/lib/dns/tests/rdata_test.c index 55e9e149fb..e692b06e40 100644 --- a/lib/dns/tests/rdata_test.c +++ b/lib/dns/tests/rdata_test.c @@ -34,6 +34,8 @@ #include "dnstest.h" +static bool debug = false; + /* * An array of these structures is passed to compare_ok(). */ @@ -219,8 +221,14 @@ check_text_ok_single(const text_ok_t *text_ok, dns_rdataclass_t rdclass, * Check whether result is as expected. */ if (text_ok->text_out != NULL) { + if (debug && result != ISC_R_SUCCESS) { + fprintf(stdout, "#'%s'\n", text_ok->text_in); + } assert_int_equal(result, ISC_R_SUCCESS); } else { + if (debug && result == ISC_R_SUCCESS) { + fprintf(stdout, "#'%s'\n", text_ok->text_in); + } assert_int_not_equal(result, ISC_R_SUCCESS); } @@ -245,6 +253,10 @@ check_text_ok_single(const text_ok_t *text_ok, dns_rdataclass_t rdclass, * unused part of the buffer. */ isc_buffer_putuint8(&target, 0); + if (debug && strcmp(buf_totext, text_ok->text_out) != 0) { + fprintf(stdout, "# '%s' != '%s'\n", + buf_totext, text_ok->text_out); + } assert_string_equal(buf_totext, text_ok->text_out); /* @@ -294,6 +306,9 @@ check_text_conversions(dns_rdata_t *rdata) { * unused part of the buffer. */ isc_buffer_putuint8(&target, 0); + if (debug) { + fprintf(stdout, "#'%s'\n", buf_totext); + } /* * Try parsing text form RDATA output by dns_rdata_totext() again. @@ -340,6 +355,9 @@ check_multiline_text_conversions(dns_rdata_t *rdata) { * writing into the apparently unused part of the buffer. */ isc_buffer_putuint8(&target, 0); + if (debug) { + fprintf(stdout, "#'%s'\n", buf_totext); + } /* * Try parsing multi-line text form RDATA output by @@ -2340,7 +2358,7 @@ iszonecutauth(void **state) { } int -main(void) { +main(int argc, char **argv) { const struct CMUnitTest tests[] = { cmocka_unit_test_setup_teardown(amtrelay, _setup, _teardown), cmocka_unit_test_setup_teardown(apl, _setup, _teardown), @@ -2368,6 +2386,12 @@ main(void) { cmocka_unit_test_setup_teardown(iszonecutauth, NULL, NULL), }; + UNUSED(argv); + + if (argc > 1) { + debug = true; + } + return (cmocka_run_group_tests(tests, NULL, NULL)); }