Alexandre Julliard : patches: Add server-side scripts for testbot result handling.

Alexandre Julliard julliard at winehq.org
Mon May 3 11:51:30 CDT 2010


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon May  3 13:38:34 2010 +0200

patches: Add server-side scripts for testbot result handling.

---

 patches/expire         |    6 +++
 patches/filter-testbot |   82 ++++++++++++++++++++++++++++++++++++++++++++++++
 patches/notify-bot     |   35 ++++++++++++++++++++
 3 files changed, 123 insertions(+), 0 deletions(-)

diff --git a/patches/expire b/patches/expire
index 0b3ac8c..a990bfa 100755
--- a/patches/expire
+++ b/patches/expire
@@ -116,6 +116,8 @@ foreach my $file (sort readdir DIR)
                 rename "$dir/$file",        "$dir/OLD/$file";
                 rename "$dir/$file.status", "$dir/OLD/$file.status";
                 rename "$dir/$file.order",  "$dir/OLD/$file.order";
+                rename "$dir/$file.testbot", "$dir/OLD/$file.testbot";
+                rename "$dir/$file.testfail", "$dir/OLD/$file.testfail";
             }
         }
         else
@@ -126,6 +128,8 @@ foreach my $file (sort readdir DIR)
                 unlink "$dir/$file";
                 unlink "$dir/$file.status";
                 unlink "$dir/$file.order";
+                unlink "$dir/$file.testbot";
+                unlink "$dir/$file.testfail";
             }
         }
     }
@@ -154,6 +158,8 @@ foreach my $file (sort readdir DIR)
             unlink "$dir/OLD/$file";
             unlink "$dir/OLD/$file.status";
             unlink "$dir/OLD/$file.order";
+            unlink "$dir/OLD/$file.testbot";
+            unlink "$dir/OLD/$file.testfail";
         }
     }
 }
diff --git a/patches/filter-testbot b/patches/filter-testbot
new file mode 100755
index 0000000..3c4e33b
--- /dev/null
+++ b/patches/filter-testbot
@@ -0,0 +1,82 @@
+#!/usr/bin/perl -w
+#
+# Filter a testbot result report.
+#
+# Copyright 2010 Alexandre Julliard
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+use strict;
+
+my $step = 0;
+my $patch = 0;
+my $failed = 0;
+
+while (<>)
+{
+    if (/^--- BEGIN GENERAL ---$/)
+    {
+        $step = 1;
+        next;
+    }
+    if (/^--- BEGIN NEW_ERRORS ---$/)
+    {
+        $step = 2;
+        next;
+    }
+    if (/^--- BEGIN FULL_LOGS ---$/)
+    {
+        $step = 3;
+        next;
+    }
+    if (/^--- END GENERAL ---$/)
+    {
+        die "no patch id found" unless $patch > 0;
+        if ($failed)
+        {
+            open TESTFAIL, ">patches/$patch.testfail" or die "cannot create $patch.testfail";
+        }
+        open TESTBOT, ">patches/$patch.testbot" or die "cannot create $patch.testbot";
+        $step = 0;
+        next;
+    }
+    if (/^--- END/)
+    {
+        $step = 0;
+        next;
+    }
+    if ($step == 1 && /^Patch: (\d+)/)
+    {
+        $patch = $1;
+        next;
+    }
+    if ($step == 1 && /^Test-Result:\s+Failed/)
+    {
+        $failed = 1;
+        next;
+    }
+    if ($step == 2 && $failed)
+    {
+        print TESTFAIL $_;
+        next;
+    }
+    if ($step == 3)
+    {
+        print TESTBOT $_;
+        next;
+    }
+}
+close TESTFAIL if $failed;
+close TESTBOT;
diff --git a/patches/notify-bot b/patches/notify-bot
new file mode 100755
index 0000000..104a496
--- /dev/null
+++ b/patches/notify-bot
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# Notify winetestbot of the arrival of new patches
+#
+# Copyright 2010 Alexandre Julliard
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+notify_addr="$1"
+subject="New patches available at http://source.winehq.org/patches"
+test -n "$notify_addr" || exit 0
+
+old=`cat $HOME/.next-patch`
+next=$old
+while test -f /home/winehq/opt/source/patches/data/$next
+do
+    next=`expr $next + 1`
+done
+if test $next -gt $old
+then
+    echo $next >$HOME/.next-patch
+    echo "The latest patch is `expr $next - 1`" | Mail -s "$subject" "$notify_addr"
+fi




More information about the wine-cvs mailing list