From: Ian Jackson Subject: [OSSTEST PATCH 13/14] Reporting: Provide report_find_push_age_info Date: Tue, 30 Jun 2015 10:57:50 +0100 Message-ID: <1435658271-31823-14-git-send-email-ian.jackson@eu.citrix.com> References: <1435658271-31823-1-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Z9sIo-0007RP-14 for xen-devel@lists.xenproject.org; Tue, 30 Jun 2015 09:58:06 +0000 In-Reply-To: <1435658271-31823-1-git-send-email-ian.jackson@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org This utility function provides information about how far behind the push gate is right now. I have tested it with this rune in the Cambridge instance: perl -we 'use Osstest::Executive; use Osstest; use Data::Dumper; open DEBUG, ">&STDERR" or die $!; csreadconfig(); print Dumper report_find_push_age_info([qw(real)], undef, [qw(osstest linux-next)], "osstest", "280a18b2b2612174e473a1c1a137ddd47c49aab9", "cc8b79ce9586d2b0fbddbd4260e876eab1d408d4")' Currently it produces this output: $VAR1 = { 'CountTip' => '4', 'FirstTip' => { 'flight' => 37635, 'intended' => 'real', 'blessing' => 'real', 'started' => 1435460756, 'branch' => 'osstest' }, 'LastTip' => { 'flight' => 37638, 'intended' => 'real', 'blessing' => 'real', 'started' => 1435538150, 'branch' => 'osstest' }, 'Basis' => { 'flight' => 37629, 'intended' => 'real', 'blessing' => 'real', 'started' => 1435181770, 'branch' => 'osstest' }, 'FirstAfterBasis' => { 'flight' => 37630, 'intended' => 'real', 'blessing' => 'real', 'started' => 1435314944, 'branch' => 'osstest' }, 'CountAfterBasis' => '9' }; Signed-off-by: Ian Jackson Acked-by: Ian Campbell --- Osstest/Executive.pm | 142 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 141 insertions(+), 1 deletion(-) diff --git a/Osstest/Executive.pm b/Osstest/Executive.pm index 87f2e98..4c470bd 100644 --- a/Osstest/Executive.pm +++ b/Osstest/Executive.pm @@ -47,7 +47,7 @@ BEGIN { @EXPORT = qw(get_harness_rev grabrepolock_reexec findtask @all_lock_tables report_run_getinfo report_altcolour - report_blessingscond + report_blessingscond report_find_push_age_info tcpconnect_queuedaemon plan_search alloc_resources alloc_resources_rollback_begin_work resource_check_allocated resource_shared_mark_ready @@ -271,6 +271,146 @@ sub report_blessingscond ($$) { return $blessingscond; } +sub report__find_test ($$$$$$$$) { + my ($blessings, $maxflight, $branches, $tree, + $revision, $selection, $extracond, $sortlimit) = @_; + # Reports information about a flight which tried to test $revision + # of $tree. ($revision may be undef); + + my @params; + + my $querytext = <execute(@params); + + my $row = $query->fetchrow_hashref(); + $query->finish(); + return $row; +} + +sub report_find_push_age_info ($$$$$$) { + my ($blessings, $maxflight, $branches, $tree, + $basis_revision, $tip_revision) = @_; + # Reports information about tests of $tree. + # (Subject to @$blessings, $maxflight, @$branches) + # Returns { + # Basis => row for last test of basis + # FirstAfterBasis => row for first test after basis + # FirstTip => row for first test of tip (after Basis) + # LastTip => row for last test of tip (after Basis) + # CountAfterBasis => count of runs strictly after Basis + # CountTip => count of runs on Tip + # } + # where + # row for ... is from fetchrow_hashref of SELECT * FROM flights + # (or undef if no such thing exists) + # Count is a scalar integer. + # + # Only flights which specified the exact revision specified + # are considered (not ones which specified a tag, for example). + + my $findtest = sub { + my ($revision,$selection,$extracond,$sortlimit) = @_; + report__find_test($blessings,$maxflight,$branches,$tree, + $revision,$selection,$extracond,$sortlimit); + }; + + my $findcount = sub { + my ($revision,$extracond,$sortlimit) = @_; + my $row = $findtest->($revision, 'COUNT(*) AS count', + $extracond, $sortlimit); + return $row->{count} // die "$revision $extracond $sortlimit ?"; + }; + + my $out = { }; + $out->{Basis} = $findtest->($basis_revision, '*', '', <{Basis} ? < $out->{Basis}{flight} +END + + $out->{FirstAfterBasis} = $findtest->(undef, '*', $afterbasis, <{FirstTip} = $findtest->($tip_revision, '*', $afterbasis, <{FirstTip} ? <= $out->{FirstTip}{flight} +END + + $out->{LastTip} = $findtest->($tip_revision, '*', $likelytip, <{FirstTip}; + + $out->{CountAfterBasis} = $findcount->(undef, $afterbasis, '') + if $afterbasis; + + $out->{CountTip} = + $out->{FirstTip} ? $findcount->($tip_revision, $likelytip, '') + : 0; + + return $out; +} + #---------- host (and other resource) allocation ---------- our $taskid; -- 1.7.10.4