Alexandre Julliard : winetest: Show the number of failures per build/ version on the index page.

Alexandre Julliard julliard at winehq.org
Tue Sep 16 14:49:45 CDT 2008


Module: tools
Branch: master
Commit: a459d639b139a0d36cefc389cec7d978337b9536
URL:    http://source.winehq.org/git/tools.git/?a=commit;h=a459d639b139a0d36cefc389cec7d978337b9536

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Sep 16 21:47:10 2008 +0200

winetest: Show the number of failures per build/version on the index page.

Use the same formatting and colors as the other report pages.

---

 winetest/build-index |   70 +++++++++++++++++++++++++++++++------------------
 winetest/index.css   |   52 -------------------------------------
 winetest/summary.css |    9 ++++++
 3 files changed, 53 insertions(+), 78 deletions(-)

diff --git a/winetest/build-index b/winetest/build-index
index cf4f4fc..50d8b12 100755
--- a/winetest/build-index
+++ b/winetest/build-index
@@ -83,18 +83,18 @@ my %versions = ();
 foreach my $build (@builds)
 {
     my %build_ver = ();
-    if (opendir( DIR, "./data/$build->{name}" ))
+    if (open TOTAL, "./data/$build->{name}/total.txt" )
     {
-        foreach my $run (readdir(DIR))
+        while (<TOTAL>)
         {
-            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}++;
+            if (/^([A-Za-z0-9]+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/)
+            {
+                my ($name, $runs, $tests, $errors, $todos) = ($1, $2, $3, $4, $5);
+                $versions{$name}++;
+                $build_ver{$name} = [ $runs, $tests, $errors, $todos ];
+            }
         }
-        closedir(DIR);
+        close TOTAL;
     }
     $build->{versions} = \%build_ver;
 }
@@ -205,46 +205,64 @@ print OUT <<"EOF";
 <html>
 <head>
   <title>Wine test runs</title>
-  <link rel="stylesheet" href="/index.css" type="text/css">
+  <link rel="stylesheet" href="/summary.css" type="text/css">
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 </head>
 <body>
+<div class="main">
+<h2>Wine test runs</h2>
 EOF
 
-print OUT "<table class=\"builds\"><tr><th class=\"build\">Build</th><th class=\"date\">Date</th>\n";
+print OUT "<table class=\"report\"><thead><tr><th class=\"test\">Build</th><th class=\"test\">Date</th>\n";
 foreach my $ver (@groups)
 {
     next unless defined($versions{$ver->{name}});
-    printf OUT "<th class=\"version\">%s</th>", $ver->{name};
+    printf OUT "<th class=\"test\">%s</th>", $ver->{name};
 }
-print OUT "<th class=\"commit\">Head commit</th></tr>\n";
+print OUT "<th colspan=\"3\">Failures</th><th></th></tr></thead>\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);
+    printf OUT "  <tr><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];
+    my ($total_runs, $total_tests, $total_errors, $total_todos);
     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)
+        my $counts = $build->{versions}->{$ver->{name}};
+        if (!defined @{$counts})
         {
-            printf OUT "<td class=\"version\"><a href=\"%s/#group_%s\">%u</a></td>", $build->{name}, $ver->{name}, $count;
+            printf OUT "<td class=\"note\"> </td>";
         }
         else
         {
-            printf OUT "<td class=\"version\"><a href=\"%s\">%u</a></td>", $build->{name}, $count;
+            my ($runs, $tests, $errors, $todos) = @{$counts};
+            my $href = $runs > 1 ? "$build->{name}/#group_$ver->{name}" : "$build->{name}";
+            my $title = $runs > 1 ? "$runs test runs, " : "";
+            $title .= "$tests unit tests, $errors have errors";
+            $title .= ", $todos have todos" if ($todos);
+            my $class = $errors ? ($todos ? "fail also-todo" : "fail") : ($todos ? "todo" : "pass");
+            printf OUT "<td class=\"result %s\"><a title=\"%s\" href=\"%s\">%u</a></td>", $class, $title, $href, $errors || $todos;
+            $total_runs++;
+            $total_tests += $tests;
+            $total_errors += $errors;
+            $total_todos += $todos;
         }
     }
-    print OUT "\n  <td class=\"commit\">";
+    if ($total_tests)
+    {
+        my $class = $total_errors ? "fail" : $total_todos ? "pass also-todo" : "pass";
+        my $title = sprintf "%u test runs, %u total unit tests, %u have errors", $total_runs, $total_tests, $total_errors;
+        $title .= ", $total_todos have todos" if $total_todos;
+        printf OUT "\n  <td>&nbsp;</td><td class=\"result %s\"><a title=\"%s\" href=\"%s\">%4.1f%%</a></td><td>&nbsp;</td>\n",
+                        $class, $title, $build->{name}, $total_errors * 100 / $total_tests;
+    }
+    else
+    {
+        print OUT "\n  <td>&nbsp;</td><td class=\"note\">&nbsp;</td><td>&nbsp;</td>\n";
+    }
+    print OUT "  <td class=\"commitlink\">";
     if ($build->{subj}) { printf OUT "<a href=\"$gitweb?a=shortlog;h=%s\">%s</a>", $build->{name}, escapeHTML($build->{subj}); }
     print OUT "</td></tr>\n";
 }
diff --git a/winetest/index.css b/winetest/index.css
deleted file mode 100644
index 020193d..0000000
--- a/winetest/index.css
+++ /dev/null
@@ -1,52 +0,0 @@
-/* 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: small;
-}
-
-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; }
-
-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;
-    font-size: medium;
-}
-td.version {
-    text-align: center;
-}
-.commit {
-    width: 100%;
-    text-align: left;
-}
diff --git a/winetest/summary.css b/winetest/summary.css
index ae4b31f..1a0711e 100644
--- a/winetest/summary.css
+++ b/winetest/summary.css
@@ -146,6 +146,15 @@ table.report td.test {
 table.report td.links {
         font-size: x-small;
 }
+table.report th.commitlink, td.commitlink {
+        text-align: left;
+}
+table.report td.build, td.date {
+        font-family: monospace;
+        font-size: medium;
+        padding-left: 5px;
+        padding-right: 5px;
+}
 form td {
         text-align: left;
 }




More information about the wine-cvs mailing list