4 # Modification history:
5 # Written 91-12-02 through 92-01-01 by Stephen McGee.
6 # Modified 92-02-11 through 92-02-22 by Chris Arthur to further generalize.
7 # End of modification history
9 # Test driver routines used by a number of test suites, including
10 # those for SCS, make, roll_dir, and scan_deps (?).
12 # this routine controls the whole mess; each test suite sets up a few
13 # variables and then calls &toplevel, which does all the real work.
15 # $Id: test_driver.pl,v 1.15 2005/07/12 04:35:13 psmith Exp $
18 # The number of test categories we've run
20 # The number of test categroies that have passed
21 $categories_passed = 0;
22 # The total number of individual tests that have been run
24 # The total number of individual tests that have passed
25 $total_tests_passed = 0;
26 # The number of tests in this category that have been run
28 # The number of tests in this category that have passed
32 # Yeesh. This whole test environment is such a hack!
36 # %makeENV is the cleaned-out environment.
39 # %extraENV are any extra environment variables the tests might want to set.
40 # These are RESET AFTER EVERY TEST!
43 # %origENV is the caller's original environment
48 # We used to say "%ENV = ();" but this doesn't work in Perl 5.000
49 # through Perl 5.004. It was fixed in Perl 5.004_01, but we don't
50 # want to require that here, so just delete each one individually.
51 foreach $v (keys %ENV) {
56 foreach $v (keys %extraENV) {
57 $ENV{$v} = $extraENV{$v};
64 # Pull in benign variables from the user's environment
66 foreach (# UNIX-specific things
67 'TZ', 'LANG', 'TMPDIR', 'HOME', 'USER', 'LOGNAME', 'PATH',
70 # Windows NT-specific stuff
72 # DJGPP-specific stuff
73 'DJDIR', 'DJGPP', 'SHELL', 'COMSPEC', 'HOSTNAME', 'LFN',
74 'FNCASE', '387', 'EMU387', 'GROUP'
76 $makeENV{$_} = $ENV{$_} if $ENV{$_};
79 # Replace the environment with the new one
85 $| = 1; # unbuffered output
87 $debug = 0; # debug flag
88 $profile = 0; # profiling flag
89 $verbose = 0; # verbose mode flag
90 $detail = 0; # detailed verbosity
91 $keep = 0; # keep temp files around
92 $workdir = "work"; # The directory where the test will start running
93 $scriptdir = "scripts"; # The directory where we find the test scripts
94 $tmpfilesuffix = "t"; # the suffix used on tmpfiles
95 $default_output_stack_level = 0; # used by attach_default_output, etc.
96 $default_input_stack_level = 0; # used by attach_default_input, etc.
97 $cwd = "."; # don't we wish we knew
98 $cwdslash = ""; # $cwd . $pathsep, but "" rather than "./"
100 &get_osname
; # sets $osname, $vos, $pathsep, and $short_filenames
102 &set_defaults
; # suite-defined
104 &parse_command_line
(@ARGV);
106 print "OS name = `$osname'\n" if $debug;
108 $workpath = "$cwdslash$workdir";
109 $scriptpath = "$cwdslash$scriptdir";
111 &set_more_defaults
; # suite-defined
117 print "Clearing $workpath...\n";
118 &remove_directory_tree
("$workpath/")
119 || &error
("Couldn't wipe out $workpath\n");
123 mkdir ($workpath, 0777) || &error
("Couldn't mkdir $workpath: $!\n");
128 &error
("Failed to find $scriptpath containing perl test scripts.\n");
133 print "Making work dirs...\n";
134 foreach $test (@TESTS)
136 if ($test =~ /^([^\/]+)\
//)
139 push (@rmdirs, $dir);
141 || mkdir ("$workpath/$dir", 0777)
142 || &error
("Couldn't mkdir $workpath/$dir: $!\n");
148 print "Finding tests...\n";
149 opendir (SCRIPTDIR
, $scriptpath)
150 || &error
("Couldn't opendir $scriptpath: $!\n");
151 @dirs = grep (!/^(\.\.?|CVS|RCS)$/, readdir (SCRIPTDIR
) );
152 closedir (SCRIPTDIR
);
155 next if ($dir =~ /^\.\.?$/ || $dir eq 'CVS' || $dir eq 'RCS'
156 || ! -d
"$scriptpath/$dir");
157 push (@rmdirs, $dir);
158 mkdir ("$workpath/$dir", 0777)
159 || &error
("Couldn't mkdir $workpath/$dir: $!\n");
160 opendir (SCRIPTDIR
, "$scriptpath/$dir")
161 || &error
("Couldn't opendir $scriptpath/$dir: $!\n");
162 @files = grep (!/^(\.\.?|CVS|RCS)$/, readdir (SCRIPTDIR
) );
163 closedir (SCRIPTDIR
);
164 foreach $test (@files)
166 next if $test =~ /~$/ || -d
$test;
167 push (@TESTS, "$dir/$test");
174 &error
("\nNo tests in $scriptpath, and none were specified.\n");
181 foreach $dir (@rmdirs)
183 rmdir ("$workpath/$dir");
188 $categories_failed = $categories_run - $categories_passed;
189 $total_tests_failed = $total_tests_run - $total_tests_passed;
191 if ($total_tests_failed)
193 print "\n$total_tests_failed Test";
194 print "s" unless $total_tests_failed == 1;
195 print " in $categories_failed Categor";
196 print ($categories_failed == 1 ?
"y" : "ies");
197 print " Failed (See .$diffext files in $workdir dir for details) :-(\n\n";
202 print "\n$total_tests_passed Test";
203 print "s" unless $total_tests_passed == 1;
204 print " in $categories_passed Categor";
205 print ($categories_passed == 1 ?
"y" : "ies");
206 print " Complete ... No Failures :-)\n\n";
213 # Set up an initial value. In perl5 we can do it the easy way.
215 $osname = defined($^O
) ?
$^O
: '';
217 # See if the filesystem supports long file names with multiple
219 $short_filenames = 0;
220 (open (TOUCHFD
, "> fancy.file.name") && close (TOUCHFD
))
221 || ($short_filenames = 1);
222 unlink ("fancy.file.name") || ($short_filenames = 1);
224 if (! $short_filenames) {
225 # Thanks go to meyering@cs.utexas.edu (Jim Meyering) for suggesting a
226 # better way of doing this. (We used to test for existence of a /mnt
227 # dir, but that apparently fails on an SGI Indigo (whatever that is).)
228 # Because perl on VOS translates /'s to >'s, we need to test for
229 # VOSness rather than testing for Unixness (ie, try > instead of /).
231 mkdir (".ostest", 0777) || &error
("Couldn't create .ostest: $!\n", 1);
232 open (TOUCHFD
, "> .ostest>ick") && close (TOUCHFD
);
233 chdir (".ostest") || &error
("Couldn't chdir to .ostest: $!\n", 1);
236 if (! $short_filenames && -f
"ick")
244 # the following is regrettably knarly, but it seems to be the only way
245 # to not get ugly error messages if uname can't be found.
246 # Hmmm, BSD/OS 2.0's uname -a is excessively verbose. Let's try it
247 # with switches first.
248 eval "chop (\$osname = `sh -c 'uname -nmsr 2>&1'`)";
249 if ($osname =~ /not found/i)
251 $osname = "(something unixy with no uname)";
253 elsif ($@
ne "" || $?
)
255 eval "chop (\$osname = `sh -c 'uname -a 2>&1'`)";
258 $osname = "(something unixy)";
265 if (! $short_filenames) {
266 chdir ("..") || &error
("Couldn't chdir to ..: $!\n", 1);
267 unlink (".ostest>ick");
268 rmdir (".ostest") || &error
("Couldn't rmdir .ostest: $!\n", 1);
272 sub parse_command_line
276 # use @ARGV if no args were passed in
283 # look at each option; if we don't recognize it, maybe the suite-specific
284 # command line parsing code will...
288 $option = shift @argv;
289 if ($option =~ /^-debug$/i)
291 print "\nDEBUG ON\n";
294 elsif ($option =~ /^-usage$/i)
299 elsif ($option =~ /^-(h|help)$/i)
304 elsif ($option =~ /^-profile$/i)
308 elsif ($option =~ /^-verbose$/i)
312 elsif ($option =~ /^-detail$/i)
317 elsif ($option =~ /^-keep$/i)
321 elsif (&valid_option
($option))
323 # The suite-defined subroutine takes care of the option
325 elsif ($option =~ /^-/)
327 print "Invalid option: $option\n";
331 else # must be the name of a test
333 $option =~ s/\.pl$//;
334 push(@TESTS,$option);
341 local($num) = shift @_;
358 local($width, $string) = @_;
361 if (length ($string))
363 $pad = " " x
( ($width - length ($string) + 1) / 2);
374 $info = "Running tests for $testee on $osname\n"; # $testee is suite-defined
375 $len = &max
(length ($line), length ($testee_version),
376 length ($banner_info), 73) + 5;
377 $line = ("-" x
$len) . "\n";
383 &print_centered
($len, $line);
384 &print_centered
($len, $info);
385 &print_centered
($len, $testee_version); # suite-defined
386 &print_centered
($len, $banner_info); # suite-defined
387 &print_centered
($len, $line);
395 foreach $testname (sort @TESTS)
398 $suite_passed = 1; # reset by test on failure
399 $num_of_logfiles = 0;
400 $num_of_tmpfiles = 0;
403 $old_makefile = undef;
404 $testname =~ s/^$scriptpath$pathsep//;
405 $perl_testname = "$scriptpath$pathsep$testname";
406 $testname =~ s/(\.pl|\.perl)$//;
407 $testpath = "$workpath$pathsep$testname";
408 # Leave enough space in the extensions to append a number, even
409 # though it needs to fit into 8+3 limits.
410 if ($short_filenames) {
422 $log_filename = "$testpath.$logext";
423 $diff_filename = "$testpath.$diffext";
424 $base_filename = "$testpath.$baseext";
425 $tmp_filename = "$testpath.$tmpfilesuffix";
427 &setup_for_test
; # suite-defined
429 $output = "........................................................ ";
431 substr($output,0,length($testname)) = "$testname ";
435 # Run the actual test!
438 $code = do $perl_testname;
440 $total_tests_run += $tests_run;
441 $total_tests_passed += $tests_passed;
449 warn "\n*** Test died ($testname): $@\n";
453 warn "\n*** Couldn't run $perl_testname\n";
456 elsif ($code == -1) {
459 elsif ($code != 1 && $code != -1) {
461 warn "\n*** Test returned $code\n";
465 ++$categories_passed;
466 $status = "ok ($tests_passed passed)";
467 for ($i = $num_of_tmpfiles; $i; $i--)
469 &rmfiles
($tmp_filename . &num_suffix
($i) );
472 for ($i = $num_of_logfiles ?
$num_of_logfiles : 1; $i; $i--)
474 &rmfiles
($log_filename . &num_suffix
($i) );
475 &rmfiles
($base_filename . &num_suffix
($i) );
479 $status = "FAILED ($tests_passed/$tests_run passed)";
486 # If the verbose option has been specified, then a short description
487 # of each test is printed before displaying the results of each test
488 # describing WHAT is being tested.
494 print "\nWHAT IS BEING TESTED\n";
495 print "--------------------";
497 print "\n\n$description\n\n";
500 # If the detail option has been specified, then the details of HOW
501 # the test is testing what it says it is testing in the verbose output
502 # will be displayed here before the results of the test are displayed.
506 print "\nHOW IT IS TESTED\n";
507 print "----------------";
508 print "\n\n$details\n\n";
515 # If the keep flag is not set, this subroutine deletes all filenames that
524 return (unlink @files);
530 sub print_standard_usage
532 local($plname,@moreusage) = @_;
535 print "Usage: perl $plname [testname] [-verbose] [-detail] [-keep]\n";
536 print " [-profile] [-usage] [-help] "
538 foreach $line (@moreusage)
544 sub print_standard_help
546 local(@morehelp) = @_;
551 $line = "Test Driver For $testee";
553 $line = "=" x
length ($line);
559 . "${t}You may, if you wish, run only ONE test if you know the name\n"
560 . "${t}of that test and specify this name anywhere on the command\n"
561 . "${t}line. Otherwise ALL existing tests in the scripts directory\n"
562 . "${t}will be run.\n"
564 . "${t}If this option is given, a description of every test is\n"
565 . "${t}displayed before the test is run. (Not all tests may have\n"
566 . "${t}descriptions at this time)\n"
568 . "${t}If this option is given, a detailed description of every\n"
569 . "${t}test is displayed before the test is run. (Not all tests\n"
570 . "${t}have descriptions at this time)\n"
572 . "${t}If this option is given, then the profile file\n"
573 . "${t}is added to other profiles every time $testee is run.\n"
574 . "${t}This option only works on VOS at this time.\n"
576 . "${t}You may give this option if you DO NOT want ANY\n"
577 . "${t}of the files generated by the tests to be deleted. \n"
578 . "${t}Without this option, all files generated by the test will\n"
579 . "${t}be deleted IF THE TEST PASSES.\n"
581 . "${t}Use this option if you would like to see all of the system\n"
582 . "${t}calls issued and their return status while running the tests\n"
583 . "${t}This can be helpful if you're having a problem adding a test\n"
584 . "${t}to the suite, or if the test fails!\n";
586 foreach $line (@morehelp)
589 if (substr ($tline, 0, 1) eq "\t")
591 substr ($tline, 0, 1) = $t;
597 #######################################################################
598 ########### Generic Test Driver Subroutines ###########
599 #######################################################################
608 $depth = defined ($_[0]) ?
$_[0] : 1;
609 ($package, $filename, $linenum) = caller ($depth + 1);
610 return "$filename: $linenum";
615 local($message) = $_[0];
616 local($caller) = &get_caller
(1);
620 $caller = &get_caller
($_[1] + 1) . " -> $caller";
623 die "$caller: $message";
628 local($answer,$logfile) = @_;
629 local($slurp, $answer_matched) = ('', 0);
631 print "Comparing Output ........ " if $debug;
633 $slurp = &read_file_into_string
($logfile);
635 # For make, get rid of any time skew error before comparing--too bad this
636 # has to go into the "generic" driver code :-/
637 $slurp =~ s/^.*modification time .*in the future.*\n//gm;
638 $slurp =~ s/^.*Clock skew detected.*\n//gm;
642 if ($slurp eq $answer) {
645 # See if it is a slash or CRLF problem
646 local ($answer_mod) = $answer;
648 $answer_mod =~ tr
,\\,/,;
649 $answer_mod =~ s
,\r\n,\n,gs
;
652 $slurp =~ s
,\r\n,\n,gs
;
654 $answer_matched = ($slurp eq $answer_mod);
657 if ($answer_matched && $test_passed)
659 print "ok\n" if $debug;
664 if (! $answer_matched) {
665 print "DIFFERENT OUTPUT\n" if $debug;
667 &create_file
(&get_basefile
, $answer);
669 print "\nCreating Difference File ...\n" if $debug;
671 # Create the difference file
673 local($command) = "diff -c " . &get_basefile
. " " . $logfile;
674 &run_command_with_output
(&get_difffile
,$command);
681 sub read_file_into_string
683 local($filename) = @_;
684 local($oldslash) = $/;
688 open (RFISFILE
, $filename) || return "";
689 local ($slurp) = <RFISFILE
>;
697 sub attach_default_output
699 local ($filename) = @_;
704 $code = system "++attach_default_output_hack $filename";
705 $code == -2 || &error
("adoh death\n", 1);
709 open ("SAVEDOS" . $default_output_stack_level . "out", ">&STDOUT")
710 || &error
("ado: $! duping STDOUT\n", 1);
711 open ("SAVEDOS" . $default_output_stack_level . "err", ">&STDERR")
712 || &error
("ado: $! duping STDERR\n", 1);
714 open (STDOUT
, "> " . $filename)
715 || &error
("ado: $filename: $!\n", 1);
716 open (STDERR
, ">&STDOUT")
717 || &error
("ado: $filename: $!\n", 1);
719 $default_output_stack_level++;
722 # close the current stdout/stderr, and restore the previous ones from
725 sub detach_default_output
731 $code = system "++detach_default_output_hack";
732 $code == -2 || &error
("ddoh death\n", 1);
736 if (--$default_output_stack_level < 0)
738 &error
("default output stack has flown under!\n", 1);
744 open (STDOUT
, ">&SAVEDOS" . $default_output_stack_level . "out")
745 || &error
("ddo: $! duping STDOUT\n", 1);
746 open (STDERR
, ">&SAVEDOS" . $default_output_stack_level . "err")
747 || &error
("ddo: $! duping STDERR\n", 1);
749 close ("SAVEDOS" . $default_output_stack_level . "out")
750 || &error
("ddo: $! closing SCSDOSout\n", 1);
751 close ("SAVEDOS" . $default_output_stack_level . "err")
752 || &error
("ddo: $! closing SAVEDOSerr\n", 1);
755 # run one command (passed as a list of arg 0 - n), returning 0 on success
756 # and nonzero on failure.
762 # We reset this before every invocation. On Windows I think there is only
763 # one environment, not one per process, so I think that variables set in
764 # test scripts might leak into subsequent tests if this isn't reset--???
767 print "\nrun_command: @_\n" if $debug;
769 print "run_command: \"@_\" returned $code.\n" if $debug;
774 # run one command (passed as a list of arg 0 - n, with arg 0 being the
775 # second arg to this routine), returning 0 on success and non-zero on failure.
776 # The first arg to this routine is a filename to connect to the stdout
777 # & stderr of the child process.
779 sub run_command_with_output
781 local ($filename) = shift;
784 # We reset this before every invocation. On Windows I think there is only
785 # one environment, not one per process, so I think that variables set in
786 # test scripts might leak into subsequent tests if this isn't reset--???
789 &attach_default_output
($filename);
791 &detach_default_output
;
793 print "run_command_with_output: '@_' returned $code.\n" if $debug;
798 # performs the equivalent of an "rm -rf" on the first argument. Like
799 # rm, if the path ends in /, leaves the (now empty) directory; otherwise
802 sub remove_directory_tree
804 local ($targetdir) = @_;
805 local ($nuketop) = 1;
808 $ch = substr ($targetdir, length ($targetdir) - 1);
809 if ($ch eq "/" || $ch eq $pathsep)
811 $targetdir = substr ($targetdir, 0, length ($targetdir) - 1);
820 &remove_directory_tree_inner
("RDT00", $targetdir) || return 0;
823 rmdir $targetdir || return 0;
829 sub remove_directory_tree_inner
831 local ($dirhandle, $targetdir) = @_;
833 local ($subdirhandle);
835 opendir ($dirhandle, $targetdir) || return 0;
836 $subdirhandle = $dirhandle;
838 while ($object = readdir ($dirhandle))
840 if ($object =~ /^(\.\.?|CVS|RCS)$/)
845 $object = "$targetdir$pathsep$object";
848 if (-d _
&& &remove_directory_tree_inner
($subdirhandle, $object))
850 rmdir $object || return 0;
854 unlink $object || return 0;
857 closedir ($dirhandle);
861 # We used to use this behavior for this function:
865 # local (@filenames) = @_;
866 # local ($now) = time;
869 # foreach $file (@filenames)
871 # utime ($now, $now, $file)
872 # || (open (TOUCHFD, ">> $file") && close (TOUCHFD))
873 # || &error ("Couldn't touch $file: $!\n", 1);
878 # But this behaves badly on networked filesystems where the time is
879 # skewed, because it sets the time of the file based on the _local_
880 # host. Normally when you modify a file, it's the _remote_ host that
881 # determines the modtime, based on _its_ clock. So, instead, now we open
882 # the file and write something into it to force the remote host to set
883 # the modtime correctly according to its clock.
891 (open(T
, ">> $file") && print(T
"\n") && close(T
))
892 || &error
("Couldn't touch $file: $!\n", 1);
896 # Touch with a time offset. To DTRT, call touch() then use stat() to get the
897 # access/mod time for each file and apply the offset.
901 local ($off) = shift;
906 local (@s) = stat($_[0]);
908 utime($s[8]+$off, $s[9]+$off, @_);
911 # open a file, write some stuff to it, and close it.
915 local ($filename, @lines) = @_;
917 open (CF
, "> $filename") || &error
("Couldn't open $filename: $!\n", 1);
918 foreach $line (@lines)
925 # create a directory tree described by an associative array, wherein each
926 # key is a relative pathname (using slashes) and its associated value is
928 # DIR indicates a directory
929 # FILE:contents indicates a file, which should contain contents +\n
930 # LINK:target indicates a symlink, pointing to $basedir/target
931 # The first argument is the dir under which the structure will be created
932 # (the dir will be made and/or cleaned if necessary); the second argument
933 # is the associative array.
937 local ($basedir, %dirtree) = @_;
940 &remove_directory_tree
("$basedir");
941 mkdir ($basedir, 0777) || &error
("Couldn't mkdir $basedir: $!\n", 1);
943 foreach $path (sort keys (%dirtree))
945 if ($dirtree {$path} =~ /^DIR$/)
947 mkdir ("$basedir/$path", 0777)
948 || &error
("Couldn't mkdir $basedir/$path: $!\n", 1);
950 elsif ($dirtree {$path} =~ /^FILE:(.*)$/)
952 &create_file
("$basedir/$path", $1 . "\n");
954 elsif ($dirtree {$path} =~ /^LINK:(.*)$/)
956 symlink ("$basedir/$1", "$basedir/$path")
957 || &error
("Couldn't symlink $basedir/$path -> $basedir/$1: $!\n", 1);
961 &error
("Bogus dirtree type: \"$dirtree{$path}\"\n", 1);
964 if ($just_setup_tree)
966 die "Tree is setup...\n";
970 # compare a directory tree with an associative array in the format used
971 # by create_dir_tree, above.
972 # The first argument is the dir under which the structure should be found;
973 # the second argument is the associative array.
977 local ($basedir, %dirtree) = @_;
988 opendir (DIR
, $basedir) || &error
("Couldn't open $basedir: $!\n", 1);
989 @allfiles = grep (!/^(\.\.?|CVS|RCS)$/, readdir (DIR
) );
993 print "dirtree: (%dirtree)\n$basedir: (@allfiles)\n";
996 foreach $path (sort keys (%dirtree))
1000 print "Checking $path ($dirtree{$path}).\n";
1004 foreach $i (0 .. $#allfiles)
1006 if ($allfiles[$i] eq $path)
1008 splice (@allfiles, $i, 1); # delete it
1011 print " Zapped $path; files now (@allfiles).\n";
1013 lstat ("$basedir/$path");
1021 print "compare_dir_tree: $path does not exist.\n";
1026 if ($dirtree {$path} =~ /^DIR$/)
1028 if (-d _
&& opendir (DIR
, "$basedir/$path") )
1030 @files = readdir (DIR
);
1032 @files = grep (!/^(\.\.?|CVS|RCS)$/ && ($_ = "$path/$_"), @files);
1033 push (@allfiles, @files);
1036 print " Read in $path; new files (@files).\n";
1041 print "compare_dir_tree: $path is not a dir.\n";
1045 elsif ($dirtree {$path} =~ /^FILE:(.*)$/)
1049 print "compare_dir_tree: $path is not a file.\n";
1056 $contents = &read_file_into_string
("$basedir/$path");
1057 if ($contents ne "$1\n")
1059 print "compare_dir_tree: $path contains wrong stuff."
1060 . " Is:\n$contentsShould be:\n$1\n";
1065 elsif ($dirtree {$path} =~ /^LINK:(.*)$/)
1070 print "compare_dir_tree: $path is not a link.\n";
1075 $contents = readlink ("$basedir/$path");
1076 $contents =~ tr/>/\//;
1077 $fulltarget = "$basedir/$target";
1078 $fulltarget =~ tr/>/\//;
1079 if (!($contents =~ /$fulltarget$/))
1083 $target = $fulltarget;
1085 print "compare_dir_tree: $path should be link to $target, "
1086 . "not $contents.\n";
1092 &error
("Bogus dirtree type: \"$dirtree{$path}\"\n", 1);
1098 print "leftovers: (@allfiles).\n";
1101 foreach $file (@allfiles)
1103 print "compare_dir_tree: $file should not exist.\n";
1110 # this subroutine generates the numeric suffix used to keep tmp filenames,
1111 # log filenames, etc., unique. If the number passed in is 1, then a null
1112 # string is returned; otherwise, we return ".n", where n + 1 is the number
1120 return "$extext$num";
1126 # This subroutine returns a log filename with a number appended to
1127 # the end corresponding to how many logfiles have been created in the
1128 # current running test. An optional parameter may be passed (0 or 1).
1129 # If a 1 is passed, then it does NOT increment the logfile counter
1130 # and returns the name of the latest logfile. If either no parameter
1131 # is passed at all or a 0 is passed, then the logfile counter is
1132 # incremented and the new name is returned.
1136 local($no_increment) = @_;
1138 $num_of_logfiles += !$no_increment;
1140 return ($log_filename . &num_suffix
($num_of_logfiles));
1143 # This subroutine returns a base (answer) filename with a number
1144 # appended to the end corresponding to how many logfiles (and thus
1145 # base files) have been created in the current running test.
1146 # NO PARAMETERS ARE PASSED TO THIS SUBROUTINE.
1150 return ($base_filename . &num_suffix
($num_of_logfiles));
1153 # This subroutine returns a difference filename with a number appended
1154 # to the end corresponding to how many logfiles (and thus diff files)
1155 # have been created in the current running test.
1159 return ($diff_filename . &num_suffix
($num_of_logfiles));
1162 # just like logfile, only a generic tmp filename for use by the test.
1163 # they are automatically cleaned up unless -keep was used, or the test fails.
1164 # Pass an argument of 1 to return the same filename as the previous call.
1168 local($no_increment) = @_;
1170 $num_of_tmpfiles += !$no_increment;
1172 return ($tmp_filename . &num_suffix
($num_of_tmpfiles));