*
* This code is released under the terms of the PostgreSQL License.
*
- * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.63 2009/06/11 14:49:15 momjian Exp $
+ * $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.69 2010/01/02 16:58:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
static char *shellprog = SHELLPROG;
#endif
-/* currently we can use the same diff switches on all platforms */
+/*
+ * On Windows we use -w in diff switches to avoid problems with inconsistent
+ * newline representation. The actual result files will generally have
+ * Windows-style newlines, but the comparison files might or might not.
+ */
+#ifndef WIN32
+const char *basic_diff_opts = "";
+const char *pretty_diff_opts = "-C3";
+#else
const char *basic_diff_opts = "-w";
const char *pretty_diff_opts = "-w -C3";
+#endif
/* options settable from command line */
_stringlist *dblist = NULL;
static char *temp_config = NULL;
static char *top_builddir = NULL;
static bool nolocale = false;
+static bool use_existing = false;
static char *hostname = NULL;
static int port = -1;
static bool port_specified_by_user = false;
cmdline2 = malloc(strlen(cmdline) + 8);
sprintf(cmdline2, "cmd /c %s", cmdline);
+#ifndef __CYGWIN__
+ AddUserToTokenDacl(restrictedToken);
+#endif
+
if (!CreateProcessAsUser(restrictedToken,
NULL,
cmdline2,
exit_nicely(2);
}
-#ifndef __CYGWIN__
- AddUserToDacl(pi.hProcess);
-#endif
-
free(cmdline2);
ResumeThread(pi.hThread);
if (num_tests == 1)
{
- status(_("test %-20s ... "), tests[0]);
+ status(_("test %-24s ... "), tests[0]);
pids[0] = (tfunc) (tests[0], &resultfiles[0], &expectfiles[0], &tags[0]);
wait_for_tests(pids, statuses, NULL, 1);
/* status line is finished below */
bool differ = false;
if (num_tests > 1)
- status(_(" %-20s ... "), tests[i]);
+ status(_(" %-24s ... "), tests[i]);
/*
* Advance over all three lists simultaneously.
*/
header(_("creating database \"%s\""), dbname);
if (encoding)
- psql_command("postgres", "CREATE DATABASE \"%s\" TEMPLATE=template0 ENCODING='%s'", dbname, encoding);
+ psql_command("postgres", "CREATE DATABASE \"%s\" TEMPLATE=template0 ENCODING='%s'%s", dbname, encoding,
+ (nolocale) ? " LC_COLLATE='C' LC_CTYPE='C'" : "");
else
- psql_command("postgres", "CREATE DATABASE \"%s\" TEMPLATE=template0", dbname);
+ psql_command("postgres", "CREATE DATABASE \"%s\" TEMPLATE=template0%s", dbname,
+ (nolocale) ? " LC_COLLATE='C' LC_CTYPE='C'" : "");
psql_command(dbname,
"ALTER DATABASE \"%s\" SET lc_messages TO 'C';"
"ALTER DATABASE \"%s\" SET lc_monetary TO 'C';"
{"dlpath", required_argument, NULL, 17},
{"create-role", required_argument, NULL, 18},
{"temp-config", required_argument, NULL, 19},
+ {"use-existing", no_argument, NULL, 20},
{NULL, 0, NULL, 0}
};
case 19:
temp_config = strdup(optarg);
break;
+ case 20:
+ use_existing = true;
+ break;
default:
/* getopt_long already emitted a complaint */
fprintf(stderr, _("\nTry \"%s -h\" for more information.\n"),
* Using an existing installation, so may need to get rid of
* pre-existing database(s) and role(s)
*/
- for (sl = dblist; sl; sl = sl->next)
- drop_database_if_exists(sl->str);
- for (sl = extraroles; sl; sl = sl->next)
- drop_role_if_exists(sl->str);
+ if (!use_existing)
+ {
+ for (sl = dblist; sl; sl = sl->next)
+ drop_database_if_exists(sl->str);
+ for (sl = extraroles; sl; sl = sl->next)
+ drop_role_if_exists(sl->str);
+ }
}
/*
* Create the test database(s) and role(s)
*/
- for (sl = dblist; sl; sl = sl->next)
- create_database(sl->str);
- for (sl = extraroles; sl; sl = sl->next)
- create_role(sl->str, dblist);
+ if (!use_existing)
+ {
+ for (sl = dblist; sl; sl = sl->next)
+ create_database(sl->str);
+ for (sl = extraroles; sl; sl = sl->next)
+ create_role(sl->str, dblist);
+ }
/*
* Ready to run the tests