[Bps-public-commit] smokingit branch, master, updated. 31122f58778b4c670a62aeb2102953e817db089f
Alex Vandiver
alexmv at bestpractical.com
Sun May 4 14:34:55 EDT 2014
The branch, master has been updated
via 31122f58778b4c670a62aeb2102953e817db089f (commit)
from b3b5adedf93ea797f61dadf9b0ff10d5ae5bc859 (commit)
Summary of changes:
lib/Smokingit/Model/SmokeResult.pm | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
- Log -----------------------------------------------------------------
commit 31122f58778b4c670a62aeb2102953e817db089f
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Sun May 4 14:33:37 2014 -0400
Provide timing information to the worker
Look back (up to 50 commits, via first-parent) for a test run with this
configuration which passed all tests. Pass the timing information for
those tests to the worker, to allow it to sort its testfiles
appropriately.
diff --git a/lib/Smokingit/Model/SmokeResult.pm b/lib/Smokingit/Model/SmokeResult.pm
index 978986c..02d6f6b 100644
--- a/lib/Smokingit/Model/SmokeResult.pm
+++ b/lib/Smokingit/Model/SmokeResult.pm
@@ -76,6 +76,29 @@ sub short_error {
return $msg;
}
+sub previous_tested {
+ my $self = shift;
+
+ # Find something to compare this to; look back (up to 50 first
+ # parents) for a test with this config which passed.
+ my $commit = $self->commit;
+ my $config = $self->configuration;
+ my $project = $self->project;
+
+ my $result = Smokingit::Model::SmokeResult->new;
+ for (1..50) {
+ ($commit) = $commit->parents;
+ my ($status) = $commit->status($config);
+ $result->load_by_cols(
+ project_id => $project->id,
+ configuration_id => $config->id,
+ commit_id => $commit->id,
+ );
+ return $result if $result->id and $result->is_ok;
+ }
+ return undef;
+}
+
sub run_smoke {
my $self = shift;
@@ -104,6 +127,20 @@ sub run_smoke {
$fileresult->delete;
}
+ # Determine the correct order
+ my $previous = $self->previous_tested;
+ if ($previous) {
+ my $testfiles = Smokingit::Model::SmokeFileResultCollection->new;
+ $testfiles->limit( column => "smoke_result_id", value => $previous->id );
+ $testfiles->order_by( { column => 'elapsed', order => 'DESC' });
+ $testfiles->columns( "id", "filename", "elapsed" );
+
+ $previous = {};
+ while (my $tf = $testfiles->next) {
+ $previous->{$tf->filename} = $tf->elapsed;
+ }
+ }
+
my $status = Smokingit::Status->new( $self );
Jifty->rpc->call(
name => "run_tests",
@@ -117,6 +154,7 @@ sub run_smoke {
env => $self->configuration->env,
parallel => ($self->configuration->parallel ? 1 : 0),
test_glob => $self->configuration->test_glob,
+ previous => $previous,
},
on_sent => sub {
my $ok = shift;
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list