Francois Gouget : testbot: Simplify and / or optimize some regular expressions.

Alexandre Julliard julliard at winehq.org
Thu Apr 18 13:40:58 CDT 2013


Module: tools
Branch: master
Commit: a13c885191e14ad205d61e33374aebfe7ee0186b
URL:    http://source.winehq.org/git/tools.git/?a=commit;h=a13c885191e14ad205d61e33374aebfe7ee0186b

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Thu Apr 18 19:20:29 2013 +0200

testbot: Simplify and / or optimize some regular expressions.

---

 testbot/bin/WineSendLog.pl         |    6 +++---
 testbot/lib/WineTestBot/Patches.pm |    2 +-
 testbot/web/Submit.pl              |    4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/testbot/bin/WineSendLog.pl b/testbot/bin/WineSendLog.pl
index 4e678bd..0b31e7c 100755
--- a/testbot/bin/WineSendLog.pl
+++ b/testbot/bin/WineSendLog.pl
@@ -392,7 +392,8 @@ EOF
     my ($BotFailure, $MessagesFromErr) = CheckErrLog("$TaskDir/err");
     if (! $BotFailure)
     {
-      my $Bits = ($StepTask->FileName =~ /_test64\.exe$/ ? 64 : 32);
+      $StepTask->FileName =~ m/^(.*)_test(64)?\.exe$/;
+      my ($BaseName, $Bits) = ($1, $2 || "32");
       my $LatestName = "$DataDir/latest/" . $StepTask->VM->Name . "_$Bits";
       my ($LatestBotFailure, $Dummy) = CheckErrLog("$LatestName.err");
       my $MessagesFromLog = "";
@@ -400,9 +401,8 @@ EOF
       {
         if (defined($StepTask->CmdLineArg))
         {
-          $StepTask->FileName =~ m/^(.*)_test(64)?\.exe/;
           $MessagesFromLog = CompareLogs("$LatestName.log", "$TaskDir/log",
-                                         $1, $StepTask->CmdLineArg);
+                                         $BaseName, $StepTask->CmdLineArg);
         }
       }
       else
diff --git a/testbot/lib/WineTestBot/Patches.pm b/testbot/lib/WineTestBot/Patches.pm
index 186398d..a478fbf 100644
--- a/testbot/lib/WineTestBot/Patches.pm
+++ b/testbot/lib/WineTestBot/Patches.pm
@@ -131,7 +131,7 @@ sub Submit
     my $Line;
     while (defined($Line = <BODY>))
     {
-      if ($Line =~ m/^\+\+\+ .*\/(dlls|programs)\/([^\/]+)\/tests\/([^\/\s]+)/)
+      if ($Line =~ m~^\+\+\+ .*/(dlls|programs)/([^/]+)/tests/([^/\s]+)~)
       {
         my $FileType = "patch$1";
         my $BaseName = $2;
diff --git a/testbot/web/Submit.pl b/testbot/web/Submit.pl
index 1288bf0..bbab0e0 100644
--- a/testbot/web/Submit.pl
+++ b/testbot/web/Submit.pl
@@ -564,7 +564,7 @@ sub DetermineFileType
       my $PrevMinus = !1;
       while (defined($Line = <FH>))
       {
-        if ($Line =~ m/^\+\+\+ .*\/(dlls|programs)\/([^\/]+)\/tests\/([^\/\s]+)/)
+        if ($Line =~ m~^\+\+\+ .*/(dlls|programs)/([^/]+)/tests/([^/\s]+)~)
         {
           $FileType = "patch$1";
           my $ThisDllBaseName = $2;
@@ -875,7 +875,7 @@ sub OnSubmit
           my $FileName=$self->GetParam("TestExecutable");
           if ($Bits eq "64")
           {
-            $FileName =~ s/^([a-zA-Z0-9_.]+)_test\.exe/\1_test64.exe/;
+            $FileName =~ s/_test\.exe$/_test64.exe/;
           }
           $TestStep->FileName($FileName);
           $TestStep->InStaging(!1);




More information about the wine-cvs mailing list