Changeset 21452 for perl5

Show
Ignore:
Timestamp:
07/23/08 13:06:04 (6 months ago)
Author:
fglock
Message:

[v6.pm] large test files are chunked

Location:
perl5/Pugs-Compiler-Perl6
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • perl5/Pugs-Compiler-Perl6/MANIFEST

    r21419 r21452  
    123123t/regex/from_perl6_rules/anchors.t 
    124124t/regex/from_perl6_rules/inline.t 
    125 t/regex/from_perl6_rules/named_chars.t 
     125t/regex/from_perl6_rules/named_chars-1.t 
     126t/regex/from_perl6_rules/named_chars-2.t 
    126127t/regex/from_perl6_rules/noncap.t 
    127128t/regex/rx_perl5_escape.t 
  • perl5/Pugs-Compiler-Perl6/Makefile.PL

    r21433 r21452  
    3434 
    3535# Parse MANIFEST and copy the tests 
     36my $rewrite_test; 
     37$rewrite_test = sub { 
     38    my ($out, $text) = @_; 
     39     
     40    # split big tests in smaller files 
     41    if ( $out =~ /\.t$/ && length($text) > 30000 ) { 
     42        $out =~ s/-?(\d*)\.t$/ "-" . (($1||0)+1) . ".t" /e; 
     43        my ($part, $text) = $text =~ /^(.{20000,}?\n)(.*)/s; 
     44        $rewrite_test->($out, $part); 
     45        $out =~ s/-?(\d*)\.t$/ "-" . (($1||0)+1) . ".t" /e; 
     46        $rewrite_test->($out, $text); 
     47        return; 
     48    } 
     49 
     50    # fix problems caused by splitting 
     51    if ( $out eq 't/regex/from_perl6_rules/named_chars-1.t' ) { 
     52        $text =~ s/^plan \d+;/plan 200;/m; 
     53        $text =~ s/^force_todo.*?\n//m; 
     54        $text .= "}\n"; 
     55    } 
     56    if ( $out eq 't/regex/from_perl6_rules/named_chars-2.t' ) { 
     57        $text =  
     58              "plan 219\n" 
     59            . "{\n" 
     60            . $text; 
     61    } 
     62     
     63    # add "use Test" to most files 
     64    if ( $out ne 't/01-sanity/05-sub.t' ) { 
     65        $text = "use Test;\n" . $text; 
     66    } 
     67     
     68    # add "use v6-alpha" everywhere 
     69    # $text =~ s/^use v6;/use v6-alpha;/m; 
     70    $text = "use v6-alpha;\n" . $text; 
     71 
     72    open( my $fh, ">", $out ) ||  
     73        die "can't create $out $!" ; 
     74    print $fh $text; 
     75}; 
     76 
    3677if (@inc) { 
    37     use File::Copy; 
    3878    use File::Path; 
    3979    use File::Basename; 
    4080 
    4181    open MANIFEST, '< MANIFEST' or die "Cannot open MANIFEST: $!"; 
     82    my %seen; 
    4283    while (<MANIFEST>) { 
    4384        chomp; 
    4485        /^t\// or next; 
    45         mkpath(dirname($_)); 
    46         my $src = "$inc[-1]/../$_"; 
     86        s/-\d+\.t$/.t/; 
     87        next if $seen{$_}; 
     88        $seen{$_} = 1; 
     89        my $out = $_; 
     90        mkpath(dirname($out)); 
     91        my $src = "$inc[-1]/../$out"; 
    4792        $src = "$inc[-1]/../ext/Test/lib/Test.pm" if $_ eq 't/Test.pm'; 
    48         next unless -f $src; 
    49         copy($src => $_); 
    50         `$^X -i -pe ' s/^use v6;/use v6-alpha;/ ' '$_' ` 
    51             if -f $_; 
     93        next unless -f $src; 
     94        my $text = do { local( @ARGV, $/ ) = $src ; <> } ; 
     95        $rewrite_test->( $out, $text ); 
    5296    } 
    5397} 
     
    77121    # precompile Perl6Prelude.pm and Test.pm 
    78122    pmc_support(); 
     123