[tests] Add a .NET/MacCatalyst variation of monotouch-test.

Also:

* Use the right arm64 runtime identifier depending on the target platform.
* Don't add CoreCLR variations of Mac Catalyst tests.
* Exclude UISearchDisplayController from tests, since it isn't available in
  Mac Catalyst anymore.
This commit is contained in:
Rolf Bjarne Kvinge 2021-05-12 10:17:44 +02:00
Родитель d1904eccf1
Коммит 12afa170bf
7 изменённых файлов: 282 добавлений и 5 удалений

Просмотреть файл

@ -7,7 +7,7 @@
// Copyright 2012 Xamarin Inc. All rights reserved.
//
#if !XAMCORE_3_0 && !MONOMAC
#if !XAMCORE_3_0 && !MONOMAC && !__MACCATALYST__
using System;
using System.Drawing;

Просмотреть файл

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>MonoTouchTest</string>
<key>CFBundleIdentifier</key>
<string>com.xamarin.monotouch-test</string>
<key>CFBundleName</key>
<string>MonoTouchTest</string>
<key>LSMinimumSystemVersion</key>
<string>10.15</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSAppleMusicUsageDescription</key>
<string>Testing tastes</string>
<key>NSCameraUsageDescription</key>
<string>Smile!</string>
<key>NSContactsUsageDescription</key>
<string>Testing friends</string>
<key>NSHomeKitUsageDescription</key>
<string>Testing roofs</string>
<key>NSMicrophoneUsageDescription</key>
<string>Testing mike</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Testing lens</string>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>Testing world domination through blue teeth coloring</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiresFullScreen</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>XSAppIconAssets</key>
<string>Assets.xcassets/AppIcons.appiconset</string>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>com.xamarin.monotouch-test.TesgBackgroundTask</string>
</array>
<key>UIBackgroundModes</key>
<array>
<string>processing</string>
</array>
</dict>
</plist>

Просмотреть файл

@ -0,0 +1,193 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-maccatalyst</TargetFramework>
<RuntimeIdentifier>maccatalyst-x64</RuntimeIdentifier>
<OutputType>Exe</OutputType>
<DefineConstants>NET</DefineConstants>
<LangVersion>latest</LangVersion>
<RootNamespace>monotouchtest</RootNamespace>
<AssemblyName>monotouchtest</AssemblyName>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\..\..\product.snk</AssemblyOriginatorKeyFile>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<CodesignEntitlements Condition="'$(Platform)' == 'iPhoneSimulator'">..\..\Entitlements.plist</CodesignEntitlements>
<AssetTargetFallback>xamarinios10;$(AssetTargetFallback)</AssetTargetFallback>
<DefineConstants Condition="'$(Platform)' == 'iPhoneSimulator'">$(DefineConstants);DYNAMIC_REGISTRAR</DefineConstants>
<DefineConstants Condition="'$(Platform)' != 'iPhoneSimulator'">$(DefineConstants);DEVICE</DefineConstants>
<RootTestsDirectory>..\..\..</RootTestsDirectory>
<MtouchLink>None</MtouchLink>
<MtouchExtraArgs>-xml=${ProjectDir}/../extra-linker-defs.xml</MtouchExtraArgs>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NUnitLite" Version="3.12.0" />
<PackageReference Include="MonoTouch.Dialog" Version="2.0.0-pre1" />
<ProjectReference Include="..\..\..\..\external\Touch.Unit\Touch.Client\dotnet\MacCatalyst\Touch.Client-MacCatalyst.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" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
<None Include="..\..\Entitlements.plist" />
<None Include="..\..\app.config" />
<None Include="..\..\EmptyNib.xib" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\**\*.cs" Exclude="$(DefaultItemExcludes);..\..\obj\**;..\..\dotnet\**">
<Link>%(RecursiveDir)%(Filename).cs</Link>
</Compile>
<Compile Include="..\..\..\..\tests\test-libraries\TrampolineTest.generated.cs" />
<Compile Include="..\..\..\..\tests\test-libraries\RegistrarTest.generated.cs" />
<Compile Include="..\..\..\api-shared\ObjCRuntime\RegistrarTest.cs">
<Link>shared\ObjCRuntime\RegistrarTest.cs</Link>
</Compile>
<Compile Include="..\..\..\api-shared\CoreFoundation\CFNotificationCenterTest.cs">
<Link>CoreFoundation\CFNotificationCenterTest.cs</Link>
</Compile>
<Compile Include="..\..\..\common\TestRuntime.cs">
<Link>TestRuntime.cs</Link>
</Compile>
<Compile Include="..\..\..\common\ConditionalCompilation.cs">
<Link>ConditionalCompilation.cs</Link>
</Compile>
<Compile Include="..\..\..\common\Extensions.cs">
<Link>Extensions.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="..\..\AudioToolbox\1.caf">
<Link>AudioToolbox\1.caf</Link>
</Content>
<Content Include="..\..\Tamarin.pdf">
<Link>Tamarin.pdf</Link>
</Content>
<Content Include="..\..\basn3p08.png">
<Link>basn3p08.png</Link>
</Content>
<Content Include="..\..\BoardingPass.pkpass">
<Link>BoardingPass.pkpass</Link>
</Content>
<Content Include="..\..\Hand.wav">
<Link>Hand.wav</Link>
</Content>
<Content Include="..\..\Pacifico.ttf">
<Link>Pacifico.ttf</Link>
</Content>
<Content Include="..\..\LL-171A-B-B797E457-16AB-C708-1E0F-32C19DBD47B5.icc">
<Link>LL-171A-B-B797E457-16AB-C708-1E0F-32C19DBD47B5.icc</Link>
</Content>
<Content Include="..\..\drum01.mp3">
<Link>drum01.mp3</Link>
</Content>
<Content Include="..\..\Model3.arobject">
<Link>Model3.arobject</Link>
</Content>
<Content Include="..\..\access-denied.html">
<Link>access-denied.html</Link>
</Content>
<Content Include="..\..\access-granted.html">
<Link>access-granted.html</Link>
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\EmbeddedResources\dotnet\MacCatalyst\EmbeddedResources.csproj" />
<ProjectReference Include="..\..\..\..\tests\bindings-test\dotnet\MacCatalyst\bindings-test.csproj" />
<ProjectReference Include="..\..\..\fsharplibrary\dotnet\MacCatalyst\fsharplibrary.fsproj" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="..\..\CoreImage\Xam.png">
<Link>CoreImage\Xam.png</Link>
</BundleResource>
<BundleResource Include="..\..\Resources\xamarin0.png">
<Link>Resources\xamarin0.png</Link>
</BundleResource>
<BundleResource Include="..\..\Resources\xamarin1.png">
<Link>Resources\xamarin1.png</Link>
</BundleResource>
<BundleResource Include="..\..\Resources\xamarin2.png">
<Link>Resources\xamarin2.png</Link>
</BundleResource>
<BundleResource Include="..\..\xamvideotest.mp4">
<Link>xamvideotest.mp4</Link>
</BundleResource>
<BundleResource Include="..\..\CoreImage\xamarinmonkey.heic">
<Link>CoreImage\xamarinmonkey.heic</Link>
</BundleResource>
<BundleResource Include="..\..\Resources\Base.lproj\Localizable.strings">
<Link>Resources\Base.lproj\Localizable.strings</Link>
</BundleResource>
<BundleResource Include="..\..\Resources\metal-sample.metal">
<Link>Resources\metal-sample.metal</Link>
</BundleResource>
<BundleResource Include="..\..\Resources\fragmentShader.metal">
<Link>Resources\fragmentShader.metal</Link>
</BundleResource>
<BundleResource Include="..\..\uncompressed.txt">
<Link>uncompressed.txt</Link>
</BundleResource>
<BundleResource Include="..\..\compressed_lze">
<Link>compressed_lze</Link>
</BundleResource>
<BundleResource Include="..\..\compressed_lz4">
<Link>compressed_lz4</Link>
</BundleResource>
<BundleResource Include="..\..\compressed_lzma">
<Link>compressed_lzma</Link>
</BundleResource>
<BundleResource Include="..\..\compressed_zip">
<Link>compressed_zip</Link>
</BundleResource>
<BundleResource Include="..\..\example.pac">
<Link>example.pac</Link>
</BundleResource>
<BundleResource Include="..\..\Resources\square.gif">
<Link>Resources\square.gif</Link>
</BundleResource>
</ItemGroup>
<ItemGroup>
<Metal Include="..\..\Resources\metal-sample.metal" Condition="'$(_SdkIsSimulator)' != 'true'">
<Link>Resources\metal-sample.metal</Link>
</Metal>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\..\Security\openssl_crt.der">
<LogicalName>monotouchtest.Security.openssl_crt.der</LogicalName>
</EmbeddedResource>
</ItemGroup>
<PropertyGroup>
<TestLibrariesDirectory>..\..\..\..\tests\test-libraries</TestLibrariesDirectory>
</PropertyGroup>
<ItemGroup>
<GeneratedTestInput Include="$(TestLibrariesDirectory)\*.m" />
<GeneratedTestInput Include="$(TestLibrariesDirectory)\*.h" />
<GeneratedTestInput Include="$(TestLibrariesDirectory)\*.cs" />
<GeneratedTestInput Include="$(TestLibrariesDirectory)\Makefile" />
<GeneratedTestOutput Include="$(TestLibrariesDirectory)\TrampolineTest.generated.cs" />
<GeneratedTestOutput Include="$(TestLibrariesDirectory)\RegistrarTest.generated.cs" />
<CustomMetalSmeltingInput Include="..\..\Resources\fragmentShader.metal" />
</ItemGroup>
<Target Name="CustomMetalSmelting" Inputs="@(CustomMetalSmeltingInput)" Outputs="$(_AppBundlePath)\fragmentShader.metallib" Condition="'$(_SdkIsSimulator)' != 'true'" DependsOnTargets="_GenerateBundleName;_DetectSdkLocations">
<PropertyGroup>
<_SmeltingSdk Condition="'$(_PlatformName)' == 'iOS'">iphoneos</_SmeltingSdk>
<_SmeltingSdk Condition="'$(_PlatformName)' == 'tvOS'">appletvos</_SmeltingSdk>
<_SmeltingMinOS Condition="'$(_PlatformName)' == 'iOS'">-mios-version-min=11.0</_SmeltingMinOS>
<_SmeltingMinOS Condition="'$(_PlatformName)' == 'tvOS'">-mtvos-version-min=11.0</_SmeltingMinOS>
</PropertyGroup>
<MakeDir Directories="$(IntermediateOutputPath);$(AppBundleDir)" />
<Exec Command="xcrun -sdk $(_SmeltingSdk) metal -c @(CustomMetalSmeltingInput) -o $(IntermediateOutputPath)\fragmentShader.air $(_SmeltingMinOS)" EnvironmentVariables="DEVELOPER_DIR=$(_SdkDevPath)" />
<Exec Command="xcrun -sdk $(_SmeltingSdk) metallib $(IntermediateOutputPath)\fragmentShader.air -o $(AppBundleDir)\fragmentShader.metallib" EnvironmentVariables="DEVELOPER_DIR=$(_SdkDevPath)" />
</Target>
<Target Name="BeforeBuild" Inputs="@(GeneratedTestInput)" Outputs="@(GeneratedTestOutput)" DependsOnTargets="CustomMetalSmelting" >
<Exec Command="make -j8 -C $(TestLibrariesDirectory)" />
</Target>
<Import Project="$(RootTestsDirectory)\nunit.framework.targets" />
</Project>

Просмотреть файл

@ -297,6 +297,13 @@ namespace Xharness {
Platform = "AnyCPU",
});
MacTestProjects.Add (new MacTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "monotouch-test", "dotnet", "MacCatalyst", "monotouch-test.csproj"))) {
Name = "monotouch-test",
IsDotNetProject = true,
TargetFrameworkFlavors = MacFlavors.MacCatalyst,
Platform = "AnyCPU",
});
foreach (var flavor in new MonoNativeFlavor [] { MonoNativeFlavor.Compat, MonoNativeFlavor.Unified }) {
var monoNativeInfo = new MonoNativeInfo (DevicePlatform.macOS, flavor, RootDirectory, Log);
var macTestProject = new MacTestProject (monoNativeInfo.ProjectPath, targetFrameworkFlavor: MacFlavors.Modern | MacFlavors.Full) {
@ -413,7 +420,7 @@ namespace Xharness {
IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "introspection", "iOS", "introspection-ios.csproj"))) { Name = "introspection", IgnoreMacCatalystVariation = false });
IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "introspection", "dotnet", "iOS", "introspection.csproj"))) { Name = "introspection", IsDotNetProject = true, SkipiOSVariation = false, SkiptvOSVariation = true, SkipwatchOSVariation = true, SkipTodayExtensionVariation = true, SkipDeviceVariations = false, SkipiOS32Variation = true, });
IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "introspection", "dotnet", "tvOS", "introspection.csproj"))) { Name = "introspection", IsDotNetProject = true, SkipiOSVariation = true, SkiptvOSVariation = true, SkipwatchOSVariation = true, SkipTodayExtensionVariation = true, SkipDeviceVariations = false, SkipiOS32Variation = true, GenerateVariations = false, TestPlatform = TestPlatform.tvOS, });
IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "monotouch-test", "dotnet", "iOS", "monotouch-test.csproj"))) { Name = "monotouch-test", IsDotNetProject = true, SkipiOSVariation = false, SkiptvOSVariation = true, SkipwatchOSVariation = true, SkipTodayExtensionVariation = true, SkipDeviceVariations = false, SkipiOS32Variation = true, IgnoreMacCatalystVariation = true });
IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "monotouch-test", "dotnet", "iOS", "monotouch-test.csproj"))) { Name = "monotouch-test", IsDotNetProject = true, SkipiOSVariation = false, SkiptvOSVariation = true, SkipwatchOSVariation = true, SkipTodayExtensionVariation = true, SkipDeviceVariations = false, SkipiOS32Variation = true, GenerateVariations = false, TestPlatform = TestPlatform.iOS_Unified, });
IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "monotouch-test", "dotnet", "tvOS", "monotouch-test.csproj"))) { Name = "monotouch-test", IsDotNetProject = true, SkipiOSVariation = true, SkiptvOSVariation = true, SkipwatchOSVariation = true, SkipTodayExtensionVariation = true, SkipDeviceVariations = false, SkipiOS32Variation = true, GenerateVariations = false, TestPlatform = TestPlatform.tvOS, });
IOSTestProjects.Add (new iOSTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "linker", "ios", "dont link", "dont link.csproj"))) {
Configurations = new string [] { "Debug", "Release" },

Просмотреть файл

@ -33,6 +33,13 @@ namespace Xharness.Jenkins {
var supports_dynamic_registrar_on_device = test.Platform == TestPlatform.iOS_Unified64 || test.Platform == TestPlatform.tvOS;
var ignore = test.TestProject.Ignore;
var mac_supports_arm64 = Harness.CanRunArm64;
var arm64_runtime_identifier = string.Empty;
if (test.Platform == TestPlatform.Mac) {
arm64_runtime_identifier = "osx-arm64";
} else if (test.Platform == TestPlatform.MacCatalyst) {
arm64_runtime_identifier = "maccatalyst-arm64";
}
switch (test.ProjectPlatform) {
case "iPhone":
@ -119,9 +126,11 @@ namespace Xharness.Jenkins {
case "monotouch-test":
if (test.TestProject.IsDotNetProject) {
var isDotNetReady = false;
yield return new TestData { Variation = "Debug (CoreCLR)", Debug = true, UseMonoRuntime = false, Ignored = !isDotNetReady || !jenkins.IncludeMac, };
yield return new TestData { Variation = "Debug (ARM64)", Debug = true, Profiling = false, Ignored = !isDotNetReady || !jenkins.IncludeMac || !mac_supports_arm64, RuntimeIdentifier = "osx-arm64", };
yield return new TestData { Variation = "Debug (CoreCLR, ARM64)", Debug = true, UseMonoRuntime = false, Profiling = false, Ignored = !isDotNetReady || !jenkins.IncludeMac || !mac_supports_arm64, RuntimeIdentifier = "osx-arm64", };
if (test.Platform != TestPlatform.MacCatalyst)
yield return new TestData { Variation = "Debug (CoreCLR)", Debug = true, UseMonoRuntime = false, Ignored = !isDotNetReady || !jenkins.IncludeMac, };
yield return new TestData { Variation = "Debug (ARM64)", Debug = true, Profiling = false, Ignored = !isDotNetReady || !jenkins.IncludeMac || !mac_supports_arm64, RuntimeIdentifier = arm64_runtime_identifier, };
if (test.Platform != TestPlatform.MacCatalyst)
yield return new TestData { Variation = "Debug (CoreCLR, ARM64)", Debug = true, UseMonoRuntime = false, Profiling = false, Ignored = !isDotNetReady || !jenkins.IncludeMac || !mac_supports_arm64, RuntimeIdentifier = arm64_runtime_identifier, };
}
break;
case "xammac tests":

Просмотреть файл

@ -13,6 +13,7 @@ namespace Xharness {
MacFlavors.Modern => TestPlatform.Mac_Modern,
MacFlavors.System => TestPlatform.Mac_System,
MacFlavors.DotNet => TestPlatform.Mac,
MacFlavors.MacCatalyst => TestPlatform.MacCatalyst,
_ => throw new NotImplementedException (flavor.ToString ()),
};
}

Просмотреть файл

@ -8,6 +8,7 @@ namespace Xharness {
System = 4, // Xamarin.Mac/System app
Console = 8, // Console executable
DotNet = 16,
MacCatalyst = 32,
}
public class MacTestProject : TestProject {