[PATCH] testbot: Add a dir option to specify the directory on Wine missions.

Francois Gouget fgouget at codeweavers.com
Mon Dec 3 13:19:29 CST 2018


This allows running the tests in a regular directory, in the root of a
drive or on a non-c: drive.
By default the tests are now run in the root of the wineprefix's c: 
drive.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/bin/WineRunReconfig.pl |  3 ++-
 testbot/bin/WineRunWineTest.pl |  6 +++---
 testbot/bin/build/WineTest.pl  | 20 +++++++++++---------
 testbot/lib/Build/Utils.pm     | 29 +++++++++++++++++++++++------
 testbot/web/admin/VMDetails.pl |  1 +
 5 files changed, 40 insertions(+), 19 deletions(-)

diff --git a/testbot/bin/WineRunReconfig.pl b/testbot/bin/WineRunReconfig.pl
index f61ee65e7e..c903ae3695 100755
--- a/testbot/bin/WineRunReconfig.pl
+++ b/testbot/bin/WineRunReconfig.pl
@@ -47,6 +47,7 @@ use WineTestBot::VMs;
 use WineTestBot::Log;
 use WineTestBot::LogUtils;
 use WineTestBot::Missions;
+use WineTestBot::Utils;
 use WineTestBot::Engine::Notify;
 
 
@@ -346,7 +347,7 @@ my $Script = $VM->Type eq "wine" ? "WineReconfig.pl" : "Reconfig.pl";
 $Script = "#!/bin/sh\n".
           "( set -x\n".
           "  git pull &&\n".
-          "  ../bin/build/$Script ". MergeMissionStatementTasks($Task->Missions) ."\n".
+          "  ../bin/build/$Script ". ShQuote(MergeMissionStatementTasks($Task->Missions)) ."\n".
           ") >Reconfig.log 2>&1\n";
 my $TA = $VM->GetAgent();
 Debug(Elapsed($Start), " Sending the script: [$Script]\n");
diff --git a/testbot/bin/WineRunWineTest.pl b/testbot/bin/WineRunWineTest.pl
index 19e3e8f3eb..5ce1448eb0 100755
--- a/testbot/bin/WineRunWineTest.pl
+++ b/testbot/bin/WineRunWineTest.pl
@@ -439,7 +439,7 @@ $Script .= "  ../bin/build/WineTest.pl ";
 if ($Step->Type eq "suite")
 {
   my $BaseTag = BuildTag($VM->Name);
-  $Script .= "--winetest ". $Task->Missions ." $BaseTag ";
+  $Script .= "--winetest ". ShQuote($Task->Missions) ." $BaseTag ";
   if (defined $WebHostName)
   {
     my $StepTask = 100 * $StepNo + $TaskNo;
@@ -455,11 +455,11 @@ if ($Step->Type eq "suite")
 }
 elsif ($Step->FileType eq "patch")
 {
-  $Script .= "--testpatch ". $Task->Missions ." patch.diff";
+  $Script .= "--testpatch ". ShQuote($Task->Missions) ." patch.diff";
 }
 else
 {
-  $Script .= join(" ", "--testexe", $Task->Missions, $FileName, $Task->CmdLineArg);
+  $Script .= join(" ", "--testexe", ShQuote($Task->Missions), $FileName, $Task->CmdLineArg);
 }
 $Script .= "\n) >Task.log 2>&1\n";
 Debug(Elapsed($Start), " Sending the script: [$Script]\n");
diff --git a/testbot/bin/build/WineTest.pl b/testbot/bin/build/WineTest.pl
index b7389ba25e..b47a6bf0fc 100755
--- a/testbot/bin/build/WineTest.pl
+++ b/testbot/bin/build/WineTest.pl
@@ -99,9 +99,9 @@ sub DailyWineTest($$$$)
   # Run WineTest. Ignore the exit code since it returns non-zero whenever
   # there are test failures.
   my $Tag = SanitizeTag("$BaseTag-$BaseName");
-  RunWine($Mission, "./programs/winetest/winetest.exe.so",
-          "-c -o '../$BaseName.report' -t $Tag ". ShArgv2Cmd(@$Args));
-  if (!-f "$BaseName.report")
+  RunWine($Mission, "programs/winetest/winetest.exe.so",
+          "-c -o '$DataDir/$BaseName.report' -t $Tag ". ShArgv2Cmd(@$Args));
+  if (!-f "$DataDir/$BaseName.report")
   {
     LogMsg "WineTest did not produce the $BaseName report\n";
     return 0;
@@ -109,8 +109,8 @@ sub DailyWineTest($$$$)
 
   # Send the report to the website
   if ((!$NoSubmit and !$Mission->{nosubmit}) and
-      RunWine($Mission, "./programs/winetest/winetest.exe.so",
-              "-c -s '../$BaseName.report'"))
+      RunWine($Mission, "programs/winetest/winetest.exe.so",
+              "-c -s '$DataDir/$BaseName.report'"))
   {
     LogMsg "WineTest failed to send the $BaseName report\n";
     # Soldier on in case it's just a network issue
@@ -168,10 +168,10 @@ sub TestPatch($$)
 
   # Run WineTest. Ignore the exit code since it returns non-zero whenever
   # there are test failures.
-  RunWine($Mission, "./programs/winetest/winetest.exe.so",
-          "-c -o '../$BaseName.report' -t do.not.submit ".
+  RunWine($Mission, "programs/winetest/winetest.exe.so",
+          "-c -o '$DataDir/$BaseName.report' -t do.not.submit ".
           join(" ", @TestList));
-  if (!-f "$BaseName.report")
+  if (!-f "$DataDir/$BaseName.report")
   {
     LogMsg "WineTest did not produce the $BaseName report\n";
     return 0;
@@ -197,7 +197,9 @@ sub TestExe($$$)
   }
 
   # Run the test executable
-  RunWine($Mission, "./TestLauncher.exe.so", "-t 120 ". ShArgv2Cmd($FileName, @$Args) ." >'../$BaseName.report'");
+  RunWine($Mission, "TestLauncher.exe.so",
+          "-t 120 ". ShArgv2Cmd($FileName, @$Args)
+          ." >'$DataDir/$BaseName.report'");
 
   return 1;
 }
diff --git a/testbot/lib/Build/Utils.pm b/testbot/lib/Build/Utils.pm
index c53f6099c5..b204386827 100644
--- a/testbot/lib/Build/Utils.pm
+++ b/testbot/lib/Build/Utils.pm
@@ -348,10 +348,26 @@ sub RunWine($$$)
 {
   my ($Mission, $Cmd, $CmdArgs) = @_;
 
-  my $Magic = `cd '$DataDir/wine-$Mission->{Build}' && file $Cmd`;
-  my $Wine = ($Magic =~ /ELF 64/ ? "./wine64" : "./wine");
-  return system("cd '$DataDir/wine-$Mission->{Build}' && set -x && ".
-                "time $Wine $Cmd $CmdArgs");
+  my $WineDir = "$DataDir/wine-$Mission->{Build}";
+  $Cmd = "$WineDir/$Cmd" if ($Cmd =~ /\.exe\.so$/);
+
+  my $CurDir = "$ENV{WINEPREFIX}/dosdevices";
+  if (!-d $CurDir)
+  {
+    $CurDir = ".";
+  }
+  else
+  {
+    my $Dir = $Mission->{dir} || "";
+    # We cannot put colons in missions so restore the drive letter
+    $Dir = "$CurDir/c:/$Dir" if ($Dir !~ s~^([a-z])/~$CurDir/$1:/~);
+    $CurDir = -d $Dir ? $Dir : "$ENV{WINEPREFIX}/dosdevices/c:";
+  }
+
+  my $Magic = `file '$Cmd'`;
+  my $Wine = ($Magic =~ /ELF 64/ ? "$WineDir/wine64" : "$WineDir/wine");
+  return system("set -x && cd '$CurDir' && ".
+                "time '$Wine' '$Cmd' $CmdArgs");
 }
 
 
@@ -367,7 +383,7 @@ sub CreateWinePrefix($;$)
   rmtree($ENV{WINEPREFIX});
 
   # Crash dialogs cause delays so disable them
-  if (RunWine($Mission, "./programs/reg/reg.exe.so", "ADD HKCU\\\\Software\\\\Wine\\\\WineDbg /v ShowCrashDialog /t REG_DWORD /d 0"))
+  if (RunWine($Mission, "programs/reg/reg.exe.so", "ADD HKCU\\\\Software\\\\Wine\\\\WineDbg /v ShowCrashDialog /t REG_DWORD /d 0"))
   {
     return "Failed to disable the crash dialogs: $!";
   }
@@ -376,7 +392,8 @@ sub CreateWinePrefix($;$)
   {
     # Ensure the WinePrefix has been fully created and the registry files
     # saved before returning.
-    system("cd '$DataDir/wine-$Mission->{Build}' && ./server/wineserver -w");
+    my $WineDir = "$DataDir/wine-$Mission->{Build}";
+    system("'$WineDir/server/wineserver' -w");
   }
 
   return undef;
diff --git a/testbot/web/admin/VMDetails.pl b/testbot/web/admin/VMDetails.pl
index 4dd9e2501a..095de3a1eb 100644
--- a/testbot/web/admin/VMDetails.pl
+++ b/testbot/web/admin/VMDetails.pl
@@ -80,6 +80,7 @@ sub GenerateFooter($)
   print "<p>On Wine VMs:<br>\n";
   print "The <i>test</i> option can be set to <i>build</i> to only test building, <i>test</i> to only rerun patched tests, <i>module</i> to rerun all of a patched dll or program's tests, or <i>all</i> to always rerun all the tests.<br>\n";
   print "The <i>lang</i> option can be set to run the tests in the specified \$LANG locale. The default is en_US (<i>.UTF-8</i> can be omitted).<br>\n";
+  print "The <i>dir</i> option can be set to specify the directory in which to run the tests. A path starting with a single letter followed by a slash specifies the drive, for instance 'c/' for 'c:' (the default).<br>\n";
   print "If set, the <i>nosubmit</i> option specifies that the WineTest results should not be published online.</p>\n";
   print "</td></tr></tbody>\n";
   print "</table></div>\n";
-- 
2.19.2



More information about the wine-devel mailing list