1--TEST--
2FPM: AppArmor basic test
3--SKIPIF--
4<?php
5include "skipif.inc";
6$config = <<<EOT
7[global]
8error_log = /dev/null
9[unconfined]
10listen = {{ADDR}}
11pm = dynamic
12pm.max_children = 5
13pm.start_servers = 2
14pm.min_spare_servers = 1
15pm.max_spare_servers = 3
16apparmor_hat = a
17EOT;
18FPM\Tester::skipIfConfigFails($config);
19?>
20--FILE--
21<?php
22
23require_once "tester.inc";
24
25$cfg = <<<EOT
26[global]
27error_log = {{FILE:LOG}}
28[unconfined]
29listen = {{ADDR:UDS}}
30pm = dynamic
31pm.max_children = 5
32pm.start_servers = 2
33pm.min_spare_servers = 1
34pm.max_spare_servers = 3
35apparmor_hat = a
36EOT;
37
38$tester = new FPM\Tester($cfg);
39/* libapparmor has a bug which can cause SIGSEGV till Version 2.8.0-0ubuntu28
40   See https://bugs.launchpad.net/apparmor/+bug/1196880
41   Possible outcomes:
42
43   - SIGSEGV|failed to query apparmor confinement
44     apparmor not running
45   - failed to change to new confinement
46     something in apparmor went wrong
47   - exited with code 70
48     Change to successful; Hat not existent (Process gets killed by apparmor)
49 */
50$tester->runTill(
51    '/(SIGSEGV|failed to query apparmor confinement|' .
52    'failed to change to new confinement|exited with code 70)/'
53);
54
55?>
56Done
57--EXPECT--
58Done
59--CLEAN--
60<?php
61require_once "tester.inc";
62FPM\Tester::clean();
63?>
64