diff --git a/tests/cecil-tests/BlittablePInvokes.cs b/tests/cecil-tests/BlittablePInvokes.cs index 26a51a66d9a9..51b2175e1e76 100644 --- a/tests/cecil-tests/BlittablePInvokes.cs +++ b/tests/cecil-tests/BlittablePInvokes.cs @@ -179,6 +179,8 @@ public BlitAndReason (bool isBlittable, string reason) [Test] public void CheckForNonBlittablePInvokes () { + Configuration.IgnoreIfNotDotNet (); + var failures = new Dictionary (); var pinvokes = new List<(AssemblyDefinition Assembly, MethodDefinition Method)> (); @@ -345,6 +347,8 @@ public void CheckForBlockLiterals () { var failures = new Dictionary (); + Configuration.IgnoreIfNotDotNet (); + foreach (var info in Helper.NetPlatformImplementationAssemblyDefinitions) { var assembly = info.Assembly; foreach (var type in assembly.EnumerateTypes ()) { @@ -396,6 +400,8 @@ public void CheckForMonoPInvokeCallback () { var failures = new Dictionary (); + Configuration.IgnoreIfNotDotNet (); + foreach (var info in Helper.NetPlatformImplementationAssemblyDefinitions) { var assembly = info.Assembly; foreach (var type in assembly.EnumerateTypes ()) { diff --git a/tests/common/Configuration.cs b/tests/common/Configuration.cs index d1aa7ed56bc9..fdc9c2078c7b 100644 --- a/tests/common/Configuration.cs +++ b/tests/common/Configuration.cs @@ -805,6 +805,8 @@ public static string GetBaseLibrary (TargetFramework targetFramework) public static IList GetRuntimeIdentifiers (ApplePlatform platform) { + if (!include_dotnet) + return Array.Empty (); return GetVariableArray ($"DOTNET_{platform.AsString ().ToUpper ()}_RUNTIME_IDENTIFIERS"); } @@ -916,6 +918,9 @@ public static void AssertiOS32BitAvailable () public static IEnumerable GetIncludedPlatforms (bool dotnet) { + if (dotnet && !include_dotnet) + yield break; + if (include_ios) yield return ApplePlatform.iOS; if (include_tvos) @@ -1124,6 +1129,13 @@ public static void IgnoreIfAnyIgnoredPlatforms (bool dotnet = true) Assert.Ignore ($"This test requires all platforms to be included, but the following platforms aren't included: {string.Join (", ", notIncluded.Select (v => v.AsString ()))}"); } + public static void IgnoreIfNotDotNet () + { + if (include_dotnet) + return; + Assert.Ignore ($"This test requires .NET to be enabled."); + } + public static string GetTestLibraryDirectory (ApplePlatform platform, bool? simulator = null) { string dir;