On 03/01/2019 10:39, Christoph Berg wrote:
> It will especially say which _alternate.out file was used, which seems
> like a big win. So +1.

It already shows that in the existing diff output header.

Although if you have a really long absolute path, it might be hard to
find it.  So perhaps the attached patch to make it more readable.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From ac586a4fa2186b4cf85c4b7c7e0269fac1af402e Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Thu, 3 Jan 2019 12:12:21 +0100
Subject: [PATCH] pg_regress: Don't use absolute paths for the diff

Don't expand inputfile and outputfile to absolute paths globally, just
where needed.  In particular, pass them as is to the file name
arguments of the diff command, so that we don't see the full absolute
path in the diff header, which makes the diff unnecessarily verbose
and harder to read.
---
 src/test/regress/pg_regress.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index 9786e86211..4970b74f1b 100644
--- a/src/test/regress/pg_regress.c
+++ b/src/test/regress/pg_regress.c
@@ -488,7 +488,7 @@ convert_sourcefiles_in(const char *source_subdir, const 
char *dest_dir, const ch
                /* Error logged in pgfnames */
                exit(2);
 
-       snprintf(testtablespace, MAXPGPATH, "%s/testtablespace", outputdir);
+       snprintf(testtablespace, MAXPGPATH, "%s/testtablespace", 
make_absolute_path(outputdir));
 
 #ifdef WIN32
 
@@ -552,10 +552,10 @@ convert_sourcefiles_in(const char *source_subdir, const 
char *dest_dir, const ch
                }
                while (fgets(line, sizeof(line), infile))
                {
-                       replace_string(line, "@abs_srcdir@", inputdir);
-                       replace_string(line, "@abs_builddir@", outputdir);
+                       replace_string(line, "@abs_srcdir@", 
make_absolute_path(inputdir));
+                       replace_string(line, "@abs_builddir@", 
make_absolute_path(outputdir));
                        replace_string(line, "@testtablespace@", 
testtablespace);
-                       replace_string(line, "@libdir@", dlpath);
+                       replace_string(line, "@libdir@", 
make_absolute_path(dlpath));
                        replace_string(line, "@DLSUFFIX@", DLSUFFIX);
                        fputs(line, outfile);
                }
@@ -2220,10 +2220,6 @@ regression_main(int argc, char *argv[], init_function 
ifunc, test_function tfunc
                 */
                port = 0xC000 | (PG_VERSION_NUM & 0x3FFF);
 
-       inputdir = make_absolute_path(inputdir);
-       outputdir = make_absolute_path(outputdir);
-       dlpath = make_absolute_path(dlpath);
-
        /*
         * Initialization
         */
@@ -2569,7 +2565,7 @@ regression_main(int argc, char *argv[], init_function 
ifunc, test_function tfunc
                printf(_("The differences that caused some tests to fail can be 
viewed in the\n"
                                 "file \"%s\".  A copy of the test summary that 
you see\n"
                                 "above is saved in the file \"%s\".\n\n"),
-                          difffilename, logfilename);
+                          make_absolute_path(difffilename), 
make_absolute_path(logfilename));
        }
        else
        {
-- 
2.20.1

Reply via email to