6 $ENV{PERL5LIB} = '../lib';
11 my $Is_VMS = $^O eq 'VMS';
12 my $tmpfile = "tmp0000";
14 1 while -f ++$tmpfile;
15 END { if ($tmpfile) { 1 while unlink $tmpfile} }
19 foreach (sort glob("pragma/warn-*")) {
21 open F, "<$_" or die "Cannot open $_: $!\n" ;
28 @prgs = (@prgs, split "\n########\n", <F>) ;
35 print "1..", scalar @prgs, "\n";
43 $switch =~ s/(-\S*[A-Z]\S*)/"-$1"/ if $Is_VMS; # protect uc switches
45 my($prog,$expected) = split(/\nEXPECT\n/, $_);
46 if ( $prog =~ /--FILE--/) {
47 my(@files) = split(/\n--FILE--\s*([^\s\n]*)\s*\n/, $prog) ;
49 die "Internal error test $i didn't split into pairs, got " .
50 scalar(@files) . "[" . join("%%%%", @files) ."]\n"
53 my $filename = shift @files ;
54 my $code = shift @files ;
55 push @temps, $filename ;
56 open F, ">$filename" or die "Cannot open $filename: $!\n" ;
61 $prog = shift @files ;
63 open TEST, ">$tmpfile";
64 print TEST $prog,"\n";
66 my $results = $Is_VMS ?
67 `MCR $^X $switch $tmpfile` :
68 `sh -c './perl $switch $tmpfile' 2>&1`;
71 # allow expected output to be written as if $prog is on STDIN
72 $results =~ s/tmp\d+/-/g;
73 $results =~ s/\n%[A-Z]+-[SIWEF]-.*$// if $Is_VMS; # clip off DCL status msg
74 $expected =~ s/\n+$//;
75 my $prefix = ($results =~ s/^PREFIX\n//) ;
76 if ( $results =~ s/^SKIPPED\n//) {
79 elsif (($prefix and $results !~ /^\Q$expected/) or
80 (!$prefix and $results ne $expected)){
81 print STDERR "PROG: $switch\n$prog\n";
82 print STDERR "EXPECTED:\n$expected\n";
83 print STDERR "GOT:\n$results\n";
86 print "ok ", ++$i, "\n";