[Bps-public-commit] smokingit branch, master, updated. 5bf47c1be3895de7e55878a76cef262391765f15

Alex Vandiver alexmv at bestpractical.com
Mon Jan 6 22:59:44 EST 2014


The branch, master has been updated
       via  5bf47c1be3895de7e55878a76cef262391765f15 (commit)
       via  41b0c4dd6d9c40247a3659b709dfe536b634a462 (commit)
       via  42c3ba10bf22a2318e37b7f5e9a2d3b52aafc22b (commit)
      from  6ebaabf8e857d29c2e9aba3b8018f1ea7972505a (commit)

Summary of changes:
 lib/Smokingit/IRC.pm | 58 +++++++++++++++++++++++++++++++++++++---------------
 1 file changed, 41 insertions(+), 17 deletions(-)

- Log -----------------------------------------------------------------
commit 42c3ba10bf22a2318e37b7f5e9a2d3b52aafc22b
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Jan 6 22:58:25 2014 -0500

    Factor out enum into its own method, as it is generally useful

diff --git a/lib/Smokingit/IRC.pm b/lib/Smokingit/IRC.pm
index 56935e1..f93a6c8 100644
--- a/lib/Smokingit/IRC.pm
+++ b/lib/Smokingit/IRC.pm
@@ -276,6 +276,13 @@ sub test_progress {
     warn "$@" if $@;
 }
 
+
+sub enum {
+    my ($sep, @lst) = @_;
+    $lst[-1] = "and $lst[-1]" if @lst > 1;
+    return join("$sep ", @lst);
+}
+
 sub describe_fail {
     my $self = shift;
 
@@ -308,23 +315,17 @@ sub describe_fail {
         $configs{$config}{$fail->filename} = 1;
     }
 
-    my $enum = sub {
-        my ($sep, @lst) = @_;
-        $lst[-1] = "and $lst[-1]" if @lst > 1;
-        return join("$sep ", @lst);
-    };
-
     # Are all of the fails across all configurations?
     my %tested_configs;
     $tested_configs{$_->configuration->id}++ for @{ $commit->smoke_results->items_array_ref };
     my $config_count = keys %tested_configs;
     if (scalar values %testnames == grep {keys(%{$_}) == $config_count} values %testnames) {
-        return "failing ".$enum->(",", sort keys %testnames);
+        return "failing ".enum(",", sort keys %testnames);
     }
 
     # Are all of the fails in just one configuration?
     if (scalar keys %configs == 1) {
-        return "failing @{[keys %configs]} tests: ".$enum->(",", sort keys %testnames);
+        return "failing @{[keys %configs]} tests: ".enum(",", sort keys %testnames);
     }
 
     # Something else; pull out all of the ones which apply to all
@@ -334,13 +335,13 @@ sub describe_fail {
         delete $configs{$c}{$_} for @all;
     }
     my @ret;
-    push @ret, $enum->(",", @all)." on all" if @all;
+    push @ret, enum(",", @all)." on all" if @all;
 
     for my $config (sort grep {keys %{$configs{$_}}} keys %configs) {
-        push @ret, $enum->(",", sort keys %{delete $configs{$config}})." on $config";
+        push @ret, enum(",", sort keys %{delete $configs{$config}})." on $config";
     }
 
-    return "failing " . $enum->(";", @ret);
+    return "failing " . enum(";", @ret);
 }
 
 sub do_analyze {

commit 41b0c4dd6d9c40247a3659b709dfe536b634a462
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Jan 6 22:58:48 2014 -0500

    Report all on-demand configurations, even if they pass

diff --git a/lib/Smokingit/IRC.pm b/lib/Smokingit/IRC.pm
index f93a6c8..e4368d4 100644
--- a/lib/Smokingit/IRC.pm
+++ b/lib/Smokingit/IRC.pm
@@ -351,6 +351,32 @@ sub do_analyze {
     my $commit = $smoke->commit;
     my $project = $smoke->project;
 
+    my $author = $commit->author;
+    $author = $1 if $author =~ /<(.*?)@/;
+
+    # If this is an on-demand configuration, report it
+    if (not $smoke->configuration->auto) {
+        my ($status) = $commit->status($smoke);
+        if ($status eq "passing") {
+            $status = String::IRC->new("passes tests")->green;
+        } else {
+            my $fails = Smokingit::Model::SmokeFileResultCollection->new;
+            $fails->limit(
+                column => "smoke_result_id",
+                value  => $smoke->id,
+            );
+            $fails->limit(
+                column => "is_ok",
+                value  => 0,
+            );
+            $status = "is failing " . enum(", ", sort map {$_->filename} @{$fails->items_array_ref});
+            $status = String::IRC->new($status)->red . " - $url");
+        }
+        my $url = Jifty->web->url(path => "/test/".$commit->short_sha);
+        return $smoke->configuration->name " of ".$commit->short_sha . " on ".$smoke->branch_name
+            ." $status";
+    }
+
     # First off, have we tested all configurations?
     return unless $commit->is_fully_smoked;
 
@@ -366,9 +392,6 @@ sub do_analyze {
     # Make sure the branch actually still contains the commit
     return unless $branch->contains($commit);
 
-    my $author = $commit->author;
-    $author = $1 if $author =~ /<(.*?)@/;
-
     my $url = Jifty->web->url(path => "/test/".$commit->short_sha);
 
     # If this is the first commit on the branch, _or_ we haven't tested

commit 5bf47c1be3895de7e55878a76cef262391765f15
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Jan 6 22:59:36 2014 -0500

    retest is not just things that have already been tested

diff --git a/lib/Smokingit/IRC.pm b/lib/Smokingit/IRC.pm
index e4368d4..a790fb3 100644
--- a/lib/Smokingit/IRC.pm
+++ b/lib/Smokingit/IRC.pm
@@ -74,8 +74,8 @@ sub incoming {
     return if $incoming->isa("IM::Engine::Incoming::IRC::Channel")
         and not $msg =~ s/^\s*$nick(?:\s*[:,])?\s*(?:please\s+)?//i;
 
-    if ($msg =~ /^retest\s+(.*)/) {
-        return $self->do_retest($incoming, $1);
+    if ($msg =~ /^(re)?test\s+(.*)/) {
+        return $self->do_test($incoming, $1);
     } elsif ($msg =~ /^status\s+(?:of\s+)?(.*)/) {
         return $self->do_status($incoming, $1);
     } elsif ($msg =~ /^(?:re)?sync(?:\s+(.*))?/) {
@@ -87,7 +87,7 @@ sub incoming {
     }
 }
 
-sub do_retest {
+sub do_test {
     my $self = shift;
     my ($incoming, $what) = @_;
     my $action = Smokingit::Action::Test->new(

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



More information about the Bps-public-commit mailing list