Module: tools Branch: master Commit: bf85455d64e25705afd326ef335e99f1a1d218cf URL: https://source.winehq.org/git/tools.git/?a=commit;h=bf85455d64e25705afd326ef...
Author: Francois Gouget fgouget@codeweavers.com Date: Fri Jun 24 16:24:51 2022 +0200
testbot: Treat regular expression warnings as errors.
In particular do so when validating failures so errors are caught when the failure is created / modified.
Signed-off-by: Francois Gouget fgouget@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
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 90620511..dc307bfa 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 9e73b5f6..41016314 100644 --- a/testbot/lib/WineTestBot/LogUtils.pm +++ b/testbot/lib/WineTestBot/LogUtils.pm @@ -1390,7 +1390,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} ||= []; @@ -1412,7 +1415,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} ||= [];