diff options
author | Thays Grazia <thaystg@gmail.com> | 2019-01-09 22:31:32 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-09 22:31:32 +0300 |
commit | cb77514a945a51838a22999730695284a35c7641 (patch) | |
tree | 5f4f508e990ae9da776c164afdf17b26fb4e5f94 /mcs/class/Mono.Debugger.Soft | |
parent | cb16759b8a2a293825cb99f693ff6df15fbea38e (diff) |
[Debugger] Crash test (#12304)
* Changing the test behavior as discussed with Ludovic, because we already have knowledge about the unreliability of the crash reporter and the test is not about it.
So if in 10 times at least one of them works for now it's good.
Fixes #11385
* Removing extra message.
* Removing the crash log file after the test is finished.
Diffstat (limited to 'mcs/class/Mono.Debugger.Soft')
-rw-r--r-- | mcs/class/Mono.Debugger.Soft/Test/dtest.cs | 60 |
1 files changed, 39 insertions, 21 deletions
diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs index 1733ae25157..e9af3d4d72a 100644 --- a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs +++ b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs @@ -2457,34 +2457,52 @@ public class DebuggerTests [Test] [Category("NotOnWindows")] - [Ignore("https://github.com/mono/mono/issues/11385")] public void Crash () { + bool deleteCrash = true; + string [] crashFileEntries = Directory.GetFiles (".", "mono_crash*.json"); + if (crashFileEntries.Length != 0) + deleteCrash = false; bool success = false; - - try { - vm.Detach (); - Start (new string [] { dtest_app_path, "crash-vm" }); - Event e = run_until ("crash"); - while (!success) { - vm.Resume (); - e = GetNextEvent (); - var crash = e as CrashEvent; - if (crash == null) - continue; - - success = true; - Assert.AreNotEqual (0, crash.Dump.Length); - - break; - } - } finally { + for (int i = 0 ; i < 10; i++) { try { vm.Detach (); + Start (new string [] { dtest_app_path, "crash-vm" }); + Event e = run_until ("crash"); + while (!success) { + vm.Resume (); + e = GetNextEvent (); + var crash = e as CrashEvent; + if (crash == null) + continue; + + success = true; + Assert.AreNotEqual (0, crash.Dump.Length); + + break; + } + } catch (VMDisconnectedException vmDisconnect) { //expected behavior because of unreliability of the crash reporter. + success = false; } finally { - vm = null; + try { + vm.Detach (); + } catch (VMDisconnectedException vmDisconnect) { //expected behavior because of unreliability of the crash reporter. + success = false; + } finally { + vm = null; + } } + if (success) + break; + //try again because of unreliability of the crash reporter. + TearDown(); + SetUp(); + } + if (deleteCrash) { + crashFileEntries = Directory.GetFiles (".", "mono_crash*.json"); + foreach (string f in crashFileEntries) { + File.Delete(f); + } } - if (!success) Assert.Fail ("Didn't get crash event"); } |