From: Tom Lane Date: Sat, 19 Jan 2008 17:43:42 +0000 (+0000) Subject: Make pg_regress clean out the testtablespace directory only on Windows. X-Git-Tag: REL8_3_0~48 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f10589e5f7a9340fc5536fb1ad3e58b0c7cdb2ae;p=postgresql 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. --- diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c index 7d4f50fea7..d88118168e 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++)