From 182966dc6fa7955e1bbdfa964e83b245a1e1da84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Strehovsk=C3=BD?= Date: Wed, 20 Mar 2024 07:36:18 +0100 Subject: [PATCH 1/2] Fix regression from test merging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #98469 regressed a development scenario around passing command line arguments to this test. Command line argument can selectively choose one test to run. This is extremely useful when there’s test failures. The test does a ton of things and ability to zoom in is useful. Alternatively, we could put the test on the non-merged plan, same way we left nativeaot\SmokeTests\ControlFlowGuard on the non-merged plan (I assume for the same reason because it uses command line arguments?). I would prefer that solution but made a PR for the other approach because if I understand it correctly, we don't want to leave tests like that. --- .../SmokeTests/DynamicGenerics/DynamicGenerics.main.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/tests/nativeaot/SmokeTests/DynamicGenerics/DynamicGenerics.main.cs b/src/tests/nativeaot/SmokeTests/DynamicGenerics/DynamicGenerics.main.cs index 8c3ffe4145600e..017bda3b2e1c5d 100644 --- a/src/tests/nativeaot/SmokeTests/DynamicGenerics/DynamicGenerics.main.cs +++ b/src/tests/nativeaot/SmokeTests/DynamicGenerics/DynamicGenerics.main.cs @@ -165,12 +165,7 @@ public static int TestEntryPoint() new CoreFXTestLibrary.Internal.TestInfo("GenericVirtualMethods.TestCoAndContraVariantCalls", () => global::GenericVirtualMethods.TestCoAndContraVariantCalls(), null) }; - // This is a placeholder for the RunTests() call below that expects an - // args array as a parameter. Tests using the Merged Wrapper system rely - // on the TestEntryPoint(), which receives no parameters, whereas the - // legacy system had a Main(string[] args) signature. However, in this - // specific test's case, the args array was always empty. - string[] args = new string[] { }; + string[] args = Environment.GetCommandLineArgs()[1..]; bool passed = CoreFXTestLibrary.Internal.Runner.RunTests(tests, args); CoreFXTestLibrary.Logger.LogInformation("Passed: {0}, Failed: {1}, Number of Tests Run: {2}", From b4604c7e8e8d178b74c87f2207a66bcb6b0618cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Strehovsk=C3=BD?= Date: Wed, 20 Mar 2024 08:08:59 +0100 Subject: [PATCH 2/2] Update DynamicGenerics.main.cs --- .../SmokeTests/DynamicGenerics/DynamicGenerics.main.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/nativeaot/SmokeTests/DynamicGenerics/DynamicGenerics.main.cs b/src/tests/nativeaot/SmokeTests/DynamicGenerics/DynamicGenerics.main.cs index 017bda3b2e1c5d..5b99da80b3c00d 100644 --- a/src/tests/nativeaot/SmokeTests/DynamicGenerics/DynamicGenerics.main.cs +++ b/src/tests/nativeaot/SmokeTests/DynamicGenerics/DynamicGenerics.main.cs @@ -165,7 +165,7 @@ public static int TestEntryPoint() new CoreFXTestLibrary.Internal.TestInfo("GenericVirtualMethods.TestCoAndContraVariantCalls", () => global::GenericVirtualMethods.TestCoAndContraVariantCalls(), null) }; - string[] args = Environment.GetCommandLineArgs()[1..]; + string[] args = System.Environment.GetCommandLineArgs()[1..]; bool passed = CoreFXTestLibrary.Internal.Runner.RunTests(tests, args); CoreFXTestLibrary.Logger.LogInformation("Passed: {0}, Failed: {1}, Number of Tests Run: {2}",