Skip to content

Commit f7df762

Browse files
committed
run-tests.php: Save stdin section to a file
1 parent b25a1a7 commit f7df762

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

run-tests.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1934,6 +1934,7 @@ function run_test(string $php, $file, array $env): string
19341934
$diff_filename = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name . 'diff';
19351935
$log_filename = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name . 'log';
19361936
$exp_filename = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name . 'exp';
1937+
$stdin_filename = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name . 'stdin';
19371938
$output_filename = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name . 'out';
19381939
$memcheck_filename = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name . 'mem';
19391940
$sh_filename = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name . 'sh';
@@ -1972,6 +1973,7 @@ function run_test(string $php, $file, array $env): string
19721973
@unlink($diff_filename);
19731974
@unlink($log_filename);
19741975
@unlink($exp_filename);
1976+
@unlink($stdin_filename);
19751977
@unlink($output_filename);
19761978
@unlink($memcheck_filename);
19771979
@unlink($sh_filename);
@@ -2696,6 +2698,16 @@ function run_test(string $php, $file, array $env): string
26962698
$diff = generate_diff($wanted, $wanted_re, $output);
26972699
}
26982700

2701+
// write .stdin
2702+
if ($test->hasSection('STDIN') || $test->hasSection('PHPDBG')) {
2703+
$stdin = $test->hasSection('STDIN')
2704+
? $test->getSection('STDIN')
2705+
: $test->getSection('PHPDBG') . "\n";
2706+
if (file_put_contents($stdin_filename, $stdin) === false) {
2707+
error("Cannot create test stdin - $stdin_filename");
2708+
}
2709+
}
2710+
26992711
if (is_array($IN_REDIRECT)) {
27002712
$orig_shortname = str_replace(TEST_PHP_SRCDIR . '/', '', $file);
27012713
$diff = "# original source file: $orig_shortname\n" . $diff;

0 commit comments

Comments
 (0)