Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 7849057

Browse files
committed
Try to make crash restart test work on windows.
Author: Andres Freund Tested-By: Andrew Dunstan Discussion: https://postgr.es/m/20170930224424.ud5ilchmclbl5y5n@alap3.anarazel.de
1 parent 2e83db3 commit 7849057

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

src/test/recovery/t/013_crash_restart.pl

+10-18
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,8 @@
1616
use Config;
1717
use Time::HiRes qw(usleep);
1818

19-
if ($Config{osname} eq 'MSWin32')
20-
{
21-
# some Windows Perls at least don't like IPC::Run's
22-
# start/kill_kill regime.
23-
plan skip_all => "Test fails on Windows perl";
24-
}
25-
else
26-
{
27-
plan tests => 18;
28-
}
19+
plan tests => 18;
20+
2921

3022
# To avoid hanging while expecting some specific input from a psql
3123
# instance being driven by us, add a timeout high enough that it
@@ -106,10 +98,10 @@
10698
$monitor_stderr = '';
10799

108100
# kill once with QUIT - we expect psql to exit, while emitting error message first
109-
my $cnt = kill 'QUIT', $pid;
101+
my $ret = TestLib::system_log('pg_ctl', 'kill', 'QUIT', $pid);
110102

111103
# Exactly process should have been alive to be killed
112-
is($cnt, 1, "exactly one process killed with SIGQUIT");
104+
is($ret, 0, "killed process with SIGQUIT");
113105

114106
# Check that psql sees the killed backend as having been terminated
115107
$killme_stdin .= q[
@@ -119,14 +111,14 @@
119111
"psql query died successfully after SIGQUIT");
120112
$killme_stderr = '';
121113
$killme_stdout = '';
122-
$killme->kill_kill;
114+
$killme->finish;
123115

124116
# Wait till server restarts - we should get the WARNING here, but
125117
# sometimes the server is unable to send that, if interrupted while
126118
# sending.
127119
ok(pump_until($monitor, \$monitor_stderr, qr/WARNING: terminating connection because of crash of another server process|server closed the connection unexpectedly/m),
128120
"psql monitor died successfully after SIGQUIT");
129-
$monitor->kill_kill;
121+
$monitor->finish;
130122

131123
# Wait till server restarts
132124
is($node->poll_query_until('postgres', 'SELECT $$restarted after sigquit$$;', 'restarted after sigquit'),
@@ -179,8 +171,8 @@
179171

180172
# kill with SIGKILL this time - we expect the backend to exit, without
181173
# being able to emit an error error message
182-
$cnt = kill 'KILL', $pid;
183-
is($cnt, 1, "exactly one process killed with KILL");
174+
$ret = TestLib::system_log('pg_ctl', 'kill', 'KILL', $pid);
175+
is($ret, 0, "killed process with KILL");
184176

185177
# Check that psql sees the server as being terminated. No WARNING,
186178
# because signal handlers aren't being run on SIGKILL.
@@ -189,14 +181,14 @@
189181
];
190182
ok(pump_until($killme, \$killme_stderr, qr/server closed the connection unexpectedly/m),
191183
"psql query died successfully after SIGKILL");
192-
$killme->kill_kill;
184+
$killme->finish;
193185

194186
# Wait till server restarts - we should get the WARNING here, but
195187
# sometimes the server is unable to send that, if interrupted while
196188
# sending.
197189
ok(pump_until($monitor, \$monitor_stderr, qr/WARNING: terminating connection because of crash of another server process|server closed the connection unexpectedly/m),
198190
"psql monitor died successfully after SIGKILL");
199-
$monitor->kill_kill;
191+
$monitor->finish;
200192

201193
# Wait till server restarts
202194
is($node->poll_query_until('postgres', 'SELECT 1', '1'), "1", "reconnected after SIGKILL");

0 commit comments

Comments
 (0)