Commits

Anonymous committed 8fd9016

update test harness to be closer to rakudo's test harness.

Comments (0)

Files changed (2)

     .param pmc args
     load_bytecode 'PGE/Dumper.pbc'
     $P0 = compreg 'Pynie'
+    $S0 = args[2]
+    $I0 = index $S0, '@INC'
+    if $I0 < 0 goto not_harness
+    exit 0
+  not_harness:  
     .tailcall $P0.'command_line'(args)
 .end
 
 #! perl
 
-# $Id: harness 17401 2007-03-09 09:00:39Z paultcochrane $
+# $Id$
+
+# note: Due to a limitation in Getopt::Long options that should be passed
+# through to fudgeall have to come after all other options
+
+use strict;
+use warnings;
 
 use FindBin;
-use lib qw( . lib ../lib ../../lib ../../lib );
-use Parrot::Test::Harness language => 'pynie', compiler => 'pynie.pbc';
+use File::Spec;
+use Getopt::Long qw(:config pass_through);
 
-# Set up PERL6LIB environment path so the "use" tests can find libraries
-# $ENV{PERL6LIB} = "$Bin/01-sanity";
+$ENV{'HARNESS_PERL'} = './pynie';
+use Test::Harness;
+$Test::Harness::switches = '';
+
+GetOptions(
+    'tests-from-file=s' => \my $list_file,
+    'verbosity=i'       => \$Test::Harness::verbose,
+    'jobs:3'            => \my $jobs,
+);
+my @pass_through_options = grep m/^--?[^-]/, @ARGV;
+my @files = grep m/^[^-]/, @ARGV;
+
+my $slash = $^O eq 'MSWin32' ? '\\' : '/';
+
+if ($list_file) {
+    open(my $f, '<', $list_file)
+        or die "Can't open file '$list_file' for reading: $!";
+    while (<$f>) {
+        next if m/^\s*#/;
+        next unless m/\S/;
+        chomp;
+        my ($fn, $fudgespec) = split m/\s+#\s*/;
+        $fn = "t/spec/$fn" unless $fn =~ m/^t\Q$slash\Espec\Q$slash\E/;
+        $fn =~ s{/}{$slash}g;
+        if ( -r $fn ) {
+            push @files, $fn;
+        } else {
+            warn "Missing test file: $fn\n";
+        }
+    }
+    close $f or die $!;
+}
+
+my @tfiles = map { all_in($_) } sort @files;
+
+runtests(@tfiles);
+
+# adapted to return only files ending in '.t'
+sub all_in {
+    my $start = shift;
+
+    return $start unless -d $start;
+
+    my @skip = ( File::Spec->updir, File::Spec->curdir, qw( .svn CVS .git ) );
+    my %skip = map {($_,1)} @skip;
+
+    my @hits = ();
+
+    if ( opendir( my $dh, $start ) ) {
+        my @files = sort readdir $dh;
+        closedir $dh or die $!;
+        for my $file ( @files ) {
+            next if $skip{$file};
+
+            my $currfile = File::Spec->catfile( $start, $file );
+            if ( -d $currfile ) {
+                push( @hits, all_in( $currfile ) );
+            } else {
+                push( @hits, $currfile ) if $currfile =~ /\.t$/;
+            }
+        }
+    } else {
+        warn "$start: $!\n";
+    }
+
+    return @hits;
+}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.