summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--regen.pl18
-rw-r--r--t/porting/regen.t46
2 files changed, 42 insertions, 22 deletions
diff --git a/regen.pl b/regen.pl
index 1b3ae5ee6d..878866835e 100644
--- a/regen.pl
+++ b/regen.pl
@@ -13,9 +13,15 @@ require 5.004; # keep this compatible, an old perl is all we may have before
use strict;
-# Which scripts to run.
+my $tap = $ARGV[0] && $ARGV[0] eq '--tap' ? '# ' : '';
+foreach my $pl (map {chomp; "regen/$_"} <DATA>) {
+ my @command = ($^X, $pl, @ARGV);
+ print "$tap@command\n";
+ system @command
+ and die "@command failed: $?"
+}
-my @scripts = qw(
+__END__
mg_vtable.pl
opcode.pl
overload.pl
@@ -24,11 +30,3 @@ regcomp.pl
warnings.pl
embed.pl
feature.pl
-);
-
-my $tap = $ARGV[0] && $ARGV[0] eq '--tap' ? '# ' : '';
-foreach my $pl (map {"regen/$_"} @scripts) {
- my @command = ($^X, $pl, @ARGV);
- print "$tap@command\n";
- system @command;
-}
diff --git a/t/porting/regen.t b/t/porting/regen.t
index 78fd64fa18..f7ec411443 100644
--- a/t/porting/regen.t
+++ b/t/porting/regen.t
@@ -16,13 +16,37 @@ if ( $^O eq "VMS" ) {
skip_all( "- regen.pl needs porting." );
}
-my $in_regen_pl = 24; # I can't see a clean way to calculate this automatically.
-my @files = qw(perly.act perly.h perly.tab keywords.c keywords.h uconfig.h);
-my @progs = qw(regen/regcharclass.pl regen/mk_PL_charclass.pl
- regen/unicode_constants.pl regen/genpacksizetables.pl
- regen/miniperlmain.pl);
+my $tests = 23; # I can't see a clean way to calculate this automatically.
-plan (tests => $in_regen_pl + @files + @progs + 2);
+my %skip = ("regen_perly.pl" => [qw(perly.act perly.h perly.tab)],
+ "regen/keywords.pl" => [qw(keywords.c keywords.h)],
+ "regen/uconfig_h.h" => [qw(uconfig.h)],
+ );
+
+my @files = map {@$_} sort values %skip;
+
+open my $fh, '<', 'regen.pl'
+ or die "Can't open regen.pl: $!";
+
+while (<$fh>) {
+ last if /^__END__/;
+}
+die "Can't find __END__ in regen.pl"
+ if eof $fh;
+
+foreach (qw(embed_lib.pl regen_lib.pl uconfig_h.pl
+ regcharclass_multi_char_folds.pl),
+ map {chomp $_; $_} <$fh>) {
+ ++$skip{"regen/$_"};
+}
+
+close $fh
+ or die "Can't close regen.pl: $!";
+
+my @progs = grep {!$skip{$_}} <regen/*.pl>;
+push @progs, 'regen.pl', map {"Porting/makemeta $_"} qw(-j -y);
+
+plan (tests => $tests + @files + @progs);
OUTER: foreach my $file (@files) {
open my $fh, '<', $file or die "Can't open $file: $!";
@@ -46,10 +70,8 @@ OUTER: foreach my $file (@files) {
is("@bad", '', "generated $file is up to date");
}
-foreach (@progs, 'regen.pl') {
- system "$^X $_ --tap";
-}
-
-foreach ( '-y', '-j' ) {
- system "$^X Porting/makemeta --tap $_";
+foreach (@progs) {
+ my $command = "$^X $_ --tap";
+ system $command
+ and die "Failed to run $command: $?";
}