[tools] testbot: Treat regular expression warnings as errors.

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


In particular do so when validating failures so errors are caught
when the failure is created / modified.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/lib/WineTestBot/Failures.pm |  1 +
 testbot/lib/WineTestBot/LogUtils.pm | 10 ++++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/testbot/lib/WineTestBot/Failures.pm b/testbot/lib/WineTestBot/Failures.pm
index 4a65374988..dee8b68558 100644
--- a/testbot/lib/WineTestBot/Failures.pm
+++ b/testbot/lib/WineTestBot/Failures.pm
@@ -104,6 +104,7 @@ sub Validate($)
     my ($Field, $Name) = @$Pair;
     my $RegExp = $self->$Field;
     my $ErrMessage = eval {
+      use warnings FATAL => qw(regexp);
       if ($RegExp and "" =~ /$RegExp/)
       {
         return "The $Name regular expression should not match empty strings";
diff --git a/testbot/lib/WineTestBot/LogUtils.pm b/testbot/lib/WineTestBot/LogUtils.pm
index 99941b54a1..651c1d0a47 100644
--- a/testbot/lib/WineTestBot/LogUtils.pm
+++ b/testbot/lib/WineTestBot/LogUtils.pm
@@ -1391,7 +1391,10 @@ sub MatchLogFailures($$)
   {
     # Ignore failures that don't apply to this configuration
     my $ConfigRegExp = $Failure->ConfigRegExp;
-    my $Match = eval { !$ConfigRegExp or $ConfigName =~ /$ConfigRegExp/ };
+    my $Match = eval {
+      use warnings FATAL => qw(regexp);
+      !$ConfigRegExp or $ConfigName =~ /$ConfigRegExp/;
+    };
     next if (!$Match);
 
     my $UnitFailures = $FailureTree{$Failure->ErrorGroup}->{$Failure->TestUnit} ||= [];
@@ -1413,7 +1416,10 @@ sub MatchLogFailures($$)
       foreach my $UnitFailure (@$UnitFailures)
       {
         my $RegExp = $UnitFailure->FailureRegExp;
-        my $Match = eval { $RegExp and $Line =~ /$RegExp/ };
+        my $Match = eval {
+          use warnings FATAL => qw(regexp);
+          $RegExp and $Line =~ /$RegExp/;
+        };
         next if (!$Match);
 
         my $LineFailures = $Group->{Failures}->{$ErrIndex} ||= [];
-- 
2.30.2




More information about the wine-devel mailing list