[SCM] build.samba.org - branch master updated
Jelmer Vernooij
jelmer at samba.org
Mon Nov 22 05:29:14 MST 2010
The branch, master has been updated
via 667a1dd Remove remaining files from the old perl-based buildfarm.
via f846851 Add status tests.
from a092307 fjall needs more time to finish tests under valgrind
http://gitweb.samba.org/?p=build-farm.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 667a1dd5493505ff1b7d495083fa29161757c501
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Mon Nov 22 13:22:10 2010 +0100
Remove remaining files from the old perl-based buildfarm.
commit f8468510105a6f9803b123a5f58dfa05d9e214e0
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Mon Nov 22 13:03:57 2010 +0100
Add status tests.
-----------------------------------------------------------------------
Summary of changes:
buildfarm/web/__init__.py | 28 +-
buildfarm/web/tests/test_status.py | 39 ++
gitlog.pl | 161 ------
history | 28 -
svnlog.pl | 182 -------
tests/data.pl | 32 --
tests/util.pl | 45 --
web/build.pl | 971 ------------------------------------
web/data.pm | 644 ------------------------
web/history.pm | 496 ------------------
web/util.pm | 203 --------
11 files changed, 54 insertions(+), 2775 deletions(-)
create mode 100644 buildfarm/web/tests/test_status.py
delete mode 100755 gitlog.pl
delete mode 100755 history
delete mode 100755 svnlog.pl
delete mode 100755 tests/data.pl
delete mode 100755 tests/util.pl
delete mode 100644 web/data.pm
delete mode 100644 web/history.pm
delete mode 100644 web/util.pm
Changeset truncated at 500 lines:
diff --git a/buildfarm/web/__init__.py b/buildfarm/web/__init__.py
index e735941..d0500af 100755
--- a/buildfarm/web/__init__.py
+++ b/buildfarm/web/__init__.py
@@ -100,20 +100,23 @@ def html_build_status(status):
ostatus = []
if "panic" in status.other_failures:
- return span("status panic", "PANIC")
+ ostatus.append(span("status panic", "PANIC"))
if "disk full" in status.other_failures:
- return span("status failed", "disk full")
+ ostatus.append(span("status failed", "disk full"))
if "timeout" in status.other_failures:
- return span("status failed", "timeout")
+ ostatus.append(span("status failed", "timeout"))
if "inconsistent test result" in status.other_failures:
ostatus.append(span("status failed", "unexpected return code"))
bstatus = "/".join([span_status(s) for s in status.stages])
- if bstatus == "":
- bstatus = "?"
- return "/".join([bstatus] + ostatus)
+ ret = bstatus
+ if ostatus:
+ ret += "(%s)" % ",".join(ostatus)
+ if ret == "":
+ ret = "?"
+ return ret
-def build_status_html(myself, build):
+def build_link(myself, build):
params = {
"host": build.host,
"tree": build.tree,
@@ -395,7 +398,7 @@ class ViewBuildPage(BuildFarmPage):
for old_build in old_builds:
yield "<tr><td>%s</td><td>%s</td><td>%s</td></tr>\n" % (
revision_link(myself, old_build.revision, tree),
- build_status_html(myself, old_build),
+ build_link(myself, old_build),
util.dhm_time(old_build.age))
yield "</tbody></table>\n"
@@ -458,7 +461,7 @@ class ViewBuildPage(BuildFarmPage):
yield "<tr><td>Tree:</td><td>%s</td></tr>\n" % self.tree_link(myself, tree)
yield "<tr><td>Build Revision:</td><td>%s</td></tr>\n" % revision_link(myself, build.revision, tree)
yield "<tr><td>Build age:</td><td><div class='age'>%s</div></td></tr>\n" % self.red_age(build.age)
- yield "<tr><td>Status:</td><td>%s</td></tr>\n" % build_status_html(myself, build)
+ yield "<tr><td>Status:</td><td>%s</td></tr>\n" % build_link(myself, build)
yield "<tr><td>Compiler:</td><td>%s</td></tr>\n" % compiler
if cflags is not None:
yield "<tr><td>CFLAGS:</td><td>%s</td></tr>\n" % cflags
@@ -575,7 +578,7 @@ class ViewRecentBuildsPage(BuildFarmPage):
yield "<td>%s</td>" % build_platform(build)
yield "<td>%s</td>" % host_link(myself, build.host)
yield "<td>%s</td>" % build.compiler
- yield "<td>%s</td>" % build_status_html(myself, build)
+ yield "<td>%s</td>" % build_link(myself, build)
yield "</tr>"
yield "</tbody></table>"
yield "</div>"
@@ -597,7 +600,7 @@ class ViewHostPage(BuildFarmPage):
yield "<td><span class='tree'>" + self.tree_link(myself, build.tree) +"</span>/" + build.compiler + "</td>"
yield "<td>" + revision_link(myself, build.revision, build.tree) + "</td>"
yield "<td><div class='age'>" + self.red_age(build.age) + "</div></td>"
- yield "<td><div class='status'>%s</div></td>" % build_status_html(myself, build)
+ yield "<td><div class='status'>%s</div></td>" % build_link(myself, build)
yield "<td>%s</td>" % warnings
yield "</tr>"
@@ -804,8 +807,7 @@ class HistoryPage(BuildFarmPage):
yield "<span class=\"label\">Builds: </span>\n"
builds = self.buildfarm.get_revision_builds(tree.name, entry.revision)
for build in builds:
- yield "%s(%s) " % (build_status_html(myself, build),
- host_link(myself, build.host))
+ yield "%s(%s) " % (build_link(myself, build), host_link(myself, build.host))
yield "</div>\n"
yield "</div>\n"
diff --git a/buildfarm/web/tests/test_status.py b/buildfarm/web/tests/test_status.py
new file mode 100644
index 0000000..a1450d3
--- /dev/null
+++ b/buildfarm/web/tests/test_status.py
@@ -0,0 +1,39 @@
+#!/usr/bin/python
+# Copyright (C) Jelmer Vernooij <jelmer at samba.org> 2010
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+from buildfarm.data import BuildStatus
+from buildfarm.web import html_build_status
+
+import testtools
+
+class BuildStatusHtmlTests(testtools.TestCase):
+
+ def test_empty(self):
+ status = BuildStatus()
+ self.assertEquals("?", html_build_status(status))
+
+ def test_failed_build(self):
+ status = BuildStatus([("CONFIGURE", 0), ("BUILD", 4)])
+ self.assertEquals(
+ '<span class="status passed">ok</span>/<span class="status failed">4</span>',
+ html_build_status(status))
+
+ def test_disk_full(self):
+ status = BuildStatus([("CONFIGURE", 0), ("BUILD", 4)], set(["timeout"]))
+ self.assertEquals(
+ '<span class="status passed">ok</span>/<span class="status failed">4</span>'
+ '(<span class="status failed">timeout</span>)', html_build_status(status))
diff --git a/gitlog.pl b/gitlog.pl
deleted file mode 100755
index a913598..0000000
--- a/gitlog.pl
+++ /dev/null
@@ -1,161 +0,0 @@
-#!/usr/bin/perl -w
-#
-# Extract information about recent git commits
-#
-# tridge at samba.org, November 2006
-# bjacke at samba.org
-
-use strict;
-use lib "web";
-use util;
-use POSIX;
-use Data::Dumper;
-use File::stat;
-use Date::Parse;
-
-####################################
-# push an entry onto the array
-
-sub push_entry($$$$)
-{
- my $entry = shift;
- my $log = shift;
- my $days = shift;
- my $tree = shift;
- unshift(@{$log}, $entry);
-# printf("Adding entry\n");
-# print Dumper $entry;
- return $log;
-}
-
-####################################
-# return an array of logfile entries given a git log file.
-# Only return entries newer than $days old
-sub git_parse($$$$)
-{
- my $git_path = shift;
- my $days = shift;
- my $tree = shift;
- my $subdir = shift;
- my $log;
- my $entry = {};
- my $addto = "";
-
- $subdir = "" unless defined($subdir);
-
- my $magicstart = "---GIT-COMMIT-MAGIC-START---";
- my $magicmsg = "---GIT-COMMIT-MAGIC-MESSAGE---";
- my $magicdiff = "---GIT-COMMIT-MAGIC-DIFF---";
- my $magicbody = "---GIT-COMMIT-MAGIC-BODY---";
- my $format = $magicstart."%n%H%n%ct%n%an%n".$magicmsg."%n%s%n".$magicbody."%b%n".$magicdiff;
- my $sincedays;
- $sincedays = "--since='$days days'" if defined($days);
- # the number of entries is also being limited to a maximum number
- # in the "git log" command. This is required because we
- # checked in 11 years of samba development 1 days ago :-)
-
- # git log --pretty=format:---GIT-COMMIT-MAGIC-START---%n%H%n%ct%n%an%n---GIT-COMMIT-MAGIC-MESSAGE---%n%s%b%n---GIT-COMMIT-MAGIC-DIFF--- --numstat --since='1 days'
- open(FILE, "cd $git_path; git log --pretty=format:$format --numstat $sincedays -500 $tree -- $subdir |");
- my $line_count;
- while (defined (my $line = <FILE>)) {
-# printf("line=$line");
- # separator line indicates new entry
- if ($line =~ /^$magicstart$/ ) {
- # only add entry if one exists
- if ($entry->{DATE}) {
- $log = push_entry($entry, $log, $days, $tree);
- }
-
- $entry = {};
- $line_count = 0;
- next;
- }
- $line_count++;
-
- if ($line_count == 1) {
- chomp $line;
- $entry->{REVISION} = $line;
- next;
- } elsif ($line_count == 2) {
- chomp $line;
- $entry->{DATE} = $line;
- next;
- } elsif ($line_count == 3) {
- chomp $line;
- $entry->{AUTHOR} = $line;
- next;
- }
-
- if ($line =~ /^$magicmsg$/) {
- $addto = "MESSAGE";
- next;
- }
-
- if ($line =~ /^$magicdiff$/) {
- $addto = "DIFF_STUFF";
- next;
- }
-
- chomp $line;
- if ($addto eq "MESSAGE") {
- if ($line =~ /^$magicbody(<unknown>$)?(.*)$/) {
- $line = $2;
- }
- $entry->{MESSAGE} .= $line."\n";
- next;
- }
-
- if ($addto eq "DIFF_STUFF") {
- $line =~ m/^([0-9]*)[ \t]*([0-9]*)[ \t]*(.*)/;
- my $a = $1;
- my $b = $2;
- my $f = $3;
- $f =~ s/^$subdir\///;
- if (($b eq "0") and ($a ne "0")) {
- $entry->{ADDED} .= "$f ";
- } elsif (($a eq "0") and ($b ne "0")) {
- $entry->{REMOVED} .= "$f ";
- } else {
- $entry->{FILES} .= "$f ";
- }
- next;
- }
- }
- # the last log entry should be caught here:
- if ($entry->{DATE}) {
- $log = push_entry($entry, $log, $days, $tree);
- }
-
- close(FILE);
-
- # cleanup the messages
-# for (my $line = $#{$log}; $line > 0; $line--) {
-# $entry = $log->[$line];
-# if ($entry->{MESSAGE}) {
-# while (chomp($entry->{MESSAGE})) { }
-# }
-# }
-
- return $log;
-}
-
-
-######################################
-# main program
-if ($#ARGV < 2 || $ARGV[0] eq '--help' || $ARGV[0] eq '-h') {
- print "
-Usage: gitlog.pl <PATH> <DAYS> <DEST> [<subdir>]
-
-Extract all commits git tree <PATH> in the last DAYS days. Store the
-results in DEST in a format easily readable by the build farm web
-scripts. "; exit(1); }
-
-my $git_path_arg = $ARGV[0];
-my $days_arg = $ARGV[1];
-my $tree_arg = $ARGV[2];
-my $dest_arg = $ARGV[3];
-my $subdir_arg = $ARGV[4];
-
-my $log_data = git_parse($git_path_arg, $days_arg, $tree_arg, $subdir_arg);
-
-util::SaveStructure($dest_arg, $log_data);
diff --git a/history b/history
deleted file mode 100755
index 590c387..0000000
--- a/history
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/bash
-
-# This script converts log files produced by CVS into Perl DataDumper
-# files that can be easily loaded by the buildfarm web interface.
-
-#cd $HOME/master || exit 1
-
-(
-
-./gitlog.pl /data/git/ppp.git/ 60 master cache/history.ppp
-./gitlog.pl /data/git/ccache.git/ 60 master cache/history.ccache
-./gitlog.pl /data/git/rsync.git/ 60 master cache/history.rsync
-./gitlog.pl /data/git/samba.git/ 60 v3-5-test cache/history.samba_3_current
-./gitlog.pl /data/git/samba.git/ 60 v3-6-test cache/history.samba_3_next
-./gitlog.pl /data/git/samba.git/ 60 master cache/history.samba_3_master
-./gitlog.pl /data/git/samba.git/ 60 master cache/history.samba_4_0_test
-./gitlog.pl /data/git/samba.git/ 60 master cache/history.samba_4_0_waf
-./gitlog.pl /data/git/samba.git/ 60 master cache/history.libreplace lib/replace
-./gitlog.pl /data/git/samba.git/ 60 master cache/history.talloc lib/talloc
-./gitlog.pl /data/git/samba.git/ 60 master cache/history.tdb lib/tdb
-./gitlog.pl /data/git/samba.git/ 60 master cache/history.ldb source4/lib/ldb
-./gitlog.pl /data/git/samba.git/ 60 master cache/history.pidl pidl
-
-./gitlog.pl /data/git/ctdb.git/ 60 master cache/history.ctdb
-./gitlog.pl /data/git/build-farm.git/ 60 master cache/history.build_farm
-./gitlog.pl /data/git/samba-web.git/ 60 master cache/history.samba-web
-
-) > history.log 2>&1
diff --git a/svnlog.pl b/svnlog.pl
deleted file mode 100755
index 02a507d..0000000
--- a/svnlog.pl
+++ /dev/null
@@ -1,182 +0,0 @@
-#!/usr/bin/perl -w
-#
-# Extract information about recent SVN commits
-#
-# tridge at samba.org, April 2001
-# vance at samba.org, August 2004
-
-use strict;
-use lib "web";
-use util;
-use POSIX;
-use Data::Dumper;
-use File::stat;
-use Date::Parse;
-
-####################################
-# push an entry onto the array
-
-sub push_entry($$$$)
-{
- my $entry = shift;
- my $log = shift;
- my $days = shift;
- my $tree = shift;
-
- # we can assume that each entry is unique, due to the nature of svn
- # so we don't need any of the magic required for cvs
- if (($entry->{DATE} > time() - $days*24*60*60) &&
- ($entry->{TREE} eq $tree)) {
-
- # we put these on in reverse order so that it's in order of
- # date.
- unshift(@{$log}, $entry);
- }
-
- return $log;
-}
-
-####################################
-# return an array of logfile entries given a svn log file.
-# Only return entries newer than $days old
-sub svn_parse($$$$)
-{
- my $repo_url = shift;
- my $tree_dir = shift;
- my $days = shift;
- my $tree = shift;
- my $log;
- my $entry = {};
-
- # don't know what time zone this machine is, but given the granularity
- # of days, (intended to be about 60 days), a few hours either way makes
- # very little difference
- my $start_date = POSIX::strftime("%Y-%m-%d", gmtime(time() - $days*60*60*24));
-
- open(FILE, "svn log --verbose --non-interactive $repo_url/$tree_dir -r HEAD:'{$start_date}' |");
- #open(FILE, "< log.txt") or die "Could not open log: $!";
- while (defined (my $line = <FILE>)) {
-
-
- # separator line indicates new entry
- if ($line =~ /^\-{5,}$/) {
- # only add entry if one exists
- if ($entry->{DATE}) {
- $log = push_entry($entry, $log, $days, $tree);
- }
-
- $entry = {};
-
- next;
- }
-
- # the first line after the separator (which sets entry to {})
- # looks like:
- # r15 | vance | 2004-07-31 22:24:55 -0700 (Sat, 31 Jul 2004) | 4 lines
- if (! defined $entry->{DATE}) {
-
- my ($rev, $author, $date, $lines) = split /\s+\|\s+/, $line;
- $entry->{DATE} = str2time($date);
-
- # kill the r in the revision
- $rev =~ s/^r//;
- $entry->{REVISION} = $rev;
- $entry->{AUTHOR} = $author;
- $entry->{TREE} = $tree;
- next;
- }
-
-
- # read the list of changed/added/removed files
- if ($line =~ /^Changed paths:/) {
-
- while (<FILE>) {
-
- $line = $_;
- if ($line =~ /^\s*$/) { last; }
-
- elsif ($line =~ /\s+A (.*)/) {
- my $file = $1;
- $file =~ s#^/$tree_dir/##o;
- if ($entry->{ADDED}) {
- $entry->{ADDED} .= " $file";
- } else {
- $entry->{ADDED} = "$file";
- }
- }
-
- elsif ($line =~ /\s+M (.*)/) {
- my $file = $1;
- $file =~ s#^/$tree_dir/##o;
- if ($entry->{FILES}) {
- $entry->{FILES} .= " $file";
- } else {
- $entry->{FILES} = "$file";
- }
- }
-
- elsif ($line =~ /\s+R (.*)/ ||
- $line =~ /\s+D (.*)/) {
- my $file = $1;
- $file =~ s#^/$tree_dir/##o;
- if ($entry->{REMOVED}) {
- $entry->{REMOVED} .= " $file";
- } else {
- $entry->{REMOVED} = "$file";
- }
- }
- }
-
- next;
- }
-
- # add the line to the message
- if (defined $entry->{MESSAGE}) {
- $entry->{MESSAGE} .= $line;
- }
- else {
- $entry->{MESSAGE} = $line;
- }
- }
-
- if ($entry->{DATE}) {
- $log = push_entry($entry, $log, $days, $tree);
- }
-
- close(FILE);
-
- # cleanup the messages
- for (my $line = $#{$log}; $line > 0; $line--) {
- $entry = $log->[$line];
- if ($entry->{MESSAGE}) {
- while (chomp($entry->{MESSAGE})) { }
- }
- }
-
- return $log;
-}
-
-
-######################################
-# main program
-if ($#ARGV < 4 || $ARGV[0] eq '--help' || $ARGV[0] eq '-h') {
- print "
-Usage: svnlog.pl <REPOSITORY-URL> <TREE-DIR> <DAYS> <TREE> <DEST>
-
-Extract all commits to REPOSITORY-URL/TREE-DIR in the last
-DAYS days. Store the results in DEST, indexed under TREE,
--
build.samba.org
More information about the samba-cvs
mailing list