mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fix GH-12077: Check lsof functionality in socket on close test
Closes GH-12084
This commit is contained in:
parent
02b3fb1f6b
commit
fe30c5098f
3 changed files with 21 additions and 5 deletions
4
NEWS
4
NEWS
|
@ -5,6 +5,10 @@ PHP NEWS
|
|||
- Core:
|
||||
. Fixed GH-11847 (DTrace enabled build is broken). (Filip Zrůst)
|
||||
|
||||
- FPM:
|
||||
. Fixed GH-12077 (PHP 8.3.0RC1 borked socket-close-on-exec.phpt).
|
||||
(Jakub Zelenka)
|
||||
|
||||
31 Aug 2023, PHP 8.3.0RC1
|
||||
|
||||
- Core:
|
||||
|
|
|
@ -3,7 +3,7 @@ FPM: Set CLOEXEC on the listen and connection socket
|
|||
--SKIPIF--
|
||||
<?php
|
||||
require_once "skipif.inc";
|
||||
FPM\Tester::skipIfShellCommandFails('lsof -v 2> /dev/null');
|
||||
FPM\Tester::skipIfShellCommandFails('lsof -v', 'lsof-org/lsof');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
|
|
@ -342,12 +342,24 @@ class Tester
|
|||
* Skip test if supplied shell command fails.
|
||||
*
|
||||
* @param string $command
|
||||
* @param string|null $expectedPartOfOutput
|
||||
*/
|
||||
static public function skipIfShellCommandFails($command)
|
||||
static public function skipIfShellCommandFails(string $command, string $expectedPartOfOutput = null)
|
||||
{
|
||||
$output = system($command, $code);
|
||||
if ($code) {
|
||||
die("skip command '$command' faield with code $code and output: $output");
|
||||
$result = exec("$command 2>&1", $output, $code);
|
||||
if ($result === false || $code) {
|
||||
die("skip command '$command' faieled with code $code");
|
||||
}
|
||||
if (!is_null($expectedPartOfOutput)) {
|
||||
if (is_array($output)) {
|
||||
foreach ($output as $line) {
|
||||
if (str_contains($line, $expectedPartOfOutput)) {
|
||||
// string found so no need to skip
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
die("skip command '$command' did not contain output '$expectedPartOfOutput'");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue