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@codeweavers.com --- 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 be0b0f673..ea3ad4eb1 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");