[svn:languages] r83 - in lolcode/trunk: config/makefiles t

tene at svn.parrot.org tene at svn.parrot.org
Tue Oct 20 18:08:20 UTC 2009


Author: tene
Date: Tue Oct 20 18:08:19 2009
New Revision: 83
URL: https://trac.parrot.org/languages/changeset/83

Log:
Fix up some minor errors, so we can actually build and run "make test"

Modified:
   lolcode/trunk/config/makefiles/root.in
   lolcode/trunk/t/harness

Modified: lolcode/trunk/config/makefiles/root.in
==============================================================================
--- lolcode/trunk/config/makefiles/root.in	Tue Sep 29 22:19:11 2009	(r82)
+++ lolcode/trunk/config/makefiles/root.in	Tue Oct 20 18:08:19 2009	(r83)
@@ -122,7 +122,7 @@
 	@echo ""
 
 test: build
-	$(PERL) -I$(LIB_DIR)/tools/lib t/harness
+	$(PERL) -I$(LIB_DIR)/tools/lib t/harness t
 
 # basic run for missing libs
 test-installable: installable

Modified: lolcode/trunk/t/harness
==============================================================================
--- lolcode/trunk/t/harness	Tue Sep 29 22:19:11 2009	(r82)
+++ lolcode/trunk/t/harness	Tue Oct 20 18:08:19 2009	(r83)
@@ -2,7 +2,94 @@
 
 # $Id$
 
+use strict;
+use warnings;
+
 use FindBin;
-use lib qw( . lib ../lib ../../lib );
-use Parrot::Test::Harness language => 'lolcode', compiler => 'lolcode.pbc';
+use File::Spec;
+use Getopt::Long qw(:config pass_through);
+
+$ENV{'HARNESS_PERL'} = './lolcode';
+use Test::Harness;
+$Test::Harness::switches = '';
+
+GetOptions(
+    'tests-from-file=s' => \my $list_file,
+    'verbosity=i'       => \$Test::Harness::verbose,
+    'jobs:3'            => \my $jobs,
+    'icu:1'             => \my $do_icu,
+);
+
+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, $flags) = split /\s+#\s*/;
+        next if ($flags && ($flags =~ m/icu/) && !$do_icu);
+        $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;
+
+if (eval { require TAP::Harness; 1 }) {
+    my %harness_options = (
+        exec      => ['./lolcode'],
+        verbosity => 0+$Test::Harness::verbose,
+        jobs      => $jobs || 1,
+    );
+    TAP::Harness->new( \%harness_options )->runtests(@tfiles);
+}
+else {
+    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;
+}
 


More information about the parrot-commits mailing list