summaryrefslogtreecommitdiff
path: root/src/test/regress/pg_regress_main.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2008-10-01 22:38:57 +0000
committerPeter Eisentraut <peter_e@gmx.net>2008-10-01 22:38:57 +0000
commitfeae7856af12ba183465b0fbbe3a586fddbd7715 (patch)
tree25c42c567ebe9b3e1921f427078bbfb9250e9fd9 /src/test/regress/pg_regress_main.c
parentdad4cb6258382e99409c3e0673f1a5ec5b8bf03f (diff)
downloadpostgresql-feae7856af12ba183465b0fbbe3a586fddbd7715.tar.gz
Allow pg_regress to be run outside the build tree. Look for input files
in both input and output dir, to handle vpath builds more simply.
Diffstat (limited to 'src/test/regress/pg_regress_main.c')
-rw-r--r--src/test/regress/pg_regress_main.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/test/regress/pg_regress_main.c b/src/test/regress/pg_regress_main.c
index a1c160aaf8..255c97e31d 100644
--- a/src/test/regress/pg_regress_main.c
+++ b/src/test/regress/pg_regress_main.c
@@ -11,7 +11,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/test/regress/pg_regress_main.c,v 1.3 2008/01/01 19:46:00 momjian Exp $
+ * $PostgreSQL: pgsql/src/test/regress/pg_regress_main.c,v 1.4 2008/10/01 22:38:57 petere Exp $
*
*-------------------------------------------------------------------------
*/
@@ -34,12 +34,26 @@ psql_start_test(const char *testname,
char expectfile[MAXPGPATH];
char psql_cmd[MAXPGPATH * 3];
+ /*
+ * Look for files in the output dir first, consistent with a vpath
+ * search. This is mainly to create more reasonable error
+ * messages if the file is not found. It also allows local test
+ * overrides when running pg_regress outside of the source tree.
+ */
snprintf(infile, sizeof(infile), "%s/sql/%s.sql",
- inputdir, testname);
+ outputdir, testname);
+ if (!file_exists(infile))
+ snprintf(infile, sizeof(infile), "%s/sql/%s.sql",
+ inputdir, testname);
+
snprintf(outfile, sizeof(outfile), "%s/results/%s.out",
outputdir, testname);
+
snprintf(expectfile, sizeof(expectfile), "%s/expected/%s.out",
- inputdir, testname);
+ outputdir, testname);
+ if (!file_exists(expectfile))
+ snprintf(expectfile, sizeof(expectfile), "%s/expected/%s.out",
+ inputdir, testname);
add_stringlist_item(resultfiles, outfile);
add_stringlist_item(expectfiles, expectfile);