From b1e718836e37afdf78f0af44ed2f68d4ce621fee Mon Sep 17 00:00:00 2001 From: nickshulman Date: Wed, 6 Dec 2023 15:34:38 -0800 Subject: [PATCH 1/2] Trying to track down why TeamCity does not notice that a StackOverflowException which causes TestRunner.exe to abruptly exit with exit code 2147943401 should be treated as a test failure. --- .../StackOverflowExceptionTest.cs | 31 +++++++++++++++++++ .../TestFunctional/TestFunctional.csproj | 1 + 2 files changed, 32 insertions(+) create mode 100644 pwiz_tools/Skyline/TestFunctional/StackOverflowExceptionTest.cs diff --git a/pwiz_tools/Skyline/TestFunctional/StackOverflowExceptionTest.cs b/pwiz_tools/Skyline/TestFunctional/StackOverflowExceptionTest.cs new file mode 100644 index 0000000000..8b10b658a7 --- /dev/null +++ b/pwiz_tools/Skyline/TestFunctional/StackOverflowExceptionTest.cs @@ -0,0 +1,31 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using pwiz.SkylineTestUtil; + +namespace pwiz.SkylineTestFunctional +{ + /// + /// Test which causes a StackOverflowException to be thrown, causing TestRunner.exe to exit immediately. + /// + /// This test should not be merged into the master branch. The only purpose of this test is to make sure that TeamCity is properly able + /// to see that the tests have failed when this test is part of the suite. + /// + [TestClass] + public class StackOverflowExceptionTest : AbstractFunctionalTest + { + [TestMethod] + public void TestStackOverflowException() + { + RunFunctionalTest(); + } + + protected override void DoTest() + { + RunUI(()=>OverflowStack()); + } + + private void OverflowStack() + { + OverflowStack(); + } + } +} diff --git a/pwiz_tools/Skyline/TestFunctional/TestFunctional.csproj b/pwiz_tools/Skyline/TestFunctional/TestFunctional.csproj index fe93267be7..d82a82fd37 100644 --- a/pwiz_tools/Skyline/TestFunctional/TestFunctional.csproj +++ b/pwiz_tools/Skyline/TestFunctional/TestFunctional.csproj @@ -211,6 +211,7 @@ + From 2ebbb06776a1608597dfcf60bbd58b0b4666ef5d Mon Sep 17 00:00:00 2001 From: nickshulman Date: Thu, 7 Dec 2023 14:12:46 -0800 Subject: [PATCH 2/2] Disable inlining on my function that is supposed to overflow the stack. --- .../Skyline/TestFunctional/StackOverflowExceptionTest.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pwiz_tools/Skyline/TestFunctional/StackOverflowExceptionTest.cs b/pwiz_tools/Skyline/TestFunctional/StackOverflowExceptionTest.cs index 8b10b658a7..15051f7c70 100644 --- a/pwiz_tools/Skyline/TestFunctional/StackOverflowExceptionTest.cs +++ b/pwiz_tools/Skyline/TestFunctional/StackOverflowExceptionTest.cs @@ -1,4 +1,5 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Runtime.CompilerServices; +using Microsoft.VisualStudio.TestTools.UnitTesting; using pwiz.SkylineTestUtil; namespace pwiz.SkylineTestFunctional @@ -23,6 +24,7 @@ protected override void DoTest() RunUI(()=>OverflowStack()); } + [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private void OverflowStack() { OverflowStack();