summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2020-02-12 14:34:48 +0100
committerChristoph M. Becker <cmbecker69@gmx.de>2020-02-17 18:52:45 +0100
commite1de11d4671ef980889940e95c06912cc188a9fb (patch)
tree1e46c5c7d16684c5f83dd15352b1f7e90ed3663d
parent54ecf57fe290f69a2112d4c2ea3a1e99208e2797 (diff)
downloadphp-git-e1de11d4671ef980889940e95c06912cc188a9fb.tar.gz
Create a new console for each test worker on Windows
The primary motivation to have each test worker running its own console is to allow the windows_mb_path tests to run in parallel. A nice side effect is that this also prevents changing the code page of the tester's console window (which can even cause its font to be changed). To be able to do so, we introduce the `create_new_console` option for `proc_open()`, which might occasionally be useful for other purposes than testing.
-rw-r--r--ext/standard/proc_open.c12
-rw-r--r--ext/standard/tests/file/windows_mb_path/CONFLICTS3
-rwxr-xr-xrun-tests.php3
3 files changed, 13 insertions, 5 deletions
diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c
index d99d008771..25a5f7fe3b 100644
--- a/ext/standard/proc_open.c
+++ b/ext/standard/proc_open.c
@@ -504,6 +504,7 @@ PHP_FUNCTION(proc_open)
int bypass_shell = 0;
int blocking_pipes = 0;
int create_process_group = 0;
+ int create_new_console = 0;
#else
char **argv = NULL;
#endif
@@ -598,6 +599,13 @@ PHP_FUNCTION(proc_open)
create_process_group = 1;
}
}
+
+ item = zend_hash_str_find(Z_ARRVAL_P(other_options), "create_new_console", sizeof("create_new_console") - 1);
+ if (item != NULL) {
+ if (Z_TYPE_P(item) == IS_TRUE || ((Z_TYPE_P(item) == IS_LONG) && Z_LVAL_P(item))) {
+ create_new_console = 1;
+ }
+ }
}
#endif
@@ -921,7 +929,9 @@ PHP_FUNCTION(proc_open)
if (create_process_group) {
dwCreateFlags |= CREATE_NEW_PROCESS_GROUP;
}
-
+ if (create_new_console) {
+ dwCreateFlags |= CREATE_NEW_CONSOLE;
+ }
envpw = php_win32_cp_env_any_to_w(env.envp);
if (envpw) {
dwCreateFlags |= CREATE_UNICODE_ENVIRONMENT;
diff --git a/ext/standard/tests/file/windows_mb_path/CONFLICTS b/ext/standard/tests/file/windows_mb_path/CONFLICTS
deleted file mode 100644
index 692a324587..0000000000
--- a/ext/standard/tests/file/windows_mb_path/CONFLICTS
+++ /dev/null
@@ -1,3 +0,0 @@
-# These tests depend on the console codepage, which is shared across all parallel workers.
-# Force these tests to run sequentially to make sure the codepage isn't change by another process.
-all
diff --git a/run-tests.php b/run-tests.php
index 1b17354111..e632f69a82 100755
--- a/run-tests.php
+++ b/run-tests.php
@@ -1424,7 +1424,8 @@ function run_all_tests_parallel($test_files, $env, $redir_tested) {
"TEST_PHP_URI" => $sockUri,
],
[
- "suppress_errors" => TRUE
+ "suppress_errors" => TRUE,
+ 'create_new_console' => TRUE,
]
);
if ($proc === FALSE) {