On 22/11/2018 14:10, Christoph Berg wrote: > It's nice that PG_REGRESS_DIFF_OPTS exists, but the diffs are often > coming from automated build logs where setting the variable after the > fact doesn't help. > > Please consider the attached patch, extension packagers will thank > you.
Committed. While we're considering the pg_regress output, what do you think about replacing the ======... separator with a standard diff separator like "diff %s %s %s\n". This would make the file behave more like a proper diff file, for use with other tools. And it shows the diff options used, for clarity. See attached patch. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
>From 00380be627fd1df6dd0474380d31fd76fcb644de Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <pe...@eisentraut.org> Date: Wed, 2 Jan 2019 21:24:51 +0100 Subject: [PATCH] Use standard diff separator for regression.diffs Instead of ======..., use the standard separator for a multi-file diff, which is, per POSIX, "diff %s %s %s\n", <diff_options>, <filename1>, <filename2> This makes regression.diffs behave more like a proper diff file, for use with other tools. And it shows the diff options used, for clarity. --- src/test/regress/pg_regress.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c index 2c469413a3..9786e86211 100644 --- a/src/test/regress/pg_regress.c +++ b/src/test/regress/pg_regress.c @@ -1453,20 +1453,23 @@ results_differ(const char *testname, const char *resultsfile, const char *defaul * Use the best comparison file to generate the "pretty" diff, which we * append to the diffs summary file. */ - snprintf(cmd, sizeof(cmd), - "diff %s \"%s\" \"%s\" >> \"%s\"", - pretty_diff_opts, best_expect_file, resultsfile, difffilename); - run_diff(cmd, difffilename); - /* And append a separator */ + /* Write diff header */ difffile = fopen(difffilename, "a"); if (difffile) { fprintf(difffile, - "\n======================================================================\n\n"); + "diff %s %s %s\n", + pretty_diff_opts, best_expect_file, resultsfile); fclose(difffile); } + /* Run diff */ + snprintf(cmd, sizeof(cmd), + "diff %s \"%s\" \"%s\" >> \"%s\"", + pretty_diff_opts, best_expect_file, resultsfile, difffilename); + run_diff(cmd, difffilename); + unlink(diff); return true; } -- 2.20.1