diff options
Diffstat (limited to 'eng/testing')
-rw-r--r-- | eng/testing/tests.android.targets | 74 | ||||
-rw-r--r-- | eng/testing/tests.mobile.targets | 124 |
2 files changed, 85 insertions, 113 deletions
diff --git a/eng/testing/tests.android.targets b/eng/testing/tests.android.targets new file mode 100644 index 00000000000..a8b279bf853 --- /dev/null +++ b/eng/testing/tests.android.targets @@ -0,0 +1,74 @@ +<Project> + <PropertyGroup> + <BundleTestAppTargets>$(BundleTestAppTargets);BundleTestAndroidApp</BundleTestAppTargets> + </PropertyGroup> + + <Import Project="$(MonoProjectRoot)\msbuild\android\build\AndroidApp.props" /> + <Import Project="$(MonoProjectRoot)\msbuild\android\build\AndroidApp.InTree.targets" /> + + <PropertyGroup> + <AndroidBuildAppDependsOn>PrepareForAndroidBuildApp;$(AndroidBuildAppDependsOn);_CopyTestArchive</AndroidBuildAppDependsOn> + + <BundleTestAndroidAppDependsOn>AndroidBuildApp</BundleTestAndroidAppDependsOn> + </PropertyGroup> + + <!-- Target that kicks off the whole test build and run flow --> + <Target Name="BundleTestAndroidApp" DependsOnTargets="$(BundleTestAndroidAppDependsOn)" /> + + <Target Name="PrepareForAndroidBuildApp"> + <Error Condition="!Exists('$(MicrosoftNetCoreAppRuntimePackRidDir)')" Text="MicrosoftNetCoreAppRuntimePackRidDir=$(MicrosoftNetCoreAppRuntimePackRidDir) doesn't exist" /> + + <WriteLinesToFile File="$(PublishDir)xunit-excludes.txt" Lines="$(XunitExcludesTxtFileContent)" Overwrite="true" /> + + <PropertyGroup> + <MainLibraryFileName Condition="'$(MainLibraryFileName)' == ''">AndroidTestRunner.dll</MainLibraryFileName> + + <AndroidAppDir>$(PublishDir)</AndroidAppDir> + <AndroidAppBundleDir>$(BundleDir)</AndroidAppBundleDir> + </PropertyGroup> + + <ItemGroup> + <AndroidEnv Condition="'$(XUnitSingleThreadedMode)' == 'true'" Include="XUNIT_SINGLE_THREADED"> + <Value>1</Value> + </AndroidEnv> + <AndroidEnv Condition="'$(XUnitUseRandomizedTestOrderer)' == 'true'" Include="XUNIT_RANDOM_ORDER_SEED"> + <Value>1883302047</Value> + </AndroidEnv> + <AndroidEnv Condition="'$(XUnitSingleThreadedMode)' == 'true'" Include="XUNIT_VERBOSE"> + <Value>1</Value> + </AndroidEnv> + </ItemGroup> + + <ItemGroup> + <AndroidAssembliesToBundle Include="@(NativeLibraries->'$(PublishDir)%(Identity)')"> + <_InternalForceInterpret>true</_InternalForceInterpret> + <_IsNative>true</_IsNative> + </AndroidAssembliesToBundle> + + <_PublishAssemblies Include="$(PublishDir)\**\*.dll" Exclude="$(PublishDir)\**\*.resources.dll" /> + <_SatelliteAssemblies Include="$(PublishDir)\**\*.resources.dll" /> + + <AndroidAssembliesToBundle Include="@(_PublishAssemblies)"> + <_InternalForceInterpret Condition="'$(UseMonoJustInterp)' == 'true' and '%(FileName)%(Extension)' != 'System.Private.CoreLib.dll'">true</_InternalForceInterpret> + <_IsNative>false</_IsNative> + </AndroidAssembliesToBundle> + + <AndroidNativeFilesToBundle Include="$(PublishDir)\**\*.*" Exclude="$(PublishDir)\*.dll" /> + </ItemGroup> + </Target> + + <Target Name="_CopyTestArchive" + Condition="'$(ArchiveTests)' == 'true' and '$(IgnoreForCI)' != 'true'"> + <Error Condition="'$(TestArchiveTestsDir)' == ''" Text="TestArchiveTestsDir property to archive the test folder must be set." /> + + <Message Importance="High" Text="PackageId: $(ApkPackageId)"/> + <Message Importance="High" Text="Instrumentation: net.dot.MonoRunner"/> + <Message Importance="High" Text="Apk: $(ApkBundlePath)"/> + + <Copy SourceFiles="$(ApkBundlePath)" + DestinationFolder="$(TestArchiveTestsDir)" + SkipUnchangedFiles="true" + Condition="'$(ArchiveTests)' == 'true' and '$(IgnoreForCI)' != 'true'" /> + </Target> + +</Project>
\ No newline at end of file diff --git a/eng/testing/tests.mobile.targets b/eng/testing/tests.mobile.targets index 1c109d50b7e..d4ef5355663 100644 --- a/eng/testing/tests.mobile.targets +++ b/eng/testing/tests.mobile.targets @@ -8,7 +8,6 @@ <RunScriptOutputPath>$([MSBuild]::NormalizePath('$(BundleDir)', '$(RunScriptOutputName)'))</RunScriptOutputPath> <PublishingTestsRun>true</PublishingTestsRun> - <BundleTestAppTargets>BundleTestAndroidApp</BundleTestAppTargets> <PublishTestAsSelfContainedDependsOn>Publish</PublishTestAsSelfContainedDependsOn> </PropertyGroup> @@ -16,6 +15,11 @@ <RunAOTCompilation Condition="'$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'tvOS'">true</RunAOTCompilation> </PropertyGroup> + <PropertyGroup> + <DotnetPgoToolDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRToolPath)', 'dotnet-pgo'))</DotnetPgoToolDir> + <DotnetPgoToolPath>$([MSBuild]::NormalizePath('$(DotnetPgoToolDir)', 'dotnet-pgo'))</DotnetPgoToolPath> + </PropertyGroup> + <PropertyGroup Condition="'$(EnableAggressiveTrimming)' == 'true' or '$(EnableSoftTrimming)' == 'true'"> <PublishTrimmed>true</PublishTrimmed> <!-- Suppress linker warnings as these are tests --> @@ -39,6 +43,10 @@ <AdditionalXHarnessArguments Condition="'$(ExpectedExitCode)' != ''">$(AdditionalXHarnessArguments) --expected-exit-code $(ExpectedExitCode)</AdditionalXHarnessArguments> </PropertyGroup> + <PropertyGroup> + <DiagnosticPorts Condition="'$(DiagnosticStartupMode)' != ''">$(DiagnosticPorts),$(DiagnosticStartupMode)</DiagnosticPorts> + </PropertyGroup> + <PropertyGroup Condition="'$(TargetOS)' == 'Android'"> <!-- The -arg flag for xharness passes the arguments along to the instrumentation app --> <AdditionalXHarnessArguments Condition="'$(XUnitMethodName)' != ''">$(AdditionalXHarnessArguments) --arg=-m=$(XUnitMethodName)</AdditionalXHarnessArguments> @@ -55,9 +63,8 @@ <Compile Include="$(RepoRoot)src\libraries\Common\tests\Tests\RandomizedTestOrderAssemblyInfo.cs" /> </ItemGroup> - <UsingTask Condition="'$(RunAOTCompilation)' == 'true'" TaskName="MonoAOTCompiler" AssemblyFile="$(MonoAOTCompilerTasksAssemblyPath)" /> - <Import Condition="'$(RunAOTCompilation)' == 'true'" Project="$(MonoAOTCompilerDir)MonoAOTCompiler.props" /> - + <Import Project="$(MSBuildThisFileDirectory)tests.android.targets" + Condition="'$(TargetOS)' == 'Android'" /> <Import Project="$(MSBuildThisFileDirectory)tests.ioslike.targets" Condition="'$(TargetsAppleMobile)' == 'true'" /> <Import Project="$(MSBuildThisFileDirectory)tests.wasm.targets" @@ -67,115 +74,6 @@ <_MobileIntermediateOutputPath>$(IntermediateOutputPath)mobile</_MobileIntermediateOutputPath> </PropertyGroup> - <UsingTask TaskName="RuntimeConfigParserTask" - AssemblyFile="$(MonoTargetsTasksAssemblyPath)" - Condition="'$(MonoTargetsTasksAssemblyPath)' != ''" /> - - <Target Name="GenerateRuntimeConfig" Condition="'$(TargetOS)' != 'Browser'" - Inputs="$(PublishDir)$(AssemblyName).runtimeconfig.json" - Outputs="$(PublishDir)runtimeconfig.bin"> - <PropertyGroup> - <RuntimeConfigFilePath>$(PublishDir)$(AssemblyName).runtimeconfig.json</RuntimeConfigFilePath> - <ParsedRuntimeConfigFilePath>$(PublishDir)runtimeconfig.bin</ParsedRuntimeConfigFilePath> - </PropertyGroup> - - <ItemGroup> - <RuntimeConfigReservedProperties Include="RUNTIME_IDENTIFIER"/> - <RuntimeConfigReservedProperties Include="APP_CONTEXT_BASE_DIRECTORY"/> - </ItemGroup> - - <!-- Parse runtimeconfig.template.json file --> - <RuntimeConfigParserTask - RuntimeConfigFile="$(RuntimeConfigFilePath)" - OutputFile="$(ParsedRuntimeConfigFilePath)" - RuntimeConfigReservedProperties="@(RuntimeConfigReservedProperties)"> - </RuntimeConfigParserTask> - </Target> - - <!-- Generate a self-contained app bundle for Android with tests. --> - <UsingTask Condition="'$(TargetOS)' == 'Android'" - TaskName="AndroidAppBuilderTask" - AssemblyFile="$(AndroidAppBuilderTasksAssemblyPath)" /> - - <Target Condition="'$(TargetOS)' == 'Android'" Name="BundleTestAndroidApp" DependsOnTargets="GenerateRuntimeConfig"> - <Error Condition="!Exists('$(MicrosoftNetCoreAppRuntimePackRidDir)')" Text="MicrosoftNetCoreAppRuntimePackRidDir=$(MicrosoftNetCoreAppRuntimePackRidDir) doesn't exist" /> - - <PropertyGroup> - <AndroidAbi Condition="'$(TargetArchitecture)' == 'arm64'">arm64-v8a</AndroidAbi> - <AndroidAbi Condition="'$(TargetArchitecture)' == 'arm'">armeabi-v7a</AndroidAbi> - <AndroidAbi Condition="'$(TargetArchitecture)' == 'x64'">x86_64</AndroidAbi> - <AndroidAbi Condition="'$(TargetArchitecture)' == 'x86'">x86</AndroidAbi> - - <MainLibraryFileName Condition="'$(MainLibraryFileName)' == ''">AndroidTestRunner.dll</MainLibraryFileName> - </PropertyGroup> - - <ItemGroup> - <_AndroidEnv Condition="'$(XUnitSingleThreadedMode)' == 'true'" Include="XUNIT_SINGLE_THREADED"> - <Value>1</Value> - </_AndroidEnv> - <_AndroidEnv Condition="'$(XUnitUseRandomizedTestOrderer)' == 'true'" Include="XUNIT_RANDOM_ORDER_SEED"> - <Value>1883302047</Value> - </_AndroidEnv> - <_AndroidEnv Condition="'$(XUnitSingleThreadedMode)' == 'true'" Include="XUNIT_VERBOSE"> - <Value>1</Value> - </_AndroidEnv> - </ItemGroup> - - <ItemGroup Condition="'$(RunAOTCompilation)' == 'true'"> - <AotInputAssemblies Include="$(PublishDir)\*.dll"> - <AotArguments>@(MonoAOTCompilerDefaultAotArguments, ';')</AotArguments> - <ProcessArguments>@(MonoAOTCompilerDefaultProcessArguments, ';')</ProcessArguments> - </AotInputAssemblies> - </ItemGroup> - - <WriteLinesToFile File="$(PublishDir)xunit-excludes.txt" Lines="$(XunitExcludesTxtFileContent)" Overwrite="true" /> - - <MakeDir Directories="$(_MobileIntermediateOutputPath)" - Condition="'$(RunAOTCompilation)' == 'true'"/> - <RemoveDir Directories="$(BundleDir)" /> - - <MonoAOTCompiler Condition="'$(RunAOTCompilation)' == 'true'" - CompilerBinaryPath="@(MonoAotCrossCompiler->WithMetadataValue('RuntimeIdentifier','$(TargetOS.ToLowerInvariant())-$(TargetArchitecture.ToLowerInvariant())'))" - OutputDir="$(_MobileIntermediateOutputPath)" - Mode="Full" - OutputType="AsmOnly" - Assemblies="@(AotInputAssemblies)" - AotModulesTablePath="$(BundleDir)\modules.c" - IntermediateOutputPath="$(IntermediateOutputPath)" - UseLLVM="$(MonoEnableLLVM)" - LLVMPath="$(MonoAotCrossDir)"> - <Output TaskParameter="CompiledAssemblies" ItemName="BundleAssemblies" /> - </MonoAOTCompiler> - - <AndroidAppBuilderTask - RuntimeIdentifier="$(RuntimeIdentifier)" - ProjectName="$(AssemblyName)" - MonoRuntimeHeaders="$(MicrosoftNetCoreAppRuntimePackNativeDir)include\mono-2.0" - Assemblies="@(BundleAssemblies)" - MainLibraryFileName="$(MainLibraryFileName)" - IncludeNetworkSecurityConfig="$(IncludeNetworkSecurityConfig)" - EnvironmentVariables="@(_AndroidEnv)" - ForceAOT="$(RunAOTCompilation)" - ForceInterpreter="$(MonoForceInterpreter)" - RuntimeComponents="$(RuntimeComponents)" - DiagnosticPorts="$(DiagnosticPorts)" - StripDebugSymbols="False" - OutputDir="$(BundleDir)" - AppDir="$(PublishDir)"> - <Output TaskParameter="ApkPackageId" PropertyName="ApkPackageId" /> - <Output TaskParameter="ApkBundlePath" PropertyName="ApkBundlePath" /> - </AndroidAppBuilderTask> - - <Message Importance="High" Text="PackageId: $(ApkPackageId)"/> - <Message Importance="High" Text="Instrumentation: net.dot.MonoRunner"/> - <Message Importance="High" Text="Apk: $(ApkBundlePath)"/> - - <Copy SourceFiles="$(ApkBundlePath)" - DestinationFolder="$(TestArchiveTestsDir)" - SkipUnchangedFiles="true" - Condition="'$(ArchiveTests)' == 'true' and '$(IgnoreForCI)' != 'true'" /> - </Target> - <!-- This .targets file is also imported by the runtime Trimming tests, and we want to be able to manually configure trimming in them so this should be considered if we ever want to change the Condition of the ConfigureTrimming target --> <Target Name="ConfigureTrimming" Condition="('$(EnableAggressiveTrimming)' == 'true' or '$(EnableSoftTrimming)' == 'true') And '$(SkipConfigureTrimming)' != 'true'" AfterTargets="AddTestRunnersToPublishedFiles"> |