testbot/web: Make JobDetails.pl handle empty err logs correctly.

Francois Gouget fgouget at codeweavers.com
Wed Mar 27 10:39:45 CDT 2013


The task scripts used to create the err log and then delete it if it was empty. However the Task module now redirects the script's stderr to the err log to help diagnose script bugs (e.g. perl errors). That means the script must only append to the err log and should certainly not delete it.
So JobDetails.pl should now be able to deal with empty err logs.
---

I could look for another place where empty err logs can be deleted but 
being able to deal with them as is seems much more robust.


 testbot/web/JobDetails.pl |   23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/testbot/web/JobDetails.pl b/testbot/web/JobDetails.pl
index 8be5076..66325f6 100644
--- a/testbot/web/JobDetails.pl
+++ b/testbot/web/JobDetails.pl
@@ -391,22 +391,25 @@ sub GenerateBody
 
       if (open ERRFILE, "<$ErrName")
       {
-        if (! $First)
-        {
-          print "</code></pre>\n";
-          $First = 1;
-        }
+        $CurrentDll = "*err*";
         while (defined($Line = <ERRFILE>))
         {
           $HasLogEntries = 1;
           chomp($Line);
-          if ($First)
+          if ($PrintedDll ne $CurrentDll)
           {
-            print "<br>\n";
-            print "<pre><code>";
-            $First = !1;
+            if ($First)
+            {
+              $First = !1;
+            }
+            else
+            {
+              print "</code></pre>\n";
+            }
+            $PrintedDll = $CurrentDll;
           }
-          print $self->escapeHTML($Line), "\n";
+          print "<br>\n";
+          print "<pre><code>", $self->escapeHTML($Line), "\n";
         }
         close ERRFILE;
       }
-- 
1.7.10.4




More information about the wine-patches mailing list