From aa0ba7fd7c1d728fdc4038ece21733eabb8ef682 Mon Sep 17 00:00:00 2001 From: Sean Gillespie Date: Wed, 12 Oct 2016 14:38:37 -0700 Subject: [PATCH] Fail fast on a couple flaky tests to get crash dumps (dotnet/coreclr#7588) Commit migrated from https://github.com/dotnet/coreclr/commit/983e6cf9f3d06c9a5120ed2aeb382742948382ab --- src/coreclr/tests/src/GC/API/GCHandleCollector/Usage.cs | 3 ++- src/coreclr/tests/src/GC/Scenarios/DoublinkList/dlcollect.cs | 6 ++++++ src/coreclr/tests/src/GC/Scenarios/DoublinkList/dlstack.cs | 6 ++++++ src/coreclr/tests/src/GC/Scenarios/DoublinkList/doublinkgen.cs | 6 ++++++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/coreclr/tests/src/GC/API/GCHandleCollector/Usage.cs b/src/coreclr/tests/src/GC/API/GCHandleCollector/Usage.cs index 14088f0..b78271b 100644 --- a/src/coreclr/tests/src/GC/API/GCHandleCollector/Usage.cs +++ b/src/coreclr/tests/src/GC/API/GCHandleCollector/Usage.cs @@ -146,7 +146,8 @@ public class Usage // ensure threshold is increasing if (!CheckPercentageIncrease(handleCount, prevHandleCount)) { - Console.WriteLine("Case 3 failed: threshold not increasing!"); + // see github#4093 for the rationale for fail-fast in this test. + Environment.FailFast(string.Empty); return false; } prevHandleCount = handleCount; diff --git a/src/coreclr/tests/src/GC/Scenarios/DoublinkList/dlcollect.cs b/src/coreclr/tests/src/GC/Scenarios/DoublinkList/dlcollect.cs index a3a0c53..a17e95a 100644 --- a/src/coreclr/tests/src/GC/Scenarios/DoublinkList/dlcollect.cs +++ b/src/coreclr/tests/src/GC/Scenarios/DoublinkList/dlcollect.cs @@ -77,6 +77,12 @@ namespace DoubLink { GC.WaitForPendingFinalizers(); + if (DLinkNode.FinalCount != iRep * iObj * 10) + { + // see github#4093 for the rationale for fail-fast in this test. + Environment.FailFast(string.Empty); + } + Console.WriteLine("{0} DLinkNodes finalized", DLinkNode.FinalCount); return (DLinkNode.FinalCount==iRep*iObj*10); } diff --git a/src/coreclr/tests/src/GC/Scenarios/DoublinkList/dlstack.cs b/src/coreclr/tests/src/GC/Scenarios/DoublinkList/dlstack.cs index 5aea958..5e207be 100644 --- a/src/coreclr/tests/src/GC/Scenarios/DoublinkList/dlstack.cs +++ b/src/coreclr/tests/src/GC/Scenarios/DoublinkList/dlstack.cs @@ -85,6 +85,12 @@ namespace DoubLink { curTotalMemory = GC.GetTotalMemory(false); } + if (DLinkNode.FinalCount != iRep * iObj * 10) + { + // see github#4093 for the rationale for fail-fast in this test. + Environment.FailFast(string.Empty); + } + Console.WriteLine("{0} DLinkNodes finalized", DLinkNode.FinalCount); return (DLinkNode.FinalCount==iRep*iObj*10); diff --git a/src/coreclr/tests/src/GC/Scenarios/DoublinkList/doublinkgen.cs b/src/coreclr/tests/src/GC/Scenarios/DoublinkList/doublinkgen.cs index 9c5e4b6..76436ea 100644 --- a/src/coreclr/tests/src/GC/Scenarios/DoublinkList/doublinkgen.cs +++ b/src/coreclr/tests/src/GC/Scenarios/DoublinkList/doublinkgen.cs @@ -71,6 +71,12 @@ namespace DoubLink { GC.WaitForPendingFinalizers(); GC.Collect(); + if (DLinkNode.FinalCount != iRep * iObj) + { + // see github#4093 for the rationale for fail-fast in this test. + Environment.FailFast(string.Empty); + } + Console.Write(DLinkNode.FinalCount); Console.WriteLine(" DLinkNodes finalized"); return (DLinkNode.FinalCount==iRep*iObj); -- 2.7.4