|
16 | 16 | use Config;
|
17 | 17 | use Time::HiResqw(usleep);
|
18 | 18 |
|
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 |
| -planskip_all=>"Test fails on Windows perl"; |
24 |
| -} |
25 |
| -else |
26 |
| -{ |
27 |
| -plantests=> 18; |
28 |
| -} |
| 19 | +plantests=> 18; |
| 20 | + |
29 | 21 |
|
30 | 22 | # To avoid hanging while expecting some specific input from a psql
|
31 | 23 | # instance being driven by us, add a timeout high enough that it
|
|
106 | 98 | $monitor_stderr ='';
|
107 | 99 |
|
108 | 100 | # 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); |
110 | 102 |
|
111 | 103 | # Exactly process should have been alive to be killed
|
112 |
| -is($cnt, 1,"exactly oneprocess killed with SIGQUIT"); |
| 104 | +is($ret, 0,"killedprocess with SIGQUIT"); |
113 | 105 |
|
114 | 106 | # Check that psql sees the killed backend as having been terminated
|
115 | 107 | $killme_stdin .=q[
|
|
119 | 111 | "psql query died successfully after SIGQUIT");
|
120 | 112 | $killme_stderr ='';
|
121 | 113 | $killme_stdout ='';
|
122 |
| -$killme->kill_kill; |
| 114 | +$killme->finish; |
123 | 115 |
|
124 | 116 | # Wait till server restarts - we should get the WARNING here, but
|
125 | 117 | # sometimes the server is unable to send that, if interrupted while
|
126 | 118 | # sending.
|
127 | 119 | ok(pump_until($monitor, \$monitor_stderr,qr/WARNING: terminating connection because of crash of another server process|server closed the connection unexpectedly/m),
|
128 | 120 | "psql monitor died successfully after SIGQUIT");
|
129 |
| -$monitor->kill_kill; |
| 121 | +$monitor->finish; |
130 | 122 |
|
131 | 123 | # Wait till server restarts
|
132 | 124 | is($node->poll_query_until('postgres','SELECT $$restarted after sigquit$$;','restarted after sigquit'),
|
|
179 | 171 |
|
180 | 172 | # kill with SIGKILL this time - we expect the backend to exit, without
|
181 | 173 | # being able to emit an error error message
|
182 |
| -$cnt =kill'KILL',$pid; |
183 |
| -is($cnt, 1,"exactly oneprocess killed with KILL"); |
| 174 | +$ret =TestLib::system_log('pg_ctl','kill','KILL',$pid); |
| 175 | +is($ret, 0,"killedprocess with KILL"); |
184 | 176 |
|
185 | 177 | # Check that psql sees the server as being terminated. No WARNING,
|
186 | 178 | # because signal handlers aren't being run on SIGKILL.
|
|
189 | 181 | ];
|
190 | 182 | ok(pump_until($killme, \$killme_stderr,qr/server closed the connection unexpectedly/m),
|
191 | 183 | "psql query died successfully after SIGKILL");
|
192 |
| -$killme->kill_kill; |
| 184 | +$killme->finish; |
193 | 185 |
|
194 | 186 | # Wait till server restarts - we should get the WARNING here, but
|
195 | 187 | # sometimes the server is unable to send that, if interrupted while
|
196 | 188 | # sending.
|
197 | 189 | ok(pump_until($monitor, \$monitor_stderr,qr/WARNING: terminating connection because of crash of another server process|server closed the connection unexpectedly/m),
|
198 | 190 | "psql monitor died successfully after SIGKILL");
|
199 |
| -$monitor->kill_kill; |
| 191 | +$monitor->finish; |
200 | 192 |
|
201 | 193 | # Wait till server restarts
|
202 | 194 | is($node->poll_query_until('postgres','SELECT 1','1'),"1","reconnected after SIGKILL");
|
|