3 # Verify that all files generated by perl scripts are up to date.
6 @INC = '..' if -f '../TestInit.pm';
8 use TestInit qw(T A); # T is chdir to the top level, A makes paths absolute
11 require 'regen/regen_lib.pl';
13 $::NO_ENDING = $::NO_ENDING = 1;
16 skip_all( "- regen.pl needs porting." );
18 if ($^O eq 'dec_osf') {
19 skip_all("$^O cannot handle this test");
21 if ( $::IS_EBCDIC || $::IS_EBCDIC) {
22 skip_all( "- We don't regen on EBCDIC." );
25 if ( $Config{usecrosscompile} ) {
26 skip_all( "Not all files are available during cross-compilation" );
29 my $tests = 26; # I can't see a clean way to calculate this automatically.
31 my %skip = ("regen_perly.pl" => [qw(perly.act perly.h perly.tab)],
32 "regen/keywords.pl" => [qw(keywords.c keywords.h)],
33 "regen/uconfig_h.h" => [qw(uconfig.h)],
34 "regen/mk_invlists.pl" => [qw(charclass_invlists.h)],
35 "regen/regcharclass.pl" => [qw(regcharclass.h)],
38 my @files = map {@$_} sort values %skip;
40 open my $fh, '<', 'regen.pl'
41 or die "Can't open regen.pl: $!";
46 die "Can't find __END__ in regen.pl"
49 foreach (qw(embed_lib.pl regen_lib.pl uconfig_h.pl
50 regcharclass_multi_char_folds.pl
51 charset_translations.pl
53 map {chomp $_; $_} <$fh>) {
58 or die "Can't close regen.pl: $!";
60 my @progs = grep {!$skip{$_}} <regen/*.pl>;
61 push @progs, 'regen.pl', map {"Porting/makemeta $_"} qw(-j -y);
63 plan (tests => $tests + @files + @progs);
65 OUTER: foreach my $file (@files) {
66 open my $fh, '<', $file or die "Can't open $file: $!";
67 1 while defined($_ = <$fh>) and !/Generated from:/;
69 fail("Can't find 'Generated from' line in $file");
74 last if /ex: set ro:/;
75 unless (/^(?: \* | #)([0-9a-f]+) (\S+)$/) {
77 fail("Bad line in $file: '$_'");
81 my $digest = digest($2);
83 push @bad, $2 unless $digest eq $1;
85 is("@bad", '', "generated $file is up to date");
89 my $command = "$^X $_ --tap";
91 and die "Failed to run $command: $?";