This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Skip t/porting/exec-bit.t on VMS.
[perl5.git] / t / porting / regen.t
... / ...
CommitLineData
1#!./perl -w
2
3# Verify that all files generated by perl scripts are up to date.
4
5my ($in_t, $lib);
6
7BEGIN {
8 $in_t = -f 'TEST' && -f '../regen.pl';
9 $lib = $in_t ? '../lib' : 'lib';
10 unshift @INC, $lib;
11}
12
13use strict;
14
15use File::Spec::Functions 'rel2abs';
16$^X = rel2abs($^X);
17$ENV{PERL5LIB} = rel2abs($lib);
18
19chdir '..' if $in_t;
20
21$INC[0] = 'lib';
22require 'regen/regen_lib.pl';
23require 't/test.pl';
24$::NO_ENDING = $::NO_ENDING = 1;
25
26my $in_regen_pl = 17; # I can't see a clean way to calculate this automatically.
27my @files = qw(perly.act perly.h perly.tab keywords.c keywords.h);
28my @progs = qw(Porting/makemeta regen/regcharclass.pl regen/mk_PL_charclass.pl);
29
30plan (tests => $in_regen_pl + @files + @progs);
31
32OUTER: foreach my $file (@files) {
33 open my $fh, '<', $file or die "Can't open $file: $!";
34 1 while defined($_ = <$fh>) and !/Generated from:/;
35 if (eof $fh) {
36 fail("Can't find 'Generated from' line in $file");
37 next;
38 }
39 my @bad;
40 while (<$fh>) {
41 last if /ex: set ro:/;
42 unless (/^(?: \* | #)([0-9a-f]+) (\S+)$/) {
43 chomp $_;
44 fail("Bad line in $file: '$_'");
45 next OUTER;
46 }
47 my $digest = digest($2);
48 note("$digest $2");
49 push @bad, $2 unless $digest eq $1;
50 }
51 is("@bad", '', "generated $file is up to date");
52}
53
54foreach (@progs, 'regen.pl') {
55 system "$^X $_ --tap";
56}