From 4f044e923807ffcbde68b4eea80ee15eabc89e79 Mon Sep 17 00:00:00 2001 From: divinity76 Date: Wed, 21 Jun 2023 20:16:26 +0200 Subject: [PATCH] support running testsuite with negative niceness (#11481) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * support running testsuite with negative niceness a bug in the regex would break getNice() if the current niceness was negative, which would make the whole test fail. Previously: this would fail: time sudo nice --adjustment=-19 ./php run-tests.php -j$(nproc) -x --offline ext/standard/tests/general_functions/proc_nice_basic.phpt --color --show-all and this would work: time sudo ./php run-tests.php -j$(nproc) -x --offline ext/standard/tests/general_functions/proc_nice_basic.phpt --color --show-all * Update ext/standard/tests/general_functions/proc_nice_basic.phpt Co-authored-by: Michael Voříšek --------- Co-authored-by: Michael Voříšek --- ext/standard/tests/general_functions/proc_nice_basic.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/standard/tests/general_functions/proc_nice_basic.phpt b/ext/standard/tests/general_functions/proc_nice_basic.phpt index 55622eaf46b..9e73a7f890b 100644 --- a/ext/standard/tests/general_functions/proc_nice_basic.phpt +++ b/ext/standard/tests/general_functions/proc_nice_basic.phpt @@ -19,7 +19,7 @@ if ($exit_code !== 0) { function getNice($id) { $res = shell_exec('ps -p ' . $id .' -o "pid,nice"'); - preg_match('/^\s*\w+\s+\w+\s*(\d+)\s+(\d+)/m', $res, $matches); + preg_match('/^\s*\w+\s+\w+\s*(\d+)\s+(-?\d+)/m', $res, $matches); if (count($matches) > 2) return $matches[2]; else