diff --git a/docs/workflow/testing/libraries/testing.md b/docs/workflow/testing/libraries/testing.md index 4d90f52af44f2..1ebd87ac40715 100644 --- a/docs/workflow/testing/libraries/testing.md +++ b/docs/workflow/testing/libraries/testing.md @@ -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. diff --git a/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/Regex.Match.Tests.cs b/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/Regex.Match.Tests.cs index 6311cdf5f6046..f8919a8b8d806 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/Regex.Match.Tests.cs +++ b/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/Regex.Match.Tests.cs @@ -2159,13 +2159,17 @@ public static IEnumerable StressTestDeepNestingOfLoops_TestData() { 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)