summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorPeter Eisentraut2020-03-28 12:01:42 +0000
committerPeter Eisentraut2020-03-28 14:01:01 +0000
commit8f3ec75de4060d86176ad4ac998eeb87a39748c2 (patch)
treee24395a83963db1716ce89da7c75e150f439edfb /src/test
parent87779aa47463d0fb3b4743a7d5c9534994bf7c98 (diff)
Enable Unix-domain sockets support on Windows
As of Windows 10 version 1803, Unix-domain sockets are supported on Windows. But it's not automatically detected by configure because it looks for struct sockaddr_un and Windows doesn't define that. So we just make our own definition on Windows and override the configure result. Set DEFAULT_PGSOCKET_DIR to empty on Windows so by default no Unix-domain socket is used, because there is no good standard location. In pg_upgrade, we have to do some extra tweaking to preserve the existing behavior of not using Unix-domain sockets on Windows. Adding support would be desirable, but it needs further work, in particular a way to select whether to use Unix-domain sockets from the command-line or with a run-time test. The pg_upgrade test script needs a fix. The previous code passed "localhost" to postgres -k, which only happened to work because Windows used to ignore the -k argument value altogether. We instead need to pass an empty string to get the desired effect. The test suites will continue to not use Unix-domain sockets on Windows. This requires a small tweak in pg_regress.c. The TAP tests don't need to be changed because they decide by the operating system rather than HAVE_UNIX_SOCKETS. Reviewed-by: Andrew Dunstan <[email protected]> Discussion: https://www.postgresql.org/message-id/flat/[email protected]
Diffstat (limited to 'src/test')
-rw-r--r--src/test/regress/pg_regress.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index f6a5e1b9c76..6bc19b9668d 100644
--- a/src/test/regress/pg_regress.c
+++ b/src/test/regress/pg_regress.c
@@ -292,7 +292,7 @@ stop_postmaster(void)
* remove the directory. Ignore errors; leaking a temporary directory is
* unimportant. This can run from a signal handler. The code is not
* acceptable in a Windows signal handler (see initdb.c:trapsig()), but
- * Windows is not a HAVE_UNIX_SOCKETS platform.
+ * on Windows, pg_regress does not use Unix sockets.
*/
static void
remove_temp(void)
@@ -2120,8 +2120,12 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
atexit(stop_postmaster);
-#ifndef HAVE_UNIX_SOCKETS
- /* no unix domain sockets available, so change default */
+#if !defined(HAVE_UNIX_SOCKETS) || defined(WIN32)
+ /*
+ * No Unix-domain sockets available, so change default. For now, we also
+ * don't use them on Windows, even if the build supports them. (See
+ * comment at remove_temp() for a reason.)
+ */
hostname = "localhost";
#endif