aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2008-01-19 17:43:42 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2008-01-19 17:43:42 +0000
commitf10589e5f7a9340fc5536fb1ad3e58b0c7cdb2ae (patch)
tree27e3537bd55e93e151680560239f4bce144030db
parentaeeef4119e56d7efaac23c38fe130f5f897d985f (diff)
downloadpostgresql-f10589e5f7a9340fc5536fb1ad3e58b0c7cdb2ae.tar.gz
postgresql-f10589e5f7a9340fc5536fb1ad3e58b0c7cdb2ae.zip
Make pg_regress clean out the testtablespace directory only on Windows.
On other platforms it's better to let the Makefile handle it, but we want the regression tests to be invokable without make on Windows. A batch file would be a better solution, but no time for that before 8.3. Per my discovery that this breaks testing under SELinux, and subsequent discussion.
-rw-r--r--src/test/regress/pg_regress.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index 7d4f50fea74..d88118168eb 100644
--- a/src/test/regress/pg_regress.c
+++ b/src/test/regress/pg_regress.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.c,v 1.40 2008/01/01 19:46:00 momjian Exp $
+ * $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.41 2008/01/19 17:43:42 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -102,10 +102,8 @@ static int success_count = 0;
static int fail_count = 0;
static int fail_ignore_count = 0;
-static bool
- directory_exists(const char *dir);
-static void
- make_directory(const char *dir);
+static bool directory_exists(const char *dir);
+static void make_directory(const char *dir);
static void
header(const char *fmt,...)
@@ -453,11 +451,23 @@ convert_sourcefiles_in(char *source, char *dest, char *suffix)
*c = '/';
#endif
- /* try to create the test tablespace dir if it doesn't exist */
snprintf(testtablespace, MAXPGPATH, "%s/testtablespace", abs_builddir);
+
+#ifdef WIN32
+ /*
+ * On Windows only, clean out the test tablespace dir, or create it if it
+ * doesn't exist. On other platforms we expect the Makefile to take
+ * care of that. (We don't migrate that functionality in here because
+ * it'd be harder to cope with platform-specific issues such as SELinux.)
+ *
+ * XXX it would be better if pg_regress.c had nothing at all to do with
+ * testtablespace, and this were handled by a .BAT file or similar on
+ * Windows. See pgsql-hackers discussion of 2008-01-18.
+ */
if (directory_exists(testtablespace))
rmtree(testtablespace, true);
make_directory(testtablespace);
+#endif
/* finally loop on each file and do the replacement */
for (name = names; *name; name++)