From 88a05a99d49e077de35760c1b409bb36139981e0 Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Sat, 6 Apr 2019 08:57:36 -0400 Subject: [PATCH] print out where the output differs which helps with long output --- src/bin/unit_test_attribute.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/bin/unit_test_attribute.c b/src/bin/unit_test_attribute.c index c58759b4780e..d4f4419f85ea 100644 --- a/src/bin/unit_test_attribute.c +++ b/src/bin/unit_test_attribute.c @@ -920,8 +920,22 @@ do { \ } if (strcmp(p + 5, output) != 0) { + char *a, *b; + fprintf(stderr, "Mismatch at line %d of %s\n\tgot : %s\n\texpected : %s\n", lineno, directory, output, p + 5); + + a = p + 5; + b = output; + + while (*a == *b) { + a++; + b++; + } + + fprintf(stderr, "\tdiffer at %zd\n\tgot ... %s\n\texpected ... %s\n", + (b - output), b, a); + goto error; } fr_strerror(); /* Clear the error buffer */