Patch-Source: https://github.com/NoiseByNorthwest/php-spx/pull/343 Give every test that writes a profiling report its own spx.data_dir. Six tests write full reports into the shared, hardcoded default data dir /tmp/spx (src/php_spx.c:113 - "spx.data_dir", "/tmp/spx", PHP_INI_SYSTEM), and two of them wipe that whole directory in their --CLEAN-- section: tests/spx_ini_params_profiling_enabled.phpt:18: exec("rm -rf /tmp/spx"); tests/spx_ini_params_not_overridden.phpt:28: exec("rm -rf /tmp/spx"); while tests/spx_custom_metadata.phpt reads its own reports back with file_get_contents('/tmp/spx/' . $key . '.json'). Since php-src 1d2ea5ce22c ("Run tests in parallel by default", GH-22939, first released in php-8.6.0beta1) run-tests.php spawns min(nproc, 10) workers by default, so the readers race the wipers and spx_custom_metadata.phpt fails with "file_get_contents(): Failed to open stream: No such file or directory". On an 8-core builder this reproduced in 15 out of 15 parallel runs. spx.data_dir is PHP_INI_SYSTEM and is therefore settable per test from --INI--, exactly the way tests/spx_ui_report_access.phpt already does it. Point each report-producing test at its own {PWD}/data_dir_ and remove only that directory in --CLEAN--, so no test can ever clobber another's reports, nothing is left behind in /tmp, and the suite stays fully parallel. Note --CLEAN-- scripts are executed with the *global* ini settings, not the test's --INI-- section, so the clean-up path is spelled out with __DIR__ rather than read back via ini_get(). --- a/tests/spx_auto_start_005.phpt +++ b/tests/spx_auto_start_005.phpt @@ -1,5 +1,7 @@ --TEST-- Auto start disabled, full report & span report keys printed +--INI-- +spx.data_dir="{PWD}/data_dir_auto_start_005" --ENV-- return << --- a/tests/spx_auto_start_007.phpt +++ b/tests/spx_auto_start_007.phpt @@ -3,6 +3,7 @@ --CGI-- --INI-- spx.debug=1 +spx.data_dir="{PWD}/data_dir_auto_start_007" spx.http_enabled=1 spx.http_key="dev" spx.http_ip_whitelist="127.0.0.1" @@ -33,4 +34,10 @@ --EXPECTF-- spx-full-%s spx-full-%s -spx-full-%s \ No newline at end of file +spx-full-%s +--CLEAN-- + --- a/tests/spx_custom_metadata.phpt +++ b/tests/spx_custom_metadata.phpt @@ -2,6 +2,7 @@ Custom metadata --INI-- log_errors=on +spx.data_dir="{PWD}/data_dir_custom_metadata" --ENV-- return << @@ -154,4 +155,10 @@ "wt" ,"zm" ] -} \ No newline at end of file +} +--CLEAN-- + --- a/tests/spx_ini_params_no_unnecessary_access_check.phpt +++ b/tests/spx_ini_params_no_unnecessary_access_check.phpt @@ -3,6 +3,7 @@ --CGI-- --INI-- spx.debug=1 +spx.data_dir="{PWD}/data_dir_ini_params_no_unnecessary_access_check" spx.http_profiling_enabled=1 spx.http_enabled=1 spx.http_key="dev" @@ -16,3 +17,9 @@ SPX-Debug-Profiling-Triggered: 1 --EXPECT-- Normal output +--CLEAN-- + --- a/tests/spx_ini_params_not_overridden.phpt +++ b/tests/spx_ini_params_not_overridden.phpt @@ -3,6 +3,7 @@ --CGI-- --INI-- spx.debug=1 +spx.data_dir="{PWD}/data_dir_ini_params_not_overridden" spx.http_profiling_enabled=1 spx.http_enabled=1 spx.http_key="dev" @@ -25,6 +26,6 @@ --CLEAN-- \ No newline at end of file --- a/tests/spx_ini_params_profiling_enabled.phpt +++ b/tests/spx_ini_params_profiling_enabled.phpt @@ -3,6 +3,7 @@ --CGI-- --INI-- spx.debug=1 +spx.data_dir="{PWD}/data_dir_ini_params_profiling_enabled" spx.http_profiling_enabled=1 --FILE-- \ No newline at end of file