Francois Gouget : testbot/build: Let the TestBot deal with logging.

Alexandre Julliard julliard at winehq.org
Wed Jun 20 17:12:28 CDT 2018


Module: tools
Branch: master
Commit: 170fe0ce2b8c0ca1d30f9129a4c1aaf0430588c5
URL:    https://source.winehq.org/git/tools.git/?a=commit;h=170fe0ce2b8c0ca1d30f9129a4c1aaf0430588c5

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Wed Jun 20 02:44:15 2018 +0200

testbot/build: Let the TestBot deal with logging.

The Engine-side scripts (WineRun*.pl) already redirect stdout and
stderr to the appropriate log. So it does not make sense to delete that
log and then add new redirects for every command started from the
client scripts.
Remove FatalError() since it's not used in Reconfig.pl.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 testbot/bin/build/Build.pl    | 42 ++++++++++-----------------------
 testbot/bin/build/Reconfig.pl | 55 +++++++++++++------------------------------
 2 files changed, 29 insertions(+), 68 deletions(-)

diff --git a/testbot/bin/build/Build.pl b/testbot/bin/build/Build.pl
index e979955..c23bb87 100755
--- a/testbot/bin/build/Build.pl
+++ b/testbot/bin/build/Build.pl
@@ -49,27 +49,19 @@ use WineTestBot::PatchUtils;
 use WineTestBot::Utils;
 
 
-my $LogFileName = "$LogDir/Build.log";
-
 sub InfoMsg(@)
 {
-  my $OldUMask = umask(002);
-  if (open(my $Log, ">>", $LogFileName))
-  {
-    print $Log @_;
-    close($Log);
-  }
-  umask($OldUMask);
+  print @_;
 }
 
 sub LogMsg(@)
 {
-  InfoMsg "Build: ", @_;
+  print "Build: ", @_;
 }
 
 sub FatalError(@)
 {
-  LogMsg @_;
+  print STDERR @_;
   exit 1;
 }
 
@@ -90,10 +82,9 @@ sub ApplyPatch($)
   my ($PatchFile) = @_;
 
   InfoMsg "Applying patch\n";
-  system("( cd $DataDir/wine && set -x && " .
-         "  git apply --verbose ". ShQuote($PatchFile) ." && ".
-         "  git add -A " .
-         ") >>$LogFileName 2>&1");
+  system("cd $DataDir/wine && set -x && ".
+         "git apply --verbose ". ShQuote($PatchFile) ." && ".
+         "git add -A");
   if ($? != 0)
   {
     LogMsg "Patch failed to apply\n";
@@ -104,9 +95,7 @@ sub ApplyPatch($)
   if ($Impacts->{Makefiles})
   {
     InfoMsg "\nRunning make_makefiles\n";
-    system("( cd $DataDir/wine && set -x && " .
-           " ./tools/make_makefiles " .
-           ") >>$LogFileName 2>&1");
+    system("cd $DataDir/wine && set -x && ./tools/make_makefiles");
     if ($? != 0)
     {
       LogMsg "make_makefiles failed\n";
@@ -117,9 +106,7 @@ sub ApplyPatch($)
   if ($Impacts->{Autoconf} && !$Impacts->{HasConfigure})
   {
     InfoMsg "\nRunning autoconf\n";
-    system("( cd $DataDir/wine && set -x && " .
-           "  autoconf " .
-           ") >>$LogFileName 2>&1");
+    system("cd $DataDir/wine && set -x && autoconf");
     if ($? != 0)
     {
       LogMsg "Autoconf failed\n";
@@ -135,9 +122,8 @@ sub BuildNative()
   mkdir "$DataDir/build-native" if (! -d "$DataDir/build-native");
 
   InfoMsg "\nRebuilding native tools\n";
-  system("( cd $DataDir/build-native && set -x && " .
-         "  time make -j$ncpus __tooldeps__ " .
-         ") >>$LogFileName 2>&1");
+  system("cd $DataDir/build-native && set -x && ".
+         "time make -j$ncpus __tooldeps__");
   if ($? != 0)
   {
     LogMsg "Rebuild of native tools failed\n";
@@ -161,9 +147,8 @@ sub BuildTestExecutables($$)
   }
 
   InfoMsg "\nBuilding the $Bits-bit test executable(s)\n";
-  system("( cd $DataDir/build-mingw$Bits && set -x && " .
-         "  time make -j$ncpus ". join(" ", sort @BuildDirs) .
-         ") >>$LogFileName 2>&1");
+  system("cd $DataDir/build-mingw$Bits && set -x && ".
+         "time make -j$ncpus ". join(" ", sort @BuildDirs));
   if ($? != 0)
   {
     LogMsg "Rebuild of $Bits-bit crossbuild failed\n";
@@ -186,9 +171,6 @@ sub BuildTestExecutables($$)
 $ENV{PATH} = "/usr/lib/ccache:/usr/bin:/bin";
 delete $ENV{ENV};
 
-# Start with a clean logfile
-unlink($LogFileName);
-
 my ($PatchFile, $BitIndicators);
 if (@ARGV == 2)
 {
diff --git a/testbot/bin/build/Reconfig.pl b/testbot/bin/build/Reconfig.pl
index c950d49..2da2f54 100755
--- a/testbot/bin/build/Reconfig.pl
+++ b/testbot/bin/build/Reconfig.pl
@@ -43,28 +43,15 @@ sub BEGIN
 use WineTestBot::Config;
 use WineTestBot::PatchUtils;
 
-my $LogFileName = "$LogDir/Reconfig.log";
 
 sub InfoMsg(@)
 {
-  my $OldUMask = umask(002);
-  if (open(my $Log, ">>", $LogFileName))
-  {
-    print $Log @_;
-    close($Log);
-  }
-  umask($OldUMask);
+  print @_;
 }
 
 sub LogMsg(@)
 {
-  InfoMsg "Reconfig: ", @_;
-}
-
-sub FatalError(@)
-{
-  LogMsg @_;
-  exit 1;
+  print "Reconfig: ", @_;
 }
 
 my $ncpus;
@@ -86,9 +73,8 @@ sub BuildTestAgentd()
   if (! -x "$BinDir/build/testagentd")
   {
     InfoMsg "\nBuilding the native testagentd\n";
-    system("( cd $::RootDir/src/testagentd && set -x && " .
-           "  time make -j$ncpus build " .
-           ") >>$LogFileName 2>&1");
+    system("cd $::RootDir/src/testagentd && set -x && ".
+           "time make -j$ncpus build");
     if ($? != 0)
     {
       LogMsg "Build testagentd failed\n";
@@ -97,9 +83,8 @@ sub BuildTestAgentd()
   }
 
   InfoMsg "\nRebuilding the Windows TestAgentd\n";
-  system("( cd $::RootDir/src/testagentd && set -x && " .
-         "  time make -j$ncpus iso " .
-         ") >>$LogFileName 2>&1");
+  system("cd $::RootDir/src/testagentd && set -x && ".
+         "time make -j$ncpus iso");
   if ($? != 0)
   {
     LogMsg "Build winetestbot.iso failed\n";
@@ -112,9 +97,8 @@ sub BuildTestAgentd()
 sub BuildTestLauncher()
 {
   InfoMsg "\nRebuilding TestLauncher\n";
-  system("( cd $::RootDir/src/TestLauncher && set -x && " .
-         "  time make -j$ncpus" .
-         ") >>$LogFileName 2>&1");
+  system("cd $::RootDir/src/TestLauncher && set -x && ".
+         "time make -j$ncpus");
   if ($? != 0)
   {
     LogMsg "Build TestLauncher failed\n";
@@ -127,7 +111,7 @@ sub BuildTestLauncher()
 sub GitPull()
 {
   InfoMsg "\nUpdating the Wine source\n";
-  system("cd $DataDir/wine && git pull >>$LogFileName 2>&1");
+  system("cd $DataDir/wine && git pull");
   if ($? != 0)
   {
     LogMsg "Git pull failed\n";
@@ -150,11 +134,10 @@ sub BuildNative()
 
   # Rebuild from scratch to make sure cruft will not accumulate
   InfoMsg "\nRebuilding native tools\n";
-  system("( cd $DataDir/build-native && set -x && " .
-         "  rm -rf * && " .
-         "  time ../wine/configure --enable-win64 --without-x --without-freetype --disable-winetest && " .
-         "  time make -j$ncpus __tooldeps__ " .
-         ") >>$LogFileName 2>&1");
+  system("cd $DataDir/build-native && set -x && ".
+         "rm -rf * && ".
+         "time ../wine/configure --enable-win64 --without-x --without-freetype --disable-winetest && ".
+         "time make -j$ncpus __tooldeps__");
 
   if ($? != 0)
   {
@@ -174,11 +157,10 @@ sub BuildCross($)
 
   # Rebuild from scratch to make sure cruft will not accumulate
   InfoMsg "\nRebuilding the $Bits-bit test executables\n";
-  system("( cd $DataDir/build-mingw$Bits && set -x && " .
-         "  rm -rf * && " .
-         "  time ../wine/configure --host=$Host --with-wine-tools=../build-native --without-x --without-freetype --disable-winetest && " .
-         "  time make -j$ncpus buildtests" .
-         ") >>$LogFileName 2>&1");
+  system("cd $DataDir/build-mingw$Bits && set -x && ".
+         "rm -rf * && ".
+         "time ../wine/configure --host=$Host --with-wine-tools=../build-native --without-x --without-freetype --disable-winetest && ".
+         "time make -j$ncpus buildtests");
   if ($? != 0)
   {
     LogMsg "Build cross ($Bits bits) failed\n";
@@ -191,9 +173,6 @@ sub BuildCross($)
 $ENV{PATH} = "/usr/lib/ccache:/usr/bin:/bin";
 delete $ENV{ENV};
 
-# Start with a clean logfile
-unlink($LogFileName);
-
 if (! -d "$DataDir/staging" and ! mkdir "$DataDir/staging")
 {
     LogMsg "Unable to create '$DataDir/staging': $!\n";




More information about the wine-cvs mailing list