From 87c179e30ee2e48a76ac97016a5195b9d1777219 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 21 Feb 2019 11:09:19 +0100 Subject: [PATCH 1/3] Try -j3 on AppVeyor --- appveyor/test_task.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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% From 538828240e3ec73153235ba6fdcac7d993e9d11a Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 27 Feb 2019 11:03:20 +0100 Subject: [PATCH 2/3] Clarify that redir_tested always null for parallel tests --- run-tests.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/run-tests.php b/run-tests.php index 9b6e85ab401b..33a7fac03de1 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 @@ -1561,7 +1562,6 @@ function run_all_tests_parallel($test_files, $env, $redir_tested) { "type" => "run_tests", "test_files" => $files, "env" => $env, - "redir_tested" => $redir_tested ]); } else { proc_terminate($workerProcs[$i]); @@ -1694,7 +1694,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"], $command["env"]); send_message($workerSock, [ "type" => "tests_finished" ]); From 0bd27bd4b3ceff373bc87e8f93c02e571cc2b2f1 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 27 Feb 2019 11:32:22 +0100 Subject: [PATCH 3/3] Use separate TEMP directories on Windows --- run-tests.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/run-tests.php b/run-tests.php index 33a7fac03de1..5e0011086cba 100755 --- a/run-tests.php +++ b/run-tests.php @@ -1412,12 +1412,19 @@ function run_all_tests_parallel($test_files, $env) { $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, ], @@ -1561,7 +1568,6 @@ function run_all_tests_parallel($test_files, $env) { send_message($workerSocks[$i], [ "type" => "run_tests", "test_files" => $files, - "env" => $env, ]); } 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"]); + run_all_tests($command["test_files"], $_ENV); send_message($workerSock, [ "type" => "tests_finished" ]);