From b4d3987282862fe202bf6216cee653f7d7fa750d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Fri, 26 Nov 2021 17:01:52 +0100 Subject: [PATCH] Fix regression in CoreClrConfigurationDetection In 16988fc6f9799e2a119167b1730953778e2b0b53 the refactoring added `IsGCStress` and used it in the `IsStressTest` property. However the `GetEnvironmentVariableValue("GCStress") != string.Empty` is always true since `GetEnvironmentVariableValue` will return the string "0" if the env variable isn't set. This in turn caused `StressModeApplies` to return false for `RuntimeTestModes.RegularRun` which made the `SkipOnCoreClr` attribute a no-op in regular runs. --- .../src/CoreClrConfigurationDetection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.DotNet.XUnitExtensions/src/CoreClrConfigurationDetection.cs b/src/Microsoft.DotNet.XUnitExtensions/src/CoreClrConfigurationDetection.cs index 64c1be76bae..73f87efea8c 100644 --- a/src/Microsoft.DotNet.XUnitExtensions/src/CoreClrConfigurationDetection.cs +++ b/src/Microsoft.DotNet.XUnitExtensions/src/CoreClrConfigurationDetection.cs @@ -21,7 +21,7 @@ public static class CoreClrConfigurationDetection public static bool IsGCStress3 => CompareGCStressModeAsLower(GetEnvironmentVariableValue("GCStress"), "0x3", "3"); public static bool IsGCStressC => CompareGCStressModeAsLower(GetEnvironmentVariableValue("GCStress"), "0xC", "C"); - public static bool IsGCStress => GetEnvironmentVariableValue("GCStress") != string.Empty; + public static bool IsGCStress => !string.Equals(GetEnvironmentVariableValue("GCStress"), "0", StringComparison.InvariantCulture); public static bool IsCheckedRuntime => AssemblyConfigurationEquals("Checked"); public static bool IsReleaseRuntime => AssemblyConfigurationEquals("Release");