Clear gcServer envvar before running the scenario (#66907)
authorAdeel Mujahid <3840695+am11@users.noreply.github.com>
Mon, 21 Mar 2022 19:12:43 +0000 (21:12 +0200)
committerGitHub <noreply@github.com>
Mon, 21 Mar 2022 19:12:43 +0000 (12:12 -0700)
src/tests/baseservices/RuntimeConfiguration/TestConfig.cs

index 383a5d0..399ba73 100644 (file)
@@ -26,7 +26,7 @@ class TestConfig
     }
 
     [Fact]
-    [ConfigProperty("DOTNET_gcServer", "0")]
+    [EnvVar("DOTNET_gcServer", "0")]
     static int Verify_ServerGC_Env_Disable(string[] _)
     {
         return GCSettings.IsServerGC
@@ -95,6 +95,10 @@ class TestConfig
 
     static int RunTests()
     {
+        // clear some environment variables that we will set during the test run
+        Environment.SetEnvironmentVariable("DOTNET_gcServer", null);
+        Environment.SetEnvironmentVariable("COMPlus_gcServer", null);
+
         string corerunPath = GetCorerunPath();
         MethodInfo[] infos = typeof(TestConfig).GetMethods(BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public);
         foreach (var mi in infos)
@@ -156,4 +160,4 @@ class TestConfig
         }
         return Path.Combine(Environment.GetEnvironmentVariable("CORE_ROOT"), corerunName);
     }
-}
\ No newline at end of file
+}