From: Andrew Dunstan <andrew@dunslane.net>
Date: Sat, 17 Mar 2012 21:24:15 +0000 (-0400)
Subject: Honor inputdir and outputdir when converting regression files.
X-Git-Tag: REL9_0_8~49
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c0998cfa53051eebbda90f2ca8d9058938c5e005;p=postgresql

Honor inputdir and outputdir when converting regression files.

When converting source files, pg_regress' inputdir and outputdir options were
ignored when computing the locations of the destination files. In consequence,
these options were effectively unusable when the regression inputs need to
be adjusted by pg_regress. This patch makes pg_regress put the converted files
in the same place that these options specify non-converted input or results
files are to be found. Backpatched to all live branches.
---

diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index 977a8c7cb7..0aa2ae7f87 100644
--- a/src/test/regress/pg_regress.c
+++ b/src/test/regress/pg_regress.c
@@ -413,7 +413,7 @@ replace_string(char *string, char *replace, char *replacement)
  * the given suffix.
  */
 static void
-convert_sourcefiles_in(char *source_subdir, char *dest_subdir, char *suffix)
+convert_sourcefiles_in(char *source_subdir, char *dest_dir, char *dest_subdir, char *suffix)
 {
 	char		testtablespace[MAXPGPATH];
 	char		indir[MAXPGPATH];
@@ -481,7 +481,8 @@ convert_sourcefiles_in(char *source_subdir, char *dest_subdir, char *suffix)
 		/* build the full actual paths to open */
 		snprintf(prefix, strlen(*name) - 6, "%s", *name);
 		snprintf(srcfile, MAXPGPATH, "%s/%s", indir, *name);
-		snprintf(destfile, MAXPGPATH, "%s/%s.%s", dest_subdir, prefix, suffix);
+		snprintf(destfile, MAXPGPATH, "%s/%s/%s.%s", dest_dir, dest_subdir, 
+				 prefix, suffix);
 
 		infile = fopen(srcfile, "r");
 		if (!infile)
@@ -528,8 +529,8 @@ convert_sourcefiles_in(char *source_subdir, char *dest_subdir, char *suffix)
 static void
 convert_sourcefiles(void)
 {
-	convert_sourcefiles_in("input", "sql", "sql");
-	convert_sourcefiles_in("output", "expected", "out");
+	convert_sourcefiles_in("input", inputdir, "sql", "sql");
+	convert_sourcefiles_in("output", outputdir, "expected", "out");
 }
 
 /*