diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-01-23 18:29:20 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-01-23 18:45:59 +0000 |
commit | c24c946d24c97d98baecdbf2c37823b55add8bcb (patch) | |
tree | 14eaac76ebfac2a2d7dcbae2d4309ca0f0deb7e8 /t | |
parent | e8fb9efbf973fedc74b46a30a67b602d07f033e9 (diff) | |
download | perl-c24c946d24c97d98baecdbf2c37823b55add8bcb.tar.gz |
Store the SHA-256 of the source in files generated by regen_perly.pl
bison isn't available everywhere, so we can't simply re-run regen_perly.pl to
verify that perly.{act,h,tab} are up to date. So instead store the SHA-256 of
the input files, and extend t/porting/regen.t to check that the input files
haven't been changed subsequently.
Diffstat (limited to 't')
-rw-r--r-- | t/porting/regen.t | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/t/porting/regen.t b/t/porting/regen.t index 810aa3547f..edae912a75 100644 --- a/t/porting/regen.t +++ b/t/porting/regen.t @@ -18,6 +18,36 @@ $ENV{PERL5LIB} = rel2abs($lib); chdir '..' if $in_t; -print "1..18\n"; # I can't see a clean way to calculate this automatically. +$INC[0] = 'lib'; +require 'regen/regen_lib.pl'; +require 't/test.pl'; +$::NO_ENDING = $::NO_ENDING = 1; + +my $in_regen_pl = 18; # I can't see a clean way to calculate this automatically. +my @files = qw(perly.act perly.h perly.tab); + +plan (tests => $in_regen_pl + @files); + +OUTER: foreach my $file (@files) { + open my $fh, '<', $file or die "Can't open $file: $!"; + 1 while defined($_ = <$fh>) and !/Generated from:/; + if (eof $fh) { + fail("Can't find 'Generated from' line in $file"); + next; + } + my @bad; + while (<$fh>) { + last if /ex: set ro:/; + unless (/^(?: \* | #)([0-9a-f]+) (\S+)$/) { + chomp $_; + fail("Bad line in $file: '$_'"); + next OUTER; + } + my $digest = digest($2); + note("$digest $2"); + push @bad, $2 unless $digest eq $1; + } + is("@bad", '', "generated $file is up to date"); +} system "$^X regen.pl --tap"; |