[Bps-public-commit] Test-Chimps-Client branch, master, updated. f749d3d1f8ac4cac743e4fb78d26ae8d91bb7ffd

Alex M Vandiver alexmv at bestpractical.com
Fri Dec 4 21:35:35 EST 2009


The branch, master has been updated
       via  f749d3d1f8ac4cac743e4fb78d26ae8d91bb7ffd (commit)
       via  c76deef0377b4bfd5742d41bf1f1722cd09918a6 (commit)
       via  fece68aa2a9ad9a4d07426b3b13ed3885d639fb3 (commit)
       via  ab07f41a10849950392367053a4e1c6174bb06d8 (commit)
       via  96dbb782fce2be1975e6a5ba27a80451a4ee24d4 (commit)
       via  b7e93528c9a1fc8d376fba572b13deae08390ab7 (commit)
       via  8cc566df8f37b5f7902e72572f1590ace96979bb (commit)
       via  b3da542af616d4b5210388454f6e912e14c58df9 (commit)
       via  f299d9d3fb973ceb3b22b9e363a7d0227dff674c (commit)
       via  8e619fafa592f7bb250c5b1c5b0631f4ced4dbd4 (commit)
       via  0f1ba31a248ddf05339117092301943e7b109c0b (commit)
      from  f07525667224ac6d773ad637acc24d5eaab369ef (commit)

Summary of changes:
 lib/Test/Chimps/Smoker.pm        |  263 +++-----------------------------------
 lib/Test/Chimps/Smoker/Git.pm    |   12 +-
 lib/Test/Chimps/Smoker/SVN.pm    |   22 ++--
 lib/Test/Chimps/Smoker/Source.pm |  249 +++++++++++++++++++++++++++++++++++-
 4 files changed, 282 insertions(+), 264 deletions(-)

- Log -----------------------------------------------------------------
commit 0f1ba31a248ddf05339117092301943e7b109c0b
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Dec 4 17:40:54 2009 -0500

    Remove deprecated "simulate" support

diff --git a/lib/Test/Chimps/Smoker.pm b/lib/Test/Chimps/Smoker.pm
index 7260acf..033413a 100644
--- a/lib/Test/Chimps/Smoker.pm
+++ b/lib/Test/Chimps/Smoker.pm
@@ -71,20 +71,12 @@ Defaults to simulation mode when reports are sent.
 Optional.  Number of seconds to sleep between repository checks.
 Defaults to 60 seconds.
 
-=item * simulate [DEPRECATED]
-
-[DEPRECATED] Just don't provide server option to enable simulation.
-
-Don't actually submit the smoke reports, just run the tests.  This
-I<does>, however, increment the revision numbers in the config
-file.
-
 =back
 
 =cut
 
 use base qw/Class::Accessor/;
-__PACKAGE__->mk_ro_accessors(qw/server config_file simulate sleep/);
+__PACKAGE__->mk_ro_accessors(qw/server config_file sleep/);
 __PACKAGE__->mk_accessors(
     qw/_env_stack meta config projects iterations/);
 
@@ -106,7 +98,6 @@ sub _init {
         spec   => {
             config_file => 1,
             server      => 0,
-            simulate    => 0,
             iterations  => {
                 optional => 1,
                 default  => 'inf'
@@ -135,9 +126,6 @@ sub _init {
         $self->{$key} = $args{$key};
     }
 
-    # support simulate for a while
-    delete $self->{'server'} if $args{'simulate'};
-
     # make it absolute so we can update it later from any dir we're in
     $self->{'config_file'} = abs_path($self->{'config_file'});
 

commit 8e619fafa592f7bb250c5b1c5b0631f4ced4dbd4
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Dec 4 17:51:19 2009 -0500

    Document jobs => parameter

diff --git a/lib/Test/Chimps/Smoker.pm b/lib/Test/Chimps/Smoker.pm
index 033413a..59bbebf 100644
--- a/lib/Test/Chimps/Smoker.pm
+++ b/lib/Test/Chimps/Smoker.pm
@@ -71,6 +71,10 @@ Defaults to simulation mode when reports are sent.
 Optional.  Number of seconds to sleep between repository checks.
 Defaults to 60 seconds.
 
+=item * jobs
+
+Optional.  Number of test jobs to run in parallel.  Defaults to 1.
+
 =back
 
 =cut

commit f299d9d3fb973ceb3b22b9e363a7d0227dff674c
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Dec 4 20:58:57 2009 -0500

    Add ->jobs accessor for smoker

diff --git a/lib/Test/Chimps/Smoker.pm b/lib/Test/Chimps/Smoker.pm
index 59bbebf..947825e 100644
--- a/lib/Test/Chimps/Smoker.pm
+++ b/lib/Test/Chimps/Smoker.pm
@@ -80,7 +80,7 @@ Optional.  Number of test jobs to run in parallel.  Defaults to 1.
 =cut
 
 use base qw/Class::Accessor/;
-__PACKAGE__->mk_ro_accessors(qw/server config_file sleep/);
+__PACKAGE__->mk_ro_accessors(qw/server config_file sleep jobs/);
 __PACKAGE__->mk_accessors(
     qw/_env_stack meta config projects iterations/);
 

commit b3da542af616d4b5210388454f6e912e14c58df9
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Dec 4 20:34:09 2009 -0500

    Document jobs key in config

diff --git a/lib/Test/Chimps/Smoker.pm b/lib/Test/Chimps/Smoker.pm
index 947825e..5d42cdf 100644
--- a/lib/Test/Chimps/Smoker.pm
+++ b/lib/Test/Chimps/Smoker.pm
@@ -669,6 +669,11 @@ be read from STDIN.
 
 An example you can find in a tarball of this distribution - F<examples/pg_dbs_cleaner.pl>.
 
+=item * jobs
+
+The number of parallel test processes to run.  If not specified, uses
+the value set on the smoker.
+
 =back
 
 =head1 REPORT VARIABLES

commit 8cc566df8f37b5f7902e72572f1590ace96979bb
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Dec 4 17:51:45 2009 -0500

    Remove unused iterations and projects arguments to constructor

diff --git a/lib/Test/Chimps/Smoker.pm b/lib/Test/Chimps/Smoker.pm
index 5d42cdf..930c8a1 100644
--- a/lib/Test/Chimps/Smoker.pm
+++ b/lib/Test/Chimps/Smoker.pm
@@ -82,7 +82,7 @@ Optional.  Number of test jobs to run in parallel.  Defaults to 1.
 use base qw/Class::Accessor/;
 __PACKAGE__->mk_ro_accessors(qw/server config_file sleep jobs/);
 __PACKAGE__->mk_accessors(
-    qw/_env_stack meta config projects iterations/);
+    qw/_env_stack meta config/);
 
 # add a signal handler so destructor gets run
 $SIG{INT} = sub {print "caught sigint.  cleaning up...\n"; exit(1)};
@@ -102,14 +102,6 @@ sub _init {
         spec   => {
             config_file => 1,
             server      => 0,
-            iterations  => {
-                optional => 1,
-                default  => 'inf'
-              },
-            projects => {
-                optional => 1,
-                default  => 'all'
-              },
             jobs => {
                 optional => 1,
                 type     => SCALAR,

commit b7e93528c9a1fc8d376fba572b13deae08390ab7
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Dec 4 20:36:18 2009 -0500

    Move much of the functionality for individual sources into Test::Chimps::Smoker::Source
    
    This also takes the keys of the configuration hash, and moves them to
    be accessors on the source object.

diff --git a/lib/Test/Chimps/Smoker.pm b/lib/Test/Chimps/Smoker.pm
index 930c8a1..9e0c52f 100644
--- a/lib/Test/Chimps/Smoker.pm
+++ b/lib/Test/Chimps/Smoker.pm
@@ -5,8 +5,6 @@ use strict;
 
 use Config;
 use Cwd qw(abs_path);
-use File::Path;
-use File::Temp qw/tempdir/;
 use Params::Validate qw/:all/;
 use Test::Chimps::Smoker::Source;
 use Test::Chimps::Client;
@@ -82,7 +80,7 @@ Optional.  Number of test jobs to run in parallel.  Defaults to 1.
 use base qw/Class::Accessor/;
 __PACKAGE__->mk_ro_accessors(qw/server config_file sleep jobs/);
 __PACKAGE__->mk_accessors(
-    qw/_env_stack meta config/);
+    qw/_env_stack sources config/);
 
 # add a signal handler so destructor gets run
 $SIG{INT} = sub {print "caught sigint.  cleaning up...\n"; exit(1)};
@@ -126,7 +124,7 @@ sub _init {
     $self->{'config_file'} = abs_path($self->{'config_file'});
 
     $self->_env_stack([]);
-    $self->meta({});
+    $self->sources({});
 
     $self->load_config;
 }
@@ -237,17 +235,17 @@ sub _smoke_once {
     my $self = shift;
     my $project = shift;
 
-    my $config = $self->config->{$project};
-    return 1 if $config->{dependency_only};
+    my $source = $self->source($project);
+    return 1 if $source->dependency_only;
 
-    $self->_clone_project( $config );
+    $source->do_clone;
 
-    my %next = $self->source($project)->next( $config->{revision} );
+    my %next = $source->next;
     return 0 unless keys %next;
 
     my $revision = $next{'revision'};
 
-    my @libs = $self->_checkout_project($config, $revision);
+    my @libs = $source->do_checkout($revision);
     unless (@libs) {
         print "Skipping report for $project revision $revision due to build failure\n";
         $self->update_revision_in_config( $project => $revision );
@@ -255,7 +253,7 @@ sub _smoke_once {
     }
 
     print "running tests for $project\n";
-    my $test_glob = $config->{test_glob} || 't/*.t t/*/t/*.t';
+    my $test_glob = $source->test_glob;
     my $tmpfile = File::Temp->new( SUFFIX => ".tar.gz" );
     my $harness = TAP::Harness::Archive->new( {
             archive          => $tmpfile,
@@ -268,7 +266,7 @@ sub _smoke_once {
                 osvers    => $Config{osvers},
                 archname  => $Config{archname},
               },
-            jobs => ($config->{jobs} || $self->{jobs}),
+            jobs => ($source->jobs || $self->jobs),
             lib => \@libs,
         } );
     {
@@ -278,7 +276,7 @@ sub _smoke_once {
         $harness->runtests(glob($test_glob));
     }
 
-    $self->_clean_project( $config );
+    $source->do_clean;
 
     $self->_unroll_env_stack;
 
@@ -332,132 +330,19 @@ sub update_revision_in_config {
 
     my $tmp = LoadFile($self->config_file);
     $tmp->{$project}->{revision} = $self->config->{$project}->{revision} = $revision;
+    $self->source($project)->revision($revision);
     DumpFile($self->config_file, $tmp);
 }
 
 sub source {
     my $self = shift;
     my $project = shift;
-    $self->meta->{$project}{'source'} ||= Test::Chimps::Smoker::Source->new(
+    $self->sources->{$project} ||= Test::Chimps::Smoker::Source->new(
             %{ $self->config->{$project}{'repository'} },
             config => $self->config->{$project},
             smoker => $self,
         );
-    return $self->meta->{$project}{'source'};
-}
-
-sub _clone_project {
-    my $self = shift;
-    my $project = shift;
-
-    my $source = $self->source( $project->{'name'} );
-    if ( $source->cloned ) {
-        $source->chdir;
-        return 1;
-    }
-
-    my $tmpdir = tempdir("chimps-XXXXXXX", TMPDIR => 1);
-    $source->directory( $tmpdir );
-    $source->chdir;
-    $source->clone;
-
-    $source->cloned(1);
-
-    return 1;
-}
-
-sub _checkout_project {
-    my $self = shift;
-    my $project = shift;
-    my $revision = shift;
-
-    my $source = $self->source( $project->{'name'} );
-    $source->chdir;
-    $source->checkout( revision => $revision );
-
-    my $projectdir = File::Spec->catdir($source->directory, $project->{root_dir});
-
-    my @libs = map File::Spec->catdir($projectdir, $_),
-      'blib/lib', @{ $project->{libs} || [] };
-    $self->meta->{ $project->{'name'} }{'libs'} = [@libs];
-
-    my @otherlibs;
-    if (defined $project->{dependencies}) {
-        foreach my $dep (@{$project->{dependencies}}) {
-            print "processing dependency $dep\n";
-            my $config = $self->config->{ $dep };
-            $self->_clone_project( $config );
-            my @deplibs = $self->_checkout_project( $config );
-            if (@deplibs) {
-                push @otherlibs, @deplibs;
-            } else {
-                print "Dependency $dep failed; aborting";
-                return ();
-            }
-        }
-    }
-
-    $self->_push_onto_env_stack({
-        $project->{env}? (%{$project->{env}}) : (),
-        'CHIMPS_'. uc($project->{'name'}) .'_ROOT' => $projectdir,
-    });
-
-    my %seen;
-    @libs = grep {not $seen{$_}++} @libs, @otherlibs;
-
-    $source->chdir($project->{root_dir});
-
-    local $ENV{PERL5LIB} = join(":", at libs,$ENV{PERL5LIB});
-
-    if (defined( my $cmd = $project->{'configure_cmd'} )) {
-        my $ret = system($cmd);
-        if ($ret) {
-            print STDERR "Return value of $cmd from $projectdir = $ret\n"
-                if $ret;
-            return ();
-        }
-    }
-
-    if (defined( my $cmd = $project->{'clean_cmd'} )) {
-        print "Going to run project cleaner '$cmd'\n";
-        my @args = (
-            '--project', $project->{'name'},
-            '--config', $self->config_file,
-        );
-        open my $fh, '-|', join(' ', $cmd, @args)
-            or die "Couldn't run `". join(' ', $cmd, @args) ."`: $!";
-        $self->meta->{ $project->{'name'} }->{'cleaner'} = do { local $/; <$fh> };
-        close $fh;
-    }
-    return @libs;
-}
-
-sub _clean_project {
-    my $self = shift;
-    my $project = shift;
-
-    my $source = $self->source( $project->{'name'} );
-    $source->chdir;
-
-    if (defined( my $cmd = $project->{'clean_cmd'} )) {
-        my @args = (
-            '--project', $project->{'name'},
-            '--config', $self->config_file,
-            '--clean',
-        );
-        open my $fh, '|-', join(' ', $cmd, @args)
-            or die "Couldn't run `". join(' ', $cmd, @args) ."`: $!";
-        print $fh $self->meta->{ $project->{'name'} }->{'cleaner'};
-        close $fh;
-    }
-
-    $source->clean;
-
-    if (defined $project->{dependencies}) {
-        foreach my $dep (@{$project->{dependencies}}) {
-            $self->_clean_project( $self->config->{ $dep } );
-        }
-    }
+    return $self->sources->{$project};
 }
 
 sub _push_onto_env_stack {
@@ -515,26 +400,7 @@ sub _unroll_env_stack {
 
 sub DESTROY {
     my $self = shift;
-    $self->remove_checkouts;
-}
-
-sub remove_checkouts {
-    my $self = shift;
-
-    my $meta = $self->meta;
-    foreach my $source ( grep $_, map $_->{'source'}, values %$meta ) {
-        next unless my $dir = $source->directory;
-
-        _remove_tmpdir($dir);
-        $source->directory(undef);
-        $source->cloned(0);
-    }
-}
-
-sub _remove_tmpdir {
-    my $tmpdir = shift;
-    print "removing temporary directory $tmpdir\n";
-    rmtree($tmpdir, 0, 0);
+    $_->remove_checkout for grep defined, values %{ $self->sources };
 }
 
 =head1 ACCESSORS
diff --git a/lib/Test/Chimps/Smoker/Git.pm b/lib/Test/Chimps/Smoker/Git.pm
index 94592e8..af31bc0 100644
--- a/lib/Test/Chimps/Smoker/Git.pm
+++ b/lib/Test/Chimps/Smoker/Git.pm
@@ -53,11 +53,11 @@ sub clone {
 # XXX: git 1.5 can not clone into dir that already exists, so we delete dir
 # and clone then
     my $dir = $self->directory;
-    chdir '..' or die "Couldn't change dir to parent of $dir: $!";
+    chdir "$dir/.." or die "Couldn't change dir to parent of $dir: $!";
     rmdir $dir
         or die "Couldn't remove '$dir' that should be empty tmp dir created for clone: $!";
     $self->run_cmd( qw(clone), $self->uri, $dir );
-    chdir $dir or die "Couldn't change dir to $dir: $!";
+    $self->chdir;
 
     # execute this manually since Chimps will die if system
     # doesn't return 0 and we're actually expecting this to 
@@ -88,7 +88,7 @@ sub checkout {
 sub next {
     my $self = shift;
 
-    my $current = $self->config->{revision};
+    my $current = $self->revision;
 
     my $revision = $self->revision_after( $current );
     unless ( $revision ) {
diff --git a/lib/Test/Chimps/Smoker/SVN.pm b/lib/Test/Chimps/Smoker/SVN.pm
index 4de6f65..7d3ba44 100644
--- a/lib/Test/Chimps/Smoker/SVN.pm
+++ b/lib/Test/Chimps/Smoker/SVN.pm
@@ -60,7 +60,7 @@ sub clean {
 sub next {
     my $self = shift;
 
-    my $revision = $self->config->{revision};
+    my $revision = $self->revision;
     my $cmd = "svn log --limit 1 -q -r ". ($revision+1) .":HEAD ". $self->uri;
     my ($next, $committer, $committed_date) = (`$cmd` =~
             m/^r([0-9]+)\s+\|\s*(.*?)\s*\|\s*([^(]*)/m);
diff --git a/lib/Test/Chimps/Smoker/Source.pm b/lib/Test/Chimps/Smoker/Source.pm
index 45d913d..4777bd2 100644
--- a/lib/Test/Chimps/Smoker/Source.pm
+++ b/lib/Test/Chimps/Smoker/Source.pm
@@ -4,9 +4,27 @@ use strict;
 use warnings;
 use base qw/Class::Accessor/;
 use Scalar::Util qw(weaken);
+use Params::Validate qw/:all/;
+use File::Temp qw/tempdir/;
+use File::Path;
 
-__PACKAGE__->mk_ro_accessors(qw/config smoker/);
-__PACKAGE__->mk_accessors(qw/directory cloned/);
+__PACKAGE__->mk_ro_accessors(qw/smoker/);
+__PACKAGE__->mk_ro_accessors(
+    qw/
+        name
+        configure_cmd
+        root_dir
+        repository
+        env
+        dependencies
+        dependency_only
+        test_glob
+        libs
+        clean_cmd
+        jobs
+        /
+);
+__PACKAGE__->mk_accessors(qw/revision directory cloned cleaner/);
 
 sub new {
     my $proto = shift;
@@ -18,12 +36,147 @@ sub new {
 
     eval "require $class; 1" or die "Couldn't load $class: $@";
 
+    my $config = delete $args{config};
     my $obj = bless { %args }, $class;
     weaken $obj->{'smoker'};
-    return $obj->_init;
+    return $obj->_init( %{$config} );
 }
 
-sub _init { return $_[0] }
+sub _init {
+    my $self = shift;
+    my %args = validate_with(
+        params => \@_,
+        called => 'The Test::Chimps::Smoker::Source constructor',
+        spec   => {
+            name            => 1,
+            configure_cmd   => 0,
+            revision        => 0,
+            root_dir        => { default => "." },
+            repository      => 1,
+            env             => { type => HASHREF, default => {} },
+            dependencies    => { type => ARRAYREF, default => [] },
+            dependency_only => 0,
+            test_glob => { default => 't/*.t t/*/t/*.t' },
+            libs      => { type    => ARRAYREF, default => [] },
+            clean_cmd => 0,
+            jobs      => 0,
+        }
+    );
+    $self->{$_} = $args{$_} for keys %args;
+    return $self;
+}
+
+sub do_clone {
+    my $self = shift;
+    if ( $self->cloned ) {
+        $self->chdir;
+        return 1;
+    }
+
+    my $tmpdir = tempdir("chimps-@{[$self->name]}-XXXX", TMPDIR => 1);
+    $self->directory( $tmpdir );
+    $self->chdir;
+    $self->clone;
+
+    $self->cloned(1);
+
+    return 1;
+}
+
+sub do_checkout {
+    my $self = shift;
+    my $revision = shift;
+
+    $self->chdir;
+    $self->checkout( revision => $revision );
+
+    my $projectdir = File::Spec->catdir($self->directory, $self->root_dir);
+
+    my @libs = map File::Spec->catdir($projectdir, $_),
+      'blib/lib', @{ $self->libs };
+
+    my @otherlibs;
+    foreach my $dep (@{$self->dependencies}) {
+        print "processing dependency $dep\n";
+        my $other = $self->smoker->source($dep);
+        $other->do_clone;
+        my @deplibs = $other->do_checkout;
+        if (@deplibs) {
+            push @otherlibs, @deplibs;
+        } else {
+            print "Dependency $dep failed; aborting";
+            return ();
+        }
+    }
+
+    $self->smoker->_push_onto_env_stack({
+        %{$self->env},
+        'CHIMPS_'. uc($self->name) .'_ROOT' => $projectdir,
+    });
+
+    my %seen;
+    @libs = grep {not $seen{$_}++} @libs, @otherlibs;
+
+    $self->chdir($self->root_dir);
+
+    local $ENV{PERL5LIB} = join(":", at libs,$ENV{PERL5LIB});
+
+    if (defined( my $cmd = $self->configure_cmd )) {
+        my $ret = system($cmd);
+        if ($ret) {
+            print STDERR "Return value of $cmd from $projectdir = $ret\n"
+                if $ret;
+            return ();
+        }
+    }
+
+    if (defined( my $cmd = $self->clean_cmd )) {
+        print "Going to run project cleaner '$cmd'\n";
+        my @args = (
+            '--project', $self->name,
+            '--config', $self->smoker->config_file,
+        );
+        open my $fh, '-|', join(' ', $cmd, @args)
+            or die "Couldn't run `". join(' ', $cmd, @args) ."`: $!";
+        $self->cleaner( do { local $/; <$fh> } );
+        close $fh;
+    }
+    return @libs;
+}
+
+sub do_clean {
+    my $self = shift;
+    $self->chdir;
+
+    if (defined( my $cmd = $self->clean_cmd )) {
+        my @args = (
+            '--project', $self->name,
+            '--config', $self->smoker->config_file,
+            '--clean',
+        );
+        open my $fh, '|-', join(' ', $cmd, @args)
+            or die "Couldn't run `". join(' ', $cmd, @args) ."`: $!";
+        print $fh $self->cleaner;
+        close $fh;
+    }
+
+    $self->clean;
+
+    foreach my $dep (@{$self->dependencies}) {
+        $self->smoker->source( $dep )->do_clean;
+    }
+}
+
+sub remove_checkout {
+    my $self = shift;
+    return unless $self->cloned;
+
+    my $dir = $self->directory;
+    print "removing temporary directory $dir\n";
+    rmtree($dir, 0, 0);
+    $self->directory(undef);
+    $self->cloned(0);
+}
 
 sub clone { return 1 }
 sub checkout { return 1 }

commit 96dbb782fce2be1975e6a5ba27a80451a4ee24d4
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Dec 4 21:33:52 2009 -0500

    Move per-project configuration docs to Test::Chimps::Smoker::Source

diff --git a/lib/Test/Chimps/Smoker.pm b/lib/Test/Chimps/Smoker.pm
index 9e0c52f..b349c33 100644
--- a/lib/Test/Chimps/Smoker.pm
+++ b/lib/Test/Chimps/Smoker.pm
@@ -450,89 +450,7 @@ look like this:
         type: SVN
         uri: svn+ssh://svn.jifty.org/svn/jifty.org/Jifty-DBI
 
-The supported project options are as follows:
-
-=over 4
-
-=item * configure_cmd
-
-The command to configure the project after checkout, but before
-running tests.
-
-=item * revision
-
-This is the last revision known for a given project.  When started,
-the poller will attempt to checkout and test all revisions (besides
-ones on which the directory did not change) between this one and
-HEAD.  When a test has been successfully uploaded, the revision
-number is updated and the configuration file is re-written.
-
-=item * root_dir
-
-The subdirectory inside the repository where configuration and
-testing commands should be run.
-
-=item * repository
-
-A hash describing repository of the project. Mandatory key is
-type which must match a source class name, for example SVN or
-Git. Particular source class may have more options, but at this
-moment Git and SVN have only 'uri' option.
-
-=item * env
-
-A hash of environment variable names and values that are set before
-configuration, and reverted to their previous values after the
-tests have been run.  In addition, if environment variable FOO's
-new value contains the string "$FOO", then the old value of FOO
-will be substituted in when setting the environment variable.
-
-Special environment variables are set in addition to described
-above. For each project CHIMPS_<project name>_ROOT is set pointing
-to the current checkout of the project.
-
-=item * dependencies
-
-A list of project names that are dependencies for the given
-project.  All dependencies are checked out at HEAD, have their
-configuration commands run, and all dependencys' $root_dir/blib/lib
-directories are added to @INC before the configuration command for
-the project is run.
-
-=item * dependency_only
-
-Indicates that this project should not be tested.  It is only
-present to serve as a dependency for another project.
-
-=item * test_glob
-
-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.
-
-=item * clean_cmd
-
-The command to clean before or after each iteration of the project testing.
-Called B<twice> before running tests and after with --config, --project
-arguments and --clean argument when called for the second time after testing.
-
-When called before testing (without --clean), state information can be printed
-to STDOUT. Later when called after testing (with --clean), the state info can
-be read from STDIN.
-
-An example you can find in a tarball of this distribution - F<examples/pg_dbs_cleaner.pl>.
-
-=item * jobs
-
-The number of parallel test processes to run.  If not specified, uses
-the value set on the smoker.
-
-=back
+See L<Test::Chimps::Smoker::Source> for a list of project options.
 
 =head1 REPORT VARIABLES
 
diff --git a/lib/Test/Chimps/Smoker/Source.pm b/lib/Test/Chimps/Smoker/Source.pm
index 4777bd2..4dd7697 100644
--- a/lib/Test/Chimps/Smoker/Source.pm
+++ b/lib/Test/Chimps/Smoker/Source.pm
@@ -203,4 +203,92 @@ sub chdir {
         or die "Couldn't change dir to '$dir': $!";
 }
 
+
+=head2 OPTIONS
+
+The following configuration options can be set on a per-projet basis,
+and have accessors on the object:
+
+=over 4
+
+=item * configure_cmd
+
+The command to configure the project after checkout, but before
+running tests.
+
+=item * revision
+
+This is the last revision known for a given project.  When started,
+the poller will attempt to checkout and test all revisions (besides
+ones on which the directory did not change) between this one and
+HEAD.  When a test has been successfully uploaded, the revision
+number is updated and the configuration file is re-written.
+
+=item * root_dir
+
+The subdirectory inside the repository where configuration and
+testing commands should be run.
+
+=item * repository
+
+A hash describing repository of the project. Mandatory key is
+type which must match a source class name, for example SVN or
+Git. Particular source class may have more options, but at this
+moment Git and SVN have only 'uri' option.
+
+=item * env
+
+A hash of environment variable names and values that are set before
+configuration, and reverted to their previous values after the
+tests have been run.  In addition, if environment variable FOO's
+new value contains the string "$FOO", then the old value of FOO
+will be substituted in when setting the environment variable.
+
+Special environment variables are set in addition to described
+above. For each project CHIMPS_<project name>_ROOT is set pointing
+to the current checkout of the project.
+
+=item * dependencies
+
+A list of project names that are dependencies for the given
+project.  All dependencies are checked out at HEAD, have their
+configuration commands run, and all dependencys' $root_dir/blib/lib
+directories are added to @INC before the configuration command for
+the project is run.
+
+=item * dependency_only
+
+Indicates that this project should not be tested.  It is only
+present to serve as a dependency for another project.
+
+=item * test_glob
+
+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.
+
+=item * clean_cmd
+
+The command to clean before or after each iteration of the project testing.
+Called B<twice> before running tests and after with --config, --project
+arguments and --clean argument when called for the second time after testing.
+
+When called before testing (without --clean), state information can be printed
+to STDOUT. Later when called after testing (with --clean), the state info can
+be read from STDIN.
+
+An example you can find in a tarball of this distribution - F<examples/pg_dbs_cleaner.pl>.
+
+=item * jobs
+
+The number of parallel test processes to run.  If not specified, uses
+the value set on the smoker.
+
+=cut
+
 1;

commit ab07f41a10849950392367053a4e1c6174bb06d8
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Dec 4 20:59:59 2009 -0500

    File::Path provides rmtree, not remote_tree

diff --git a/lib/Test/Chimps/Smoker/SVN.pm b/lib/Test/Chimps/Smoker/SVN.pm
index 7d3ba44..e8e0551 100644
--- a/lib/Test/Chimps/Smoker/SVN.pm
+++ b/lib/Test/Chimps/Smoker/SVN.pm
@@ -5,7 +5,7 @@ use warnings;
 use base qw(Test::Chimps::Smoker::Source);
 __PACKAGE__->mk_ro_accessors(qw/uri/);
 
-use File::Path qw(remove_tree);
+use File::Path qw(rmtree);
 
 sub revision_info {
     my $self = shift;
@@ -53,7 +53,7 @@ sub clean {
         or die "Can't call program `svn status .`: $!";
     while ( my $s = <$status_fh> ) {
         next unless my ($path) = ($s =~ /^\?\s*(.*)$/);
-        remove_tree( File::Spec->catdir($self->directory, $path) );
+        rmtree( File::Spec->catdir($self->directory, $path) );
     }
 }
 

commit fece68aa2a9ad9a4d07426b3b13ed3885d639fb3
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Dec 4 21:02:45 2009 -0500

    Split clone and checkout for svn

diff --git a/lib/Test/Chimps/Smoker/SVN.pm b/lib/Test/Chimps/Smoker/SVN.pm
index e8e0551..e10d6e1 100644
--- a/lib/Test/Chimps/Smoker/SVN.pm
+++ b/lib/Test/Chimps/Smoker/SVN.pm
@@ -33,16 +33,17 @@ sub committed_date {
     return ($self->revision_info( @_ ))[3];
 }
 
+sub clone {
+    my $self = shift;
+
+    $self->run_cmd("checkout", "-r", $self->revision, $self->uri, $self->directory);
+}
+
 sub checkout {
     my $self = shift;
     my %args = @_;
 
-    unless ( -e '.svn' ) {
-        $self->run_cmd("checkout", "-r", ($args{'revision'} || 'HEAD'), $self->uri, $self->directory);
-    }
-    else {
-        $self->run_cmd("update", "-r", ($args{'revision'} || 'HEAD'), $self->directory);
-    }
+    $self->run_cmd("update", "-r", ($args{'revision'} || 'HEAD'), $self->directory);
 }
 
 sub clean {

commit c76deef0377b4bfd5742d41bf1f1722cd09918a6
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Dec 4 21:03:34 2009 -0500

    If revision isn't set, assume we've smoked all but HEAD

diff --git a/lib/Test/Chimps/Smoker/Git.pm b/lib/Test/Chimps/Smoker/Git.pm
index af31bc0..0a0a276 100644
--- a/lib/Test/Chimps/Smoker/Git.pm
+++ b/lib/Test/Chimps/Smoker/Git.pm
@@ -69,6 +69,8 @@ sub clone {
         $self->run_cmd( 'checkout', '-t', '-b', $self->branch, 'origin/'.$self->branch );
     }
 
+    $self->revision($self->branch . "^") unless $self->revision;
+
     return 1;
 }
 
diff --git a/lib/Test/Chimps/Smoker/SVN.pm b/lib/Test/Chimps/Smoker/SVN.pm
index e10d6e1..f82ec96 100644
--- a/lib/Test/Chimps/Smoker/SVN.pm
+++ b/lib/Test/Chimps/Smoker/SVN.pm
@@ -36,6 +36,7 @@ sub committed_date {
 sub clone {
     my $self = shift;
 
+    $self->revision( ($self->revision_info)[0] - 1 ) unless $self->revision;
     $self->run_cmd("checkout", "-r", $self->revision, $self->uri, $self->directory);
 }
 

commit f749d3d1f8ac4cac743e4fb78d26ae8d91bb7ffd
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Dec 4 21:03:55 2009 -0500

    For consistency, pass a single value, not a paramhash

diff --git a/lib/Test/Chimps/Smoker/Git.pm b/lib/Test/Chimps/Smoker/Git.pm
index 0a0a276..9c2fb3b 100644
--- a/lib/Test/Chimps/Smoker/Git.pm
+++ b/lib/Test/Chimps/Smoker/Git.pm
@@ -82,9 +82,9 @@ sub clean {
 
 sub checkout {
     my $self = shift;
-    my %args = @_;
+    my $revision = shift;
 
-    $self->run_cmd(qw(checkout), ($args{'revision'} || $self->branch));
+    $self->run_cmd(qw(checkout), $revision || $self->branch);
 }
 
 sub next {
diff --git a/lib/Test/Chimps/Smoker/SVN.pm b/lib/Test/Chimps/Smoker/SVN.pm
index f82ec96..6d0f3e1 100644
--- a/lib/Test/Chimps/Smoker/SVN.pm
+++ b/lib/Test/Chimps/Smoker/SVN.pm
@@ -42,9 +42,9 @@ sub clone {
 
 sub checkout {
     my $self = shift;
-    my %args = @_;
+    my $revision = shift;
 
-    $self->run_cmd("update", "-r", ($args{'revision'} || 'HEAD'), $self->directory);
+    $self->run_cmd("update", "-r", ($revision || 'HEAD'), $self->directory);
 }
 
 sub clean {
diff --git a/lib/Test/Chimps/Smoker/Source.pm b/lib/Test/Chimps/Smoker/Source.pm
index 4dd7697..7368db5 100644
--- a/lib/Test/Chimps/Smoker/Source.pm
+++ b/lib/Test/Chimps/Smoker/Source.pm
@@ -88,7 +88,7 @@ sub do_checkout {
     my $revision = shift;
 
     $self->chdir;
-    $self->checkout( revision => $revision );
+    $self->checkout( $revision );
 
     my $projectdir = File::Spec->catdir($self->directory, $self->root_dir);
 

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list