pg_regress: Promptly detect failed postmaster startup.
authorNoah Misch
Mon, 31 Dec 2018 21:50:32 +0000 (13:50 -0800)
committerNoah Misch
Mon, 31 Dec 2018 21:51:18 +0000 (13:51 -0800)
Detect it the way pg_ctl's wait_for_postmaster() does.  When pg_regress
spawned a postmaster that failed startup, we were detecting that only
with "pg_regress: postmaster did not respond within 60 seconds".
Back-patch to 9.4 (all supported versions).

Reviewed by Tom Lane.

Discussion: https://postgr.es/m/20181231172922[email protected]

src/test/regress/pg_regress.c

index acf26821d794406893a915c2595dd66c9aa71c15..5d08d1e12e5ecc46012b905b30e6be321794b905 100644 (file)
@@ -2390,7 +2390,7 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
             * Fail immediately if postmaster has exited
             */
 #ifndef WIN32
-           if (kill(postmaster_pid, 0) != 0)
+           if (waitpid(postmaster_pid, NULL, WNOHANG) == postmaster_pid)
 #else
            if (WaitForSingleObject(postmaster_pid, 0) == WAIT_OBJECT_0)
 #endif