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


The test harness used the default verbosity mode provided by TAP::Harness.
It seemed useful to be able to tell the parrot harness to pass a specific
verbosity flag down to TAP::Harness.

The attached patch does several things. First, it adds support for the
verbose option. Secondly, it changes the name of the options array to
something that won't clobber the import method's parameter so that more
parameters can be supported easily in the future. It also adds support in
the languages/perl6 harness to pass this parameter through to parrot's
harness. Finally, it adds a target to languages/perl6/Makefile to provide a
localtest target with a reasonably loud option (so the user can do 'make
localtest_loud' to see each test's result).

Since I work on many tests individually, I wanted to be able to set the
verbosity flag from a make target at once (typically locally,
spectest_regression.data shouldn't be noisy) and see each individual test
result. This patch fills the void.

Thanks,

Jason "s1n" Switzer
Index: lib/Parrot/Test/Harness.pm
===================================================================
--- lib/Parrot/Test/Harness.pm	(revision 29931)
+++ lib/Parrot/Test/Harness.pm	(working copy)
@@ -20,6 +20,7 @@
 
   use Parrot::Test::Harness
       language  => 'eclectus',
+      verbosity => 1,
       exec      => [ 'petite', '--script' ],
       arguments => [ '--files' ],
       files     => [ 't/*.pl' ];
@@ -46,6 +47,9 @@
 through your compiler itself.  If you can load PIR libraries from your
 language, you can even use the existing PIR testing tools.
 
+If the C<verbosity> argument pair is provided, it will pass it through to the TAP::Harness
+as is. This allows for extremely quiet or loud test output to be generated.
+
 =head1 AUTHOR
 
 Written by chromatic with most of the intelligence stolen from the Punie
@@ -162,11 +166,12 @@
     exit unless my @files = get_files(%options);
 
     if (eval { require TAP::Harness; 1 }) {
-        my %options =
+        my %opts =
               $options{exec}     ? ( exec => $options{exec} )
             : $options{compiler} ? ( exec => [ '../../parrot', './' . $options{compiler} ] )
             :                      ();
-        TAP::Harness->new( \%options )->runtests( @files );
+        $opts{verbosity} = $options{verbosity} ? $options{verbosity} : 0;
+        TAP::Harness->new( \%opts )->runtests( @files );
 
         return;
     }
Index: languages/perl6/t/harness
===================================================================
--- languages/perl6/t/harness	(revision 29931)
+++ languages/perl6/t/harness	(working copy)
@@ -17,11 +17,13 @@
 our %harness_args = (
     language  => 'perl6',
     compiler  => 'perl6.pbc',
+    verbosity => 0,
 );
 
 GetOptions(
         'tests-from-file=s' => \my $list_file,
         'fudge'             => \my $do_fudge,
+        'verbosity=i'       => \$harness_args{verbosity},
     );
 
 
Index: languages/perl6/config/makefiles/root.in
===================================================================
--- languages/perl6/config/makefiles/root.in	(revision 29931)
+++ languages/perl6/config/makefiles/root.in	(working copy)
@@ -207,6 +207,10 @@
 localtest: all t/spec t/localtest.data
 	@$(HARNESS_WITH_FUDGE) --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
+	@$(HARNESS_WITH_FUDGE) --tests-from-file=t/localtest.data --verbosity=1
+
 # Run many tests of your choise.
 # make somtests TESTFILES=t/foo/bar
 sometests: all

Reply via email to