1--TEST--
2If SIGQUIT and SIGTERM during reloading fail, SIGKILL should be sent
3--SKIPIF--
4<?php
5include "skipif.inc";
6if (!function_exists('pcntl_sigprocmask')) die('skip Requires pcntl_sigprocmask()');
7if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request');
8?>
9--FILE--
10<?php
11
12require_once "tester.inc";
13
14$cfg = <<<EOT
15[global]
16error_log = {{FILE:LOG}}
17pid = {{FILE:PID}}
18process_control_timeout=1
19[unconfined]
20listen = {{ADDR}}
21ping.path = /ping
22ping.response = pong
23pm = dynamic
24pm.max_children = 5
25pm.start_servers = 1
26pm.min_spare_servers = 1
27pm.max_spare_servers = 1
28EOT;
29
30$code = <<<EOT
31<?php
32pcntl_sigprocmask(SIG_BLOCK, [SIGQUIT, SIGTERM]);
33EOT;
34
35$tester = new FPM\Tester($cfg, $code);
36$tester->start();
37$tester->expectLogStartNotices();
38$tester->request()->expectEmptyBody();
39$tester->signal('USR2');
40$tester->expectLogNotice('Reloading in progress ...');
41$tester->expectLogNotice('reloading: .*');
42// The timeout needs to elapse twice until the process will be killed,
43// so we have to wait at least two seconds.
44sleep(2);
45$tester->expectLogNotice('using inherited socket fd=\d+, "127.0.0.1:\d+"');
46$tester->expectLogStartNotices();
47$tester->ping('{{ADDR}}');
48$tester->terminate();
49$tester->expectLogTerminatingNotices();
50$tester->close();
51
52?>
53Done
54--EXPECT--
55Done
56--CLEAN--
57<?php
58require_once "tester.inc";
59FPM\Tester::clean();
60?>
61