diff options
author | Alexander Kyte <alexmkyte@gmail.com> | 2018-04-10 18:36:08 +0300 |
---|---|---|
committer | Ludovic Henry <luhenry@microsoft.com> | 2018-04-10 18:36:08 +0300 |
commit | 7b545988f2a42178e719f65994f25e8d15b259d8 (patch) | |
tree | 6c3d6997ae0245ba66e57a78ec0cb3ac97030e7b /mcs/class/Mono.Debugger.Soft | |
parent | eda870e6d62aefb723780b82be89e8b0f49e0b47 (diff) |
[sdks] Add managed debugger tests to sdks (#6309)
* [sdks] New SDK target: soft debugger + non-nunit exe
This adds support for building an arbitrary .exe (dtest-app is hardcoded
now, but changing that and setting the arguments is another line or two,
to bu customized to the app being bound)
When an environment variable is set, the runtime will wait for the
managed debugger. This enables the desktop to debug the deployed .exe.
This will be used for the Mono.Debugger.Soft tests, but is useful for
isolated reproductions with android bugs.
An unmanaged debugger versions of the managed debugger is coming in
another PR.
* [runtime] Provide argument to dtest-app when running remotely
* [runtime] Fix case of VMDisconnectionException when getting Process of remote host that has disconnected
* [runtime] Script monodroid desktop debugger agent
* [runtime] Use g_warning in debugger agent
* [sdks] Ship PDBs on android
* [sdks] Add Android target to run debugger tests
* [sdks] Add desktop profile target for debugger tests
* [sdks] Disable debugger tests on mobile that use unsupported apis
* [sdks] Add monodroid test profile to android sdks
* [runtime] Allow dtest-app to be built on non-debugger-client profiles
* [runtime] Allow dtest-app building on mobile profiles
Diffstat (limited to 'mcs/class/Mono.Debugger.Soft')
-rw-r--r-- | mcs/class/Mono.Debugger.Soft/Makefile | 14 | ||||
-rw-r--r-- | mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs | 17 | ||||
-rw-r--r-- | mcs/class/Mono.Debugger.Soft/Test/dtest.cs | 43 |
3 files changed, 64 insertions, 10 deletions
diff --git a/mcs/class/Mono.Debugger.Soft/Makefile b/mcs/class/Mono.Debugger.Soft/Makefile index 5b002b86eeb..a3afe51be87 100644 --- a/mcs/class/Mono.Debugger.Soft/Makefile +++ b/mcs/class/Mono.Debugger.Soft/Makefile @@ -16,15 +16,8 @@ VALID_TEST_PROFILE := $(filter net_4_x, $(PROFILE)) # The test exe is not profile specific, and compiling a 2.0 will make the 4.5 tests fail ifdef VALID_TEST_PROFILE -TEST_HELPERS_SOURCES = \ - ../test-helpers/NetworkHelpers.cs \ - Test/TypeLoadClass.cs - test-local: dtest-app.exe dtest-excfilter.exe -dtest-app.exe: Test/dtest-app.cs $(TEST_HELPERS_SOURCES) - $(CSCOMPILE) -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll -r:$(topdir)/class/lib/$(PROFILE)/System.Core.dll -r:$(topdir)/class/lib/$(PROFILE)/System.dll -out:$@ -unsafe $(PLATFORM_DEBUG_FLAGS) -optimize- Test/dtest-app.cs $(TEST_HELPERS_SOURCES) - dtest-excfilter.exe: Test/dtest-excfilter.il $(ILASM) -out:$@ /exe /debug Test/dtest-excfilter.il @@ -35,6 +28,13 @@ check: endif +TEST_HELPERS_SOURCES = \ + ../test-helpers/NetworkHelpers.cs \ + Test/TypeLoadClass.cs + +dtest-app.exe: Test/dtest-app.cs $(TEST_HELPERS_SOURCES) + $(CSCOMPILE) -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll -r:$(topdir)/class/lib/$(PROFILE)/System.Core.dll -r:$(topdir)/class/lib/$(PROFILE)/System.dll -out:$@ -unsafe $(PLATFORM_DEBUG_FLAGS) -optimize- Test/dtest-app.cs $(TEST_HELPERS_SOURCES) + CLEAN_FILES = dtest-app.exe dtest-app.exe.mdb dtest-app.pdb dtest-excfilter.exe dtest-excfilter.exe.mdb dtest-excfilter.pdb EXTRA_DISTFILES = \ diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs b/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs index 33ef36b6d5c..f0a9ce8dbe6 100644 --- a/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs +++ b/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs @@ -13,7 +13,9 @@ using System.Threading.Tasks; using System.Collections.Generic; using System.Linq; using System.Net.Sockets; +#if !MOBILE using MonoTests.Helpers; +#endif public class TestsBase { @@ -266,6 +268,8 @@ public class Tests : TestsBase, ITest2 public static bool is_attached = Debugger.IsAttached; public NestedStruct nested_struct; + static string arg; + #pragma warning restore 0414 public class NestedClass { @@ -299,6 +303,9 @@ public class Tests : TestsBase, ITest2 } public static int Main (String[] args) { + if (args.Length == 0) + args = new String [] { Tests.arg }; + tls_i = 42; if (args.Length > 0 && args [0] == "suspend-test") @@ -321,7 +328,11 @@ public class Tests : TestsBase, ITest2 return 0; } if (args.Length >0 && args [0] == "threadpool-io") { +#if !MOBILE threadpool_io (); +#else + throw new Exception ("Can't run threadpool-io test on mobile"); +#endif return 0; } if (args.Length > 0 && args [0] == "attach") { @@ -350,7 +361,9 @@ public class Tests : TestsBase, ITest2 threads (); dynamic_methods (); user (); +#if !MOBILE type_load (); +#endif regress (); gc_suspend (); set_ip (); @@ -1561,6 +1574,7 @@ public class Tests : TestsBase, ITest2 Debugger.Log (5, Debugger.IsLogging () ? "A" : "", "B"); } +#if !MOBILE [MethodImplAttribute (MethodImplOptions.NoInlining)] public static void type_load () { type_load_2 (); @@ -1575,6 +1589,7 @@ public class Tests : TestsBase, ITest2 var c2 = new TypeLoadClass2 (); c2.ToString (); } +#endif [MethodImplAttribute (MethodImplOptions.NoInlining)] public static void regress () { @@ -1691,6 +1706,7 @@ public class Tests : TestsBase, ITest2 [MethodImplAttribute (MethodImplOptions.NoInlining)] public static void threadpool_bp () { } +#if !MOBILE [MethodImplAttribute (MethodImplOptions.NoInlining)] public static void threadpool_io () { // Start a threadpool task that blocks on I/O. @@ -1730,6 +1746,7 @@ public class Tests : TestsBase, ITest2 streamOut.Close (); var bsIn = t.Result; } +#endif [MethodImplAttribute (MethodImplOptions.NoInlining)] public void attach_break () { diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs index 8fb43da5d61..da0d8dc3d1a 100644 --- a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs +++ b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs @@ -39,7 +39,11 @@ public class DebuggerTests } // No other way to pass arguments to the tests ? +#if MONODROID_TEST + public static bool listening = true; +#else public static bool listening = Environment.GetEnvironmentVariable ("DBG_SUSPEND") != null; +#endif public static string runtime = Environment.GetEnvironmentVariable ("DBG_RUNTIME"); public static string agent_args = Environment.GetEnvironmentVariable ("DBG_AGENT_ARGS"); @@ -90,7 +94,10 @@ public class DebuggerTests var pi = CreateStartInfo (args); vm = VirtualMachineManager.Launch (pi, new LaunchOptions { AgentArgs = agent_args }); } else { - var ep = new IPEndPoint (IPAddress.Any, 10000); +#if MONODROID_TEST + System.Diagnostics.Process.Start("/usr/bin/make", "-C ../android dirty-run-debugger-test"); +#endif + var ep = new IPEndPoint (IPAddress.Any, 6100); Console.WriteLine ("Listening on " + ep + "..."); vm = VirtualMachineManager.Listen (ep); } @@ -123,6 +130,22 @@ public class DebuggerTests } load_req.Disable (); + + if (args.Length == 2) { + var this_type = entry_point.DeclaringType; + var str = vm.RootDomain.CreateString (args [1]); + var slot = this_type.GetField ("arg"); + + if (slot == null) + throw new Exception ("Missing slot"); + + if (str == null) + throw new Exception ("Bug in createstring"); + + this_type.SetValue (slot, str); + } else if (args.Length > 2) { + throw new Exception (String.Format ("Fixme {0}", args [2])); + } } BreakpointEvent run_until (string name) { @@ -2315,7 +2338,13 @@ public class DebuggerTests Assert.AreEqual (5, (e as VMDeathEvent).ExitCode); - var p = vm.Process; + System.Diagnostics.Process p = null; + + try { + p = vm.Process; + } + catch (Exception) {} + /* Could be a remote vm with no process */ if (p != null) { p.WaitForExit (); @@ -2339,7 +2368,13 @@ public class DebuggerTests var e = GetNextEvent (); Assert.IsInstanceOfType (typeof (VMDisconnectEvent), e); - var p = vm.Process; + System.Diagnostics.Process p = null; + + try { + p = vm.Process; + } + catch (Exception) {} + /* Could be a remote vm with no process */ if (p != null) { p.WaitForExit (); @@ -3037,6 +3072,7 @@ public class DebuggerTests vm.GetThreads (); } +#if !MONODROID_TEST [Test] public void Threads () { Event e = run_until ("threads"); @@ -3062,6 +3098,7 @@ public class DebuggerTests Assert.IsInstanceOfType (typeof (ThreadDeathEvent), e); Assert.AreEqual (ThreadState.Stopped, e.Thread.ThreadState); } +#endif [Test] public void Frame_SetValue () { |