Skip to content

Commit c910c0e

Browse files
committed
adding new tests
1 parent 4c04aec commit c910c0e

File tree

3 files changed

+132
-0
lines changed

3 files changed

+132
-0
lines changed

sapi/fpm/tests/cpuaffinity-fail2.phpt

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
--TEST--
2+
FPM: cpu affinity test
3+
--SKIPIF--
4+
<?php include "skipif.inc";
5+
6+
if (!str_contains(PHP_OS, 'Linux') && !str_contains(PHP_OS, 'FreeBSD')) {
7+
die('skipped supported only on Linux and FreeBSD');
8+
}
9+
?>
10+
--FILE--
11+
<?php
12+
13+
require_once "tester.inc";
14+
15+
$cfg = <<<EOT
16+
[global]
17+
process.cpu_list = MYcpuListIs1024-2048
18+
error_log = {{FILE:LOG}}
19+
pid = {{FILE:PID}}
20+
[unconfined]
21+
listen = {{ADDR:IPv4}}
22+
pm = dynamic
23+
pm.max_children = 1
24+
pm.start_servers = 1
25+
pm.min_spare_servers = 1
26+
pm.max_spare_servers = 1
27+
EOT;
28+
29+
$tester = new FPM\Tester($cfg);
30+
$tester->start();
31+
$tester->expectLogError("FPM initialization failed");
32+
$tester->close();
33+
34+
?>
35+
Done
36+
--EXPECT--
37+
Done
38+
--CLEAN--
39+
<?php
40+
require_once "tester.inc";
41+
FPM\Tester::clean();
42+
?>

sapi/fpm/tests/cpuaffinity-fail3.phpt

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
--TEST--
2+
FPM: cpu affinity test
3+
--SKIPIF--
4+
<?php include "skipif.inc";
5+
6+
if (!str_contains(PHP_OS, 'Linux') && !str_contains(PHP_OS, 'FreeBSD')) {
7+
die('skipped supported only on Linux and FreeBSD');
8+
}
9+
?>
10+
--FILE--
11+
<?php
12+
13+
require_once "tester.inc";
14+
15+
$cfg = <<<EOT
16+
[global]
17+
process.cpu_list = 12de-34ad
18+
error_log = {{FILE:LOG}}
19+
pid = {{FILE:PID}}
20+
[unconfined]
21+
listen = {{ADDR:IPv4}}
22+
pm = dynamic
23+
pm.max_children = 1
24+
pm.start_servers = 1
25+
pm.min_spare_servers = 1
26+
pm.max_spare_servers = 1
27+
EOT;
28+
29+
$tester = new FPM\Tester($cfg);
30+
$tester->start();
31+
$tester->expectLogError("FPM initialization failed");
32+
$tester->close();
33+
34+
?>
35+
Done
36+
--EXPECT--
37+
Done
38+
--CLEAN--
39+
<?php
40+
require_once "tester.inc";
41+
FPM\Tester::clean();
42+
?>

sapi/fpm/tests/cpuaffinity-multi.phpt

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
--TEST--
2+
FPM: cpu affinity test
3+
--SKIPIF--
4+
<?php include "skipif.inc";
5+
6+
if (!str_contains(PHP_OS, 'Linux') && !str_contains(PHP_OS, 'FreeBSD')) {
7+
die('skipped supported only on Linux and FreeBSD');
8+
}
9+
10+
if (FPM\Tester::getCores() < 4) {
11+
die('skipped supported only on multicores environments');
12+
}
13+
?>
14+
--FILE--
15+
<?php
16+
17+
require_once "tester.inc";
18+
19+
$cfg = <<<EOT
20+
[global]
21+
error_log = {{FILE:LOG}}
22+
pid = {{FILE:PID}}
23+
[unconfined]
24+
listen = {{ADDR:IPv4}}
25+
pm = dynamic
26+
pm.max_children = 1
27+
pm.start_servers = 1
28+
pm.min_spare_servers = 1
29+
pm.max_spare_servers = 1
30+
process.cpu_list = 1,2-3,4
31+
EOT;
32+
33+
$tester = new FPM\Tester($cfg);
34+
$tester->start();
35+
$tester->expectLogStartNotices();
36+
$tester->terminate();
37+
$tester->expectLogTerminatingNotices();
38+
$tester->close();
39+
40+
?>
41+
Done
42+
--EXPECT--
43+
Done
44+
--CLEAN--
45+
<?php
46+
require_once "tester.inc";
47+
FPM\Tester::clean();
48+
?>

0 commit comments

Comments
 (0)