[Rt-commit] r5420 - in Test-Chimps: . branches trunk trunk/bin
trunk/lib trunk/lib/Test trunk/lib/Test/Smoke/Report trunk/t
zev at bestpractical.com
zev at bestpractical.com
Fri Jun 23 17:32:16 EDT 2006
Author: zev
Date: Fri Jun 23 17:32:15 2006
New Revision: 5420
Added:
Test-Chimps/branches/
Test-Chimps/trunk/
Test-Chimps/trunk/Changes
Test-Chimps/trunk/MANIFEST
Test-Chimps/trunk/Makefile.PL
Test-Chimps/trunk/README
Test-Chimps/trunk/bin/
Test-Chimps/trunk/bin/submit_report.pl (contents, props changed)
Test-Chimps/trunk/lib/
Test-Chimps/trunk/lib/Test/
Test-Chimps/trunk/lib/Test/Smoke/
Test-Chimps/trunk/lib/Test/Smoke/Report/
Test-Chimps/trunk/lib/Test/Smoke/Report.pm
Test-Chimps/trunk/lib/Test/Smoke/Report/Client.pm
Test-Chimps/trunk/t/
Test-Chimps/trunk/t/00-load.t
Test-Chimps/trunk/t/boilerplate.t
Test-Chimps/trunk/t/pod-coverage.t
Test-Chimps/trunk/t/pod.t
Modified:
Test-Chimps/ (props changed)
Log:
r4184 at galvatron (orig r1): zev | 2006-06-16 13:31:54 -0400
r4071 at galvatron: zev | 2006-06-16 13:31:49 -0400
initial commit
Added: Test-Chimps/trunk/Changes
==============================================================================
--- (empty file)
+++ Test-Chimps/trunk/Changes Fri Jun 23 17:32:15 2006
@@ -0,0 +1,6 @@
+Revision history for Test-Smoke-Report
+
+0.01 Fri Jun 16 13:21:11 EDT 2006
+ First revision. Test::Smoke::Report and
+ Test::Smoke::Report::Client are both functional.
+
Added: Test-Chimps/trunk/MANIFEST
==============================================================================
--- (empty file)
+++ Test-Chimps/trunk/MANIFEST Fri Jun 23 17:32:15 2006
@@ -0,0 +1,10 @@
+Changes
+MANIFEST
+META.yml # Will be created by "make dist"
+Makefile.PL
+README
+lib/Test/Smoke/Report.pm
+t/00-load.t
+t/boilerplate.t
+t/pod-coverage.t
+t/pod.t
Added: Test-Chimps/trunk/Makefile.PL
==============================================================================
--- (empty file)
+++ Test-Chimps/trunk/Makefile.PL Fri Jun 23 17:32:15 2006
@@ -0,0 +1,16 @@
+use strict;
+use warnings;
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+ NAME => 'Test::Smoke::Report',
+ AUTHOR => 'Zev Benjamin <zev at cpan.org>',
+ VERSION_FROM => 'lib/Test/Smoke/Report.pm',
+ ABSTRACT_FROM => 'lib/Test/Smoke/Report.pm',
+ PL_FILES => {},
+ PREREQ_PM => {
+ 'Test::More' => 0,
+ },
+ dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
+ clean => { FILES => 'Test-Smoke-Report-*' },
+);
Added: Test-Chimps/trunk/README
==============================================================================
--- (empty file)
+++ Test-Chimps/trunk/README Fri Jun 23 17:32:15 2006
@@ -0,0 +1,44 @@
+Test-Smoke-Report
+
+This module modularizes the pugs smoke server/client
+(smokeserv-client.pl and smokeserv-server.pl). It also makes the
+code more generic so that other groups can take advantage of the
+simple but powerful smoke server. It will provide scripts to
+replicate pugs' scripts behavior in a more generic fashion.
+
+INSTALLATION
+
+To install this module, run the following commands:
+
+ perl Makefile.PL
+ make
+ make test
+ make install
+
+
+SUPPORT AND DOCUMENTATION
+
+After installing, you can find documentation for this module with the perldoc command.
+
+ perldoc Test::Smoke::Report
+
+You can also look for information at:
+
+ Search CPAN
+ http://search.cpan.org/dist/Test-Smoke-Report
+
+ CPAN Request Tracker:
+ http://rt.cpan.org/NoAuth/Bugs.html?Dist=Test-Smoke-Report
+
+ AnnoCPAN, annotated CPAN documentation:
+ http://annocpan.org/dist/Test-Smoke-Report
+
+ CPAN Ratings:
+ http://cpanratings.perl.org/d/Test-Smoke-Report
+
+COPYRIGHT AND LICENCE
+
+Copyright (C) 2006 Zev Benjamin
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
Added: Test-Chimps/trunk/bin/submit_report.pl
==============================================================================
--- (empty file)
+++ Test-Chimps/trunk/bin/submit_report.pl Fri Jun 23 17:32:15 2006
@@ -0,0 +1,27 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+use lib '/home/zev/bps/Test-Smoke-Report/lib';
+
+use Getopt::Long;
+use Test::Smoke::Report;
+use Test::Smoke::Report::Client;
+use Test::TAP::Model::Visual;
+
+chdir "jifty/trunk";
+
+my $model = Test::TAP::Model::Visual->new_with_tests(glob("t/*.t"));# t/*/t/*.t"));
+
+my $report = Test::Smoke::Report->new(model => $model);
+
+my $client = Test::Smoke::Report::Client->new(reports => [$report],
+ server => 'http://galvatron.mit.edu/cgi-bin/smokeserv-server.pl');
+
+my ($status, $msg) = $client->send;
+
+if (! $status) {
+ print "Error: $msg\n";
+ exit(1);
+}
Added: Test-Chimps/trunk/lib/Test/Smoke/Report.pm
==============================================================================
--- (empty file)
+++ Test-Chimps/trunk/lib/Test/Smoke/Report.pm Fri Jun 23 17:32:15 2006
@@ -0,0 +1,127 @@
+package Test::Smoke::Report;
+
+use warnings;
+use strict;
+
+use Carp;
+use Params::Validate;
+use Test::TAP::HTMLMatrix;
+
+=head1 NAME
+
+Test::Smoke::Report - Encapsulate a smoke test report
+
+=head1 VERSION
+
+Version 0.01
+
+=cut
+
+our $VERSION = '0.01';
+
+=head1 SYNOPSIS
+
+This module encapsulates a L<Test::TAP::Model>'s structure and a
+freeform report text. If not provided, Test::TAP::HTMLMatrix will
+be used to generate the report.
+
+ use Test::Smoke::Report;
+ use Test::TAP::Model::Visual;
+
+ chdir "some/module/directory";
+
+ my $model = Test::TAP::Model::Visual->new_with_tests(glob("t/*.t"));# t/*/t/*.t"));
+
+ my $report = Test::Smoke::Report->new(model => $model);
+
+ ...
+
+=cut
+
+sub new {
+ my $class = shift;
+ my $obj = bless {}, $class;
+ $obj->_init(@_);
+ return $obj;
+}
+
+sub _init {
+ my $self = shift;
+ validate(@_,
+ { model =>
+ { isa => 'Test::TAP::Model'},
+ report_text => 0 });
+
+ my %args = @_;
+
+ $self->{model_structure} = $args{model}->structure;
+ if (defined $args{report_text}) {
+ $self->{report_text} = $args{report_text};
+ } else {
+ my $v = Test::TAP::HTMLMatrix->new($args{model});
+ $self->{report_text} = $v->detail_html;
+ }
+}
+
+sub model_structure {
+ my $self = shift;
+ return $self->{model_structure};
+}
+
+sub report_text {
+ my $self = shift;
+ return $self->{report_text};
+}
+
+=head1 AUTHOR
+
+Zev Benjamin, C<< <zev at cpan.org> >>
+
+=head1 BUGS
+
+Please report any bugs or feature requests to
+C<bug-test-smoke-report at rt.cpan.org>, or through the web interface at
+L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Smoke-Report>.
+I will be notified, and then you'll automatically be notified of progress on
+your bug as I make changes.
+
+=head1 SUPPORT
+
+You can find documentation for this module with the perldoc command.
+
+ perldoc Test::Smoke::Report
+
+You can also look for information at:
+
+=over 4
+
+=item * AnnoCPAN: Annotated CPAN documentation
+
+L<http://annocpan.org/dist/Test-Smoke-Report>
+
+=item * CPAN Ratings
+
+L<http://cpanratings.perl.org/d/Test-Smoke-Report>
+
+=item * RT: CPAN's request tracker
+
+L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Test-Smoke-Report>
+
+=item * Search CPAN
+
+L<http://search.cpan.org/dist/Test-Smoke-Report>
+
+=back
+
+=head1 ACKNOWLEDGEMENTS
+
+=head1 COPYRIGHT & LICENSE
+
+Copyright 2006 Zev Benjamin, all rights reserved.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+=cut
+
+1; # End of Test::Smoke::Report
Added: Test-Chimps/trunk/lib/Test/Smoke/Report/Client.pm
==============================================================================
--- (empty file)
+++ Test-Chimps/trunk/lib/Test/Smoke/Report/Client.pm Fri Jun 23 17:32:15 2006
@@ -0,0 +1,76 @@
+package Test::Smoke::Report::Client;
+
+use warnings;
+use strict;
+
+use Carp;
+use Params::Validate qw/:all/;
+use Test::Smoke::Report;
+use LWP::UserAgent;
+use YAML::Syck;
+
+use constant PROTO_VERSION => 0.1;
+
+sub new {
+ my $class = shift;
+ my $obj = bless {}, $class;
+ $obj->_init(@_);
+ return $obj;
+}
+
+sub _init {
+ my $self = shift;
+ validate(@_,
+ { reports =>
+ { type => ARRAYREF },
+ server => 1,
+ compress => 0});
+
+ my %args = @_;
+ $self->{reports} = $args{reports};
+ foreach my $report (@{$self->{reports}}) {
+ croak "one the the specified reports is not a Test::Smoke::Report"
+ if ! (ref $report && $report->isa('Test::Smoke::Report'));
+ }
+ $self->{server} = $args{server};
+ $self->{compress} = $args{compress} || 0;
+}
+
+sub reports {
+ my $self = shift;
+ return $self->{reports};
+}
+
+sub server {
+ my $self = shift;
+ return $self->{server};
+}
+
+sub compress {
+ my $self = shift;
+ return $self->{compress};
+}
+
+sub send {
+ my $self = shift;
+
+ my $ua = LWP::UserAgent->new;
+ $ua->agent("Test-Smoke-Report-Client/" . PROTO_VERSION);
+ $ua->env_proxy;
+
+ my $serialized_reports = [ map { Dump($_) } @{$self->reports} ];
+ my %request = (upload => 1, version => PROTO_VERSION,
+ reports => $serialized_reports);
+ my $resp = $ua->post($self->server => \%request);
+ if($resp->is_success) {
+ if($resp->content =~ /^ok/) {
+ return (1, '');
+ } else {
+ return (0, $resp->content);
+ }
+ } else {
+ return (0, $resp->status_line);
+ }
+}
+
+1;
Added: Test-Chimps/trunk/t/00-load.t
==============================================================================
--- (empty file)
+++ Test-Chimps/trunk/t/00-load.t Fri Jun 23 17:32:15 2006
@@ -0,0 +1,9 @@
+#!perl -T
+
+use Test::More tests => 1;
+
+BEGIN {
+ use_ok( 'Test::Smoke::Report' );
+}
+
+diag( "Testing Test::Smoke::Report $Test::Smoke::Report::VERSION, Perl $], $^X" );
Added: Test-Chimps/trunk/t/boilerplate.t
==============================================================================
--- (empty file)
+++ Test-Chimps/trunk/t/boilerplate.t Fri Jun 23 17:32:15 2006
@@ -0,0 +1,48 @@
+#!perl -T
+
+use strict;
+use warnings;
+use Test::More tests => 3;
+
+sub not_in_file_ok {
+ my ($filename, %regex) = @_;
+ open my $fh, "<", $filename
+ or die "couldn't open $filename for reading: $!";
+
+ my %violated;
+
+ while (my $line = <$fh>) {
+ while (my ($desc, $regex) = each %regex) {
+ if ($line =~ $regex) {
+ push @{$violated{$desc}||=[]}, $.;
+ }
+ }
+ }
+
+ if (%violated) {
+ fail("$filename contains boilerplate text");
+ diag "$_ appears on lines @{$violated{$_}}" for keys %violated;
+ } else {
+ pass("$filename contains no boilerplate text");
+ }
+}
+
+not_in_file_ok(README =>
+ "The README is used..." => qr/The README is used/,
+ "'version information here'" => qr/to provide version information/,
+);
+
+not_in_file_ok(Changes =>
+ "placeholder date/time" => qr(Date/time)
+);
+
+sub module_boilerplate_ok {
+ my ($module) = @_;
+ not_in_file_ok($module =>
+ 'the great new $MODULENAME' => qr/ - The great new /,
+ 'boilerplate description' => qr/Quick summary of what the module/,
+ 'stub function definition' => qr/function[12]/,
+ );
+}
+
+module_boilerplate_ok('lib/Test/Smoke/Report.pm');
Added: Test-Chimps/trunk/t/pod-coverage.t
==============================================================================
--- (empty file)
+++ Test-Chimps/trunk/t/pod-coverage.t Fri Jun 23 17:32:15 2006
@@ -0,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod::Coverage 1.04";
+plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@;
+all_pod_coverage_ok();
Added: Test-Chimps/trunk/t/pod.t
==============================================================================
--- (empty file)
+++ Test-Chimps/trunk/t/pod.t Fri Jun 23 17:32:15 2006
@@ -0,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod 1.14";
+plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
+all_pod_files_ok();
More information about the Rt-commit
mailing list