Here's some more patches to improve things. It adds the following:
+ require TAP::Harness::Archive 0.10 so we can add extra_properties to our TAP
archives.
+ Collect Architecture, Compiler, DEVEL, Optimize, Perl Version, Platform, SVN
Revision and Version data into our TAP archives as extra_properties.
+ Add tags to the upload so it's easy to search by architecture, compiler,
version #, platform and perl version.
+ After the "make smolder_test" target completes successfully, print a URL
that the user can visit to see the report
If everyone is happy with the way this is going then in the near future I can
remove the existing "make smoke" target and replace it with what "make
smolder_test" does now.
Also, if we want to expand to having smolder tests for other parrot projects
(like rakudo, rakudo spec-tests, pipp, cardinal, etc) we might think about
having just a separate Smolder install at smolder.parrotcode.org (which I can
still host on the same server at my $work).
BTW chromatic: You had asked to be able to see individual TAP streams for test
files in Smolder. I've added that feature and you can see it at:
http://smolder.plusthree.com/app/developer_projects/report_details/1396
Just click on one of the "Ok" or "Failed" boxes and there should be a "TAP" link
that will popup with the raw TAP stream for that file.
--
Michael Peters
Plus Three, LP
Index: lib/Parrot/Harness/Smoke.pm
===================================================================
--- lib/Parrot/Harness/Smoke.pm (revision 29090)
+++ lib/Parrot/Harness/Smoke.pm (working copy)
@@ -31,6 +31,8 @@
our @EXPORT_OK = qw(
generate_html_smoke_report
send_archive_to_smolder
+ smolder_url
+ collect_test_environment_data
);
my %SMOLDER_CONFIG = (
@@ -41,41 +43,77 @@
);
sub send_archive_to_smolder {
+ my %test_env_data = @_;
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"
+ . "\nPlease install it if you want to send TAP archives Smolder.\n"
. ('-' x 55) . "[EMAIL PROTECTED]";
}
- # get the comments from svn
- my @lines = grep { $_ =~ /URL|Revision|LastChanged/ } `svn info`;
- push @lines, `$^X -v | grep -i 'this is perl'`;
- chomp @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 $url = "$SMOLDER_CONFIG{server}/app/developer_projects/process_add_report/$SMOLDER_CONFIG{project_id}";
- my $ua = LWP::UserAgent->new();
+ # create our tags based off the test environment information
+ my $tags = join(',',
+ (map { $test_env_data{$_} } qw(Architecture Compiler Platform Version)),
+ 'Perl ' . $test_env_data{'Perl Version'});
my $response = $ua->post(
$url,
Content_Type => 'form-data',
Content => [
- architecture => $PConfig{cpuarch},
- platform => $PConfig{osname},
- comments => $comments,
username => $SMOLDER_CONFIG{username},
password => $SMOLDER_CONFIG{password},
+ tags => $tags,
report_file => ['parrot_test_run.tar.gz'],
]
);
- if ($response->code != 302) {
+ if ($response->code == 302) {
+ print "Test report successfully sent to Smolder at\n"
+ . $SMOLDER_CONFIG{server}
+ . '/app/public_projects/smoke_reports/'
+ . $SMOLDER_CONFIG{project_id} . "\n";
+ }
+ else {
die "Could not upload report to Smolder at $SMOLDER_CONFIG{server}"
. "\nHTTP CODE: " . $response->code . " ("
. $response->message . ")\n";
}
}
+sub collect_test_environment_data {
+ return (
+ 'Architecture' => $PConfig{cpuarch},
+ 'Compiler' => _get_compiler_version(),
+ 'DEVEL' => $PConfig{DEVEL},
+ 'Optimize' => ($PConfig{optimize} || 'none'),
+ 'Perl Version' => (sprintf('%vd', $^V) . " $PConfig{archname}"),
+ 'Platform' => $PConfig{osname},
+ 'SVN Revision' => _get_svn_revision(),
+ 'Version' => $PConfig{VERSION},
+ );
+}
+
+# TODO expand this to handle svk and/or git checkouts too
+sub _get_svn_revision {
+ foreach my $line (`svn info`) {
+ return $1 if $line =~ /^Revision:\s*(\d+)/;
+ }
+ return 'unknown';
+}
+
+# TODO expand this to more than just GCC
+sub _get_compiler_version {
+ my $compiler = $PConfig{cc};
+ if($compiler eq 'gcc') {
+ $compiler .= " $PConfig{gccversion}";
+ }
+ return $compiler;
+}
+
sub generate_html_smoke_report {
my $argsref = shift;
my $html_fn = $argsref->{file};
Index: t/harness
===================================================================
--- t/harness (revision 29090)
+++ t/harness (working copy)
@@ -24,6 +24,7 @@
use Parrot::Harness::Smoke qw(
generate_html_smoke_report
send_archive_to_smolder
+ collect_test_environment_data
);
local @ARGV = @ARGV;
@@ -80,31 +81,37 @@
. "\nPlease install it if you want to create TAP archives.\n"
. ('-' x 55) . "[EMAIL PROTECTED]";
}
+ # for extra_properties we need TAP::Harness::Archive >= .10
+ if ($TAP::Harness::Archive::VERSION < .10) {
+ die "\n" . ('-' x 55) . "\nWe need TAP::Harness::Archive >= .10."
+ . "\nPlease install it if you want to create TAP archives.\n"
+ . ('-' x 55) . "\n";
+ }
+
+ my %env_data = collect_test_environment_data();
$harness = TAP::Harness::Archive->new(
{
- verbosity => $ENV{HARNESS_VERBOSE},
- archive => 'parrot_test_run.tar.gz',
- merge => 1,
+ verbosity => $ENV{HARNESS_VERBOSE},
+ archive => 'parrot_test_run.tar.gz',
+ merge => 1,
+ extra_properties => \%env_data,
}
);
+ $harness->runtests(@tests);
+ send_archive_to_smolder(%env_data) if $longopts->{send_to_smolder};
+
} else {
eval { require TAP::Harness };
if ($@) {
Test::Harness::runtests(@tests);
exit;
- }
- else {
+ } else {
$harness = TAP::Harness->new({
verbosity => $ENV{HARNESS_VERBOSE}, merge => 0
});
}
+ $harness->runtests(@tests);
}
-
- $harness->runtests(@tests);
-
- if ($longopts->{send_to_smolder}) {
- send_archive_to_smolder();
- }
}
=head1 NAME