Changeset 19582 for util

Show
Ignore:
Timestamp:
01/19/08 01:57:03 (12 months ago)
Author:
lwall
Message:

[fudge] fudging everything that needs fudging

Location:
util
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • util/fudge

    r19541 r19582  
    44use warnings; 
    55 
    6 unless (@ARGV) { 
    7     die "Usage: $0 implname testfilename"; 
     6my $ME = shift; 
     7my $IN = shift; 
     8my $OUT = shift; 
     9 
     10if (!$OUT) { 
     11    ($OUT = $IN) =~ s/\.t$/.$ME/ or $OUT .= ".$ME"; 
    812} 
    9 my $ME = shift; 
     13unless ($ME and $IN and -e $IN and $OUT) { 
     14    die "Usage: $0 implname testfilename [fudgedtestfilename]"; 
     15} 
    1016 
     17if (-e $OUT) { 
     18    if (-M $IN > -M $OUT) { 
     19        print "$OUT\n";         # unchanged, so no need to refudge 
     20        exit(0); 
     21    } 
     22    else { 
     23        unlink $OUT;            # old fudged version, may or may not regenerate... 
     24    } 
     25} 
     26 
     27my $REALLY_FUDGED = 0; 
     28my $OUTPUT = ""; 
    1129my $FUDGE = ""; 
    1230our $PENDING = 0; 
     
    1432my $IS = '\\b(?:is|ok|is_deeply|isnt|like|unlike|eval_dies_ok|cmp_ok|isa_ok|use_ok|throws_ok|dies_ok|pass|flunk)(?:\\b|_)'; 
    1533 
     34@ARGV = ($IN); 
    1635fudgeblock(); 
     36 
     37if ($REALLY_FUDGED) { 
     38    open OUT, ">", $OUT or die "Can't create $OUT: $!"; 
     39    print OUT $OUTPUT; 
     40    print OUT <<'END'; 
     41 
     42say "# FUDGED!"; 
     43exit(1);        # hopefully reported as "dubious" 
     44END 
     45    close OUT; 
     46    print "$OUT\n";     # pick the output file to run 
     47} 
     48else { 
     49    print "$IN\n";      # pick the input file to run 
     50} 
    1751 
    1852sub fudgeblock { 
    1953    while (<>) { 
    2054        if (/^\s*\#\? (\w+) \: \s* (.*)/x and $1 eq $ME) { 
     55            $REALLY_FUDGED = 1; 
    2156            $ARGS = $2; 
    2257            if ($ARGS =~ s/^(\d+)\s*//) { 
     
    3974            if ($FUDGE eq 'todo') { 
    4075                local $PENDING = 999999;        # do all in block as one action 
    41                 print $_; 
     76                $OUTPUT .= $_; 
    4277                fudgeblock(); 
    4378                $_ = ''; 
     
    99134    } 
    100135    continue { 
    101         print $_; 
     136        $OUTPUT .= $_; 
    102137        return if /^\}/ and $PENDING > 0; 
    103138    } 
  • util/fudgeall

    r19528 r19582  
    1818    map { 
    1919        if ($SPEC or m!\bspec\b!) { 
    20             my $fud; 
    21             if (($fud = $_) =~ s/\.t/.fud/) { 
    22                 warn "$dir/util/fudge $platform $_ >$fud\n"; 
    23                 system "$dir/util/fudge $platform $_ >$fud"; 
    24                 $fud; 
    25             } 
    26             else { 
    27                 $_; 
    28             } 
     20            chomp(my $pick = `$dir/util/fudge $platform $_`); 
     21            $pick; 
    2922        } 
    3023        else { 
  • util/prove6

    r15968 r19582  
    99use Test::Harness; 
    1010use File::Spec; 
     11use Cwd; 
     12my $top = getcwd; 
     13 
     14while (not -f "$top/util/prove6") { 
     15    die "Not inside pugs directory\n" unless $top; 
     16    $top =~ s!(.*)/(.*)!!; 
     17} 
    1118 
    1219my ($pugs, $pir, $perl5, $help, $inc); 
     
    98105if ($sum > 1) { die "error: you can't specify multiple implementations/backends.\n"; } 
    99106if ($sum == 0) { $pugs = 1 } # default to pugs 
     107my $impl = "pugs"; 
     108# $impl = "smop" if $smop; 
     109# etc. 
    100110 
    101111my @tfiles = sort map { -d $_ ? all_in($_) : $_ } map glob, @ARGV; 
     112@tfiles = split ' ', `$^X $top/util/fudgeall $impl @tfiles`; 
    102113 
    103114$ENV{PERL6LIB} ||= 'blib6/lib'; 
     
    127138    warn "$pugs_exec -CParse-YAML ext/Test/lib/Test.pm > blib6/lib/Test.pm.yml\n"; 
    128139    system("$pugs_exec -CParse-YAML ext/Test/lib/Test.pm > blib6/lib/Test.pm.yml"); 
    129     system("$^X util/gen_prelude.pl -v -i src/perl6/Prelude.pm -p pugs " . 
     140    system("$^X $top/util/gen_prelude.pl -v -i src/perl6/Prelude.pm -p pugs " . 
    130141        "--output blib6/lib/Prelude.pm.yml"); 
    131142} 
  • util/yaml_harness.pl

    r16888 r19582  
    1010use Test::Harness; 
    1111use Test::TAP::Model; 
     12use Cwd; 
     13my $top = getcwd; 
     14 
     15while (not -f "$top/util/prove6") { 
     16    die "Not inside pugs directory\n" unless $top; 
     17    $top =~ s!(.*)/(.*)!!; 
     18} 
    1219 
    1320# Package and global declarations 
     
    8390get_config(); 
    8491 
     92my $impl = "pugs"; 
     93 
    8594@ARGV = sort map glob, "t/*/*.t", "t/*/*/*.t", "ext/*/t/*.t" unless @ARGV; 
     95@ARGV = split ' ', `$^X $top/util/fudgeall $impl @ARGV`; 
    8696 
    8797my $s = __PACKAGE__->new;