Skip to content

Commit

Permalink
Probe DOTNET_ variables related to COMPlus_ as well
Browse files Browse the repository at this point in the history
  • Loading branch information
am11 committed Sep 24, 2021
1 parent fe22dce commit cc825c0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,20 @@ namespace Microsoft.DotNet.XUnitExtensions
{
public class SkipOnCoreClrDiscoverer : ITraitDiscoverer
{
private static readonly Lazy<bool> s_isJitStress = new Lazy<bool>(() => !string.Equals(GetEnvironmentVariableValue("COMPlus_JitStress"), "0", StringComparison.InvariantCulture));
private static readonly Lazy<bool> s_isJitStressRegs = new Lazy<bool>(() => !string.Equals(GetEnvironmentVariableValue("COMPlus_JitStressRegs"), "0", StringComparison.InvariantCulture));
private static readonly Lazy<bool> s_isJitMinOpts = new Lazy<bool>(() => string.Equals(GetEnvironmentVariableValue("COMPlus_JITMinOpts"), "1", StringComparison.InvariantCulture));
private static readonly Lazy<bool> s_isTailCallStress = new Lazy<bool>(() => string.Equals(GetEnvironmentVariableValue("COMPlus_TailcallStress"), "1", StringComparison.InvariantCulture));
private static readonly Lazy<bool> s_isZapDisable = new Lazy<bool>(() => string.Equals(GetEnvironmentVariableValue("COMPlus_ZapDisable"), "1", StringComparison.InvariantCulture));
private static readonly Lazy<bool> s_isGCStress3 = new Lazy<bool>(() => CompareGCStressModeAsLower(GetEnvironmentVariableValue("COMPlus_GCStress"), "0x3", "3"));
private static readonly Lazy<bool> s_isGCStressC = new Lazy<bool>(() => CompareGCStressModeAsLower(GetEnvironmentVariableValue("COMPlus_GCStress"), "0xC", "C"));
private static readonly Lazy<bool> s_isJitStress = new Lazy<bool>(() => !string.Equals(GetEnvironmentVariableValue("COMPlus_JitStress"), "0", StringComparison.InvariantCulture) &&
!string.Equals(GetEnvironmentVariableValue("DOTNET_JitStress"), "0", StringComparison.InvariantCulture));
private static readonly Lazy<bool> s_isJitStressRegs = new Lazy<bool>(() => !string.Equals(GetEnvironmentVariableValue("COMPlus_JitStressRegs"), "0", StringComparison.InvariantCulture) &&
!string.Equals(GetEnvironmentVariableValue("DOTNET_JitStressRegs"), "0", StringComparison.InvariantCulture));
private static readonly Lazy<bool> s_isJitMinOpts = new Lazy<bool>(() => string.Equals(GetEnvironmentVariableValue("COMPlus_JITMinOpts"), "1", StringComparison.InvariantCulture) ||
string.Equals(GetEnvironmentVariableValue("DOTNET_JITMinOpts"), "1", StringComparison.InvariantCulture));
private static readonly Lazy<bool> s_isTailCallStress = new Lazy<bool>(() => string.Equals(GetEnvironmentVariableValue("COMPlus_TailcallStress"), "1", StringComparison.InvariantCulture) ||
string.Equals(GetEnvironmentVariableValue("DOTNET_TailcallStress"), "1", StringComparison.InvariantCulture));
private static readonly Lazy<bool> s_isZapDisable = new Lazy<bool>(() => string.Equals(GetEnvironmentVariableValue("COMPlus_ZapDisable"), "1", StringComparison.InvariantCulture) ||
string.Equals(GetEnvironmentVariableValue("DOTNET_ZapDisable"), "1", StringComparison.InvariantCulture));
private static readonly Lazy<bool> s_isGCStress3 = new Lazy<bool>(() => CompareGCStressModeAsLower(GetEnvironmentVariableValue("COMPlus_GCStress"), "0x3", "3") ||
CompareGCStressModeAsLower(GetEnvironmentVariableValue("DOTNET_GCStress"), "0x3", "3"));
private static readonly Lazy<bool> s_isGCStressC = new Lazy<bool>(() => CompareGCStressModeAsLower(GetEnvironmentVariableValue("COMPlus_GCStress"), "0xC", "C") ||
CompareGCStressModeAsLower(GetEnvironmentVariableValue("DOTNET_GCStress"), "0xC", "C"));
private static readonly Lazy<bool> s_isCheckedRuntime = new Lazy<bool>(() => IsCheckedRuntime());
private static readonly Lazy<bool> s_isReleaseRuntime = new Lazy<bool>(() => IsReleaseRuntime());
private static readonly Lazy<bool> s_isDebugRuntime = new Lazy<bool>(() => IsDebugRuntime());
Expand Down
14 changes: 7 additions & 7 deletions src/Microsoft.DotNet.XUnitExtensions/src/RuntimeTestModes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@ public enum RuntimeTestModes
// JitStress, JitStressRegs, JitMinOpts and TailcallStress enable
// various modes in the JIT that cause us to exercise more code paths,
// and generate different kinds of code
JitStress = 1 << 1, // COMPlus_JitStress is set.
JitStressRegs = 1 << 2, // COMPlus_JitStressRegs is set.
JitMinOpts = 1 << 3, // COMPlus_JITMinOpts is set.
TailcallStress = 1 << 4, // COMPlus_TailcallStress is set.
JitStress = 1 << 1, // DOTNET_JitStress (or COMPlus_JitStress) is set.
JitStressRegs = 1 << 2, // DOTNET_JitStressRegs (or COMPlus_JitStressRegs) is set.
JitMinOpts = 1 << 3, // DOTNET_JITMinOpts (or COMPlus_JITMinOpts) is set.
TailcallStress = 1 << 4, // DOTNET_TailcallStress (or COMPlus_TailcallStress) is set.

// ZapDisable says to not use NGEN or ReadyToRun images.
// This means we JIT everything.
ZapDisable = 1 << 5, // COMPlus_ZapDisable is set.
ZapDisable = 1 << 5, // DOTNET_ZapDisable (or COMPlus_ZapDisable) is set.

// GCStress3 forces a GC at various locations, typically transitions
// to/from the VM from managed code.
GCStress3 = 1 << 6, // COMPlus_GCStress includes mode 0x3.
GCStress3 = 1 << 6, // DOTNET_GCStress (or COMPlus_GCStress) includes mode 0x3.

// GCStressC forces a GC at every JIT-generated code instruction,
// including in NGEN/ReadyToRun code.
GCStressC = 1 << 7, // COMPlus_GCStress includes mode 0xC.
GCStressC = 1 << 7, // DOTNET_GCStress (or COMPlus_GCStress) includes mode 0xC.
AnyGCStress = GCStress3 | GCStressC // Disable when any GCStress is exercised.
}
}

0 comments on commit cc825c0

Please sign in to comment.