Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion appveyor/test_task.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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%

Expand Down
20 changes: 13 additions & 7 deletions run-tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
],
Expand Down Expand Up @@ -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]);
Expand Down Expand Up @@ -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;
}
}
Expand All @@ -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"
]);
Expand Down