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