Skip to content

Commit

Permalink
[monotouch-test] Create a shared.csproj for all the .NET monotouch-te…
Browse files Browse the repository at this point in the history
…st project files. (#12128)

* [monotouch-test] Create a shared.csproj for all the .NET monotouch-test project files.

Also complete the logic to build metal files, so that it works on Mac Catalyst as well.

* [monotouch-test] Add helper makefiles.

* [monotouch-test] Fix the RootTestsDirectory in the csproj.

* [monotouch-test] Add empty ItemGroup for xharness to put stuff in.

* [monotouch-test] Set DYNAMIC_REGISTRAR in each csproj, because xharness needs to be able to unset it.

* [monotouch-test] Exclude tests that don't work with AOT from Mac Catalyst/ARM64.

* [monotouch-test] Use 'ComputedPlatform' instead of 'Platform' to determine whether we're building for a device or not.

'Platform' can be anything, while we know the value of 'ComputedPlatform'. And
since 'ComputedPlatform' is computed after the csproj is read, we need to
delay the computation until later (thus in a separate target).
  • Loading branch information
rolfbjarne authored Jul 19, 2021
1 parent 7ea2524 commit e968a93
Show file tree
Hide file tree
Showing 11 changed files with 272 additions and 738 deletions.
4 changes: 2 additions & 2 deletions tests/monotouch-test/ObjCRuntime/BlocksTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static TestClass ()
}
}

#if !DEVICE && !MONOMAC // some of these tests cause the AOT compiler to assert
#if !DEVICE && !MONOMAC && !AOT // some of these tests cause the AOT compiler to assert
// No MonoPInvokeCallback
static void InvalidTrampoline1 () { }

Expand Down Expand Up @@ -98,7 +98,7 @@ public void InvalidBlockTrampolines ()

Assert.Throws<ArgumentNullException> (() => block.SetupBlock (null, userDelegate), "null trampoline");

#if !DEVICE && !MONOMAC
#if !DEVICE && !MONOMAC && !AOT
if (Runtime.Arch == Arch.SIMULATOR) {
// These checks only occur in the simulator
Assert.Throws<ArgumentException> (() => block.SetupBlock ((Action) InvalidBlockTrampolines, userDelegate), "instance trampoline");
Expand Down
1 change: 1 addition & 0 deletions tests/monotouch-test/dotnet/MacCatalyst/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../shared.mk
184 changes: 7 additions & 177 deletions tests/monotouch-test/dotnet/MacCatalyst/monotouch-test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,190 +2,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-maccatalyst</TargetFramework>
<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>
<DefineConstants Condition="'$(Configuration)' == 'Debug'">$(DefineConstants);DYNAMIC_REGISTRAR</DefineConstants> <!-- this can't be in shared.csproj, because xharness needs to remove the DYNAMIC_REGISTRAR define for certain test cases -->
<AssetTargetFallback>xamarinios10;$(AssetTargetFallback)</AssetTargetFallback>
<DefineConstants Condition="'$(Platform)' == 'iPhoneSimulator'">$(DefineConstants);DYNAMIC_REGISTRAR</DefineConstants>
<DefineConstants Condition="'$(Platform)' != 'iPhoneSimulator'">$(DefineConstants);DEVICE</DefineConstants>
<RootTestsDirectory>..\..\..</RootTestsDirectory>
<MtouchLink>None</MtouchLink>
<RootTestsDirectory>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)\..\..\..'))</RootTestsDirectory> <!-- this can't be in shared.csproj, because xharness won't see it there -->
<AssemblyName>monotouchtest</AssemblyName> <!-- this can't be in shared.csproj, because xharness won't see it there -->
</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" />
<!-- this empty item group is here for xharness -->
</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>
<Import Project="$(RootTestsDirectory)/monotouch-test/dotnet/shared.csproj" />

<PropertyGroup>
<TestLibrariesDirectory>..\..\..\..\tests\test-libraries</TestLibrariesDirectory>
<!-- This must be after the place where xharness injects the RuntimeIdentifier property -->
<DefineConstants Condition="'$(RuntimeIdentifier)' == 'maccatalyst-arm64'">$(DefineConstants);AOT</DefineConstants>
</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>
4 changes: 4 additions & 0 deletions tests/monotouch-test/dotnet/iOS/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include ../shared.mk

dev:
$(DOTNET6) build /bl *.csproj $(MSBUILD_VERBOSITY) /p:RuntimeIdentifier=ios-arm64
Loading

8 comments on commit e968a93

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ [CI Build] Tests failed on Build ❌

Tests failed on Build.

API diff

✅ API Diff from stable

View API diff

API & Generator diff

API Diff (from PR only) (no change)
Generator Diff (no change)

Packages generated

View packages

Test results

3 tests failed, 218 tests passed.

Failed tests

  • monotouch-test/Mac Catalyst/Debug [dotnet]: Failed (Tests run: 2629 Passed: 2492 Inconclusive: 35 Failed: 2 Ignored: 135)
  • link sdk/tvOS - simulator/Debug: Failed
  • Generator tests/.NET: Failed (Execution failed with exit code 1)

Pipeline on Agent XAMBOT-1035.BigSur'
[monotouch-test] Create a shared.csproj for all the .NET monotouch-test project files. (#12128)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 Tests failed catastrophically on VSTS: device tests tvOS 🔥

Not enough free space in the host.

Pipeline on Agent
[monotouch-test] Create a shared.csproj for all the .NET monotouch-test project files. (#12128)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Tests were not ran (VSTS: device tests tvOS). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
[monotouch-test] Create a shared.csproj for all the .NET monotouch-test project files. (#12128)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Tests were not ran (VSTS: device tests iOS). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
[monotouch-test] Create a shared.csproj for all the .NET monotouch-test project files. (#12128)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Tests passed on macOS Mac Catalina (10.15) ✅

Tests passed

All tests on macOS X Mac Catalina (10.15) passed.

Pipeline on Agent
[monotouch-test] Create a shared.csproj for all the .NET monotouch-test project files. (#12128)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Tests passed on macOS Mac Mojave (10.14) ✅

Tests passed

All tests on macOS X Mac Mojave (10.14) passed.

Pipeline on Agent
[monotouch-test] Create a shared.csproj for all the .NET monotouch-test project files. (#12128)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Tests passed on macOS Mac High Sierra (10.13) ✅

Tests passed

All tests on macOS X Mac High Sierra (10.13) passed.

Pipeline on Agent
[monotouch-test] Create a shared.csproj for all the .NET monotouch-test project files. (#12128)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Tests were not ran (VSTS: device tests iOS32b). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
[monotouch-test] Create a shared.csproj for all the .NET monotouch-test project files. (#12128)

Please sign in to comment.