# New Ticket Created by  Patrick R. Michaud 
# Please include the string:  [perl #57530]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=57530 >


Schwern provided the following patch at the OSCON hackathon,
but we should probably test it on a couple of other architectures
before applying it.  So, can others apply, test, and report
results?

If it works on sufficient platforms, we can apply it.

Thanks!

Pm

----- Forwarded message from Michael G Schwern <[EMAIL PROTECTED]> -----

Date: Sat, 26 Jul 2008 19:44:36 -0700
From: Michael G Schwern <[EMAIL PROTECTED]>
To: "Patrick R. Michaud" <[EMAIL PROTECTED]>
Subject: Parallelize the Perl 6 tests

Turns on parallel testing for the perl 6 tests
* default 3 jobs in parallel.  Useful for dual cores,
  not so much to swamp a single core machine.
* introduces a "jobs" option Parrot::Test::Harness
* also a PARROT_HARNESS_JOBS environment variable

Runs the spectest_regression about 50% faster on my Macbook.


-- 
Insulting our readers is part of our business model.
        http://somethingpositive.net/sp07122005.shtml


Index: lib/Parrot/Test/Harness.pm
===================================================================
--- lib/Parrot/Test/Harness.pm  (revision 29706)
+++ lib/Parrot/Test/Harness.pm  (working copy)
@@ -162,12 +162,14 @@
     exit unless my @files = get_files(%options);
 
     if (eval { require TAP::Harness; 1 }) {
-        my %options =
+        my %harness_options =
               $options{exec}     ? ( exec => $options{exec} )
             : $options{compiler} ? ( exec => [ '../../parrot', './' . 
$options{compiler} ] )
             :                      ();
-        TAP::Harness->new( \%options )->runtests( @files );
 
+        $harness_options{jobs} = $ENV{PARROT_HARNESS_JOBS} || $options{jobs} 
|| 1;
+        TAP::Harness->new( \%harness_options )->runtests( @files );
+
         return;
     }
 
Index: languages/perl6/t/harness
===================================================================
--- languages/perl6/t/harness   (revision 29782)
+++ languages/perl6/t/harness   (working copy)
@@ -11,7 +11,6 @@
 use lib qw( ../../lib );
 use strict;
 
-our %harness_args;
 our $recurse = 1;
 
 our %harness_args = (
@@ -22,6 +21,10 @@
 GetOptions(
         'tests-from-file=s' => \my $list_file,
         'fudge'             => \my $do_fudge,
+
+        # 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 29782)
+++ languages/perl6/config/makefiles/root.in    (working copy)
@@ -189,7 +189,7 @@
 
 # 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 = $(PERL) t/harness --fudge --keep-exit-code --jobs
 
 spectest: all t/spec
        -cd t/spec && svn up
@@ -213,7 +213,7 @@
 
 # Run a single test
 t/*.t t/*/*.t t/*/*/*.t: all
-       @$(HARNESS_WITH_FUDGE) $@
+       @$(HARNESS_WITH_FUDGE) --jobs=1 $@
 
 t/localtest.data:
        $(PERL) -MExtUtils::Command -e test_f $@


----- End forwarded message -----

Reply via email to