Francois Gouget : testbot/LogUtils: Add support for arrays in .errors files.

Alexandre Julliard julliard at winehq.org
Mon Jan 25 16:41:51 CST 2021


Module: tools
Branch: master
Commit: 2f043aaf3b5aff2478343ddc2b7cf4391182e72a
URL:    https://source.winehq.org/git/tools.git/?a=commit;h=2f043aaf3b5aff2478343ddc2b7cf4391182e72a

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Mon Jan 25 14:52:28 2021 +0100

testbot/LogUtils: Add support for arrays in .errors files.

Array lines allow providing multiple values for a given 'property' name.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 testbot/lib/WineTestBot/LogUtils.pm | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/testbot/lib/WineTestBot/LogUtils.pm b/testbot/lib/WineTestBot/LogUtils.pm
index 3488c7b..7971435 100644
--- a/testbot/lib/WineTestBot/LogUtils.pm
+++ b/testbot/lib/WineTestBot/LogUtils.pm
@@ -848,6 +848,10 @@ Property lines contain (name, value) pairs.
 Note that properties which can be calculated while reading the errors file
 are not saved (e.g. ErrCount and NewCount).
 
+=item a <name> <value>
+Array lines contain (name, value) pairs and can appear multiple times for a
+given name, resulting in a corresponding list of values.
+
 =item g <lineno> <groupname>
 Group lines contain the group name and the line number of the first line of
 the group in the log. Note that the first line would typically not be an
@@ -897,6 +901,22 @@ sub LoadLogErrorsFromFh($$)
         return $Line;
       }
     }
+    elsif ($Type eq "a")
+    {
+      if (!defined $LogInfo->{$Property})
+      {
+        $LogInfo->{$Property} = [ $Value ];
+      }
+      elsif (ref($LogInfo->{$Property}) eq "ARRAY")
+      {
+        push @{$LogInfo->{$Property}}, $Value;
+      }
+      else
+      {
+        $LogInfo->{BadLog} = "$LogInfo->{LineNo}: $Property is not an array, its value is $LogInfo->{$Property}";
+        return $Line;
+      }
+    }
     elsif ($Type eq "g")
     {
       $LogInfo->{CurGroup} = _AddLogGroup($LogInfo, $Value, $Property);
@@ -1025,7 +1045,15 @@ sub _DumpErrors
       next;
     }
 
-    print STDERR "+ $Key $LogInfo->{$Key}\n";
+    if (ref($LogInfo->{$Key}) eq "ARRAY")
+    {
+      print STDERR "+ $Key\n";
+      map { print STDERR "  | $_\n" } (@{$LogInfo->{$Key}});
+    }
+    else
+    {
+      print STDERR "+ $Key $LogInfo->{$Key}\n";
+    }
   }
   _WriteLogErrorsToFh(*STDERR, $LogInfo);
   map { _DumpErrors("$Label.$_", $LogInfo->{$_}) } (@SubKeys);




More information about the wine-cvs mailing list