Example #1
0
        public IEnumerable <KeyValuePair <string, string> > GetTraits(IAttributeInfo traitAttribute)
        {
            if (!SkipOnMonoDiscoverer.IsMonoRuntime)
            {
                TestPlatforms          testPlatforms = TestPlatforms.Any;
                RuntimeStressTestModes stressMode    = RuntimeStressTestModes.Any;
                foreach (object arg in traitAttribute.GetConstructorArguments().Skip(1)) // We skip the first one as it is the reason
                {
                    if (arg is TestPlatforms tp)
                    {
                        testPlatforms = tp;
                    }
                    else if (arg is RuntimeStressTestModes rstm)
                    {
                        stressMode = rstm;
                    }
                }

                if (DiscovererHelpers.TestPlatformApplies(testPlatforms) && StressModeApplies(stressMode))
                {
                    if (IsCheckedRuntime() || (IsRuntimeStressTesting && !stressMode.HasFlag(RuntimeStressTestModes.CheckedRuntime)))
                    {
                        return(new[] { new KeyValuePair <string, string>(XunitConstants.Category, XunitConstants.Failing) });
                    }
                }
            }

            return(Array.Empty <KeyValuePair <string, string> >());
        }
Example #2
0
 // Order here matters as some env variables may appear in multiple modes
 private static bool StressModeApplies(RuntimeStressTestModes stressMode) =>
 stressMode == RuntimeStressTestModes.Any ||
 (stressMode.HasFlag(RuntimeStressTestModes.GCStress3) && IsGCStress3) ||
 (stressMode.HasFlag(RuntimeStressTestModes.GCStressC) && IsGCStressC) ||
 (stressMode.HasFlag(RuntimeStressTestModes.ZapDisable) && IsZapDisable) ||
 (stressMode.HasFlag(RuntimeStressTestModes.TailcallStress) && IsTailCallStress) ||
 (stressMode.HasFlag(RuntimeStressTestModes.JitStressRegs) && IsJitStressRegs) ||
 (stressMode.HasFlag(RuntimeStressTestModes.JitStress) && IsJitStress) ||
 (stressMode.HasFlag(RuntimeStressTestModes.JitMinOpts) && IsJitMinOpts) ||
 stressMode == RuntimeStressTestModes.CheckedRuntime;     // if checked runtime is the only flag, all stress modes apply.
 public SkipOnCoreClrAttribute(string reason, TestPlatforms testPlatforms, RuntimeStressTestModes testMode)
 {
 }