]> granicus.if.org Git - postgresql/commitdiff
Honor inputdir and outputdir when converting regression files.
authorAndrew Dunstan <andrew@dunslane.net>
Sat, 17 Mar 2012 21:24:14 +0000 (17:24 -0400)
committerAndrew Dunstan <andrew@dunslane.net>
Sat, 17 Mar 2012 21:24:14 +0000 (17:24 -0400)
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.

src/test/regress/pg_regress.c

index 94ad263fb493661996d2134eb1f0dc5f71272e7a..42fbf98d94ba8256c75ee483b14090bab3b0ce27 100644 (file)
@@ -403,7 +403,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];
@@ -471,7 +471,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)
@@ -518,8 +519,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");
 }
 
 /*