]> granicus.if.org Git - postgresql/commitdiff
Use standard diff separator for regression.diffs
authorPeter Eisentraut <peter@eisentraut.org>
Wed, 2 Jan 2019 20:24:51 +0000 (21:24 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Fri, 15 Feb 2019 14:09:50 +0000 (15:09 +0100)
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.

Discussion: https://www.postgresql.org/message-id/70440c81-37bb-76dd-e48b-b5a9550d5613@2ndquadrant.com

src/test/regress/pg_regress.c

index a4caa228e28ea06d46744dc821982ae71473c8f4..10111ebfb913941518504b3b3700ce99477f7001 100644 (file)
@@ -1454,20 +1454,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;
 }