Disable StressTestDeepNestingOfLoops for NonBacktracking engine (#87369)
authorDan Moseley <danmose@microsoft.com>
Tue, 13 Jun 2023 02:05:13 +0000 (19:05 -0700)
committerGitHub <noreply@github.com>
Tue, 13 Jun 2023 02:05:13 +0000 (22:05 -0400)
* Disable hanging RE test

* feedback

* Oops

* Apply suggestions from code review

Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Update testing.md

---------

Co-authored-by: Stephen Toub <stoub@microsoft.com>
docs/workflow/testing/libraries/testing.md
src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/Regex.Match.Tests.cs

index 4d90f52..1ebd87a 100644 (file)
@@ -79,13 +79,23 @@ cd src\libraries\System.Collections.Immutable\tests
 dotnet build /t:Test
 ```
 
-It is possible to pass parameters to the underlying xunit runner via the `XUnitOptions` parameter, e.g.:
+### Running only certain tests
+
+It is possible to pass parameters to the underlying xunit runner via the `XUnitOptions` parameter, e.g., to filter to tests in just one fixture (class):
 
 ```cmd
 dotnet build /t:Test /p:XUnitOptions="-class Test.ClassUnderTests"
 ```
 
-Which is very useful when you want to run tests as `x86` on a `x64` machine:
+or to just one test method:
+
+```cmd
+dotnet build /t:test /p:outerloop=true /p:xunitoptions="-method System.Text.RegularExpressions.Tests.RegexMatchTests.StressTestDeepNestingOfLoops"
+```
+
+### Running only specific architectures
+
+To run tests as `x86` on a `x64` machine:
 
 ```cmd
 dotnet build /t:Test /p:TargetArchitecture=x86
@@ -145,3 +155,6 @@ It is important to highlight that these tests do not use the standard XUnit test
 - `-nonamespace`
 - `-parallel`
 
+### Viewing XUnit logs
+
+It's usually sufficient to see the test failure output in the console. There is also a test log file, which you can find in a location like `...\runtime\artifacts\bin\System.Text.RegularExpressions.Tests\Debug\net8.0\testResults.xml`. It can be helpful, for example, to grep through a series of failures, or to see how long a slow test actually took.
index 6311cdf..f8919a8 100644 (file)
@@ -2159,13 +2159,17 @@ namespace System.Text.RegularExpressions.Tests
         {
             foreach (RegexEngine engine in RegexHelpers.AvailableEngines)
             {
-                yield return new object[] { engine, "(", "a", ")*", "a", 2000, 1000 };
+                if (engine != RegexEngine.NonBacktracking) // Hangs, or effectively hangs. https://github.com/dotnet/runtime/issues/84188
+                {
+                    yield return new object[] { engine, "(", "a", ")*", "a", 2000, 1000 };
+                }
+
                 yield return new object[] { engine, "(", "[aA]", ")+", "aA", 2000, 3000 };
                 yield return new object[] { engine, "(", "ab", "){0,1}", "ab", 2000, 1000 };
             }
         }
 
-        [OuterLoop("Can take over 10 seconds")]
+        [OuterLoop("Can take a few seconds")]
         [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.Is64BitProcess))] // consumes a lot of memory
         [MemberData(nameof(StressTestDeepNestingOfLoops_TestData))]
         public async Task StressTestDeepNestingOfLoops(RegexEngine engine, string begin, string inner, string end, string input, int pattern_repetition, int input_repetition)