1#!./perl -w 2 3# Verify that all files generated by perl scripts are up to date. 4 5BEGIN { 6 @INC = '..' if -f '../TestInit.pm'; 7} 8use TestInit qw(T A); # T is chdir to the top level, A makes paths absolute 9use strict; 10 11require 'regen/regen_lib.pl'; 12require 't/test.pl'; 13$::NO_ENDING = $::NO_ENDING = 1; 14 15if ( $^O eq "VMS" ) { 16 skip_all( "- regen.pl needs porting." ); 17} 18 19my $in_regen_pl = 23; # I can't see a clean way to calculate this automatically. 20my @files = qw(perly.act perly.h perly.tab keywords.c keywords.h uconfig.h); 21my @progs = qw(regen/regcharclass.pl regen/mk_PL_charclass.pl); 22 23plan (tests => $in_regen_pl + @files + @progs + 2); 24 25OUTER: foreach my $file (@files) { 26 open my $fh, '<', $file or die "Can't open $file: $!"; 27 1 while defined($_ = <$fh>) and !/Generated from:/; 28 if (eof $fh) { 29 fail("Can't find 'Generated from' line in $file"); 30 next; 31 } 32 my @bad; 33 while (<$fh>) { 34 last if /ex: set ro:/; 35 unless (/^(?: \* | #)([0-9a-f]+) (\S+)$/) { 36 chomp $_; 37 fail("Bad line in $file: '$_'"); 38 next OUTER; 39 } 40 my $digest = digest($2); 41 note("$digest $2"); 42 push @bad, $2 unless $digest eq $1; 43 } 44 is("@bad", '', "generated $file is up to date"); 45} 46 47foreach (@progs, 'regen.pl') { 48 system "$^X $_ --tap"; 49} 50 51foreach ( '-y', '-j' ) { 52 system "$^X Porting/makemeta --tap $_"; 53} 54