[tools] testbot/UpdateFailures: Truncate the bug status and description if needed.

Francois Gouget fgouget at codeweavers.com
Fri Jun 24 09:26:21 CDT 2022


They have to fit otherwise Failure::Validate() will prevent saving to 
the database.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/bin/UpdateFailures.pl | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/testbot/bin/UpdateFailures.pl b/testbot/bin/UpdateFailures.pl
index 7c89b7b99b..f324cca280 100755
--- a/testbot/bin/UpdateFailures.pl
+++ b/testbot/bin/UpdateFailures.pl
@@ -157,6 +157,7 @@ foreach my $FailureId (@FailureIds)
 
 # Update the failures bug information
 my $Bugs = CollectBugInfo([keys %$BugIds]);
+my ($MaxStatusLen, $MaxDescriptionLen);
 foreach my $FailureId (@FailureIds)
 {
   my $Failure = $Failures->GetItem($FailureId);
@@ -167,9 +168,19 @@ foreach my $FailureId (@FailureIds)
     {
       my $Resolution = $Bug->{Resolution} || " ---";
       $Resolution = $Resolution eq " ---" ? "" : " $Resolution";
-      $Failure->BugStatus("$Bug->{Status}$Resolution");
+      if (!defined $MaxStatusLen)
+      {
+        my $PropertyDescriptor = $Failure->GetPropertyDescriptorByName("BugStatus");
+        $MaxStatusLen = $PropertyDescriptor->GetMaxLength();
+      }
+      $Failure->BugStatus(substr("$Bug->{Status}$Resolution", 0, $MaxStatusLen));
+    }
+    if (!defined $MaxDescriptionLen)
+    {
+      my $PropertyDescriptor = $Failure->GetPropertyDescriptorByName("BugDescription");
+      $MaxDescriptionLen = $PropertyDescriptor->GetMaxLength();
     }
-    $Failure->BugDescription($Bug->{Description});
+    $Failure->BugDescription(substr($Bug->{Description}, 0, $MaxDescriptionLen));
   }
   else
   {
-- 
2.30.2



More information about the wine-devel mailing list