The branch, master has been updated via de658c7 Add log_checksum function. via 63a1c0a remove unused test.pl script. from e4357c0 Fix status sort so that sorting is the same as in the perl version
http://gitweb.samba.org/?p=build-farm.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit de658c790fd05af218357f0b16d18ee08c5db97e Author: Jelmer Vernooij <jel...@samba.org> Date: Sun Nov 7 21:56:02 2010 +0100 Add log_checksum function. commit 63a1c0aba351d5a1b6c35f4589d88e6d85ac3ca7 Author: Jelmer Vernooij <jel...@samba.org> Date: Sun Nov 7 00:27:30 2010 +0100 remove unused test.pl script. ----------------------------------------------------------------------- Summary of changes: buildfarm/data.py | 4 ++ web/test.pl | 114 ----------------------------------------------------- 2 files changed, 4 insertions(+), 114 deletions(-) delete mode 100755 web/test.pl Changeset truncated at 500 lines: diff --git a/buildfarm/data.py b/buildfarm/data.py index acddf84..e6521ea 100644 --- a/buildfarm/data.py +++ b/buildfarm/data.py @@ -23,6 +23,7 @@ import ConfigParser +import hashlib import os import re import time @@ -182,6 +183,9 @@ class Build(object): """read full err file""" return util.FileLoad(self._store.build_fname(self.tree, self.host, self.compiler, self.rev)+".err") + def log_checksum(self): + return hashlib.sha1(self.read_log()).hexdigest() + def revision_details(self): """get the revision of build diff --git a/web/test.pl b/web/test.pl deleted file mode 100755 index 8754795..0000000 --- a/web/test.pl +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/perl - -use DBI; - -use FindBin qw($RealBin); -use lib "$RealBin/.."; -use DBI; -use strict; -use warnings; -use util; -use CGI; -use URI::Escape; -use hostdb; - -my $hostdb = new hostdb("$RealBin/../hostdb.sqlite" ) || die "Cannot connect: $DBI::errstr"; - -my $dbh = $hostdb->{dbh}; - -my $cgi = new CGI; - -print $cgi->header; - -sub show_summary($) -{ - my $tree = shift; - - print $cgi->start_table, - $cgi->thead($cgi->Tr($cgi->th(["Test", "Breakages", "Last Broken Build", "Hosts"]))), - $cgi->start_tbody; - - my $failed = {}; - my $success = {}; - - my $resultref = $dbh->selectall_arrayref("SELECT test_run.test AS test, build.host AS host, build.compiler AS compiler, test_run.result AS testresult, build.revision AS revision, build.checksum AS checksum FROM build, test_run WHERE build.tree = ? AND test_run.build = build.id GROUP BY test, host, compiler ORDER BY revision DESC", undef, $tree); - foreach (@$resultref) { - unless (defined($failed->{$_->[0]})) { $failed->{$_->[0]} = []; } - unless (defined($success->{$_->[0]})) { $success->{$_->[0]} = 0; } - if ($_->[3] eq "FAILED") { push(@{$failed->{$_->[0]}}, $_); } - elsif ($_->[3] eq "PASSED") { $success->{$_->[0]}++; } - elsif ($_->[3] eq "SKIPPED") {} - else { - print "Unknown test result $_->[3]<br>"; - } - } - - my @problematic_tests = (); - - foreach (keys %$failed) { - next if ($#{$failed->{$_}} == -1); - - my $numfails = $#{$failed->{$_}}+1; - - my $percentage = $numfails / ($numfails+$success->{$_}) * 100.0; - my $hosts = ""; - my $last_broken_rev = 0; - foreach (@{$failed->{$_}}) { - $hosts .= $cgi->a({-href=>"/test.pl?build=".uri_escape($_->[5]).";test=".uri_escape($_->[0])}, "$_->[1]/$_->[2]($_->[4])"). " "; - if ($_->[4] > $last_broken_rev) { - $last_broken_rev = $_->[4]; - } - } - - push (@problematic_tests, [$last_broken_rev, $percentage, $numfails, $success->{$_}, $_, $hosts]); - } - - sub sortfn { - my $ret = $$b[0] <=> $$a[0]; - return $ret unless ($ret); - return $$b[1] <=> $$a[1]; - } - - @problematic_tests = sort { $$b[0] <=> $$a[0] } @problematic_tests; - - foreach (@problematic_tests) { - my ($last_broken_rev, $percentage, $numfails, $numpass, $name, $hosts) = @$_; - my $clr = int(2.55 * $percentage)+40; - print $cgi->start_Tr, - $cgi->td($cgi->a({-href=>"/test.pl?test=".uri_escape($name)}, $name)), - $cgi->td({-style => "color: rgb($clr,".(255-$clr).",0);"}, "$numfails/".($numpass+$numfails).sprintf(" (%.2f%%)", $percentage)), - $cgi->td($last_broken_rev), - $cgi->td($hosts), - $cgi->end_Tr; - } - - print $cgi->end_tbody, $cgi->end_table; -} - -sub show_test_host($$) -{ - my ($test, $build) = @_; - - my @resultref = $dbh->selectrow_array("SELECT test_run.output FROM test_run, build WHERE test_run.build = build.id AND build.checksum = ? AND test_run.test = ? ORDER BY build.revision LIMIT 1", undef, $build, $test); - print $cgi->pre($resultref[0]); -} - -sub show_test($) -{ - my ($test) = @_; - my $resultref = $dbh->selectall_arrayref("SELECT build.host, build.compiler, build.revision, test_run.output FROM test_run, build WHERE build.id = test_run.build AND test_run.test = ? ORDER BY test_run.result", undef, $test); - foreach (@$resultref) { - print $cgi->h2($_->[0]); - print $cgi->pre($_->[3]); - } -} - -if (defined($cgi->param('test')) and defined($cgi->param('build'))) { - show_test_host($cgi->param('test'), $cgi->param('build')); -} elsif (defined($cgi->param('test'))) { - show_test($cgi->param('test')); -} else { - show_summary("samba_4_0_test"); -} - -1; -- build.samba.org