From ec1bc2bff48767cfca8e1e1ec1c23d30f6e7de6a Mon Sep 17 00:00:00 2001 From: Jakub Zelenka Date: Wed, 30 Aug 2023 13:18:28 +0100 Subject: [PATCH] Fix GH-12077: Check lsof functionality in socket on close test --- sapi/fpm/tests/socket-close-on-exec.phpt | 2 +- sapi/fpm/tests/tester.inc | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/sapi/fpm/tests/socket-close-on-exec.phpt b/sapi/fpm/tests/socket-close-on-exec.phpt index b879854059f2..9a62449a9080 100644 --- a/sapi/fpm/tests/socket-close-on-exec.phpt +++ b/sapi/fpm/tests/socket-close-on-exec.phpt @@ -3,7 +3,7 @@ FPM: Set CLOEXEC on the listen and connection socket --SKIPIF-- /dev/null'); +FPM\Tester::skipIfShellCommandFails('lsof -v', 'lsof-org/lsof'); ?> --FILE-- &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'"); } }