Ron Schmidt via RT wrote:
>> It'd be nice if we used the same env var for this as we did for the
>> main harness. (that one is currently TEST_JOBS, iirc.)
> 
> Per request from moritz I have come up with an updated patch that seems
> to apply cleanly and tested it on Ubuntu and cygwin/Windows Vista.  It
> gives the expected output for "make test" and "make spectest" in both
> cases and gives a nice performance boost under Ubuntu.  Under
> cygwin/Windows Vista however the performance seems a bit slower and I
> wonder if we shouldn't really check for the OS or use 'jobs:1' in
> languages/perl6/t/harness rather than 'jobs:3'.
> 
> Per the suggestion above the controlling environment variable in the
> patch is TEST_JOBS.

Attached is a slightly improved patch:
1) doesn't have trailing spaces in t/harness
2) 'make localtest_loud' works as before
(with the old patch you wouldn't see the verbose output, which is
crucial when you try to fudge tests for rakudo)
3) 'make t/spec/$path_to_file.t' is now verbose by default (which also
makes sense because you usually don't want to run many of those from the
command line)

Moritz

-- 
Moritz Lenz
http://moritz.faui2k3.org/ |  http://perl-6.de/
Index: lib/Parrot/Test/Harness.pm
===================================================================
--- lib/Parrot/Test/Harness.pm	(revision 30954)
+++ lib/Parrot/Test/Harness.pm	(working copy)
@@ -166,12 +166,13 @@
     exit unless my @files = get_files(%options);
 
     if (eval { require TAP::Harness; 1 }) {
-        my %opts =
+        my %harness_options =
               $options{exec}     ? ( exec => $options{exec} )
             : $options{compiler} ? ( exec => [ '../../parrot', './' . $options{compiler} ] )
             :                      ();
-        $opts{verbosity} = $options{verbosity} ? $options{verbosity} : 0;
-        TAP::Harness->new( \%opts )->runtests( @files );
+        $harness_options{verbosity} = $options{verbosity} ? $options{verbosity} : 0;
+        $harness_options{jobs} = $ENV{TEST_JOBS} || $options{jobs} || 1;
+        TAP::Harness->new( \%harness_options )->runtests( @files );
 
         return;
     }
Index: languages/perl6/t/harness
===================================================================
--- languages/perl6/t/harness	(revision 30969)
+++ languages/perl6/t/harness	(working copy)
@@ -24,6 +24,9 @@
         'tests-from-file=s' => \my $list_file,
         'fudge'             => \my $do_fudge,
         'verbosity=i'       => \$harness_args{verbosity},
+        # A sensible default is num_cores + 1.
+        # Many people have two cores these days.
+        'jobs:3'            => \$harness_args{jobs},
     );
 
 
Index: languages/perl6/config/makefiles/root.in
===================================================================
--- languages/perl6/config/makefiles/root.in	(revision 30969)
+++ languages/perl6/config/makefiles/root.in	(working copy)
@@ -197,21 +197,22 @@
 # NOTE: eventually, we should remove --keep-exit-code and --fudge
 #       as the goal is that all tests must pass without fudge
 HARNESS_WITH_FUDGE = $(PERL) t/harness --fudge --keep-exit-code
+HARNESS_WITH_FUDGE_JOBS = $(HARNESS_WITH_FUDGE) --jobs
 
 spectest: all t/spec
 	-cd t/spec && svn up
-	$(HARNESS_WITH_FUDGE) t/spec
+	$(HARNESS_WITH_FUDGE_JOBS) t/spec
 
 # Run the spectests that we know work.
 spectest_regression: all t/spec t/spectest_regression.data
 	-cd t/spec && svn up
-	$(HARNESS_WITH_FUDGE) --tests-from-file=t/spectest_regression.data
+	$(HARNESS_WITH_FUDGE_JOBS) --tests-from-file=t/spectest_regression.data
 
 fulltest: coretest spectest_regression codetest
 
 # Run the tests in t/localtest.data
 localtest: all t/spec t/localtest.data
-	@$(HARNESS_WITH_FUDGE) --tests-from-file=t/localtest.data
+	@$(HARNESS_WITH_FUDGE_JOBS) --tests-from-file=t/localtest.data
 
 # Run the tests in t/localtest.data with a higher verbosity
 localtest_loud: all t/spec t/localtest.data
@@ -220,11 +221,11 @@
 # Run many tests of your choise.
 # make somtests TESTFILES=t/foo/bar
 sometests: all
-	@$(HARNESS_WITH_FUDGE) $(TESTFILES)
+	@$(HARNESS_WITH_FUDGE_JOBS) $(TESTFILES)
 
 # Run a single test
 t/*.t t/*/*.t t/*/*/*.t: all
-	@$(HARNESS_WITH_FUDGE) $@
+	@$(HARNESS_WITH_FUDGE) --verbosity=1 $@
 
 t/localtest.data:
 	$(PERL) -MExtUtils::Command -e test_f $@

Reply via email to