From 3ed3a71741f1bf6e1b1d9931ed5f027d322e1b2f Mon Sep 17 00:00:00 2001 From: Nuno Lopes Date: Thu, 14 Sep 2006 17:07:41 +0000 Subject: [PATCH] MFB --- run-tests.php | 7 +++++-- tests/run-test/test010.phpt | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 tests/run-test/test010.phpt diff --git a/run-tests.php b/run-tests.php index c3d5f83677..297705fcf5 100755 --- a/run-tests.php +++ b/run-tests.php @@ -841,7 +841,7 @@ function error_report($testname, $logname, $tested) } } -function system_with_timeout($commandline, $env = null) +function system_with_timeout($commandline, $env = null, $stdin = null) { global $leak_check; @@ -856,6 +856,9 @@ function system_with_timeout($commandline, $env = null) if (!$proc) return false; + if (is_string($stdin)) { + fwrite($pipes[0], $stdin); + } fclose($pipes[0]); while (true) { @@ -1400,7 +1403,7 @@ SCRIPT_FILENAME = " . $env['SCRIPT_FILENAME'] . " COMMAND $cmd "; - $out = system_with_timeout($cmd, $env); + $out = system_with_timeout($cmd, $env, isset($section_text['STDIN']) ? $section_text['STDIN'] : null); if (array_key_exists('CLEAN', $section_text) && (!$no_clean || $cfg['keep']['clean'])) { if (trim($section_text['CLEAN'])) { diff --git a/tests/run-test/test010.phpt b/tests/run-test/test010.phpt new file mode 100644 index 0000000000..cc3ca3591e --- /dev/null +++ b/tests/run-test/test010.phpt @@ -0,0 +1,17 @@ +--TEST-- +STDIN input +--FILE-- + +--STDIN-- +fooBar +use this to input some thing to the php script +--EXPECT-- +string(54) "fooBar +use this to input some thing to the php script +" +string(0) "" +string(0) "" -- 2.50.1