[Rt-commit] r5539 - in Test-Chimps/branches/dbi: bin
lib/Test/Chimps lib/Test/Chimps/Client
zev at bestpractical.com
zev at bestpractical.com
Thu Jul 6 15:37:41 EDT 2006
Author: zev
Date: Thu Jul 6 15:37:26 2006
New Revision: 5539
Modified:
Test-Chimps/branches/dbi/ (props changed)
Test-Chimps/branches/dbi/bin/poll_and_submit.pl
Test-Chimps/branches/dbi/bin/report_server.pl
Test-Chimps/branches/dbi/bin/yaml2dbi.pl
Test-Chimps/branches/dbi/lib/Test/Chimps/Client.pm
Test-Chimps/branches/dbi/lib/Test/Chimps/Client/Poller.pm
Test-Chimps/branches/dbi/lib/Test/Chimps/Report.pm
Test-Chimps/branches/dbi/lib/Test/Chimps/Server.pm
Log:
r11362 at galvatron: zev | 2006-07-06 15:30:32 -0400
client and server now work with a database backend, but it's not very
configurable
Modified: Test-Chimps/branches/dbi/bin/poll_and_submit.pl
==============================================================================
--- Test-Chimps/branches/dbi/bin/poll_and_submit.pl (original)
+++ Test-Chimps/branches/dbi/bin/poll_and_submit.pl Thu Jul 6 15:37:26 2006
@@ -6,9 +6,8 @@
use Test::Chimps::Client::Poller;
my $poller = Test::Chimps::Client::Poller->new(
- server => 'http://smoke.bestpractical.com/cgi-bin/report_server.pl',
+ server => 'http://galvatron.mit.edu/cgi-bin/report_server.pl',
config_file => "$ENV{HOME}/poll-config.yml",
- simulate => 1
);
$poller->poll;
Modified: Test-Chimps/branches/dbi/bin/report_server.pl
==============================================================================
--- Test-Chimps/branches/dbi/bin/report_server.pl (original)
+++ Test-Chimps/branches/dbi/bin/report_server.pl Thu Jul 6 15:37:26 2006
@@ -1,7 +1,5 @@
#!/usr/bin/env perl
-use lib '/home/zev/bps/Test-Chimps-dbi/lib';
-
use Test::Chimps::Server;
my $server = Test::Chimps::Server->new(base_dir => '/var/www/bps-smokes',
@@ -13,7 +11,7 @@
timestamp => 1,
duration => 1,
osname => 1,
- osver => 1,
+ osvers => 1,
archname => 1
});
Modified: Test-Chimps/branches/dbi/bin/yaml2dbi.pl
==============================================================================
--- Test-Chimps/branches/dbi/bin/yaml2dbi.pl (original)
+++ Test-Chimps/branches/dbi/bin/yaml2dbi.pl Thu Jul 6 15:37:26 2006
@@ -23,7 +23,7 @@
timestamp
duration
osname
- osver
+ osvers
archname
/
);
Modified: Test-Chimps/branches/dbi/lib/Test/Chimps/Client.pm
==============================================================================
--- Test-Chimps/branches/dbi/lib/Test/Chimps/Client.pm (original)
+++ Test-Chimps/branches/dbi/lib/Test/Chimps/Client.pm Thu Jul 6 15:37:26 2006
@@ -7,7 +7,7 @@
use Params::Validate qw/:all/;
use Test::Chimps;
use LWP::UserAgent;
-use YAML::Syck;
+use Storable qw/nfreeze/;
use constant PROTO_VERSION => 0.2;
@@ -67,7 +67,7 @@
=item * server
-Mandatory. The URI of the server script to upload the models to.
+Mandatory. The URI of the server script to upload the model to.
=back
@@ -75,7 +75,7 @@
use base qw/Class::Accessor/;
-__PACKAGE__->mk_ro_accessors(qw/models server compress report_variables/);
+__PACKAGE__->mk_ro_accessors(qw/model server compress report_variables/);
sub new {
my $class = shift;
@@ -123,8 +123,8 @@
$ua->env_proxy;
my %request = (upload => 1, version => PROTO_VERSION,
- model_structure => Dump($self->model->structure),
- report_variables => Dump($self->report_variables));
+ model_structure => nfreeze($self->model->structure),
+ report_variables => nfreeze($self->report_variables));
my $resp = $ua->post($self->server => \%request);
if($resp->is_success) {
Modified: Test-Chimps/branches/dbi/lib/Test/Chimps/Client/Poller.pm
==============================================================================
--- Test-Chimps/branches/dbi/lib/Test/Chimps/Client/Poller.pm (original)
+++ Test-Chimps/branches/dbi/lib/Test/Chimps/Client/Poller.pm Thu Jul 6 15:37:26 2006
@@ -38,7 +38,7 @@
my $poller = Test::Chimps::Client::Poll->new(
server => 'http://www.example.com/cgi-bin/smoke-server.pl',
config_file => '/path/to/configfile.yml'
- )
+
$poller->poll();
@@ -129,12 +129,10 @@
next if $config->{$project}->{dependency_only};
my $info_out = `svn info $config->{$project}->{svn_uri}`;
- $info_out =~ m/Revision: (\d+)/;
+ $info_out =~ m/^Revision: (\d+)/m;
my $latest_revision = $1;
- $info_out =~ m/Last Changed Revision: (\d+)/;
+ $info_out =~ m/^Last Changed Rev: (\d+)/m;
my $last_changed_revision = $1;
- $info_out =~ m/Last Changed Author: (\w+)/;
- my $committer = $1;
my $old_revision = $config->{$project}->{revision};
@@ -143,8 +141,12 @@
foreach my $revision (($old_revision + 1) .. $latest_revision) {
# only actually do the check out if the revision and last changed revision match for
# a particular revision
- next unless _revisions_match($config->{$project}->{svn_uri}, $revision);
-
+ next unless _change_on_revision($config->{$project}->{svn_uri}, $revision);
+
+ $info_out = `svn info -r $revision $config->{$project}->{svn_uri}`;
+ $info_out =~ m/^Last Changed Author: (\w+)/m;
+ my $committer = $1;
+
$config->{$project}->{revision} = $revision;
$self->_checkout_project($config->{$project}, $revision);
@@ -168,8 +170,8 @@
_remove_tmpdir($tmpdir);
}
$self->_checkout_paths([]);
-
- my $report = Test::Chimps::Report->new(model => $model,
+
+ my $client = Test::Chimps::Client->new(model => $model,
report_variables =>
{ project => $project,
revision => $revision,
@@ -177,11 +179,9 @@
timestamp => scalar gmtime,
duration => $duration,
osname => $Config{osname},
- osver => $Config{osver},
+ osvers => $Config{osvers},
archname => $Config{archname}
- });
-
- my $client = Test::Chimps::Client->new(reports => [$report],
+ },
server => $self->server);
my ($status, $msg);
@@ -249,14 +249,14 @@
rmtree($tmpdir, 0, 0);
}
-sub _revisions_match {
+sub _change_on_revision {
my $uri = shift;
my $revision = shift;
my $info_out = `svn info -r $revision $uri`;
- $info_out =~ m/Revision: (\d+)/;
+ $info_out =~ m/^Revision: (\d+)/m;
my $latest_revision = $1;
- $info_out =~ m/Last Changed Revision: (\d+)/;
+ $info_out =~ m/^Last Changed Rev: (\d+)/m;
my $last_changed_revision = $1;
return $latest_revision == $last_changed_revision;
Modified: Test-Chimps/branches/dbi/lib/Test/Chimps/Report.pm
==============================================================================
--- Test-Chimps/branches/dbi/lib/Test/Chimps/Report.pm (original)
+++ Test-Chimps/branches/dbi/lib/Test/Chimps/Report.pm Thu Jul 6 15:37:26 2006
@@ -49,7 +49,8 @@
use Jifty::DBI::Schema;
column report_html => type is 'text';
-column model_structure => type is 'text';
+column model_structure => type is 'text',
+ filters are 'Jifty::DBI::Filter::Storable', 'Jifty::DBI::Filter::base64';
column total_ok => type is 'integer';
column total_passed => type is 'integer';
column total_nok => type is 'integer';
Modified: Test-Chimps/branches/dbi/lib/Test/Chimps/Server.pm
==============================================================================
--- Test-Chimps/branches/dbi/lib/Test/Chimps/Server.pm (original)
+++ Test-Chimps/branches/dbi/lib/Test/Chimps/Server.pm Thu Jul 6 15:37:26 2006
@@ -11,13 +11,15 @@
use CGI::Carp qw<fatalsToBrowser>;
use CGI;
use Digest::MD5 qw<md5_hex>;
+use Fcntl qw<:DEFAULT :flock>;
use File::Basename;
use File::Spec;
-use Fcntl qw<:DEFAULT :flock>;
use Jifty::DBI::Handle;
use Jifty::DBI::SchemaGenerator;
use Params::Validate qw<:all>;
-use Storable qw<store_fd fd_retrieve freeze>;
+use Storable qw<store_fd fd_retrieve nfreeze thaw>;
+use Test::TAP::HTMLMatrix;
+use Test::TAP::Model::Visual;
use YAML::Syck;
use constant PROTO_VERSION => 0.2;
@@ -323,7 +325,7 @@
my $cgi = shift;
if (defined $self->{variables_validation_spec}) {
- my $report_variables = Load($cgi->param('report_variables'));
+ my $report_variables = thaw($cgi->param('report_variables'));
eval {
validate(@{[%$report_variables]}, $self->{variables_validation_spec});
};
@@ -331,7 +333,7 @@
# XXX: doesn't dump subroutines because we're using YAML::Syck
print "This server accepts specific report variables. It's validation ",
"string looks like this:\n", Dump($self->{variables_validation_spec}),
- "\nYour extra data looks like this:\n", $cgi->param('report_variables');
+ "\nYour report variables look like this:\n", $cgi->param('report_variables');
exit;
}
}
@@ -342,25 +344,40 @@
my $cgi = shift;
my $params = {};
- my $report_variables = Load($cgi->param('report_variables'));
- foreach my $var (@{$report_variables}) {
+ my $report_variables = thaw($cgi->param('report_variables'));
+ foreach my $var (keys %{$report_variables}) {
$params->{$var} = $report_variables->{$var};
}
- my $model = Test::TAP::Model::Visual->new_with_struct($cgi->param('model_structure'));
+ my $model = Test::TAP::Model::Visual->new_with_struct(thaw($cgi->param('model_structure')));
+
+ foreach my $var (
+ qw/total_ok
+ total_passed
+ total_nok
+ total_failed
+ total_percentage
+ total_ratio
+ total_seen
+ total_skipped
+ total_todo
+ total_unexpectedly_succeeded/
+ )
+ {
- foreach my $var (qw/total_ok total_failed total_todo
- total_skipped total_unexpectedly_succeeded/) {
$params->{$var} = $model->$var;
}
- $params->{report_html} =
- Test::TAP::HTMLMatrix->new($model,
- $cgi->param('report_variables'));
+ $params->{model_structure} = thaw($cgi->param('model_structure'));
+
+ my $matrix = Test::TAP::HTMLMatrix->new($model,
+ Dump(thaw($cgi->param('report_variables'))));
+ $matrix->has_inline_css(1);
+ $params->{report_html} = $matrix->detail_html;
my $report = Test::Chimps::Report->new(handle => $self->handle);
- $report->create($params) or croak "Couldn't add report to database: $!\n";
+ $report->create(%$params) or croak "Couldn't add report to database: $!\n";
}
sub _process_detail {
More information about the Rt-commit
mailing list