Skip to content
Newer
Older
100644 119 lines (94 sloc) 2.83 KB
d7e6ed9 @chromatic Created Parrot::Test::Harness.
chromatic authored Apr 14, 2006
1 #! perl
2
84f4ea8 @bschmalhofer Let Parrot::Test::Harness check for '--files' in ARGV.
bschmalhofer authored Apr 14, 2006
3 # $Id$
4
fa9d590 @pmichaud [rakudo]:
pmichaud authored May 22, 2008
5 # note: du to a limitation in Getopt::Long options that should be passed
6 # through to fudgeall have to come after all other options
7
222b3ea @audreyt * copy all Pugs's sanity tests into languages/perl6/ harness.
audreyt authored Apr 15, 2006
8 use FindBin;
cac6628 @particle [rakudo]: filter tests through fudging utils -- TimToady++
particle authored Jan 19, 2008
9 use File::Spec;
fa9d590 @pmichaud [rakudo]:
pmichaud authored May 22, 2008
10 use Getopt::Long qw(:config pass_through);
a26b223 @moritz [t/harness] parrot libs can also be in parrot/lib
moritz authored Feb 7, 2009
11 use lib qw( parrot/lib ../../lib );
fa9d590 @pmichaud [rakudo]:
pmichaud authored May 22, 2008
12 use strict;
cac6628 @particle [rakudo]: filter tests through fudging utils -- TimToady++
particle authored Jan 19, 2008
13
45ec470 @particle [rakudo]: make fudging an option in the test harness
particle authored Jan 22, 2008
14 our %harness_args;
fa9d590 @pmichaud [rakudo]:
pmichaud authored May 22, 2008
15 our $recurse = 1;
16
17 our %harness_args = (
18 language => 'perl6',
19 compiler => 'perl6.pbc',
256f4fb @jkeenan Applying patch submitted by Jason Switzer in
jkeenan authored Aug 3, 2008
20 verbosity => 0,
fa9d590 @pmichaud [rakudo]:
pmichaud authored May 22, 2008
21 );
7ca8767 @particle [rakudo]: pass fudged files to Parrot::Test::Harness
particle authored Jan 19, 2008
22
fb66ff6 @moritz [t/harness] fix testing if not checked out as languages/rakudo
moritz authored Feb 8, 2009
23 if (-d 'parrot') {
24 $harness_args{exec} = ['parrot/parrot', 'perl6.pbc'];
25 } else {
26 $harness_args{compiler} = 'perl6.pbc';
27 }
28
fa9d590 @pmichaud [rakudo]:
pmichaud authored May 22, 2008
29 GetOptions(
30 'tests-from-file=s' => \my $list_file,
31 'fudge' => \my $do_fudge,
256f4fb @jkeenan Applying patch submitted by Jason Switzer in
jkeenan authored Aug 3, 2008
32 'verbosity=i' => \$harness_args{verbosity},
0e8b4cb @moritz Enable parallel testing in rakudo.
moritz authored Sep 11, 2008
33 # A sensible default is num_cores + 1.
34 # Many people have two cores these days.
35 'jobs:3' => \$harness_args{jobs},
45ec470 @particle [rakudo]: make fudging an option in the test harness
particle authored Jan 22, 2008
36 );
28de107 @particle [rakudo][t] clean up lib path in harness
particle authored Feb 18, 2008
37
7d2219f @jnthn [rakudo] Add spectest_regression makefile target, which only runs tes…
jnthn authored May 21, 2008
38
fa9d590 @pmichaud [rakudo]:
pmichaud authored May 22, 2008
39 my @pass_through_options = grep m/^--?[^-]/, @ARGV;
40 my @files = grep m/^[^-]/, @ARGV;
41
42 my %accepted_tests;
65382bc @pmichaud [rakudo]: Allow single-test make targets, refactor fudge/harness.
pmichaud authored Jul 27, 2008
43 if ($list_file) {
fdf3e70 @particle [rakudo] [perl #54988] [PATCH] enhance t/harness (again)
particle authored May 29, 2008
44 open(my $f, '<', $list_file)
45 or die "Can't open file '$list_file' for reading: $!";
fa9d590 @pmichaud [rakudo]:
pmichaud authored May 22, 2008
46 my $slash = $^O eq 'MSWin32' ? '\\' : '/';
47 while (<$f>){
48 next if m/^\s*#/;
49 next unless m/\S/;
50 chomp;
fdf3e70 @particle [rakudo] [perl #54988] [PATCH] enhance t/harness (again)
particle authored May 29, 2008
51 my ($fn, $fudgespec) = split m/\s+#\s*/;
40e27cf @particle [rakudo] allow leading 't/spec/' path in filenames specified in test …
particle authored May 29, 2008
52 $fn = "t/spec/$fn" unless $fn =~ m/^t\Q$slash\Espec\Q$slash\E/;
fdf3e70 @particle [rakudo] [perl #54988] [PATCH] enhance t/harness (again)
particle authored May 29, 2008
53 $fn =~ s/\//$slash/g;
9c3d19d @moritz [rakudo] t/harness warns on no-existiing test files.
moritz authored Jul 7, 2008
54 if( -r $fn ) {
65382bc @pmichaud [rakudo]: Allow single-test make targets, refactor fudge/harness.
pmichaud authored Jul 27, 2008
55 push @files, $fn;
9c3d19d @moritz [rakudo] t/harness warns on no-existiing test files.
moritz authored Jul 7, 2008
56 } else {
57 warn "Missing test file: $fn\n";
58 }
8702168 @particle [rakudo] generalize command-line argument processing in the test harness
particle authored Apr 25, 2008
59 }
fa9d590 @pmichaud [rakudo]:
pmichaud authored May 22, 2008
60 close $f;
61 }
8702168 @particle [rakudo] generalize command-line argument processing in the test harness
particle authored Apr 25, 2008
62
fdf3e70 @particle [rakudo] [perl #54988] [PATCH] enhance t/harness (again)
particle authored May 29, 2008
63 # first prepare our list of files
65382bc @pmichaud [rakudo]: Allow single-test make targets, refactor fudge/harness.
pmichaud authored Jul 27, 2008
64 my @tfiles = map { all_in($_) } sort @files;
fdf3e70 @particle [rakudo] [perl #54988] [PATCH] enhance t/harness (again)
particle authored May 29, 2008
65
66 # then decide if and what to fudge
65382bc @pmichaud [rakudo]: Allow single-test make targets, refactor fudge/harness.
pmichaud authored Jul 27, 2008
67 if ($do_fudge) {
68 @tfiles = fudge(@tfiles);
fa9d590 @pmichaud [rakudo]:
pmichaud authored May 22, 2008
69 }
70
fdf3e70 @particle [rakudo] [perl #54988] [PATCH] enhance t/harness (again)
particle authored May 29, 2008
71 $harness_args{arguments} = \@tfiles;
72
73 sub fudge {
74 my $impl = 'rakudo';
75 my $cmd = join ' ', $^X, 't/spec/fudgeall',
76 @pass_through_options, $impl, @_;
65382bc @pmichaud [rakudo]: Allow single-test make targets, refactor fudge/harness.
pmichaud authored Jul 27, 2008
77 # print "$cmd\n";
fdf3e70 @particle [rakudo] [perl #54988] [PATCH] enhance t/harness (again)
particle authored May 29, 2008
78 return split ' ', `$cmd`;
79 }
80
fa9d590 @pmichaud [rakudo]:
pmichaud authored May 22, 2008
81 # Stolen directly from 'prove'
82 # adapted to return only files ending in '.t'
83 sub all_in {
84 my $start = shift;
85
fdf3e70 @particle [rakudo] [perl #54988] [PATCH] enhance t/harness (again)
particle authored May 29, 2008
86 return $start unless -d $start;
87
fa9d590 @pmichaud [rakudo]:
pmichaud authored May 22, 2008
88 my @hits = ();
89
90 local *DH;
91 if ( opendir( DH, $start ) ) {
92 my @files = sort readdir DH;
93 closedir DH;
94 for my $file ( @files ) {
95 next if $file eq File::Spec->updir || $file eq File::Spec->curdir;
96 next if $file eq ".svn";
97 next if $file eq "CVS";
98
99 my $currfile = File::Spec->catfile( $start, $file );
100 if ( -d $currfile ) {
101 push( @hits, all_in( $currfile ) ) if $recurse;
102 } else {
103 push( @hits, $currfile ) if $currfile =~ /\.t$/;
cac6628 @particle [rakudo]: filter tests through fudging utils -- TimToady++
particle authored Jan 19, 2008
104 }
105 }
fa9d590 @pmichaud [rakudo]:
pmichaud authored May 22, 2008
106 } else {
107 warn "$start: $!\n";
cac6628 @particle [rakudo]: filter tests through fudging utils -- TimToady++
particle authored Jan 19, 2008
108 }
109
fa9d590 @pmichaud [rakudo]:
pmichaud authored May 22, 2008
110 return @hits;
111 }
cf9a773 @particle [perl6]:
particle authored Apr 14, 2006
112
222b3ea @audreyt * copy all Pugs's sanity tests into languages/perl6/ harness.
audreyt authored Apr 15, 2006
113 # Set up PERL6LIB environment path so the "use" tests can find libraries
fa9d590 @pmichaud [rakudo]:
pmichaud authored May 22, 2008
114 $ENV{PERL6LIB} = "$FindBin::Bin/01-sanity";
cac6628 @particle [rakudo]: filter tests through fudging utils -- TimToady++
particle authored Jan 19, 2008
115
fa9d590 @pmichaud [rakudo]:
pmichaud authored May 22, 2008
116 eval 'use Parrot::Test::Harness %harness_args';
cac6628 @particle [rakudo]: filter tests through fudging utils -- TimToady++
particle authored Jan 19, 2008
117
118
Something went wrong with that request. Please try again.