Alexandre Julliard : winetest: Build a proper index page for the test results.
Alexandre Julliard
julliard at winehq.org
Tue May 27 09:05:44 CDT 2008
Module: tools
Branch: master
Commit: 6d94eb8e800c602f9e3b11002e2268b8b8f2e99f
URL: http://source.winehq.org/git/tools.git/?a=commit;h=6d94eb8e800c602f9e3b11002e2268b8b8f2e99f
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue May 27 15:59:58 2008 +0200
winetest: Build a proper index page for the test results.
---
winetest/build-index | 155 ++++++++++++++++++++++++++++++++++++++++++++++++
winetest/index.css | 54 +++++++++++++++++
winetest/winetest.conf | 5 +-
winetest/winetest.cron | 7 +--
4 files changed, 214 insertions(+), 7 deletions(-)
diff --git a/winetest/build-index b/winetest/build-index
new file mode 100755
index 0000000..7b708f9
--- /dev/null
+++ b/winetest/build-index
@@ -0,0 +1,155 @@
+#!/usr/bin/perl -w
+#
+# Build the global index for winetest result data
+#
+# Copyright 2008 Alexandre Julliard <julliard at winehq.org>
+#
+
+use strict;
+use open ':utf8';
+use CGI qw(:standard);
+
+use vars qw/$gitdir $gitweb/;
+require "winetest.conf";
+
+binmode STDIN, ':utf8';
+binmode STDOUT, ':utf8';
+
+$ENV{GIT_DIR} = $gitdir;
+
+my %w95 = (name => "Win95");
+my %w98 = (name => "Win98");
+my %me = (name => "Me");
+my %nt3 = (name => "NT3");
+my %nt4 = (name => "NT4");
+my %w2k = (name => "2000");
+my %xp = (name => "XP");
+my %w2k3 = (name => "2003");
+my %vista = (name => "Vista");
+my %wine = (name => "Wine");
+
+# Map dissect's IDs to the above hashes
+my %idmap = (95=>\%w95, 98=>\%w98, me=>\%me, nt3=>\%nt3, nt4=>\%nt4,
+ 2000=>\%w2k, xp=>\%xp, 2003=>\%w2k3, vista=>\%vista, wine=>\%wine);
+
+# Define the order of version groups in the summary
+my @groups = (\%w95, \%w98, \%me, \%nt3, \%nt4, \%w2k, \%xp, \%w2k3, \%vista, \%wine);
+
+my @months = ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
+
+# read the test data dir
+
+my @builds;
+my @too_old;
+
+opendir(DIR, "./data/") or die "cannot open ./data";
+foreach my $build (readdir(DIR))
+{
+ next if $build =~ /^\./;
+ next unless $build =~ /^[-.0-9a-zA-Z]+$/;
+ next unless -f "./data/$build/index.html";
+
+ my ($commit, $date, $subject);
+ $commit = `git log --max-count=1 --pretty="format:%ct %s" "$build^0" 2>/dev/null` if ($build =~ /^[0-9a-f]{40}$/);
+ if ($commit && $commit =~ /^(\d+) (.*)$/)
+ {
+ $date = $1;
+ $subject = $2;
+ # make sure the file mtime matches the commit time
+ utime $date, $date, "data/$build";
+ }
+ else
+ {
+ $date = (stat "./data/$build")[9];
+ $subject = "";
+ }
+ # archive builds older than 2 months
+ if (time() - $date > 60 * 24 * 60 * 60) { push @too_old, $build; }
+ else { push @builds, { name => $build, date => $date, subj => $subject }; }
+}
+
+closedir(DIR);
+ at builds = sort { $b->{date} <=> $a->{date} } @builds;
+
+# remove the too old results
+foreach my $build (@too_old) { rename "data/$build", "old-data/$build"; }
+
+# count how many test runs we have for each version
+
+my %versions = ();
+
+foreach my $build (@builds)
+{
+ my %build_ver = ();
+ if (opendir( DIR, "./data/$build->{name}" ))
+ {
+ foreach my $run (readdir(DIR))
+ {
+ next unless -d "./data/$build->{name}/$run";
+ next unless $run =~ /^([0-9a-z]*)_.*/;
+ next unless defined $idmap{$1};
+ my $ver = $idmap{$1}->{name};
+ $versions{$ver}++;
+ $build_ver{$ver}++;
+ }
+ closedir(DIR);
+ }
+ $build->{versions} = \%build_ver;
+}
+
+open OUT, ">data/index.html.new" or die "cannot create data/index.html.new";
+
+print OUT <<"EOF";
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <title>Wine test runs</title>
+ <link rel="stylesheet" href="/index.css" type="text/css">
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+</head>
+<body>
+EOF
+
+print OUT "<table class=\"builds\"><tr><th class=\"build\">Build</th><th class=\"date\">Date</th>\n";
+foreach my $ver (@groups)
+{
+ next unless defined($versions{$ver->{name}});
+ printf OUT "<th class=\"version\">%s</th>", $ver->{name};
+}
+print OUT "<th class=\"commit\">Head commit</th></tr>\n";
+
+my $odd = 0;
+foreach my $build (@builds)
+{
+ printf OUT "<tr class=\"%s\">\n", $odd ? "dark" : "light";
+ $odd = !$odd;
+ printf OUT " <td class=\"build\"><a href=\"%s\" title=\"%s\">%s</a></td>\n", $build->{name}, $build->{name}, substr($build->{name},0,12);
+ my @date = gmtime($build->{date});
+ printf OUT " <td class=\"date\">%02d-%s-%04d %02d:%02d</td>", $date[3], $months[$date[4]], $date[5] + 1900, $date[2], $date[1], $date[0];
+ foreach my $ver (@groups)
+ {
+ next unless defined($versions{$ver->{name}});
+ my $count = $build->{versions}->{$ver->{name}};
+ if (!$count)
+ {
+ printf OUT "<td class=\"version\">.</td>";
+ }
+ elsif ($count > 1)
+ {
+ printf OUT "<td class=\"version\"><a href=\"%s/#group_%s\">%u</a></td>", $build->{name}, $ver->{name}, $count;
+ }
+ else
+ {
+ printf OUT "<td class=\"version\"><a href=\"%s\">%u</a></td>", $build->{name}, $count;
+ }
+ }
+ print OUT "\n <td class=\"commit\">";
+ if ($build->{subj}) { printf OUT "<a href=\"$gitweb?a=shortlog;h=%s\">%s</a>", $build->{name}, escapeHTML($build->{subj}); }
+ print OUT "</td></tr>\n";
+}
+print OUT "</table>\n</body></html>\n";
+close OUT;
+
+rename "data/index.html.new", "data/index.html" or unlink "data/index.html.new";
+exit 0;
diff --git a/winetest/index.css b/winetest/index.css
new file mode 100644
index 0000000..f90b133
--- /dev/null
+++ b/winetest/index.css
@@ -0,0 +1,54 @@
+/* give a WineHQ-ish look to the test list */
+
+body {
+ background-color: #E2E2E2;
+ color: #000000;
+ font-family: "bitstream vera sans", "verdana", "arial", "helvetica", sans-serif;
+ margin: 10px;
+ font-size: 12px;
+}
+
+a { color: #A50D0D; text-decoration: none; }
+a:visited { color: #FF0000; }
+a:hover { color: #FF6666; text-decoration: underline; }
+a:active { color: #FF0000; }
+a.hidden { text-decoration: none; color: #000000; }
+
+ol,ul,p { font-size: 12px; }
+td,tr,th { font-size: 12px; }
+
+table.builds {
+ margin-right: auto;
+ text-spacing: 0;
+ border-spacing: 0;
+ white-space: nowrap;
+}
+
+table.builds th {
+ line-height: 0.9;
+ vertical-align: text-top;
+ border-width: thin;
+ background-color: #601919;
+ color: #ffffff;
+ padding: 5px;
+}
+
+table.builds td {
+ padding: 1px 5px;
+}
+
+tr.light { background-color: #ffffff; }
+tr.dark { background-color: #fff8f8; }
+tr.light:hover { background-color: #f8e8e8; }
+tr.dark:hover { background-color: #f8e8e8; }
+
+td.build, td.date {
+ font-family: monospace;
+}
+td.version {
+ text-align: center;
+}
+.commit {
+ width: 100%;
+ text-align: left;
+}
diff --git a/winetest/winetest.conf b/winetest/winetest.conf
index a7ddf3f..e1b0297 100644
--- a/winetest/winetest.conf
+++ b/winetest/winetest.conf
@@ -1,11 +1,14 @@
# Hey Emacs! This is a -*-cperl-*- file!
-$root = "/wine/winetest";
+$root = "/home/winehq/opt/winetest";
$builds = "$root/winetest.builds";
# These two below should be on the same filesystem
$queuedir = "$root/queue";
$datadir = "$root/data";
+$gitdir = "/home/winehq/opt/source/git/wine.git";
+$gitweb = "http://source.winehq.org/git/wine.git";
+
# Maximum number of reports for one version and tag
$maxmult = 10;
diff --git a/winetest/winetest.cron b/winetest/winetest.cron
index e4129db..da41a7c 100755
--- a/winetest/winetest.cron
+++ b/winetest/winetest.cron
@@ -8,12 +8,7 @@ if [ ! -f $lock ]; then
touch $lock
while perl dissect; [ $? -eq 0 -o $? -eq 1 ]; do true; done
while perl gather; do true; done
-
- # move 2-month old results out of the way
- for i in `find ./data -maxdepth 1 -mtime +60 -type d -print`
- do
- mv $i old-data
- done
+ perl build-index
# and archive 6-month old results
(cd old-data && for i in `find . -maxdepth 1 -mtime +180 -type d -print`
More information about the wine-cvs
mailing list