From: Arran Cudbard-Bell Date: Mon, 29 Apr 2019 19:28:10 +0000 (-0400) Subject: Place a marker where result stopped matching expected X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=96bd26b555ffde1502f1f9f38b59017289804740;p=thirdparty%2Ffreeradius-server.git Place a marker where result stopped matching expected --- diff --git a/src/bin/unit_test_attribute.c b/src/bin/unit_test_attribute.c index d4f4419f85e..6b6cd08ec57 100644 --- a/src/bin/unit_test_attribute.c +++ b/src/bin/unit_test_attribute.c @@ -812,21 +812,22 @@ static void command_parse(TALLOC_CTX *ctx, char *input, char *output, size_t out snprintf(output, outlen, "Unknown command '%s'", input); } + static int process_file(TALLOC_CTX *ctx, CONF_SECTION *features, fr_dict_t *dict, const char *root_dir, char const *filename) { - int lineno; - size_t i, outlen; - ssize_t len, data_len; - FILE *fp; - char input[8192], buffer[8192]; - char output[8192]; - char directory[8192]; - uint8_t *attr, data[2048]; - TALLOC_CTX *tp_ctx = talloc_named_const(ctx, 0, "tp_ctx"); - fr_dict_t *proto_dict = NULL; - - bool encode_error = false; //!< Whether the last encode errored. + int lineno; + size_t i, outlen; + ssize_t len, data_len; + FILE *fp; + char input[8192], buffer[8192]; + char output[8192]; + char directory[8192]; + uint8_t *attr, data[2048]; + TALLOC_CTX *tp_ctx = talloc_named_const(ctx, 0, "tp_ctx"); + fr_dict_t *proto_dict = NULL; + + bool encode_error = false; //!< Whether the last encode errored. #define CLEAR_TEST_POINT \ do { \ @@ -908,6 +909,8 @@ do { \ strlcpy(test_type, p, (q - p) + 1); if (strcmp(test_type, "data") == 0) { + char *spaces; + encode_error = false; /* Clear the encode error if we're doing a comparison */ /* @@ -933,8 +936,11 @@ do { \ b++; } - fprintf(stderr, "\tdiffer at %zd\n\tgot ... %s\n\texpected ... %s\n", - (b - output), b, a); + spaces = talloc_array(NULL, char, (b - output) + 1); + memset(spaces, ' ', (b - output)); + spaces[(b - output)] = '\0'; + fprintf(stderr, "\t %s^ differs here\n", spaces, b, a); + talloc_free(spaces); goto error; }