* tests/test_driver.pl (run_all_tests): Keep one copy of STDIN

This commit is contained in:
Paul Smith 2022-04-24 13:34:15 -04:00
parent 700af780af
commit 51c1c07e7a

View file

@ -530,22 +530,9 @@ sub run_all_tests
$categories_run = 0;
$lasttest = '';
# $testname is published
foreach $testname (sort @TESTS) {
# Skip duplicates on VMS caused by logical name search lists.
next if $testname eq $lasttest;
$lasttest = $testname;
$suite_passed = 1; # reset by test on failure
$num_of_logfiles = 0;
$num_of_tmpfiles = 0;
$description = "";
$details = "";
$old_makefile = undef;
$testname =~ s/^$scriptpath$pathsep//;
$perl_testname = "$scriptpath$pathsep$testname";
$testname =~ s/(\.pl|\.perl)$//;
$testpath = "$workpath$pathsep$testname";
# Make a copy of STDIN so we can reset it
open(INCOPY, "<&STDIN");
# Leave enough space in the extensions to append a number, even
# though it needs to fit into 8+3 limits.
if ($short_filenames) {
@ -561,6 +548,24 @@ sub run_all_tests
$runext = 'run';
$extext = '.';
}
$lasttest = '';
# $testname is published
foreach $testname (sort @TESTS) {
# Skip duplicates on VMS caused by logical name search lists.
next if $testname eq $lasttest;
$lasttest = $testname;
$suite_passed = 1; # reset by test on failure
$num_of_logfiles = 0;
$num_of_tmpfiles = 0;
$description = "";
$details = "";
$old_makefile = undef;
$testname =~ s/^$scriptpath$pathsep//;
$perl_testname = "$scriptpath$pathsep$testname";
$testname =~ s/(\.pl|\.perl)$//;
$testpath = "$workpath$pathsep$testname";
$extext = '_' if $^O eq 'VMS';
$log_filename = "$testpath.$logext";
$diff_filename = "$testpath.$diffext";
@ -574,21 +579,18 @@ sub run_all_tests
$output = "........................................................ ";
substr($output,0,length($testname)) = "$testname ";
substr($output, 0, length($testname)) = "$testname ";
print $output;
$tests_run = 0;
$tests_passed = 0;
# make a copy of STDIN so we can reset it
open(INCOPY, "<&STDIN");
# Run the test!
$code = do $perl_testname;
# Restore STDIN
open(STDIN, "<&OLDIN");
# Reset STDIN from the copy in case it was changed
open(STDIN, "<&INCOPY");
++$categories_run;
$total_tests_run += $tests_run;
@ -662,6 +664,8 @@ sub run_all_tests
print "$status\n";
}
close(INCOPY);
}
# If the keep flag is not set, this subroutine deletes all filenames that