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.
This commit is contained in:
Andrew Dunstan 2012-03-17 17:24:14 -04:00
parent 77397621d8
commit 206f5b08ec

View File

@ -391,7 +391,7 @@ replace_string(char *string, char *replace, char *replacement)
* the given suffix. * the given suffix.
*/ */
static void static void
convert_sourcefiles_in(char *source, char *dest, char *suffix) convert_sourcefiles_in(char *source, char * dest_dir, char *dest, char *suffix)
{ {
char abs_srcdir[MAXPGPATH]; char abs_srcdir[MAXPGPATH];
char abs_builddir[MAXPGPATH]; char abs_builddir[MAXPGPATH];
@ -490,7 +490,8 @@ convert_sourcefiles_in(char *source, char *dest, char *suffix)
/* build the full actual paths to open */ /* build the full actual paths to open */
snprintf(prefix, strlen(*name) - 6, "%s", *name); snprintf(prefix, strlen(*name) - 6, "%s", *name);
snprintf(srcfile, MAXPGPATH, "%s/%s", indir, *name); snprintf(srcfile, MAXPGPATH, "%s/%s", indir, *name);
snprintf(destfile, MAXPGPATH, "%s/%s.%s", dest, prefix, suffix); snprintf(destfile, MAXPGPATH, "%s/%s/%s.%s", dest_dir, dest,
prefix, suffix);
infile = fopen(srcfile, "r"); infile = fopen(srcfile, "r");
if (!infile) if (!infile)
@ -536,8 +537,8 @@ convert_sourcefiles_in(char *source, char *dest, char *suffix)
static void static void
convert_sourcefiles(void) convert_sourcefiles(void)
{ {
convert_sourcefiles_in("input", "sql", "sql"); convert_sourcefiles_in("input", inputdir, "sql", "sql");
convert_sourcefiles_in("output", "expected", "out"); convert_sourcefiles_in("output", outputdir, "expected", "out");
} }
/* /*