[Bps-public-commit] smokingit branch, full-tap, created. 4cfca5e2cecfd31c051ddb68adedd9f834755e4f
Alex Vandiver
alexmv at bestpractical.com
Sat Jul 20 00:07:42 EDT 2013
The branch, full-tap has been created
at 4cfca5e2cecfd31c051ddb68adedd9f834755e4f (commit)
- Log -----------------------------------------------------------------
commit 0ea45a8a85edb615f4350b8a4b0e6ef8240b9b35
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Jun 21 11:47:03 2013 -0700
Switch to clients sending raw TAP, not the parsed data from the aggregator
diff --git a/etc/config.yml b/etc/config.yml
index 1b9d03a..5716b09 100644
--- a/etc/config.yml
+++ b/etc/config.yml
@@ -11,7 +11,7 @@ framework:
Host: localhost
Password: ''
User: postgres
- Version: 0.0.7
+ Version: 0.0.8
DevelMode: 1
LogLevel: INFO
Mailer: Sendmail
diff --git a/lib/Smokingit/Model/SmokeFileResult.pm b/lib/Smokingit/Model/SmokeFileResult.pm
new file mode 100644
index 0000000..311015f
--- /dev/null
+++ b/lib/Smokingit/Model/SmokeFileResult.pm
@@ -0,0 +1,35 @@
+use strict;
+use warnings;
+
+package Smokingit::Model::SmokeFileResult;
+use Jifty::DBI::Schema;
+use Smokingit::Status;
+
+use Smokingit::Record schema {
+ column smoke_result_id =>
+ is mandatory,
+ references Smokingit::Model::SmokeResult,
+ is indexed;
+
+ column filename => type is 'text';
+ column elapsed => type is 'float';
+ column is_ok => is boolean;
+ column raw_tap => type is 'text';
+ column tests_run => type is 'integer';
+};
+
+sub since { '0.0.8' }
+
+sub is_protected {1}
+
+sub current_user_can {
+ my $self = shift;
+ my $right = shift;
+ my %args = (@_);
+
+ return 1 if $right eq 'read';
+
+ return $self->SUPER::current_user_can($right => %args);
+}
+
+1;
diff --git a/lib/Smokingit/Model/SmokeResult.pm b/lib/Smokingit/Model/SmokeResult.pm
index 75ce7fe..0e072cb 100644
--- a/lib/Smokingit/Model/SmokeResult.pm
+++ b/lib/Smokingit/Model/SmokeResult.pm
@@ -47,7 +47,8 @@ use Smokingit::Record schema {
column aggregator =>
type is 'blob',
- filters are 'Jifty::DBI::Filter::Storable';
+ filters are 'Jifty::DBI::Filter::Storable',
+ till '0.0.8';
column is_ok => is boolean;
@@ -58,11 +59,13 @@ use Smokingit::Record schema {
column skipped => type is 'integer';
column todo => type is 'integer';
column todo_passed => type is 'integer';
+ column total => type is 'integer',
+ since '0.0.8';
column wait => type is 'integer';
column exit => type is 'integer';
- column elapsed => type is 'integer';
+ column elapsed => type is 'float';
};
sub is_protected {1}
@@ -138,31 +141,10 @@ sub post_result {
my ($arg) = @_;
my %result = %{ $arg };
+ delete $result{start};
+ delete $result{end};
- # Properties to extract from the aggregator
- my @props =
- qw/failed
- parse_errors
- passed
- planned
- skipped
- todo
- todo_passed
- wait
- exit/;
-
- # Aggregator might not exist if we had a configure failure
- require TAP::Parser::Aggregator;
- my $a = $result{aggregator};
- if ($a) {
- $result{$_} = $a->$_ for @props;
- $result{is_ok} = not($a->has_problems);
- $result{elapsed} = $a->elapsed->[0];
- $result{error} = undef;
- } else {
- # Unset the existing data if there was a fail
- $result{$_} = undef for @props, "is_ok", "elapsed";
- }
+ my %tests = %{ delete $result{test} };
my $status = Smokingit::Status->new( $self );
@@ -190,6 +172,29 @@ sub post_result {
# Mark as no longer smoking
$self->set_queue_status(undef);
+ # Delete all previous test file results
+ my $testfiles = Smokingit::Model::SmokeFileResultCollection->new(
+ current_user => Smokingit::CurrentUser->superuser,
+ );
+ $testfiles->limit( column => "smoke_result_id", value => $self->id );
+ while (my $fileresult = $testfiles->next) {
+ $fileresult->delete;
+ }
+
+ # Create rows for all test files
+ for my $filename (sort keys %tests) {
+ my $fileresult = Smokingit::Model::SmokeFileResult->new(
+ current_user => Smokingit::CurrentUser->superuser,
+ );
+ my ($ok, $msg) = $fileresult->create(
+ %{$tests{$filename}},
+ filename => $filename,
+ smoke_result_id => $self->id,
+ );
+ warn "Failed to create entry for $filename: $msg"
+ unless $ok;
+ }
+
# And commit all of that
Jifty->handle->commit;
diff --git a/lib/Smokingit/Upgrade.pm b/lib/Smokingit/Upgrade.pm
index 3236a9a..c8813de 100644
--- a/lib/Smokingit/Upgrade.pm
+++ b/lib/Smokingit/Upgrade.pm
@@ -34,4 +34,9 @@ since '0.0.4' => sub {
}
};
+# Time elapsed became a float
+since '0.0.8' => sub {
+ Jifty->handle->simple_query("ALTER TABLE smoke_results ALTER COLUMN elapsed TYPE float");
+};
+
1;
diff --git a/lib/Smokingit/View/Commit.pm b/lib/Smokingit/View/Commit.pm
index 2ab3c23..cf09412 100644
--- a/lib/Smokingit/View/Commit.pm
+++ b/lib/Smokingit/View/Commit.pm
@@ -20,11 +20,6 @@ template '/smoke' => page {
return;
}
- my $a = $s->aggregator;
- pre {
- YAML::Dump($a);
- };
-
};
1;
commit 29280408f27f7d3ab7748570483eb78110864fb0
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Jun 28 16:50:33 2013 -0400
Link test results from commit pages
diff --git a/lib/Smokingit/View/Commit.pm b/lib/Smokingit/View/Commit.pm
index cf09412..8aba98f 100644
--- a/lib/Smokingit/View/Commit.pm
+++ b/lib/Smokingit/View/Commit.pm
@@ -7,6 +7,24 @@ use Jifty::View::Declare -base;
template '/commit' => page {
redirect '/' unless get('commit');
page_title is get('commit')->short_sha;
+
+ my $commit = get('commit');
+
+ ul {
+ my $configs = $b->project->configurations;
+ while (my $config = $configs->next) {
+ li {
+ my $smoke = Smokingit::Model::SmokeResult->new;
+ $smoke->load_by_cols(
+ project_id => $commit->project->id,
+ configuration_id => $config->id,
+ commit_id => $commit->id,
+ );
+ next unless $smoke->id;
+ Smokingit::View::test_result( $smoke );
+ }
+ }
+ }
};
template '/smoke' => page {
commit 6c72d113f15440df5693ea82c687dcb03a4925f3
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Jun 28 16:51:42 2013 -0400
Bare-bones passing/failing test list for smoke results
diff --git a/lib/Smokingit/View/Commit.pm b/lib/Smokingit/View/Commit.pm
index 8aba98f..28589ee 100644
--- a/lib/Smokingit/View/Commit.pm
+++ b/lib/Smokingit/View/Commit.pm
@@ -38,6 +38,20 @@ template '/smoke' => page {
return;
}
+ my $results = Smokingit::Model::SmokeFileResultCollection->new;
+ $results->limit( column => "smoke_result_id", value => $s->id );
+ $results->order_by( column => "filename" );
+ $results->columns( "filename", "is_ok", "elapsed" );
+ while (my $result = $results->next) {
+ div {
+ class is ($result->is_ok ? "passingfile" : "failingfile");
+ outs $result->filename;
+ span {
+ class is "elapsed";
+ outs sprintf "(%.2fs)", $result->elapsed;
+ };
+ };
+ }
};
1;
diff --git a/share/web/static/css/app-late.css b/share/web/static/css/app-late.css
index f5e2456..6dd7fe9 100644
--- a/share/web/static/css/app-late.css
+++ b/share/web/static/css/app-late.css
@@ -1,3 +1,5 @@
+ at import "testresults.css";
+
html {
padding: .75em;
background: #223;
@@ -352,15 +354,6 @@ li {
}
-/* Commit pages */
-.failingtest .header {
- border-bottom: 5px dotted #f11;
-}
-.passingtest .header {
- border-bottom: 5px dotted #1c1;
-}
-
-
/* Footer and escaping smoke in the corner */
#footer {
position: absolute;
diff --git a/share/web/static/css/testresults.css b/share/web/static/css/testresults.css
new file mode 100644
index 0000000..a96e372
--- /dev/null
+++ b/share/web/static/css/testresults.css
@@ -0,0 +1,29 @@
+/* Commit pages */
+.failingtest .header {
+ border-bottom: 5px dotted #f11;
+}
+.passingtest .header {
+ border-bottom: 5px dotted #1c1;
+}
+
+.passingfile, .failingfile {
+ border-collapse: collapse;
+ padding: 0.1em 1em;
+ margin-right: auto;
+ margin-left: auto;
+}
+
+.passingfile {
+ border: 1px solid #cfc;
+ background-color: #beb;
+}
+
+.failingfile {
+ border: 1px solid #fcc;
+ background-color: #f99;
+}
+
+.elapsed {
+ position: absolute;
+ right: 2em;
+}
\ No newline at end of file
commit 4cfca5e2cecfd31c051ddb68adedd9f834755e4f
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Jul 19 01:43:45 2013 -0400
Add an upgrade step to build SmokeFileResults out of aggregators
diff --git a/lib/Smokingit/Upgrade.pm b/lib/Smokingit/Upgrade.pm
index c8813de..f56a6df 100644
--- a/lib/Smokingit/Upgrade.pm
+++ b/lib/Smokingit/Upgrade.pm
@@ -34,9 +34,46 @@ since '0.0.4' => sub {
}
};
-# Time elapsed became a float
since '0.0.8' => sub {
+ # Time elapsed became a float
Jifty->handle->simple_query("ALTER TABLE smoke_results ALTER COLUMN elapsed TYPE float");
+
+ # Go through and inflate all of the old aggregators into test result rows
+ my $tests = Smokingit::Model::SmokeResultCollection->new( current_user => $super );
+ $tests->unlimit;
+ $tests->columns( "id", "aggregator" );
+ require TAP::Parser;
+ require TAP::Parser::Aggregator;
+ while (my $test = $tests->next) {
+ my $aggregator = $test->_value('aggregator');
+ for my $filename ($aggregator->descriptions) {
+ my ($parser) = $aggregator->parsers($filename);
+
+ my $tap = "";
+ if ($parser->skip_all) {
+ $tap = "1..0 # skipped\n";
+ } else {
+ $tap = $parser->plan . "\n";
+ my %lines;
+ $lines{$_} = "ok $_ # skip" for $parser->skipped;
+ $lines{$_} ||= "ok $_ # TODO" for $parser->todo_passed;
+ $lines{$_} ||= "not ok $_ # TODO" for $parser->todo;
+ $lines{$_} ||= "ok $_" for $parser->actual_passed;
+ $lines{$_} ||= "not ok $_" for $parser->actual_failed;
+ $tap .= "$lines{$_}\n" for sort {$a <=> $b} keys %lines;
+ }
+
+ my $filetest = Smokingit::Model::SmokeFileResult->new( current_user => $super );
+ $filetest->create(
+ smoke_result_id => $test->id,
+ filename => $filename,
+ elapsed => ($parser->end_time - $parser->start_time),
+ is_ok => !$parser->has_problems,
+ tests_run => $parser->tests_run,
+ raw_tap => $tap,
+ );
+ }
+ }
};
1;
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list