Added condition to skip Omnisharp test cases for ppc64le and s390x (#17176)
Co-authored-by: Michael Simons <msimons@microsoft.com>
This commit is contained in:
parent
f06d7cded3
commit
ec4c1ffc81
5 changed files with 24 additions and 15 deletions
|
@ -25,7 +25,7 @@ public class OmniSharpTests : SmokeTests
|
|||
|
||||
public OmniSharpTests(ITestOutputHelper outputHelper) : base(outputHelper) { }
|
||||
|
||||
[SkippableTheory(Config.ExcludeOmniSharpEnv, skipOnTrue: true)]
|
||||
[SkippableTheory(Config.ExcludeOmniSharpEnv, skipOnTrueEnv: true, skipArchitectures: new[] { "ppc64le", "s390x" })]
|
||||
[InlineData(DotNetTemplate.BlazorWasm)]
|
||||
[InlineData(DotNetTemplate.ClassLib)]
|
||||
[InlineData(DotNetTemplate.Console)]
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Microsoft.DotNet.SourceBuild.SmokeTests
|
|||
{
|
||||
public PoisonTests(ITestOutputHelper outputHelper) : base(outputHelper) { }
|
||||
|
||||
[SkippableFact(Config.PoisonReportPathEnv, skipOnNullOrWhiteSpace: true)]
|
||||
[SkippableFact(Config.PoisonReportPathEnv, skipOnNullOrWhiteSpaceEnv: true)]
|
||||
public void VerifyUsage()
|
||||
{
|
||||
if (!File.Exists(Config.PoisonReportPath))
|
||||
|
|
|
@ -31,7 +31,7 @@ public class SdkContentTests : SmokeTests
|
|||
/// This makes the baseline durable between releases. This does mean however, entries
|
||||
/// in the baseline may appear identical if the diff is version specific.
|
||||
/// </Summary>
|
||||
[SkippableFact(new[] { Config.MsftSdkTarballPathEnv, Config.SdkTarballPathEnv }, skipOnNullOrWhiteSpace: true)]
|
||||
[SkippableFact(new[] { Config.MsftSdkTarballPathEnv, Config.SdkTarballPathEnv }, skipOnNullOrWhiteSpaceEnv: true)]
|
||||
public void CompareMsftToSbFileList()
|
||||
{
|
||||
const string msftFileListingFileName = "msftSdkFiles.txt";
|
||||
|
@ -44,7 +44,7 @@ public class SdkContentTests : SmokeTests
|
|||
BaselineHelper.CompareBaselineContents("MsftToSbSdkFiles.diff", diff, OutputHelper, Config.WarnOnSdkContentDiffs);
|
||||
}
|
||||
|
||||
[SkippableFact(new[] { Config.MsftSdkTarballPathEnv, Config.SdkTarballPathEnv }, skipOnNullOrWhiteSpace: true)]
|
||||
[SkippableFact(new[] { Config.MsftSdkTarballPathEnv, Config.SdkTarballPathEnv }, skipOnNullOrWhiteSpaceEnv: true)]
|
||||
public void CompareMsftToSbAssemblyVersions()
|
||||
{
|
||||
Assert.NotNull(Config.MsftSdkTarballPath);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.DotNet.SourceBuild.SmokeTests;
|
||||
|
@ -12,28 +13,36 @@ namespace Microsoft.DotNet.SourceBuild.SmokeTests;
|
|||
/// </summary>
|
||||
internal class SkippableFactAttribute : FactAttribute
|
||||
{
|
||||
public SkippableFactAttribute(string envName, bool skipOnNullOrWhiteSpace = false, bool skipOnTrue = false) =>
|
||||
CheckEnvs(skipOnNullOrWhiteSpace, skipOnTrue, (skip) => Skip = skip, envName);
|
||||
public SkippableFactAttribute(string envName, bool skipOnNullOrWhiteSpaceEnv = false, bool skipOnTrueEnv = false, string[] skipArchitectures = null) =>
|
||||
EvaluateSkips(skipOnNullOrWhiteSpaceEnv, skipOnTrueEnv, skipArchitectures, (skip) => Skip = skip, envName);
|
||||
|
||||
public SkippableFactAttribute(string[] envNames, bool skipOnNullOrWhiteSpace = false, bool skipOnTrue = false) =>
|
||||
CheckEnvs(skipOnNullOrWhiteSpace, skipOnTrue, (skip) => Skip = skip, envNames);
|
||||
public SkippableFactAttribute(string[] envNames, bool skipOnNullOrWhiteSpaceEnv = false, bool skipOnTrueEnv = false, string[] skipArchitectures = null) =>
|
||||
EvaluateSkips(skipOnNullOrWhiteSpaceEnv, skipOnTrueEnv, skipArchitectures, (skip) => Skip = skip, envNames);
|
||||
|
||||
public static void CheckEnvs(bool skipOnNullOrWhiteSpace, bool skipOnTrue, Action<string> setSkip, params string[] envNames)
|
||||
public static void EvaluateSkips(bool skipOnNullOrWhiteSpaceEnv, bool skipOnTrueEnv, string[] skipArchitectures, Action<string> setSkip, params string[] envNames)
|
||||
{
|
||||
foreach (string envName in envNames)
|
||||
{
|
||||
string? envValue = Environment.GetEnvironmentVariable(envName);
|
||||
|
||||
if (skipOnNullOrWhiteSpace && string.IsNullOrWhiteSpace(envValue))
|
||||
if (skipOnNullOrWhiteSpaceEnv && string.IsNullOrWhiteSpace(envValue))
|
||||
{
|
||||
setSkip($"Skipping because `{envName}` is null or whitespace");
|
||||
break;
|
||||
}
|
||||
else if (skipOnTrue && bool.TryParse(envValue, out bool boolValue) && boolValue)
|
||||
else if (skipOnTrueEnv && bool.TryParse(envValue, out bool boolValue) && boolValue)
|
||||
{
|
||||
setSkip($"Skipping because `{envName}` is set to True");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (skipArchitectures != null) {
|
||||
string? arch = Config.TargetArchitecture;
|
||||
if (skipArchitectures.Contains(arch))
|
||||
{
|
||||
setSkip($"Skipping because arch is `{arch}`");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,9 +11,9 @@ namespace Microsoft.DotNet.SourceBuild.SmokeTests;
|
|||
/// </summary>
|
||||
internal class SkippableTheoryAttribute : TheoryAttribute
|
||||
{
|
||||
public SkippableTheoryAttribute(string envName, bool skipOnNullOrWhiteSpace = false, bool skipOnTrue = false) =>
|
||||
SkippableFactAttribute.CheckEnvs(skipOnNullOrWhiteSpace, skipOnTrue, (skip) => Skip = skip, envName);
|
||||
public SkippableTheoryAttribute(string envName, bool skipOnNullOrWhiteSpaceEnv = false, bool skipOnTrueEnv = false, string[] skipArchitectures = null) =>
|
||||
SkippableFactAttribute.EvaluateSkips(skipOnNullOrWhiteSpaceEnv, skipOnTrueEnv, skipArchitectures, (skip) => Skip = skip, envName);
|
||||
|
||||
public SkippableTheoryAttribute(string[] envNames, bool skipOnNullOrWhiteSpace = false, bool skipOnTrue = false) =>
|
||||
SkippableFactAttribute.CheckEnvs(skipOnNullOrWhiteSpace, skipOnTrue, (skip) => Skip = skip, envNames);
|
||||
public SkippableTheoryAttribute(string[] envNames, bool skipOnNullOrWhiteSpaceEnv = false, bool skipOnTrueEnv = false, string[] skipArchitectures = null) =>
|
||||
SkippableFactAttribute.EvaluateSkips(skipOnNullOrWhiteSpaceEnv, skipOnTrueEnv, skipArchitectures, (skip) => Skip = skip, envNames);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue