Use the path of the current executable by default in soft debugger tests on
authorNiklas Therning <niklas@therning.org>
Mon, 19 Sep 2016 12:11:54 +0000 (14:11 +0200)
committerNiklas Therning <niklas@therning.org>
Mon, 19 Sep 2016 12:27:35 +0000 (14:27 +0200)
Windows to launch the child mono process

The 'mono' shell script generated by the Cygwin make file system doesn't work
when running the soft debugger tests against an MSVC built mono executable.
This patch first tries with the main module of the current process when
running on Windows (and mono is built using MSVC). If it looks like a mono
executable the tests will use it before falling back to the shell script.

mcs/class/Mono.Debugger.Soft/Test/dtest.cs

index 1933fc5e827372129731655297986401622ff064..581e90744aafe5ab50bcb89d996758ddc3f78113 100644 (file)
@@ -69,9 +69,17 @@ public class DebuggerTests
                if (!listening) {
                        var pi = new Diag.ProcessStartInfo ();
 
-                       if (runtime != null)
+                       if (runtime != null) {
                                pi.FileName = runtime;
-                       else
+                       } else if (Path.DirectorySeparatorChar == '\\') {
+                               string processExe = Diag.Process.GetCurrentProcess ().MainModule.FileName;
+                               if (processExe != null) {
+                                       string fileName = Path.GetFileName (processExe);
+                                       if (fileName.StartsWith ("mono") && fileName.EndsWith (".exe"))
+                                               pi.FileName = processExe;
+                               }
+                       }
+                       if (string.IsNullOrEmpty (pi.FileName))
                                pi.FileName = "mono";
                        pi.Arguments = String.Join (" ", args);
                        vm = VirtualMachineManager.Launch (pi, new LaunchOptions { AgentArgs = agent_args });