diff options
author | Nicholas Clark <nick@ccl4.org> | 2010-09-28 16:50:26 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2010-09-28 16:50:26 +0100 |
commit | 3879ea51d63e30f393172fcd711bc89f88997019 (patch) | |
tree | 53e01b81dbbff025a2182461c86ac0dc443aa37e | |
parent | bd6920d7fd435edce8cd45d53f46b2a0ca0f5663 (diff) | |
download | perl-3879ea51d63e30f393172fcd711bc89f88997019.tar.gz |
A test to check that regen.pl doesn't need running.
We can't run regen.pl as part of the build, as we'd end up with a circular
dependency between the headers and miniperl.
-rw-r--r-- | MANIFEST | 1 | ||||
-rw-r--r-- | regen.pl | 3 | ||||
-rw-r--r-- | regen_lib.pl | 9 | ||||
-rw-r--r-- | t/porting/regen.t | 23 |
4 files changed, 34 insertions, 2 deletions
@@ -4689,6 +4689,7 @@ t/porting/exec-bit.t Check that exec-bit bins are identified t/porting/maintainers.t Test that Porting/Maintaners.pl is up to date t/porting/manifest.t Test that this MANIFEST file is well formed t/porting/podcheck.t Test the POD of shipped modules is well formed +t/porting/regen.t Check that regen.pl doesn't need running t/porting/test_bootstrap.t Test that the instructions for test bootstrapping aren't accidentally overlooked. t/README Instructions for regression tests t/re/overload.t Test against string corruption in pattern matches on overloaded objects @@ -26,8 +26,9 @@ warnings.pl embed.pl ); +my $tap = $ARGV[0] && $ARGV[0] eq '--tap' ? '# ' : ''; foreach my $pl (@scripts) { my @command = ($^X, $pl, @ARGV); - print "@command\n"; + print "$tap@command\n"; system @command; } diff --git a/regen_lib.pl b/regen_lib.pl index 7d396c0447..9008629998 100644 --- a/regen_lib.pl +++ b/regen_lib.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl -w use strict; -use vars qw($Needs_Write $Verbose @Changed); +use vars qw($Needs_Write $Verbose @Changed $TAP); use File::Compare; use Symbol; @@ -10,6 +10,7 @@ $Needs_Write = $^O eq 'cygwin' || $^O eq 'os2' || $^O eq 'MSWin32'; $Verbose = 0; @ARGV = grep { not($_ eq '-q' and $Verbose = -1) } + grep { not($_ eq '--tap' and $TAP = 1) } grep { not($_ eq '-v' and $Verbose = 1) } @ARGV; END { @@ -42,6 +43,12 @@ sub safer_rename_silent { sub rename_if_different { my ($from, $to) = @_; + if ($TAP) { + my $not = compare($from, $to) ? 'not ' : ''; + print STDOUT $not . "ok - $0 $to\n"; + safer_unlink($from); + return; + } if (compare($from, $to) == 0) { warn "no changes between '$from' & '$to'\n" if $Verbose > 0; safer_unlink($from); diff --git a/t/porting/regen.t b/t/porting/regen.t new file mode 100644 index 0000000000..9699d5571a --- /dev/null +++ b/t/porting/regen.t @@ -0,0 +1,23 @@ +#!./perl -w + +# Verify that all files generated by perl scripts are up to date. + +my ($in_t, $lib); + +BEGIN { + $in_t = -f 'TEST' && -f '../regen.pl'; + $lib = $in_t ? '../lib' : 'lib'; + unshift @INC, $lib; +} + +use strict; + +use File::Spec::Functions 'rel2abs'; +$^X = rel2abs($^X); +$ENV{PERL5LIB} = rel2abs($lib); + +chdir '..' if $in_t; + +print "1..17\n"; # I can't see a clean way to calculate this automatically. + +system "$^X regen.pl --tap"; |