diff --git a/appveyor/test_task.bat b/appveyor/test_task.bat index 9604524608c7..04aad4769c4b 100644 --- a/appveyor/test_task.bat +++ b/appveyor/test_task.bat @@ -91,7 +91,7 @@ mkdir c:\tests_tmp set TEST_PHP_JUNIT=c:\junit.out.xml cd "%APPVEYOR_BUILD_FOLDER%" -nmake test TESTS="%OPCACHE_OPTS% -q --offline --show-diff --show-slow 1000 --set-timeout 120 -g FAIL,XFAIL,BORK,WARN,LEAK,SKIP --temp-source c:\tests_tmp --temp-target c:\tests_tmp -j2" +nmake test TESTS="%OPCACHE_OPTS% -q --offline --show-diff --show-slow 1000 --set-timeout 120 -g FAIL,XFAIL,BORK,WARN,LEAK,SKIP --temp-source c:\tests_tmp --temp-target c:\tests_tmp -j3" set EXIT_CODE=%errorlevel% diff --git a/run-tests.php b/run-tests.php index 9b6e85ab401b..5e0011086cba 100755 --- a/run-tests.php +++ b/run-tests.php @@ -1283,7 +1283,8 @@ function run_all_tests($test_files, $env, $redir_tested = null) global $PHP_FAILED_TESTS, $workers, $workerID, $workerSock; if ($workers !== null && !$workerID) { - run_all_tests_parallel($test_files, $env, $redir_tested); + if ($redir_tested) die("redir_tested set for coordinator process"); + run_all_tests_parallel($test_files, $env); return; } @@ -1336,7 +1337,7 @@ function run_all_tests($test_files, $env, $redir_tested = null) } /** The heart of parallel testing. */ -function run_all_tests_parallel($test_files, $env, $redir_tested) { +function run_all_tests_parallel($test_files, $env) { global $workers, $test_idx, $test_cnt, $test_results, $failed_tests_file, $result_tests_file, $PHP_FAILED_TESTS, $shuffle; // The PHP binary running run-tests.php, and run-tests.php itself @@ -1411,12 +1412,19 @@ function run_all_tests_parallel($test_files, $env, $redir_tested) { $sockUri = "tcp://$sockHost:$sockPort"; for ($i = 1; $i <= $workers; $i++) { + $workerEnv = $env; + // Use separate TEMP dir on Windows to get separate opcache instances. + if (PHP_OS_FAMILY == 'Windows') { + $workerEnv['TEMP'] .= '\\run-tests-' . $i; + @mkdir($workerEnv['TEMP']); + } + $proc = proc_open( $thisPHP . ' ' . escapeshellarg($thisScript), [], // Inherit our stdin, stdout and stderr $pipes, NULL, - $_ENV + [ + $workerEnv + [ "TEST_PHP_WORKER" => $i, "TEST_PHP_URI" => $sockUri, ], @@ -1560,8 +1568,6 @@ function run_all_tests_parallel($test_files, $env, $redir_tested) { send_message($workerSocks[$i], [ "type" => "run_tests", "test_files" => $files, - "env" => $env, - "redir_tested" => $redir_tested ]); } else { proc_terminate($workerProcs[$i]); @@ -1672,7 +1678,7 @@ function run_worker() { }); foreach ($greeting["GLOBALS"] as $var => $value) { - if ($var !== "workerID" && $var !== "workerSock" && $var !== "GLOBALS") { + if ($var !== "workerID" && $var !== "workerSock" && $var !== "GLOBALS" && $var !== "_ENV") { $GLOBALS[$var] = $value; } } @@ -1694,7 +1700,7 @@ function run_worker() { switch ($command["type"]) { case "run_tests": - run_all_tests($command["test_files"], $command["env"], $command["redir_tested"]); + run_all_tests($command["test_files"], $_ENV); send_message($workerSock, [ "type" => "tests_finished" ]);