On 03/08/2012 02:59 PM, David E. Wheeler wrote:
On Mar 8, 2012, at 10:22 AM, Andrew Dunstan wrote:

This seems like an outright bug. I don't recall any discussion on it. Maybe 
nobody's come across it before. ISTM the correct behaviour would be to put 
converted sql files in $inputdir/sql and converted results files in 
$outputdir/expected.
In my extension distributions, I have

     tests/sql
     tests/expected

And for that, --inputdir=test works just fine. I don't mess with --outputdir, 
which just seems to affect where the actual output is written to, which is just 
a directory named regression.out at the top of the project.


It works fine if you don't need to do any file conversions (i.e. if you don't have "input" or "output" directories). But file_textarray_fdw does.

Here's a patch that I think fixes the problem.

cheers

andrew


*** a/src/test/regress/pg_regress.c
--- b/src/test/regress/pg_regress.c
***************
*** 407,413 **** replace_string(char *string, char *replace, char *replacement)
   * the given suffix.
   */
  static void
! convert_sourcefiles_in(char *source_subdir, char *dest_subdir, char *suffix)
  {
  	char		testtablespace[MAXPGPATH];
  	char		indir[MAXPGPATH];
--- 407,413 ----
   * the given suffix.
   */
  static void
! convert_sourcefiles_in(char *source_subdir, char *dest_dir, char *dest_subdir, char *suffix)
  {
  	char		testtablespace[MAXPGPATH];
  	char		indir[MAXPGPATH];
***************
*** 475,481 **** 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);
  
  		infile = fopen(srcfile, "r");
  		if (!infile)
--- 475,482 ----
  		/* 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.%s", dest_dir, dest_subdir, 
! 				 prefix, suffix);
  
  		infile = fopen(srcfile, "r");
  		if (!infile)
***************
*** 522,529 **** 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");
  }
  
  /*
--- 523,530 ----
  static void
  convert_sourcefiles(void)
  {
! 	convert_sourcefiles_in("input", inputdir, "sql", "sql");
! 	convert_sourcefiles_in("output", outputdir, "expected", "out");
  }
  
  /*
-- 
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to