]> granicus.if.org Git - php/commitdiff
Create a new console for each test worker on Windows
authorChristoph M. Becker <cmbecker69@gmx.de>
Wed, 12 Feb 2020 13:34:48 +0000 (14:34 +0100)
committerChristoph M. Becker <cmbecker69@gmx.de>
Mon, 17 Feb 2020 17:52:45 +0000 (18:52 +0100)
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.

ext/standard/proc_open.c
ext/standard/tests/file/windows_mb_path/CONFLICTS [deleted file]
run-tests.php

index d99d0087716952087b238f89034b50347c0adac5..25a5f7fe3b880c4639462558a0a3c74d9fdade59 100644 (file)
@@ -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 (file)
index 692a324..0000000
+++ /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
index 1b1735411147a5a84a4344c3ede584d6c4fffe06..e632f69a828f5b0a5254ab3aebf933cc1a16af8d 100755 (executable)
@@ -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) {