diff options
author | Alexander Köplinger <alex.koeplinger@outlook.com> | 2019-01-10 14:28:39 +0300 |
---|---|---|
committer | Alexander Köplinger <alex.koeplinger@outlook.com> | 2019-01-10 14:28:39 +0300 |
commit | a037a97cdf35f918b90c8b6780b124954c85c86a (patch) | |
tree | be14030ac03904cb220e40efbfde4cf9f18acd6b /mcs/class/Mono.Debugger.Soft | |
parent | baa8cf7312565cee893c489a89c90ded2fce3807 (diff) |
[Mono.Debugger.Soft] Keep existing crash files in Crash() test
Instead of deleting all, only delete the ones created by the test.
Diffstat (limited to 'mcs/class/Mono.Debugger.Soft')
-rw-r--r-- | mcs/class/Mono.Debugger.Soft/Test/dtest.cs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs index e9af3d4d72a..c0aefeab751 100644 --- a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs +++ b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs @@ -2458,10 +2458,8 @@ public class DebuggerTests [Test] [Category("NotOnWindows")] public void Crash () { - bool deleteCrash = true; - string [] crashFileEntries = Directory.GetFiles (".", "mono_crash*.json"); - if (crashFileEntries.Length != 0) - deleteCrash = false; + string [] existingCrashFileEntries = Directory.GetFiles (".", "mono_crash*.json"); + bool success = false; for (int i = 0 ; i < 10; i++) { try { @@ -2481,12 +2479,12 @@ public class DebuggerTests break; } } catch (VMDisconnectedException vmDisconnect) { //expected behavior because of unreliability of the crash reporter. - success = false; + success = false; } finally { try { vm.Detach (); } catch (VMDisconnectedException vmDisconnect) { //expected behavior because of unreliability of the crash reporter. - success = false; + success = false; } finally { vm = null; } @@ -2497,12 +2495,14 @@ public class DebuggerTests TearDown(); SetUp(); } - if (deleteCrash) { - crashFileEntries = Directory.GetFiles (".", "mono_crash*.json"); - foreach (string f in crashFileEntries) { - File.Delete(f); - } + + // delete crash files created by this test + string [] crashFileEntries = Directory.GetFiles (".", "mono_crash*.json"); + foreach (string f in crashFileEntries) { + if (!existingCrashFileEntries.Contains (f)) + File.Delete(f); } + if (!success) Assert.Fail ("Didn't get crash event"); } |