Francois Gouget : testbot/WineRunTask: Use a trampoline script to capture cmd errors.

Alexandre Julliard julliard at winehq.org
Thu Oct 31 16:46:47 CDT 2019


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

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Thu Oct 31 16:54:23 2019 +0100

testbot/WineRunTask: Use a trampoline script to capture cmd errors.

This side-steps the console / redirection bug in the currently deployed
versions of TestAgentd.
This also side-steps cmd's command line parsing bug. When given
["cmd". "/c", "script.bat >Task.log"] TestAgent would build a command
line of the form '"cmd" "/c" "script.bat >Task.log"' which would lead
cmd to try to run '"script.bat >Task.log'. This would fail because of
the extraneous double quote. Note that cmd fails in the same way for
'cmd "/c" "script.bat >Task.log"'.

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

---

 testbot/bin/WineRunTask.pl | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/testbot/bin/WineRunTask.pl b/testbot/bin/WineRunTask.pl
index 0177e05..1f21050 100755
--- a/testbot/bin/WineRunTask.pl
+++ b/testbot/bin/WineRunTask.pl
@@ -502,14 +502,19 @@ if (!$TA->SendFileFromString($Script, "script.bat", $TestAgent::SENDFILE_EXE))
   FatalTAError($TA, "Could not send the task script to the VM");
 }
 
+my $Logger = "script.bat >Task.log 2>&1\r\n";
+if (!$TA->SendFileFromString($Logger, "cmdlogger.bat", $TestAgent::SENDFILE_EXE))
+{
+  FatalTAError($TA, "Could not send the logging script to the VM");
+}
+
 
 #
 # Run the test
 #
 
 Debug(Elapsed($Start), " Starting the script\n");
-my $TaskLog = $TA->HasMinVersion(1, 7) ? "Task.log" : undef;
-my $Pid = $TA->Run(["./script.bat"], 0, undef, $TaskLog, $TaskLog);
+my $Pid = $TA->Run(["./cmdlogger.bat"], 0);
 if (!$Pid)
 {
   FatalTAError($TA, "Failed to start the test");
@@ -540,13 +545,10 @@ if (!defined $TA->Wait($Pid, $Timeout, $Keepalive))
   }
 }
 
-if (defined $TaskLog)
+Debug(Elapsed($Start), " Retrieving 'Task.log'\n");
+if (!$TA->GetFile("Task.log", "$TaskDir/log") and !defined $TAError)
 {
-  Debug(Elapsed($Start), " Retrieving 'Task.log'\n");
-  if (!$TA->GetFile($TaskLog, "$TaskDir/log") and !defined $TAError)
-  {
-    $TAError = "An error occurred while retrieving the task log: ". $TA->GetLastError();
-  }
+  $TAError = "An error occurred while retrieving the task log: ". $TA->GetLastError();
 }
 
 Debug(Elapsed($Start), " Retrieving the report file to '$RptFileName'\n");




More information about the wine-cvs mailing list