I've got this working pretty well on my checkout (except that the current
revision, #28476, doesn't build). You can do a "make smolder_test" and have the
results sent to the Smolder server. I talked with chromatic and some others
about removing some of the old existing smoke stuff, but I'll do that later.

So now the question is how do I send this as a patch. It touches several files
and adds new ones. Is a simple svn diff good enough? If so, it's attached.

-- 
Michael Peters
Plus Three, LP

Index: lib/Parrot/Harness/Options.pm
===================================================================
--- lib/Parrot/Harness/Options.pm	(revision 28476)
+++ lib/Parrot/Harness/Options.pm	(working copy)
@@ -50,6 +50,14 @@
     $longopts{help} = grep { $_ eq '--help' } @argv;
     @argv = grep { $_ ne '--help' } @argv;
 
+    $longopts{archive} = grep { $_ eq '--archive' } @argv;
+    @argv = grep { $_ ne '--archive' } @argv;
+
+    if( $longopts{archive} ) {
+        $longopts{send_to_smolder} = grep { $_ eq '--send-to-smolder' } @argv;
+        @argv = grep { $_ ne '--send-to-smolder' } @argv;
+    }
+
     return (\%longopts, @argv);
 }
 
@@ -91,6 +99,8 @@
     --runcore-tests
     --html
     --code-tests
+    --archive  ... create a TAP archive of the test run
+    --send-to-smolder ... send the TAP archive to the Parrot Smolder server
 EOF
 
     return;
Index: lib/Parrot/Harness/Smoke.pm
===================================================================
--- lib/Parrot/Harness/Smoke.pm	(revision 28476)
+++ lib/Parrot/Harness/Smoke.pm	(working copy)
@@ -27,11 +27,55 @@
 
 use lib qw( . lib ../lib ../../lib );
 use Parrot::Config qw/%PConfig/;
+use Config;
 use base qw( Exporter );
 our @EXPORT_OK = qw(
     generate_html_smoke_report
+    send_archive_to_smolder
 );
 
+my %SMOLDER_CONFIG = (
+    server     => 'http://smolder.plusthree.com',
+    username   => 'parrot-autobot',
+    password   => '[EMAIL PROTECTED]',
+    project_id => 8,
+);
+
+sub send_archive_to_smolder {
+    eval { require LWP::UserAgent };
+    if( $@ ) {
+        die "\n" . ('-' x 55) . "\nCould not load LWP::UserAgent."
+            . "\nPlease install it if you want to send TAP archives smolder.\n"
+            . ('-' x 55) . "[EMAIL PROTECTED]";
+    }
+
+    # get the comments from svn
+    my @lines = `svn info`;
+    @lines = grep { $_ =~ /URL|Revision|LastChanged/ } @lines;
+    push(@lines, `perl -v | grep -i 'this is perl'`);
+    chomp foreach @lines;
+    my $comments = join("\n", @lines);
+
+    my $url = "$SMOLDER_CONFIG{server}/app/developer_projects/process_add_report/$SMOLDER_CONFIG{project_id}";
+    my $ua = LWP::UserAgent->new();
+    my $response = $ua->post(
+        $url,
+        Content_Type => 'form-data',
+        Content      => [
+            architecture => $Config{myarchname},
+            platform     => $^O,
+            comments     => $comments,
+            username     => $SMOLDER_CONFIG{username},
+            password     => $SMOLDER_CONFIG{password},
+            report_file  => ['parrot_test_run.tar.gz'],
+        ]
+    );
+    if($response->code != 302) {
+        die "Could not upload report to Smolder at $SMOLDER_CONFIG{server}"
+            . "\nHTTP CODE: " . $response->code . " (" . $response->message . ")\n";
+    }
+}
+
 sub generate_html_smoke_report {
     my $argsref = shift;
     my $html_fn = $argsref->{file};
Index: t/harness
===================================================================
--- t/harness	(revision 28476)
+++ t/harness	(working copy)
@@ -19,6 +19,7 @@
 );
 use Parrot::Harness::Smoke qw(
     generate_html_smoke_report
+    send_archive_to_smolder
 );
 
 local @ARGV = @ARGV;
@@ -51,21 +52,46 @@
     $longopts->{runcore_tests_only}
 );
 
-my @tests = map { glob( $_ ) } (@ARGV ? @ARGV : @default_tests);
+my @tests;
+if ($longopts->{code}) {
+    @tests = @developing_tests;
+} else {
+    @tests = map { glob($_) } (@ARGV ? @ARGV : @default_tests);
+}
 
-if ( $longopts->{code} ) {
-    Test::Harness::runtests(@developing_tests);
+if ($longopts->{html}) {
+    generate_html_smoke_report(
+        {
+            tests => [EMAIL PROTECTED],
+            args  => $args,
+            file  => 'smoke.html',
+        }
+    );
+} else {
+    my $harness;
+    if ($longopts->{archive}) {
+        eval { require TAP::Harness::Archive };
+        if( $@ ) {
+            die "\n" . ('-' x 55) . "\nCould not load TAP::Harness::Archive."
+                . "\nPlease install it if you want to create TAP archives.\n"
+                . ('-' x 55) . "[EMAIL PROTECTED]";
+        }
+        $harness = TAP::Harness::Archive->new(
+            {
+                verbosity => $ENV{HARNESS_VERBOSE},
+                archive   => 'parrot_test_run.tar.gz',
+                merge     => 1,
+            }
+        );
+    } else {
+        $harness = TAP::Harness->new({verbosity => $ENV{HARNESS_VERBOSE}, merge => 0});
+    }
+    $harness->runtests(@tests);
+
+    if($longopts->{send_to_smolder}) {
+        send_archive_to_smolder();
+    }
 }
-elsif ( $longopts->{html} ) {
-    generate_html_smoke_report ( {
-        tests       => [EMAIL PROTECTED],
-        args        => $args,
-        file        => 'smoke.html',
-    } );
-}
-else {
-    Test::Harness::runtests(@tests);
-}
 
 =head1 NAME
 
Index: config/gen/makefiles/root.in
===================================================================
--- config/gen/makefiles/root.in	(revision 28476)
+++ config/gen/makefiles/root.in	(working copy)
@@ -1435,6 +1435,10 @@
 test : test_prep
 	$(PERL) t/harness $(EXTRA_TEST_ARGS)
 
+# run the test suite, create a TAP archive and send it off to smolder
+smolder_test : test_prep
+	$(PERL) t/harness $(EXTRA_TEST_ARGS) --archive --send-to-smolder
+
 # "core tests" -- test basic functionality but not ancillaries
 coretest : test_prep
 	$(PERL) t/harness $(EXTRA_TEST_ARGS) --core-tests

Reply via email to