6 $ENV{PERL5LIB} = '../lib';
11 my $Is_VMS = $^O eq 'VMS';
12 my $Is_MSWin32 = $^O eq 'MSWin32';
13 my $tmpfile = "tmp0000";
15 1 while -f ++$tmpfile;
16 END { if ($tmpfile) { 1 while unlink $tmpfile} }
20 foreach (sort glob("pragma/warn-*")) {
22 next if /(~|\.orig)$/;
24 open F, "<$_" or die "Cannot open $_: $!\n" ;
31 @prgs = (@prgs, split "\n########\n", <F>) ;
38 print "1..", scalar @prgs, "\n";
46 $switch =~ s/(-\S*[A-Z]\S*)/"-$1"/ if $Is_VMS; # protect uc switches
48 my($prog,$expected) = split(/\nEXPECT\n/, $_);
49 if ( $prog =~ /--FILE--/) {
50 my(@files) = split(/\n--FILE--\s*([^\s\n]*)\s*\n/, $prog) ;
52 die "Internal error test $i didn't split into pairs, got " .
53 scalar(@files) . "[" . join("%%%%", @files) ."]\n"
56 my $filename = shift @files ;
57 my $code = shift @files ;
58 push @temps, $filename ;
59 open F, ">$filename" or die "Cannot open $filename: $!\n" ;
64 $prog = shift @files ;
66 open TEST, ">$tmpfile";
67 print TEST $prog,"\n";
69 my $results = $Is_VMS ?
70 `MCR $^X $switch $tmpfile` :
72 `.\\perl -I../lib $switch $tmpfile 2>&1` :
73 `sh -c './perl $switch $tmpfile' 2>&1`;
76 # allow expected output to be written as if $prog is on STDIN
77 $results =~ s/tmp\d+/-/g;
78 $results =~ s/\n%[A-Z]+-[SIWEF]-.*$// if $Is_VMS; # clip off DCL status msg
79 $expected =~ s/\n+$//;
80 my $prefix = ($results =~ s/^PREFIX\n//) ;
81 if ( $results =~ s/^SKIPPED\n//) {
84 elsif (($prefix and $results !~ /^\Q$expected/) or
85 (!$prefix and $results ne $expected)){
86 print STDERR "PROG: $switch\n$prog\n";
87 print STDERR "EXPECTED:\n$expected\n";
88 print STDERR "GOT:\n$results\n";
91 print "ok ", ++$i, "\n";