Skip to content

Commit

Permalink
[tests] Port link all to .NET (#9515)
Browse files Browse the repository at this point in the history
* [tests] Port link all to .NET

* [tests] Exclude link all tests in .NET that reference OpenTK-1.0.dll

OpenTK-1.0.dll isn't supported yet.

* [tests] Exclude link all tests using API that isn't available anymore in .NET.
  • Loading branch information
rolfbjarne authored and mandel-macaque committed Oct 21, 2020
1 parent 594668b commit e4d14ad
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/linker/ios/link all/LinkAllTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ public enum CertificateProblem : long {
CertTRUSTEFAIL = 0x800B010B,
}

#if !NET
// ICertificatePolicy has been removed from .NET 5+
class TestPolicy : ICertificatePolicy {

const int RecoverableTrustFailure = 5; // SecTrustResult
Expand Down Expand Up @@ -202,6 +204,7 @@ public void TrustUsingOldPolicy ()
ServicePointManager.CertificatePolicy = old;
}
}
#endif

[Test]
public void DetectPlatform ()
Expand Down Expand Up @@ -423,6 +426,7 @@ public void AssemblyReferences_16213 ()
}

#if !__WATCHOS__
#if !NET // OpenTK-1.0.dll isn't supported in .NET yet
[Test]
public void OpenTk10_Preserved ()
{
Expand All @@ -441,6 +445,7 @@ public void OpenTk10_Preserved ()
core = Helper.GetType ("OpenTK.Graphics.ES20.GL/Core, OpenTK-1.0", false);
Assert.NotNull (core, "ES20/Core");
}
#endif // !NET
#endif // !__WATCHOS__

[Test]
Expand Down
101 changes: 101 additions & 0 deletions tests/linker/ios/link all/dotnet/iOS/link all.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.iOS.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<RuntimeIdentifier>ios-x64</RuntimeIdentifier>
<OutputType>Exe</OutputType>
<DefineConstants>NET</DefineConstants>
<LangVersion>latest</LangVersion>
<RootNamespace>linkall</RootNamespace>
<AssemblyName>link all</AssemblyName>
<MtouchLink>Full</MtouchLink>
<AssetTargetFallback>xamarinios10;$(AssetTargetFallback)</AssetTargetFallback>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<MtouchExtraArgs>--optimize=all,-remove-dynamic-registrar,-force-rejected-types-removal</MtouchExtraArgs>
</PropertyGroup>

<ItemGroup>
<Reference Include="support">
<HintPath>../../support.dll</HintPath>
</Reference>

<PackageReference Include="System.ComponentModel.Composition" Version="4.7.0" />
<PackageReference Include="NUnitLite" Version="3.12.0" />
<PackageReference Include="MonoTouch.Dialog" Version="2.0.0-pre1" />
<ProjectReference Include="..\..\..\..\..\..\external\Touch.Unit\Touch.Client\dotnet\iOS\Touch.Client-iOS.dotnet.csproj" />
<!-- MonoTouch.Dialog references System.Json, which isn't shipped with .NET5, so reference the NuGet instead -->
<PackageReference Include="System.Json" Version="4.7.1" />
<!-- The linker resolves some assembly references too eagerly, and fails when it can't find them, so work around this by referencing the missing assemblies-->
<!-- ref: https://github.com/mono/linker/issues/1139 -->
<PackageReference Include="System.Security.Permissions" Version="5.0.0-preview.2.20160.6" />
<PackageReference Include="System.Threading.AccessControl" Version="5.0.0-preview.2.20160.6" />
<PackageReference Include="System.CodeDom" Version="5.0.0-preview.2.20160.6" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="5.0.0-preview.2.20160.6" />
<PackageReference Include="System.Diagnostics.PerformanceCounter" Version="5.0.0-preview.2.20160.6" />
<PackageReference Include="System.Diagnostics.EventLog" Version="5.0.0-preview.2.20160.6" />
<PackageReference Include="System.IO.Ports" Version="5.0.0-preview.2.20160.6" />
<PackageReference Include="System.Data.SqlClient" Version="5.0.0-alpha1.19523.8" />

<ProjectReference Include="..\..\..\..\..\BundledResources\dotnet\iOS\BundledResources.csproj" />
<ProjectReference Include="..\..\..\..\..\bindings-test\dotnet\iOS\bindings-test.csproj" />
</ItemGroup>

<ItemGroup>
<None Include="..\..\Info.plist">
<LogicalName>Info.plist</LogicalName>
</None>
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\Main.cs" />
<Compile Include="..\..\AppDelegate.cs" />
<Compile Include="..\..\LinkAllTest.cs" />
<Compile Include="..\..\ClassLayoutTest.cs" />
<Compile Include="..\..\StructLayoutTest.cs" />
<Compile Include="..\..\XmlSerializationTest.cs" />
<Compile Include="..\..\AttributeTest.cs" />
<Compile Include="..\..\InterfacesTest.cs" />
<Compile Include="..\..\DataContractTest.cs" />
<Compile Include="..\..\..\..\BaseOptimizeGeneratedCodeTest.cs" />
<Compile Include="..\..\..\link sdk\OptimizeGeneratedCodeTest.cs">
<Link>OptimizeGeneratedCodeTest.cs</Link>
</Compile>
<Compile Include="..\..\InternalsTest.cs" />
<Compile Include="..\..\LinqExpressionTest.cs" />
<Compile Include="..\..\CalendarTest.cs" />
<Compile Include="..\..\PreserveTest.cs" />
<Compile Include="..\..\MEFTests.cs" />
<Compile Include="..\..\SealerTest.cs" />
<Compile Include="..\..\..\link sdk\ReflectionTest.cs">
<Link>ReflectionTest.cs</Link>
</Compile>
<Compile Include="..\..\SerializationTest.cs" />
<Compile Include="..\..\..\..\ILReader.cs" />
<Compile Include="..\..\..\..\..\common\TestRuntime.cs">
<Link>TestRuntime.cs</Link>
</Compile>
<Compile Include="..\..\..\..\CommonLinkAllTest.cs">
<Link>CommonLinkAllTest.cs</Link>
</Compile>
<Compile Include="..\..\..\..\CommonLinkAnyTest.cs">
<Link>CommonLinkAnyTest.cs</Link>
</Compile>
<Compile Include="..\..\..\..\..\monotouch-test\System.Net.Http\NetworkResources.cs">
<Link>NetworkResources.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="..\..\LaunchScreen.storyboard" />
</ItemGroup>
<ItemGroup>
<ImageAsset Include="..\..\Assets.xcassets\AppIcons.appiconset\Contents.json" />
<ImageAsset Include="..\..\Assets.xcassets\AppIcons.appiconset\Icon-app-60%403x.png" />
<ImageAsset Include="..\..\Assets.xcassets\AppIcons.appiconset\icon-app-57.png" />
<ImageAsset Include="..\..\Assets.xcassets\AppIcons.appiconset\icon-app-57%402x.png" />
<ImageAsset Include="..\..\Assets.xcassets\AppIcons.appiconset\icon-app-60%402x.png" />
<ImageAsset Include="..\..\Assets.xcassets\AppIcons.appiconset\icon-app-72.png" />
<ImageAsset Include="..\..\Assets.xcassets\AppIcons.appiconset\icon-app-72%402x.png" />
<ImageAsset Include="..\..\Assets.xcassets\AppIcons.appiconset\icon-app-76.png" />
<ImageAsset Include="..\..\Assets.xcassets\AppIcons.appiconset\icon-app-76%402x.png" />
<ImageAsset Include="..\..\Assets.xcassets\AppIcons.appiconset\icon-app-83.5%402x.png" />
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions tests/xharness/Harness.cs
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ void AutoConfigureIOS ()
IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "linker", "ios", "dont link", "dont link.csproj"))) { Configurations = new string [] { "Debug", "Release" } });
IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "linker", "ios", "dont link", "dotnet", "iOS", "dont link.csproj"))) { Configurations = new string [] { "Debug", "Release" }, IsDotNetProject = true, SkipiOSVariation = false, SkiptvOSVariation = true, SkipwatchOSVariation = true, SkipTodayExtensionVariation = true, SkipDeviceVariations = true, SkipiOS32Variation = true });
IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "linker", "ios", "link all", "link all.csproj"))) { Configurations = new string [] { "Debug", "Release" } });
IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "linker", "ios", "link all", "dotnet", "iOS", "link all.csproj"))) { Configurations = new string [] { "Debug", "Release" }, IsDotNetProject = true, SkipiOSVariation = false, SkiptvOSVariation = true, SkipwatchOSVariation = true, SkipTodayExtensionVariation = true, SkipDeviceVariations = true, SkipiOS32Variation = true, Ignore = true });
IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "linker", "ios", "link sdk", "link sdk.csproj"))) { Configurations = new string [] { "Debug", "Release" } });
IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "linker", "ios", "link sdk", "dotnet", "iOS", "link sdk.csproj"))) { Configurations = new string [] { "Debug" /*, "Release" */ }, IsDotNetProject = true, SkipiOSVariation = false, SkiptvOSVariation = true, SkipwatchOSVariation = true, SkipTodayExtensionVariation = true, SkipDeviceVariations = true, SkipiOS32Variation = true });

Expand Down

0 comments on commit e4d14ad

Please sign in to comment.