mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Unblock tests under ASan on Windows
These tests execute php.exe without passing the PATH, what might be a more general issues, but at least with ASan enabled, the required DLLs could usually not be found, resulting in the tests stalling. Closes GH-17079.
This commit is contained in:
@@ -21,7 +21,8 @@ $cmd = "$cgi -n -C $fl";
|
||||
|
||||
/* Need to run CGI with the env reset. */
|
||||
$desc = array(0 => array("pipe", "r"));
|
||||
$proc = proc_open($cmd, $desc, $pipes, getcwd(), array());
|
||||
/* PATH is needed to find ASan DLLs (and maybe others) on Windows */
|
||||
$proc = proc_open($cmd, $desc, $pipes, getcwd(), array('PATH' => getenv('PATH')));
|
||||
if (is_resource($proc)) {
|
||||
echo stream_get_contents($pipes[0]);
|
||||
|
||||
|
||||
@@ -8,10 +8,11 @@ $php = getenv('TEST_PHP_EXECUTABLE_ESCAPED');
|
||||
if ($php === false) {
|
||||
die("no php executable defined");
|
||||
}
|
||||
/* PATH is needed to find ASan DLLs (and maybe others) on Windows */
|
||||
$proc = proc_open(
|
||||
"$php -n",
|
||||
array(0 => array('pipe', 'r'), 1 => array('pipe', 'w')),
|
||||
$pipes, getcwd(), array(), array()
|
||||
$pipes, getcwd(), array('PATH' => getenv('PATH')), array()
|
||||
);
|
||||
if ($proc === false) {
|
||||
print "something went wrong.\n";
|
||||
|
||||
@@ -44,7 +44,8 @@ fpassthru($pipes[1]);
|
||||
proc_close($proc);
|
||||
|
||||
putenv('ENV_1=ENV_1');
|
||||
$env = ['ENV_2' => 'ENV_2'];
|
||||
/* PATH is needed to find ASan DLLs (and maybe others) on Windows */
|
||||
$env = ['ENV_2' => 'ENV_2', 'PATH' => getenv('PATH')];
|
||||
$cmd = [$php, '-n', '-r', 'var_dump(getenv("ENV_1"), getenv("ENV_2"));'];
|
||||
|
||||
echo "\nEnvironment inheritance:\n";
|
||||
|
||||
@@ -21,6 +21,7 @@ TMPFILE
|
||||
|
||||
$command = sprintf("%s -n %s", getenv('TEST_PHP_EXECUTABLE_ESCAPED'), escapeshellarg($file));
|
||||
|
||||
/* PATH is needed to find ASan DLLs (and maybe others) on Windows */
|
||||
$process = proc_open(
|
||||
$command,
|
||||
[
|
||||
@@ -30,7 +31,7 @@ $process = proc_open(
|
||||
],
|
||||
$pipes,
|
||||
getcwd(),
|
||||
[],
|
||||
['PATH' => getenv('PATH')],
|
||||
[
|
||||
'suppress_errors' => true,
|
||||
'bypass_shell' => false
|
||||
|
||||
@@ -14,7 +14,8 @@ $descriptors = array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w'))
|
||||
$stdin = str_repeat('*', 4097);
|
||||
|
||||
$options = array_merge(array('suppress_errors' => true, 'bypass_shell' => false));
|
||||
$process = proc_open($cmd, $descriptors, $pipes, getcwd(), array(), $options);
|
||||
/* PATH is needed to find ASan DLLs (and maybe others) on Windows */
|
||||
$process = proc_open($cmd, $descriptors, $pipes, getcwd(), array('PATH' => getenv('PATH')), $options);
|
||||
|
||||
foreach ($pipes as $pipe) {
|
||||
stream_set_blocking($pipe, false);
|
||||
|
||||
Reference in New Issue
Block a user