[PATCH] testbot: Add a GetMTime() helper function.

Francois Gouget fgouget at codeweavers.com
Wed Sep 18 03:07:58 CDT 2019


Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/bin/CheckForWinetestUpdate.pl | 2 +-
 testbot/lib/WineTestBot/PatchUtils.pm | 3 ++-
 testbot/lib/WineTestBot/Utils.pm      | 8 +++++++-
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/testbot/bin/CheckForWinetestUpdate.pl b/testbot/bin/CheckForWinetestUpdate.pl
index eaff8923f..c677af2f4 100755
--- a/testbot/bin/CheckForWinetestUpdate.pl
+++ b/testbot/bin/CheckForWinetestUpdate.pl
@@ -118,7 +118,7 @@ sub UpdateWineTest($$)
   my $Request = HTTP::Request->new(GET => $WineTestUrls{$Build});
   if (-r $LatestFileName)
   {
-    my $Since = gmtime((stat $LatestFileName)[9]);
+    my $Since = gmtime(GetMTime($LatestFileName));
     $Request->header("If-Modified-Since" => "$Since GMT");
   }
   Debug("Checking $WineTestUrls{$Build}\n");
diff --git a/testbot/lib/WineTestBot/PatchUtils.pm b/testbot/lib/WineTestBot/PatchUtils.pm
index d96b14a7a..71be9cf00 100644
--- a/testbot/lib/WineTestBot/PatchUtils.pm
+++ b/testbot/lib/WineTestBot/PatchUtils.pm
@@ -37,6 +37,7 @@ our @EXPORT = qw(GetPatchImpacts LastPartSeparator UpdateWineData
 use List::Util qw(min max);
 
 use WineTestBot::Config;
+use WineTestBot::Utils;
 
 
 #
@@ -83,7 +84,7 @@ files and a hashtable of all the Wine files.
 sub _LoadWineFiles()
 {
   my $FileName = "$DataDir/latest/winefiles.txt";
-  my $MTime = (stat($FileName))[9] || 0;
+  my $MTime = GetMTime($FileName);
 
   if ($_TestList and $_TimeStamp == $MTime)
   {
diff --git a/testbot/lib/WineTestBot/Utils.pm b/testbot/lib/WineTestBot/Utils.pm
index 711917c7a..309fb19ce 100644
--- a/testbot/lib/WineTestBot/Utils.pm
+++ b/testbot/lib/WineTestBot/Utils.pm
@@ -28,7 +28,7 @@ WineTestBot::Utils - Utility functions
 
 use Exporter 'import';
 our @EXPORT = qw(MakeSecureURL SecureConnection GenerateRandomString
-                 OpenNewFile CreateNewFile CreateNewLink CreateNewDir
+                 OpenNewFile CreateNewFile CreateNewLink CreateNewDir GetMTime
                  DurationToString BuildEMailRecipient IsValidFileName
                  BuildTag SanitizeTag LocaleName NotifyAdministrator
                  BatchQuote ShQuote ShArgv2Cmd);
@@ -255,6 +255,12 @@ sub CreateNewDir($$)
   }
 }
 
+sub GetMTime($)
+{
+  my ($Filename) = @_;
+  return (stat($Filename))[9] || 0;
+}
+
 
 #
 # WineTest helpers
-- 
2.20.1




More information about the wine-devel mailing list