Imported Upstream version 4.4
[platform/upstream/make.git] / tests / run_make_tests.pl
1 #!/usr/bin/env perl
2 # -*-perl-*-
3
4 # Test driver for the Make test suite
5
6 # Usage:  run_make_tests  [testname]
7 #                         [-debug]
8 #                         [-help]
9 #                         [-verbose]
10 #                         [-keep]
11 #                         [-make <make prog>]
12 #                        (and others)
13
14 # Copyright (C) 1992-2022 Free Software Foundation, Inc.
15 # This file is part of GNU Make.
16 #
17 # GNU Make is free software; you can redistribute it and/or modify it under
18 # the terms of the GNU General Public License as published by the Free Software
19 # Foundation; either version 3 of the License, or (at your option) any later
20 # version.
21 #
22 # GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
23 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
24 # FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
25 # details.
26 #
27 # You should have received a copy of the GNU General Public License along with
28 # this program.  If not, see <https://www.gnu.org/licenses/>.
29
30 # Add the working directory to @INC and load the test driver
31 use FindBin;
32 use lib "$FindBin::Bin";
33
34 our $testsroot = $FindBin::Bin;
35
36 require "test_driver.pl";
37
38 use File::Spec;
39
40 use Cwd;
41 $cwdpath = cwd();
42 ($cwdvol, $cwddir, $_) = File::Spec->splitpath($cwdpath, 1);
43
44 # Some target systems might not have the POSIX module...
45 $has_POSIX = eval { require "POSIX.pm" };
46
47 %FEATURES = ();
48 %DEFVARS = (
49     AR => undef,
50     CC => undef
51 );
52
53 $valgrind = 0;              # invoke make with valgrind
54 $valgrind_args = '';
55 $memcheck_args = '--num-callers=15 --tool=memcheck --leak-check=full --suppressions=guile.supp';
56 $massif_args = '--num-callers=15 --tool=massif --alloc-fn=xmalloc --alloc-fn=xcalloc --alloc-fn=xrealloc --alloc-fn=xstrdup --alloc-fn=xstrndup';
57 $pure_log = undef;
58
59 # The location of the GNU make source directory
60 $srcdir = undef;
61 $fqsrcdir = undef;
62 $srcvol = undef;
63
64 # The location of the build directory
65 $blddir = undef;
66 $fqblddir = undef;
67 $bldvol = undef;
68
69 $make_path = undef;
70 @make_command = ();
71
72 $command_string = '';
73
74 $all_tests = 0;
75
76 # Shell commands
77
78 $sh_name = '/bin/sh';
79 $is_posix_sh = 1;
80
81 $CMD_rmfile = 'rm -f';
82
83 # rmdir broken in some Perls on VMS.
84 if ($^O eq 'VMS')
85 {
86   require VMS::Filespec;
87   VMS::Filespec->import();
88
89   sub vms_rmdir {
90     my $vms_file = vmspath($_[0]);
91     $vms_file = fileify($vms_file);
92     my $ret = unlink(vmsify($vms_file));
93     return $ret
94   };
95
96   *CORE::GLOBAL::rmdir = \&vms_rmdir;
97
98   $CMD_rmfile = 'delete_file -no_ask';
99 }
100
101 %CONFIG_FLAGS = ();
102
103 # Find the strings that will be generated for various error codes.
104 # We want them from the C locale regardless of our current locale.
105
106 $ERR_no_such_file = undef;
107 $ERR_read_only_file = undef;
108 $ERR_unreadable_file = undef;
109 $ERR_nonexe_file = undef;
110 $ERR_exe_dir = undef;
111 $ERR_command_not_found = undef;
112
113 #$SIG{INT} = sub { print STDERR "Caught a signal!\n"; die @_; };
114
115 sub valid_option
116 {
117    local($option) = @_;
118
119    if ($option =~ /^-make([-_]?path)?$/i) {
120        $make_path = shift @argv;
121        if (! -f $make_path) {
122            print "$option $make_path: Not found.\n";
123            exit 1;
124        }
125        return 1;
126    }
127
128    if ($option =~ /^-srcdir$/i) {
129        $srcdir = shift @argv;
130        if (! -f File::Spec->catfile($srcdir, 'src', 'gnumake.h')) {
131            print "$option $srcdir: Not a valid GNU make source directory.\n";
132            exit 1;
133        }
134        return 1;
135    }
136
137    if ($option =~ /^-all([-_]?tests)?$/i) {
138        $all_tests = 1;
139        return 1;
140    }
141
142    if ($option =~ /^-(valgrind|memcheck)$/i) {
143        $valgrind = 1;
144        $valgrind_args = $memcheck_args;
145        return 1;
146    }
147
148    if ($option =~ /^-massif$/i) {
149        $valgrind = 1;
150        $valgrind_args = $massif_args;
151        return 1;
152    }
153
154 # This doesn't work--it _should_!  Someone badly needs to fix this.
155 #
156 #   elsif ($option =~ /^-work([-_]?dir)?$/)
157 #   {
158 #      $workdir = shift @argv;
159 #      return 1;
160 #   }
161
162    return 0;
163 }
164
165
166 # This is an "all-in-one" function.  Arguments are as follows:
167 #
168 #  [0] (string):  The makefile to be tested.  undef means use the last one.
169 #  [1] (string):  Arguments to pass to make.
170 #  [2] (string):  Answer we should get back.
171 #  [3] (integer): Exit code we expect.  A missing code means 0 (success)
172
173 $makefile = undef;
174 $old_makefile = undef;
175 $mkpath = undef;
176 $make_name = undef;
177 $helptool = undef;
178
179 sub subst_make_string
180 {
181     local $_ = shift;
182     $makefile and s/#MAKEFILE#/$makefile/g;
183     s/#MAKEPATH#/$mkpath/g;
184     s/#MAKE#/$make_name/g;
185     s/#PERL#/$perl_name/g;
186     s/#PWD#/$cwdpath/g;
187     s/#WORK#/$workdir/g;
188     # If we're using a shell
189     s/#HELPER#/$perl_name $helptool/g;
190     return $_;
191 }
192
193 sub run_make_test
194 {
195   local ($makestring, $options, $answer, $err_code, $timeout) = @_;
196   my @call = caller;
197
198   # If the user specified a makefile string, create a new makefile to contain
199   # it.  If the first value is not defined, use the last one (if there is
200   # one).
201
202   if (! defined $makestring) {
203     defined $old_makefile
204       or die "run_make_test(undef) invoked before run_make_test('...')\n";
205     $makefile = $old_makefile;
206   } elsif ($makestring) {
207     if (! defined($makefile)) {
208       $makefile = &get_tmpfile();
209     }
210
211     # Make sure it ends in a newline and substitute any special tokens.
212     $makestring && $makestring !~ /\n$/s and $makestring .= "\n";
213     $makestring = subst_make_string($makestring);
214
215     # Populate the makefile!
216     open(MAKEFILE, "> $makefile") or die "Failed to open $makefile: $!\n";
217     print MAKEFILE $makestring;
218     close(MAKEFILE) or die "Failed to write $makefile: $!\n";
219   }
220
221   # Do the same processing on $answer as we did on $makestring.
222   if (defined $answer) {
223       $answer && $answer !~ /\n$/s and $answer .= "\n";
224       $answer = subst_make_string($answer);
225   }
226
227   run_make_with_options($makefile, $options, &get_logfile(0),
228                         $err_code, $timeout, @call);
229   &compare_output($answer, &get_logfile(1));
230
231   $old_makefile = $makefile;
232   $makefile = undef;
233 }
234
235 sub add_options {
236   my $cmd = shift;
237
238   foreach (@_) {
239     if (ref($cmd)) {
240       push(@$cmd, ref($_) ? @$_ : $_);
241     } else {
242       $cmd .= ' '.(ref($_) ? "@$_" : $_);
243     }
244   }
245
246   return $cmd;
247 }
248
249 sub create_command {
250   return !$_[0] || ref($_[0]) ? [@make_command] : join(' ', @make_command);
251 }
252
253 # The old-fashioned way...
254 # $options can be a scalar (string) or a ref to an array of options
255 # If it's a scalar the entire argument is passed to system/exec etc. as
256 # a single string.  If it's a ref then the array is passed to system/exec.
257 # Using a ref should be preferred as it's more portable but all the older
258 # invocations use strings.
259 sub run_make_with_options {
260   my ($filename, $options, $logname, $expected_code, $timeout, @call) = @_;
261   @call = caller unless @call;
262   my $code;
263   my $command = create_command($options);
264
265   $expected_code = 0 unless defined($expected_code);
266
267   # Reset to reflect this one test.
268   $test_passed = 1;
269
270   if ($filename) {
271     $command = add_options($command, '-f', $filename);
272   }
273
274   if ($options) {
275     if (!ref($options) && $^O eq 'VMS') {
276       # Try to make sure arguments are properly quoted.
277       # This does not handle all cases.
278       # We should convert the tests to use array refs not strings
279
280       # VMS uses double quotes instead of single quotes.
281       $options =~ s/\'/\"/g;
282
283       # If the leading quote is inside non-whitespace, then the
284       # quote must be doubled, because it will be enclosed in another
285       # set of quotes.
286       $options =~ s/(\S)(\".*\")/$1\"$2\"/g;
287
288       # Options must be quoted to preserve case if not already quoted.
289       $options =~ s/(\S+)/\"$1\"/g;
290
291       # Special fixup for embedded quotes.
292       $options =~ s/(\"\".+)\"(\s+)\"(.+\"\")/$1$2$3/g;
293
294       $options =~ s/(\A)(?:\"\")(.+)(?:\"\")/$1\"$2\"/g;
295
296       # Special fixup for misc/general4 test.
297       $options =~ s/""\@echo" "cc""/\@echo cc"/;
298       $options =~ s/"\@echo link"""/\@echo link"/;
299
300       # Remove shell escapes expected to be removed by bash
301       if ($options !~ /path=pre/) {
302         $options =~ s/\\//g;
303       }
304
305       # special fixup for options/eval
306       $options =~ s/"--eval=\$\(info" "eval/"--eval=\$\(info eval/;
307
308       print ("Options fixup = -$options-\n") if $debug;
309     }
310
311     $command = add_options($command, $options);
312   }
313
314   my $cmdstr = cmd2str($command);
315   $command_string = "# $call[1]:$call[2]:\n$cmdstr\n";
316
317   if ($valgrind) {
318     print VALGRIND "\n\nExecuting: $cmdstr\n";
319   }
320
321   {
322       my $old_timeout = $test_timeout;
323       $timeout and $test_timeout = $timeout;
324
325       # If valgrind is enabled, turn off the timeout check
326       $valgrind and $test_timeout = 0;
327
328       if (ref($command)) {
329           $code = run_command_with_output($logname, @$command);
330       } else {
331           $code = run_command_with_output($logname, $command);
332       }
333       $test_timeout = $old_timeout;
334   }
335
336   # Check to see if we have Purify errors.  If so, keep the logfile.
337   # For this to work you need to build with the Purify flag -exit-status=yes
338
339   if ($pure_log && -f $pure_log) {
340     if ($code & 0x7000) {
341       $code &= ~0x7000;
342
343       # If we have a purify log, save it
344       $tn = $pure_testname . ($num_of_logfiles ? ".$num_of_logfiles" : "");
345       print("Renaming purify log file to $tn\n") if $debug;
346       rename($pure_log, "$tn") or die "Can't rename $pure_log to $tn: $!\n";
347       ++$purify_errors;
348     } else {
349       unlink($pure_log);
350     }
351   }
352
353   if ($code != $expected_code) {
354     print "Error running @make_command (expected $expected_code; got $code)\n$call[1]:$call[2]: $cmdstr\n";
355     $test_passed = 0;
356     &create_file(get_runfile(), $command_string);
357     # If it's a SIGINT, stop here
358     if ($code & 127) {
359       print STDERR "\nCaught signal ".($code & 127)."!\n";
360       ($code & 127) == 2 and exit($code);
361     }
362     return 0;
363   }
364
365   if ($profile & $vos) {
366     system "add_profile @make_command";
367   }
368
369   return 1;
370 }
371
372 sub print_usage
373 {
374    &print_standard_usage ("run_make_tests",
375                           "[-make MAKE_PATHNAME] [-srcdir SRCDIR] [-memcheck] [-massif]",);
376 }
377
378 sub print_help
379 {
380    &print_standard_help (
381         "-make",
382         "\tYou may specify the pathname of the copy of make to run.",
383         "-srcdir",
384         "\tSpecify the make source directory.",
385         "-valgrind",
386         "-memcheck",
387         "\tRun the test suite under valgrind's memcheck tool.",
388         "\tChange the default valgrind args with the VALGRIND_ARGS env var.",
389         "-massif",
390         "\tRun the test suite under valgrind's massif tool.",
391         "\tChange the default valgrind args with the VALGRIND_ARGS env var."
392        );
393 }
394
395 sub set_defaults
396 {
397   # $profile = 1;
398   $testee = "GNU Make";
399   $make_path = "make";
400   $tmpfilesuffix = "mk";
401   if ($port_type eq 'UNIX') {
402     $scriptsuffix = '.sh';
403   } elsif ($port_type eq 'VMS') {
404     $scriptsuffix = '.com';
405   } else {
406     $scriptsuffix = '.bat';
407   }
408
409   $ENV{LC_ALL} = $makeENV{LC_ALL};
410   $ENV{LANG} = $makeENV{LANG};
411   $ENV{LANGUAGE} = $makeENV{LANGUAGE};
412
413   use locale;
414
415   my $loc = undef;
416   if ($has_POSIX) {
417       POSIX->import(qw(locale_h));
418       # Windows has POSIX locale, but only LC_ALL not LC_MESSAGES
419       $loc = POSIX::setlocale(&POSIX::LC_ALL);
420       POSIX::setlocale(&POSIX::LC_ALL, 'C');
421   }
422
423   if (open(my $F, '<', 'file.none')) {
424       print "Opened non-existent file! Skipping related tests.\n";
425   } else {
426       $ERR_no_such_file = "$!";
427   }
428
429   unlink('file.out');
430   touch('file.out');
431
432   chmod(0444, 'file.out');
433   if (open(my $F, '>', 'file.out')) {
434       print "Opened read-only file! Skipping related tests.\n";
435       close($F);
436   } else {
437       $ERR_read_only_file = "$!";
438   }
439
440   $_ = `./file.out 2>&1`;
441   if ($? == 0) {
442       print "Executed non-executable file!  Skipping related tests.\n";
443   } else {
444       $ERR_nonexe_file = "$!";
445   }
446
447   if ($^O =~ /cygwin/i) {
448       # For some reason the execute here gives a different answer than make's
449       print "Skipping directory execution on $^O\n";
450   } else {
451       $_ = `./. 2>&1`;
452       if ($? == 0) {
453           print "Executed directory!  Skipping related tests.\n";
454       } else {
455           $ERR_exe_dir = "$!";
456       }
457   }
458
459   chmod(0000, 'file.out');
460   if (open(my $F, '<', 'file.out')) {
461       print "Opened unreadable file!  Skipping related tests.\n";
462       close($F);
463   } else {
464       $ERR_unreadable_file = "$!";
465   }
466
467   unlink('file.out') or die "Failed to delete file.out: $!\n";
468
469   $_ = `/bin/sh -c 'bad-command 2>&1'`;
470   if ($? == 0) {
471       print "Invoked invalid file!  Skipping related tests.\n";
472   } else {
473       chomp($_);
474       s/bad-command/#CMDNAME#/g;
475       $ERR_command_not_found = $_;
476   }
477
478   $loc and POSIX::setlocale(&POSIX::LC_ALL, $loc);
479
480   $ENV{LC_ALL} = $origENV{LC_ALL};
481   $ENV{LANG} = $origENV{LANG};
482   $ENV{LANGUAGE} = $origENV{LANGUAGE};
483 }
484
485 # This is no longer used: we import config-flags.pm instead
486 # sub parse_status
487 # {
488 #   if (open(my $fh, '<', "$_[0]/config.status")) {
489 #     while (my $line = <$fh>) {
490 #       $line =~ m/^[SD]\["([^\"]+)"\]=" *(.*)"/ and $CONFIG_FLAGS{$1} = $2;
491 #     }
492 #     return 1;
493 #   }
494 #   return 0;
495 # }
496
497 sub find_prog
498 {
499   my $prog = $_[0];
500   my ($v, $d, $f) = File::Spec->splitpath($prog);
501
502   # If there's no directory then we need to search the PATH
503   if (! $d) {
504     foreach my $e (File::Spec->path()) {
505       $prog = File::Spec->catfile($e, $f);
506       if (-x $prog) {
507         ($v, $d, $f) = File::Spec->splitpath($prog);
508         last;
509       }
510     }
511   }
512
513   return ($v, $d, $f);
514 }
515
516 sub get_config
517 {
518   return exists($CONFIG_FLAGS{$_[0]}) ? $CONFIG_FLAGS{$_[0]} : '';
519 }
520
521 sub set_more_defaults
522 {
523   my $string;
524
525   # Now that we have located make_path, locate the srcdir and blddir
526   my ($mpv, $mpd, $mpf) = find_prog($make_path);
527
528   # We have a make program so try to compute the blddir.
529   if ($mpd) {
530     my $f = File::Spec->catpath($mpv, File::Spec->catdir($mpd, 'tests'), 'config-flags.pm');
531     if (-f $f) {
532       $bldvol = $mpv;
533       $blddir = $mpd;
534     }
535   }
536
537   # If srcdir wasn't provided on the command line, try to find it.
538   if (! $srcdir && $blddir) {
539     # See if the blddir is the srcdir
540     my $f = File::Spec->catpath($bldvol, File::Spec->catdir($blddir, 'src'), 'gnumake.h');
541     if (-f $f) {
542       $srcdir = $blddir;
543       $srcvol = $bldvol;
544     }
545   }
546
547   if (! $srcdir) {
548     # Not found, see if our parent is the source dir
549     my $f = File::Spec->catpath($cwdvol, File::Spec->catdir(File::Spec->updir(), 'src'), 'gnumake.h');
550     if (-f $f) {
551       $srcdir = File::Spec->updir();
552       $srcvol = $cwdvol;
553     }
554   }
555
556   # If we have srcdir but not blddir, set them equal
557   if ($srcdir && !$blddir) {
558     $blddir = $srcdir;
559     $bldvol = $srcvol;
560   }
561
562   # Load the config flags
563   if (!$blddir) {
564     warn "Cannot locate config-flags.pm (no blddir)\n";
565   } else {
566     my $f = File::Spec->catpath($bldvol, File::Spec->catdir($blddir, 'tests'), 'config-flags.pm');
567     if (! -f $f) {
568       warn "Cannot locate $f\n";
569     } else {
570       unshift(@INC, File::Spec->catpath($bldvol, File::Spec->catdir($blddir, 'tests'), ''));
571       require "config-flags.pm";
572     }
573   }
574
575   # Find the full pathname of Make.  For DOS systems this is more
576   # complicated, so we ask make itself.
577   if ($osname eq 'VMS') {
578     $port_type = 'VMS-DCL' unless defined $ENV{"SHELL"};
579     # On VMS pre-setup make to be found with simply 'make'.
580     $make_path = 'make';
581   } else {
582     create_file('make.mk', 'all:;$(info $(MAKE))');
583     my $mk = `$make_path -sf make.mk`;
584     unlink('make.mk');
585     $mk =~ s/\r?\n$//;
586     $mk or die "FATAL ERROR: Cannot determine the value of \$(MAKE)\n";
587     $make_path = $mk;
588   }
589   ($mpv, $mpd, $mpf) = File::Spec->splitpath($make_path);
590
591   # Ask make what shell to use
592   create_file('shell.mk', 'all:;$(info $(SHELL))');
593   $sh_name = `$make_path -sf shell.mk`;
594   unlink('shell.mk');
595   $sh_name =~ s/\r?\n$//;
596   if (! $sh_name) {
597       print "Cannot determine shell\n";
598       $is_posix_sh = 0;
599   } else {
600       my $o = `$sh_name -c ': do nothing' 2>&1`;
601       $is_posix_sh = $? == 0 && $o eq '';
602   }
603
604   $string = `$make_path -v`;
605   $string =~ /^(GNU Make [^,\n]*)/ or die "$make_path is not GNU make.  Version:\n$string";
606   $testee_version = "$1\n";
607
608   create_file('null.mk', '');
609
610   my $redir = '2>&1';
611   $redir = '' if os_name eq 'VMS';
612   $string = `$make_path -f null.mk $redir`;
613   if ($string =~ /(.*): \*\*\* No targets\.  Stop\./) {
614     $make_name = $1;
615   } else {
616     $make_name = $mpf;
617   }
618
619   # prepend pwd if this is a relative path (ie, does not
620   # start with a slash, but contains one).  Thanks for the
621   # clue, Roland.
622
623   if ($mpd && !File::Spec->file_name_is_absolute($make_path) && $cwdvol == $mpv) {
624      $mkpath = File::Spec->catpath($cwdvol, File::Spec->catdir($cwd, $mpd), $mpf);
625   } else {
626      $mkpath = $make_path;
627   }
628
629   # Not with the make program, so see if we can get it out of the makefile
630   if (! $srcdir && open(MF, '<', File::Spec->catfile(File::Spec->updir(), 'Makefile'))) {
631     local $/ = undef;
632     $_ = <MF>;
633     close(MF);
634     /^abs_srcdir\s*=\s*(.*?)\s*$/m;
635     -f File::Spec->catfile($1, 'src', 'gnumake.h') and $srcdir = $1;
636   }
637
638   # At this point we should have srcdir and blddir: get fq versions
639   $fqsrcdir = File::Spec->rel2abs($srcdir);
640   $fqblddir = File::Spec->rel2abs($blddir);
641
642   # Find the helper tool
643   $helptool = File::Spec->catfile($fqsrcdir, 'tests', 'thelp.pl');
644
645   # It's difficult to quote this properly in all the places it's used so
646   # ensure it doesn't need to be quoted.
647   $helptool =~ s,\\,/,g if $port_type eq 'W32';
648   $helptool =~ s, ,\\ ,g;
649
650   # Get Purify log info--if any.
651
652   if (exists $ENV{PURIFYOPTIONS}
653       && $ENV{PURIFYOPTIONS} =~ /.*-logfile=([^ ]+)/) {
654     $pure_log = $1 || '';
655     $pure_log =~ s/%v/$make_name/;
656     $purify_errors = 0;
657   }
658
659   $string = `$make_path -j 2 -f null.mk $redir`;
660   if ($string =~ /not supported/) {
661     $parallel_jobs = 0;
662   }
663   else {
664     $parallel_jobs = 1;
665   }
666
667   unlink('null.mk');
668
669   create_file('features.mk', 'all:;$(info $(.FEATURES))');
670   %FEATURES = map { $_ => 1 } split /\s+/, `$make_path -sf features.mk`;
671   unlink('features.mk');
672
673   # Find the default values for different built-in variables
674   my $s = "all:;\n";
675   foreach (keys %DEFVARS) {
676       $s .= "\$(info $_=\$($_))\n";
677   }
678   create_file('defvars.mk', $s);
679   foreach (split "\n", `$make_path -sf defvars.mk`) {
680       my @e = split /=/, $_, 2;
681       $DEFVARS{$e[0]} = $e[1];
682   }
683   unlink('defvars.mk');
684
685   # Set up for valgrind, if requested.
686
687   @make_command = ($make_path);
688
689   if ($valgrind) {
690     my $args = $valgrind_args;
691     open(VALGRIND, "> valgrind.out") or die "Cannot open valgrind.out: $!\n";
692     #  -q --leak-check=yes
693     exists $ENV{VALGRIND_ARGS} and $args = $ENV{VALGRIND_ARGS};
694     @make_command = ('valgrind', '--log-fd='.fileno(VALGRIND));
695     push(@make_command, split(' ', $args));
696     push(@make_command, $make_path);
697     # F_SETFD is 2
698     fcntl(VALGRIND, 2, 0) or die "fcntl(setfd) failed: $!\n";
699     system("echo Starting on `date` 1>&".fileno(VALGRIND));
700     print "Enabled valgrind support.\n";
701   }
702
703   if ($debug) {
704     print "Port type:    $port_type\n";
705     print "Make command: @make_command\n";
706     print "Shell path:   $sh_name".($is_posix_sh ? ' (POSIX)' : '')."\n";
707     print "#PWD#:        $cwdpath\n";
708     print "#PERL#:       $perl_name\n";
709     print "#MAKEPATH#:   $mkpath\n";
710     print "#MAKE#:       $make_name\n";
711   }
712 }
713
714 sub setup_for_test
715 {
716   $makefile = &get_tmpfile;
717   if (-f $makefile) {
718     unlink $makefile;
719   }
720
721   # Get rid of any Purify logs.
722   if ($pure_log) {
723     ($pure_testname = $testname) =~ tr,/,_,;
724     $pure_testname = "$pure_log.$pure_testname";
725     system("rm -f $pure_testname*");
726     print("Purify testfiles are: $pure_testname*\n") if $debug;
727   }
728 }
729
730 exit !&toplevel;