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} }
22 { print "ARGV = [@ARGV]\n" ; @w_files = map { s#^#./pragma/warn/#; $_ } @ARGV }
24 { @w_files = sort glob("pragma/warn/*") }
30 next if /(~|\.orig)$/;
32 open F, "<$_" or die "Cannot open $_: $!\n" ;
39 @prgs = (@prgs, split "\n########\n", <F>) ;
46 print "1..", scalar @prgs, "\n";
54 $switch =~ s/(-\S*[A-Z]\S*)/"-$1"/ if $Is_VMS; # protect uc switches
56 my($prog,$expected) = split(/\nEXPECT\n/, $_);
57 if ( $prog =~ /--FILE--/) {
58 my(@files) = split(/\n--FILE--\s*([^\s\n]*)\s*\n/, $prog) ;
60 die "Internal error test $i didn't split into pairs, got " .
61 scalar(@files) . "[" . join("%%%%", @files) ."]\n"
64 my $filename = shift @files ;
65 my $code = shift @files ;
66 push @temps, $filename ;
67 open F, ">$filename" or die "Cannot open $filename: $!\n" ;
72 $prog = shift @files ;
74 open TEST, ">$tmpfile";
75 print TEST $prog,"\n";
77 my $results = $Is_VMS ?
78 `MCR $^X $switch $tmpfile` :
80 `.\\perl -I../lib $switch $tmpfile 2>&1` :
81 `sh -c './perl $switch $tmpfile' 2>&1`;
84 # allow expected output to be written as if $prog is on STDIN
85 $results =~ s/tmp\d+/-/g;
86 $results =~ s/\n%[A-Z]+-[SIWEF]-.*$// if $Is_VMS; # clip off DCL status msg
87 $expected =~ s/\n+$//;
88 my $prefix = ($results =~ s/^PREFIX\n//) ;
89 if ( $results =~ s/^SKIPPED\n//) {
92 elsif (($prefix and $results !~ /^\Q$expected/) or
93 (!$prefix and $results ne $expected)){
94 print STDERR "PROG: $switch\n$prog\n";
95 print STDERR "EXPECTED:\n$expected\n";
96 print STDERR "GOT:\n$results\n";
99 print "ok ", ++$i, "\n";