Skip to content

Commit

Permalink
[mono][tests] Run Mono iOS sample as functional test on the simulator…
Browse files Browse the repository at this point in the history
… and maccatalyst on Helix (#86578)

* Add HelloiOS sample on iossimulator

* Enable AOT compilation and JustInterp mode on iossimulator

* Remove custom tasks from the sample app

* Set default props for the sample app. Use diagnostics_tracing and marshal-ilgen for RuntimeComponents

---------

Co-authored-by: Filip Navara <filip.navara@gmail.com>
  • Loading branch information
kotlarmilos and filipnavara authored Jun 11, 2023
1 parent 0ea4609 commit 19712d9
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 163 deletions.
12 changes: 6 additions & 6 deletions eng/pipelines/coreclr/templates/build-perf-sample-apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ steps:
artifactName: ${{ parameters.artifactName }}
- template: /eng/pipelines/common/upload-artifact-step.yml
parameters:
rootFolder: $(Build.SourcesDirectory)/src/mono/sample/iOS/bin/ios-arm64/publish/app/HelloiOS/Release-iphoneos/HelloiOS.app
rootFolder: $(Build.SourcesDirectory)/src/mono/sample/iOS/bin/ios-arm64/Bundle/HelloiOS/Release-iphoneos/HelloiOS.app
includeRootFolder: true
displayName: iOS Sample App NoLLVM
artifactName: iOSSampleAppNoLLVMSymbols
Expand All @@ -72,7 +72,7 @@ steps:
artifactName: ${{ parameters.artifactName }}
- template: /eng/pipelines/common/upload-artifact-step.yml
parameters:
rootFolder: $(Build.SourcesDirectory)/src/mono/sample/iOS/bin/ios-arm64/publish/app/HelloiOS/Release-iphoneos/HelloiOS.app
rootFolder: $(Build.SourcesDirectory)/src/mono/sample/iOS/bin/ios-arm64/Bundle/HelloiOS/Release-iphoneos/HelloiOS.app
includeRootFolder: true
displayName: iOS Sample App NoLLVM NoSymbols
artifactName: iOSSampleAppNoLLVMNoSymbols
Expand All @@ -94,7 +94,7 @@ steps:
artifactName: ${{ parameters.artifactName }}
- template: /eng/pipelines/common/upload-artifact-step.yml
parameters:
rootFolder: $(Build.SourcesDirectory)/src/mono/sample/iOS/bin/ios-arm64/publish/app/HelloiOS/Release-iphoneos/HelloiOS.app
rootFolder: $(Build.SourcesDirectory)/src/mono/sample/iOS/bin/ios-arm64/Bundle/HelloiOS/Release-iphoneos/HelloiOS.app
includeRootFolder: true
displayName: iOS Sample App LLVM
artifactName: iOSSampleAppLLVMSymbols
Expand All @@ -116,7 +116,7 @@ steps:
artifactName: ${{ parameters.artifactName }}
- template: /eng/pipelines/common/upload-artifact-step.yml
parameters:
rootFolder: $(Build.SourcesDirectory)/src/mono/sample/iOS/bin/ios-arm64/publish/app/HelloiOS/Release-iphoneos/HelloiOS.app
rootFolder: $(Build.SourcesDirectory)/src/mono/sample/iOS/bin/ios-arm64/Bundle/HelloiOS/Release-iphoneos/HelloiOS.app
includeRootFolder: true
displayName: iOS Sample App LLVM NoSymbols
artifactName: iOSSampleAppLLVMNoSymbols
Expand All @@ -137,7 +137,7 @@ steps:
artifactName: ${{ parameters.artifactName }}
- template: /eng/pipelines/common/upload-artifact-step.yml
parameters:
rootFolder: $(Build.SourcesDirectory)/src/mono/sample/iOS-NativeAOT/bin/publish/app/HelloiOS/Release-iphoneos/HelloiOS.app
rootFolder: $(Build.SourcesDirectory)/src/mono/sample/iOS-NativeAOT/bin/Bundle/HelloiOS/Release-iphoneos/HelloiOS.app
includeRootFolder: true
displayName: iOS Sample App Symbols
artifactName: iOSSampleAppSymbols
Expand All @@ -159,7 +159,7 @@ steps:
artifactName: ${{ parameters.artifactName }}
- template: /eng/pipelines/common/upload-artifact-step.yml
parameters:
rootFolder: $(Build.SourcesDirectory)/src/mono/sample/iOS-NativeAOT/bin/publish/app/HelloiOS/Release-iphoneos/HelloiOS.app
rootFolder: $(Build.SourcesDirectory)/src/mono/sample/iOS-NativeAOT/bin/Bundle/HelloiOS/Release-iphoneos/HelloiOS.app
includeRootFolder: true
displayName: iOS Sample App NoSymbols
artifactName: iOSSampleAppNoSymbols
Expand Down
10 changes: 4 additions & 6 deletions src/libraries/tests.proj
Original file line number Diff line number Diff line change
Expand Up @@ -632,9 +632,8 @@
</ItemGroup>

<ItemGroup Condition="'$(ArchiveTests)' == 'true' and '$(RunSmokeTestsOnly)' != 'true' and '$(RunGrpcTestsOnly)' != 'true' and '$(TargetOS)' == 'iossimulator'">
<!-- https://github.com/dotnet/runtime/issues/57666 -->
<!-- <ProjectReference Include="$(MonoProjectRoot)sample\iOS\Program.csproj"
BuildInParallel="false" /> -->
<ProjectReference Include="$(MonoProjectRoot)sample\iOS\Program.csproj"
BuildInParallel="false" />
<ProjectReference Include="$(RepoRoot)\src\tests\FunctionalTests\iOS\Simulator\**\*.Test.csproj"
Exclude="@(ProjectExclusions)"
BuildInParallel="false" />
Expand All @@ -647,9 +646,8 @@
</ItemGroup>

<ItemGroup Condition="'$(ArchiveTests)' == 'true' and '$(RunSmokeTestsOnly)' != 'true' and '$(RunGrpcTestsOnly)' != 'true' and '$(TargetOS)' == 'maccatalyst'">
<!-- https://github.com/dotnet/runtime/issues/57666 -->
<!-- <ProjectReference Include="$(MonoProjectRoot)sample\iOS\Program.csproj"
BuildInParallel="false" /> -->
<ProjectReference Include="$(MonoProjectRoot)sample\iOS\Program.csproj"
BuildInParallel="false" />
<ProjectReference Include="$(RepoRoot)\src\tests\FunctionalTests\iOS\Simulator\**\*.Test.csproj"
Exclude="@(ProjectExclusions)"
BuildInParallel="false" />
Expand Down
3 changes: 2 additions & 1 deletion src/mono/msbuild/apple/build/AppleBuild.InTree.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
<UsingTask TaskName="MonoAOTCompiler" AssemblyFile="$(MonoAOTCompilerTasksAssemblyPath)" />
<UsingTask TaskName="RuntimeConfigParserTask" AssemblyFile="$(MonoTargetsTasksAssemblyPath)" />

<!-- For MacCatalyst, adhoc is the default. Set it here so that we don't have to specify when running local -->
<!-- For MacCatalyst, adhoc is the default. Set it here so that we don't have to specify when running local -->
<PropertyGroup>
<DevTeamProvisioning Condition="'$(DevTeamProvisioning)' == '' and '$(TargetOS)' != 'maccatalyst'">-</DevTeamProvisioning>
<DevTeamProvisioning Condition="'$(DevTeamProvisioning)' == '' and '$(TargetOS)' == 'maccatalyst'">adhoc</DevTeamProvisioning>
</PropertyGroup>

Expand Down
8 changes: 6 additions & 2 deletions src/mono/msbuild/apple/build/AppleBuild.targets
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<BundleDir>$(AppleBundleDir)</BundleDir>
<_MonoHeaderPath>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'include', 'mono-2.0'))</_MonoHeaderPath>
<_AotModuleTablePath>$(AppleBundleDir)\modules.m</_AotModuleTablePath>
<AppName Condition="'$(AppName)' == ''">$(AssemblyName)</AppName>
</PropertyGroup>

<!-- common linker arguments for app and library builds -->
Expand Down Expand Up @@ -84,6 +85,7 @@
<PropertyGroup>
<_AppleRuntimeConfigFilePath Condition="'$(_AppleRuntimeConfigFilePath)' == ''">$([MSBuild]::NormalizePath($(AppleBuildDir), '$(AssemblyName).runtimeconfig.json'))</_AppleRuntimeConfigFilePath>
<_ParsedRuntimeConfigFilePath Condition="'$(_ParsedRuntimeConfigFilePath)' == ''">$([MSBuild]::NormalizePath($(AppleBuildDir), 'runtimeconfig.bin'))</_ParsedRuntimeConfigFilePath>
<UseConsoleUITemplate Condition="'$(UseConsoleUITemplate)' == ''">true</UseConsoleUITemplate>
</PropertyGroup>

<RemoveDir Directories="$(AppleBundleDir)" />
Expand Down Expand Up @@ -183,6 +185,7 @@
<AotArguments>@(MonoAOTCompilerDefaultAotArguments, ';')</AotArguments>
<ProcessArguments>@(MonoAOTCompilerDefaultProcessArguments, ';')</ProcessArguments>
</_AotInputAssemblies>
<_ExcludeFromAppDir Include="$(_iOSLikeDedupAssembly)" />
</ItemGroup>

<!--
Expand Down Expand Up @@ -255,10 +258,11 @@
NativeMainSource="$(NativeMainSource)"
Optimized="$(Optimized)"
OutputDirectory="$(AppleBundleDir)"
ProjectName="$(AssemblyName)"
ProjectName="$(AppName)"
RuntimeComponents="$(RuntimeComponents)"
TargetOS="$(TargetOS)"
UseConsoleUITemplate="True">
ExcludeFromAppDir="@(_ExcludeFromAppDir)"
UseConsoleUITemplate="$(UseConsoleUITemplate)">
<Output TaskParameter="AppBundlePath" PropertyName="AppBundlePath" />
<Output TaskParameter="XcodeProjectPath" PropertyName="XcodeProjectPath" />
</AppleAppBuilderTask>
Expand Down
77 changes: 40 additions & 37 deletions src/mono/sample/iOS/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ MONO_CONFIG?=Debug
MONO_ARCH?=x64
DOTNET := ../../../../dotnet.sh
USE_LLVM=true
AOT?=false
TARGET?=iossimulator
DEPLOY_AND_RUN?=true
APP_SANDBOX?=false
Expand All @@ -25,68 +24,72 @@ appbuilder:
$(DOTNET) build -c Debug $(TOOLS_DIR)/AppleAppBuilder/AppleAppBuilder.csproj

runtimepack:
../../../../build.sh Mono+Libs -os $(TARGET) -arch $(MONO_ARCH) -c $(MONO_CONFIG)
../../../../build.sh mono+libs -os $(TARGET) -arch $(MONO_ARCH) -c $(MONO_CONFIG)

build-appbundle: clean appbuilder
$(DOTNET) publish \
-c $(MONO_CONFIG) \
/p:TargetOS=$(TARGET) \
/p:TargetArchitecture=$(MONO_ARCH) \
/p:MonoEnableLLVM=$(USE_LLVM) \
/p:StripDebugSymbols=$(STRIP_DEBUG_SYMBOLS) \
/p:DeployAndRun=false \
/bl

run: clean appbuilder
$(DOTNET) publish \
-c $(MONO_CONFIG) \
/p:TargetOS=ios \
/p:TargetArchitecture=$(MONO_ARCH) \
/p:UseLLVM=$(USE_LLVM) \
/p:ForceAOT=$(AOT) \
'/p:RuntimeComponents="$(RUNTIME_COMPONENTS)"' \
'/p:DeployAndRun="$(DEPLOY_AND_RUN)"' \
'/p:DiagnosticPorts="$(DIAGNOSTIC_PORTS)"'
/p:MonoEnableLLVM=$(USE_LLVM) \
/p:DeployAndRun=$(DEPLOY_AND_RUN) \
/p:RuntimeComponents="$(RUNTIME_COMPONENTS)" \
/p:DiagnosticPorts="$(DIAGNOSTIC_PORTS)" \
/bl

run-sim: clean appbuilder
$(DOTNET) publish \
-c $(MONO_CONFIG) \
/p:TargetOS=iossimulator \
/p:TargetArchitecture=$(MONO_ARCH) \
/p:UseLLVM=$(USE_LLVM) \
/p:ForceAOT=$(AOT) \
'/p:RuntimeComponents="$(RUNTIME_COMPONENTS)"' \
'/p:DeployAndRun="$(DEPLOY_AND_RUN)"' \
'/p:DiagnosticPorts="$(DIAGNOSTIC_PORTS)"'
/p:MonoEnableLLVM=$(USE_LLVM) \
/p:DeployAndRun=$(DEPLOY_AND_RUN) \
/p:RuntimeComponents="$(RUNTIME_COMPONENTS)" \
/p:DiagnosticPorts="$(DIAGNOSTIC_PORTS)" \
/bl

build-appbundle: clean appbuilder
$(DOTNET) publish -c $(MONO_CONFIG) /p:TargetOS=$(TARGET) /p:TargetArchitecture=$(MONO_ARCH) \
'/p:DeployAndRun="$(DEPLOY_AND_RUN)"' \
/p:StripDebugSymbols=$(STRIP_DEBUG_SYMBOLS) \
/p:UseLLVM=$(USE_LLVM) /p:ForceAOT=$(AOT) /bl \

run-catalyst:
run-sim-interp: clean appbuilder
$(DOTNET) publish \
-c $(MONO_CONFIG) \
/p:TargetOS=maccatalyst \
/p:TargetOS=iossimulator \
/p:TargetArchitecture=$(MONO_ARCH) \
'/p:DeployAndRun="$(DEPLOY_AND_RUN)"' \
/p:UseLLVM=False \
/p:ForceAOT=True \
/p:EnableAppSandbox=$(APP_SANDBOX)
/p:MonoEnableLLVM=$(USE_LLVM) \
/p:MonoForceInterpreter=true \
/p:DeployAndRun=$(DEPLOY_AND_RUN) \
/p:RuntimeComponents="$(RUNTIME_COMPONENTS)" \
/p:DiagnosticPorts="$(DIAGNOSTIC_PORTS)" \
/bl

run-sim-interp: clean appbuilder
run-catalyst: clean appbuilder
$(DOTNET) publish \
-c $(MONO_CONFIG) \
/p:TargetOS=iossimulator \
/p:TargetOS=maccatalyst \
/p:TargetArchitecture=$(MONO_ARCH) \
/p:UseLLVM=$(USE_LLVM) \
/p:ForceAOT=$(AOT) \
/p:MonoForceInterpreter=true \
'/p:DeployAndRun="$(DEPLOY_AND_RUN)"' \
'/p:RuntimeComponents="$(RUNTIME_COMPONENTS)"' \
'/p:DiagnosticPorts="$(DIAGNOSTIC_PORTS)"'
/p:MonoEnableLLVM=false \
/p:DeployAndRun=$(DEPLOY_AND_RUN) \
/p:EnableAppSandbox=$(APP_SANDBOX) \
/bl

run-catalyst-interp:
run-catalyst-interp: clean appbuilder
$(DOTNET) publish \
-c $(MONO_CONFIG) \
/p:TargetOS=maccatalyst \
/p:TargetArchitecture=$(MONO_ARCH) \
/p:UseLLVM=False \
'/p:DeployAndRun="$(DEPLOY_AND_RUN)"' \
/p:ForceAOT=True \
/p:MonoEnableLLVM=False \
/p:MonoForceInterpreter=true \
/p:DeployAndRun=$(DEPLOY_AND_RUN) \
/p:EnableAppSandbox=$(APP_SANDBOX) \
/p:MonoForceInterpreter=true
/bl

clean:
rm -rf bin
Loading

0 comments on commit 19712d9

Please sign in to comment.