[Bps-public-commit] r13544 - in Test-Chimps-Client/trunk: lib/Test/Chimps
alexmv at bestpractical.com
alexmv at bestpractical.com
Mon Jun 23 17:21:21 EDT 2008
Author: alexmv
Date: Mon Jun 23 17:21:20 2008
New Revision: 13544
Modified:
Test-Chimps-Client/trunk/ (props changed)
Test-Chimps-Client/trunk/lib/Test/Chimps/Smoker.pm
Log:
r33413 at kohr-ah: chmrr | 2008-06-23 17:21:13 -0400
* A very-hackish and entirely Pg-specific hack to ensure we don't
build up extra databases between test runs. Pg gets _very_ sad if
there are several thousand extra databases sitting around.
* Add a 'libs' config option
* Remove 10 minute 'alarm' -- many testsuites easily pass it.
Modified: Test-Chimps-Client/trunk/lib/Test/Chimps/Smoker.pm
==============================================================================
--- Test-Chimps-Client/trunk/lib/Test/Chimps/Smoker.pm (original)
+++ Test-Chimps-Client/trunk/lib/Test/Chimps/Smoker.pm Mon Jun 23 17:21:20 2008
@@ -12,6 +12,8 @@
use Test::TAP::Model::Visual;
use YAML::Syck;
+use DBI;
+
=head1 NAME
Test::Chimps::Smoker - Poll a set of SVN repositories and run tests when they change
@@ -148,16 +150,11 @@
$self->_checkout_project($config->{$project}, $revision);
my $model;
- {
- local $SIG{ALRM} = sub { die "10 minute timeout exceeded" };
- alarm 600;
- print "running tests for $project\n";
- my $test_glob = $config->{$project}->{test_glob} || 't/*.t t/*/t/*.t';
- eval {
- $model = Test::TAP::Model::Visual->new_with_tests(glob($test_glob));
- };
- alarm 0; # cancel alarm
- }
+ print "running tests for $project\n";
+ my $test_glob = $config->{$project}->{test_glob} || 't/*.t t/*/t/*.t';
+ eval {
+ $model = Test::TAP::Model::Visual->new_with_tests(glob($test_glob));
+ };
if ($@) {
print "Tests aborted: $@\n";
@@ -180,6 +177,8 @@
}
$self->_checkout_paths([]);
+ $self->_clean_dbs;
+
my $client = Test::Chimps::Client->new(
model => $model,
report_variables => {
@@ -198,6 +197,7 @@
if ($self->simulate) {
$status = 1;
} else {
+ print "Sending smoke report for @{[$self->server]}\n";
($status, $msg) = $client->send;
}
@@ -343,7 +343,10 @@
}
$ENV{PERL5LIB} = $old_perl5lib;
- for my $libloc (qw{blib/lib}) {
+ my @libs = qw{blib/lib};
+ push @libs, @{$project->{libs}} if $project->{libs};
+
+ for my $libloc (@libs) {
my $libdir = File::Spec->catdir($tmpdir,
$project->{root_dir},
$libloc);
@@ -356,6 +359,18 @@
return $projectdir;
}
+sub _clean_dbs {
+ my %skip = map {$_ => 1} (qw/postgres template0 template1 smoke jifty jiftydbitestdb/);
+
+ $ENV{DBI_USER} = "postgres";
+ my @dbs = grep {not $skip{$_}}
+ map {s/.*dbname=(.*)/$1/; $_}
+ DBI->data_sources("Pg");
+
+ my $dbh = DBI->connect("dbi:Pg:dbname=template1","postgres","",{RaiseError => 1});
+ $dbh->do("DROP DATABASE $_") for @dbs;
+}
+
sub _remove_tmpdir {
my $tmpdir = shift;
print "removing temporary directory $tmpdir\n";
@@ -505,7 +520,13 @@
How to find all your tests, defaults to
t/*.t t/*/t/*.t
-"
+
+=item * libs
+
+A list of paths, relative to the project root, which should be added
+to @INC. C<blib/lib> is automatically added, but you may need to
+include C<lib> here, for instance.
+
=back
=head1 REPORT VARIABLES
More information about the Bps-public-commit
mailing list