diff --git a/eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml b/eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml index db0ab302b43545..26b86483cd8e28 100644 --- a/eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml +++ b/eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml @@ -19,8 +19,7 @@ parameters: variables: {} pool: '' dependsOn: [] - compileOnHelix: false - interpreter: false + extraHelixArguments: '' buildAllTestsAsStandalone: false #arcade-specific parameters condition: always() @@ -84,56 +83,41 @@ steps: env: __MonoToolPrefix: aarch64-linux-gnu- - # Checks the value of the compileOnHelix parameter - # and if set invokes libraries pipeline for AOT on Helix - - ${{ if eq(parameters.compileOnHelix, 'true') }}: - - template: /eng/pipelines/libraries/helix.yml - parameters: - osGroup: ${{ parameters.osGroup }} - runtimeFlavor: ${{ parameters.runtimeFlavor }} - archType: ${{ parameters.archType }} - targetRid: ${{ parameters.targetRid }} - buildConfig: ${{ parameters.buildConfig }} - interpreter: ${{ parameters.interpreter }} - testRunNamePrefixSuffix: ${{ parameters.testRunNamePrefixSuffix }} - extraHelixArguments: ${{ parameters.extraHelixArguments }} - helixQueues: ${{ parameters.helixQueues }} - creator: ${{ parameters.creator }} - - ${{ else }}: - - template: /eng/pipelines/common/templates/runtimes/send-to-helix-step.yml - parameters: - displayName: Send tests to Helix - buildConfig: $(buildConfigUpper) - archType: ${{ parameters.archType }} - osGroup: ${{ parameters.osGroup }} - osSubgroup: ${{ parameters.osSubgroup}} - coreClrRepoRoot: $(Build.SourcesDirectory)/src/coreclr - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - runtimeFlavor: ${{ parameters.runtimeFlavor }} - runtimeVariant: ${{ parameters.runtimeVariant }} + - template: /eng/pipelines/common/templates/runtimes/send-to-helix-step.yml + parameters: + displayName: Send tests to Helix + buildConfig: $(buildConfigUpper) + archType: ${{ parameters.archType }} + osGroup: ${{ parameters.osGroup }} + osSubgroup: ${{ parameters.osSubgroup}} + coreClrRepoRoot: $(Build.SourcesDirectory)/src/coreclr + shouldContinueOnError: ${{ parameters.shouldContinueOnError }} + runtimeFlavor: ${{ parameters.runtimeFlavor }} + runtimeVariant: ${{ parameters.runtimeVariant }} - ${{ if eq(variables['System.TeamProject'], 'internal') }}: - # Access token variable for internal project from the - # DotNet-HelixApi-Access variable group - helixAccessToken: $(HelixApiAccessToken) - ${{ else }}: - creator: $(Build.DefinitionName) + ${{ if eq(variables['System.TeamProject'], 'internal') }}: + # Access token variable for internal project from the + # DotNet-HelixApi-Access variable group + helixAccessToken: $(HelixApiAccessToken) + ${{ else }}: + creator: $(Build.DefinitionName) - helixBuild: $(Build.BuildNumber) - helixSource: $(_HelixSource) - ${{ if ne(parameters.readyToRun, true) }}: - helixType: 'test/functional/cli/' + helixBuild: $(Build.BuildNumber) + helixSource: $(_HelixSource) + ${{ if ne(parameters.readyToRun, true) }}: + helixType: 'test/functional/cli/' - helixQueues: ${{ parameters.helixQueues }} - # This tests whether an array is empty - ${{ if eq(join('', parameters.helixQueues), '') }}: - condition: false - publishTestResults: true - timeoutPerTestInMinutes: $(timeoutPerTestInMinutes) - timeoutPerTestCollectionInMinutes: $(timeoutPerTestCollectionInMinutes) - runCrossGen2: ${{ eq(parameters.readyToRun, true) }} - compositeBuildMode: ${{ parameters.compositeBuildMode }} - runInUnloadableContext: ${{ parameters.runInUnloadableContext }} - nativeAotTest: ${{ parameters.nativeAotTest }} - helixProjectArguments: '$(Build.SourcesDirectory)/src/tests/Common/helixpublishwitharcade.proj' - scenarios: ${{ parameters.scenarios }} + helixQueues: ${{ parameters.helixQueues }} + # This tests whether an array is empty + ${{ if eq(join('', parameters.helixQueues), '') }}: + condition: false + publishTestResults: true + timeoutPerTestInMinutes: $(timeoutPerTestInMinutes) + timeoutPerTestCollectionInMinutes: $(timeoutPerTestCollectionInMinutes) + runCrossGen2: ${{ eq(parameters.readyToRun, true) }} + compositeBuildMode: ${{ parameters.compositeBuildMode }} + runInUnloadableContext: ${{ parameters.runInUnloadableContext }} + nativeAotTest: ${{ parameters.nativeAotTest }} + helixProjectArguments: '$(Build.SourcesDirectory)/src/tests/Common/helixpublishwitharcade.proj' + extraHelixArguments: ${{ parameters.extraHelixArguments }} + scenarios: ${{ parameters.scenarios }} diff --git a/eng/pipelines/common/templates/runtimes/send-to-helix-step.yml b/eng/pipelines/common/templates/runtimes/send-to-helix-step.yml index a45c3817d13b53..989ccdc9319a92 100644 --- a/eng/pipelines/common/templates/runtimes/send-to-helix-step.yml +++ b/eng/pipelines/common/templates/runtimes/send-to-helix-step.yml @@ -19,6 +19,7 @@ parameters: runCrossGen2: '' compositeBuildMode: false helixProjectArguments: '' + extraHelixArguments: '' runInUnloadableContext: '' tieringTest: '' hotColdSplitting: '' @@ -38,7 +39,7 @@ steps: - template: send-to-helix-inner-step.yml parameters: osGroup: ${{ parameters.osGroup }} - sendParams: ${{ parameters.helixProjectArguments }} ${{ parameters.msbuildParallelism }} /bl:$(Build.SourcesDirectory)/artifacts/log/SendToHelix.binlog /p:TargetArchitecture=${{ parameters.archType }} /p:TargetOS=${{ parameters.osGroup }} /p:TargetOSSubgroup=${{ parameters.osSubgroup }} /p:Configuration=${{ parameters.buildConfig }} + sendParams: ${{ parameters.helixProjectArguments }} ${{ parameters.msbuildParallelism }} /bl:$(Build.SourcesDirectory)/artifacts/log/SendToHelix.binlog /p:TargetArchitecture=${{ parameters.archType }} /p:TargetOS=${{ parameters.osGroup }} /p:TargetOSSubgroup=${{ parameters.osSubgroup }} /p:Configuration=${{ parameters.buildConfig }} ${{ parameters.extraHelixArguments }} condition: and(succeeded(), ${{ parameters.condition }}) shouldContinueOnError: ${{ parameters.shouldContinueOnError }} displayName: ${{ parameters.displayName }} diff --git a/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslike.yml b/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslike.yml index c123ea162e4d08..47a38df343f80d 100644 --- a/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslike.yml +++ b/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslike.yml @@ -91,9 +91,8 @@ jobs: - template: /eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml parameters: creator: dotnet-bot + testBuildArgs: /p:DevTeamProvisioning=- /p:RunAOTCompilation=true /p:MonoForceInterpreter=true /p:BuildTestsOnHelix=true compileOnHelix: true - interpreter: true - testBuildArgs: /p:ArchiveTests=true /p:DevTeamProvisioning=- /p:RunAOTCompilation=true /p:MonoForceInterpreter=true /p:BuildTestsOnHelix=true testRunNamePrefixSuffix: Mono_$(_BuildConfig) extraHelixArguments: /p:NeedsToBuildAppsOnHelix=true diff --git a/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslikesimulator.yml b/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslikesimulator.yml index 714acd5b9c159f..2cfb553d5dbd6e 100644 --- a/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslikesimulator.yml +++ b/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslikesimulator.yml @@ -89,9 +89,8 @@ jobs: - template: /eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml parameters: creator: dotnet-bot + testBuildArgs: /p:DevTeamProvisioning=- /p:RunAOTCompilation=true /p:MonoForceInterpreter=true /p:BuildTestsOnHelix=true compileOnHelix: true - interpreter: true - testBuildArgs: /p:ArchiveTests=true /p:DevTeamProvisioning=- /p:RunAOTCompilation=true /p:MonoForceInterpreter=true /p:BuildTestsOnHelix=true testRunNamePrefixSuffix: Mono_$(_BuildConfig) extraHelixArguments: /p:NeedsToBuildAppsOnHelix=true diff --git a/eng/testing/tests.ioslike.targets b/eng/testing/tests.ioslike.targets index e2e36415a31834..6e7d667bdfe020 100644 --- a/eng/testing/tests.ioslike.targets +++ b/eng/testing/tests.ioslike.targets @@ -28,6 +28,7 @@ <_AppleBuildCommand Condition="'$(IncludesTestRunner)' == 'true'">apple test <_AppleBuildCommand Condition="'$(IncludesTestRunner)' != 'true'">apple run + <_AppleExpectedExitCode Condition="'$(ExpectedExitCode)' != ''">--expected-exit-code $(ExpectedExitCode) <_AfterBuildCommands> mv $XHARNESS_OUT/AOTBuild.binlog "$HELIX_WORKITEM_UPLOAD_ROOT" @@ -178,7 +179,7 @@ true true true - AppleTestRunner.dll + AppleTestRunner.dll $(PublishDir) $(BundleDir) diff --git a/src/mono/msbuild/apple/build/AppleBuild.props b/src/mono/msbuild/apple/build/AppleBuild.props index c1e8952f835e76..a3fc8dc30b3be1 100644 --- a/src/mono/msbuild/apple/build/AppleBuild.props +++ b/src/mono/msbuild/apple/build/AppleBuild.props @@ -49,4 +49,4 @@ - \ No newline at end of file + diff --git a/src/tests/Common/CoreCLRTestLibrary/PlatformDetection.cs b/src/tests/Common/CoreCLRTestLibrary/PlatformDetection.cs index 0a47a6a8ee9709..f07d33fe94cfa6 100644 --- a/src/tests/Common/CoreCLRTestLibrary/PlatformDetection.cs +++ b/src/tests/Common/CoreCLRTestLibrary/PlatformDetection.cs @@ -64,5 +64,6 @@ public static bool IsNonZeroLowerBoundArraySupported // These platforms have not had their infrastructure updated to support native test assets. public static bool PlatformDoesNotSupportNativeTestAssets => OperatingSystem.IsIOS() || OperatingSystem.IsTvOS() || OperatingSystem.IsWatchOS() || OperatingSystem.IsAndroid() || OperatingSystem.IsBrowser() || OperatingSystem.IsWasi(); + public static bool IsAppleMobile => OperatingSystem.IsIOS() || OperatingSystem.IsTvOS() || OperatingSystem.IsWatchOS() || OperatingSystem.IsMacCatalyst(); } } diff --git a/src/tests/Common/XUnitWrapperGenerator/XUnitWrapperGenerator.cs b/src/tests/Common/XUnitWrapperGenerator/XUnitWrapperGenerator.cs index 9e7b2e0104df08..6f0e669dda18a3 100644 --- a/src/tests/Common/XUnitWrapperGenerator/XUnitWrapperGenerator.cs +++ b/src/tests/Common/XUnitWrapperGenerator/XUnitWrapperGenerator.cs @@ -259,7 +259,7 @@ private static void AddRunnerSource(SourceProductionContext context, ImmutableAr { if (targetOS?.ToLowerInvariant() is "ios" or "iossimulator" or "tvos" or "tvossimulator" or "maccatalyst" or "android" or "browser") { - context.AddSource("XHarnessRunner.g.cs", GenerateXHarnessTestRunner(methods, aliasMap, assemblyName)); + context.AddSource("XHarnessRunner.g.cs", GenerateXHarnessTestRunner(methods, aliasMap, assemblyName, targetOS)); } else { @@ -431,7 +431,7 @@ private static string GenerateFullTestRunner(ImmutableArray testInfos return builder.GetCode(); } - private static string GenerateXHarnessTestRunner(ImmutableArray testInfos, ImmutableDictionary aliasMap, string assemblyName) + private static string GenerateXHarnessTestRunner(ImmutableArray testInfos, ImmutableDictionary aliasMap, string assemblyName, string? targetOS) { // For simplicity, we'll use top-level statements for the generated Main method. CodeBuilder builder = new(); @@ -440,6 +440,18 @@ private static string GenerateXHarnessTestRunner(ImmutableArray testI builder.AppendLine("XUnitWrapperLibrary.TestSummary summary;"); builder.AppendLine("System.Diagnostics.Stopwatch stopwatch;"); builder.AppendLine("XUnitWrapperLibrary.TestOutputRecorder outputRecorder;"); + if (targetOS?.ToLowerInvariant() is "ios" or "iossimulator" or "tvos" or "tvossimulator" or "maccatalyst") + { + builder.AppendLine("string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);"); + builder.AppendLine($@"string tempLogPath = System.IO.Path.Combine(documentsPath, ""{assemblyName}.templog.xml"");"); + builder.AppendLine($@"string testStatsPath = System.IO.Path.Combine(documentsPath, ""{assemblyName}.testStats.csv"");"); + } + else + { + builder.AppendLine($@"string tempLogPath = ""{assemblyName}.templog.xml"";"); + builder.AppendLine($@"string testStatsPath = ""{assemblyName}.testStats.csv"";"); + } + builder.AppendLine(); builder.AppendLine("try"); @@ -468,16 +480,16 @@ private static string GenerateXHarnessTestRunner(ImmutableArray testI using (builder.NewBracesScope()) { - builder.AppendLine($@"if (System.IO.File.Exists(""{assemblyName}.tempLog.xml""))"); + builder.AppendLine("if (System.IO.File.Exists(tempLogPath))"); using (builder.NewBracesScope()) { - builder.AppendLine($@"System.IO.File.Delete(""{assemblyName}.tempLog.xml"");"); + builder.AppendLine("System.IO.File.Delete(tempLogPath);"); } - builder.AppendLine($@"if (System.IO.File.Exists(""{assemblyName}.testStats.csv""))"); + builder.AppendLine("if (System.IO.File.Exists(testStatsPath))"); using (builder.NewBracesScope()) { - builder.AppendLine($@"System.IO.File.Delete(""{assemblyName}.testStats.csv"");"); + builder.AppendLine("System.IO.File.Delete(testStatsPath);"); } builder.AppendLine(); @@ -495,8 +507,8 @@ private static string GenerateXHarnessTestRunner(ImmutableArray testI builder.AppendLine("Initialize();"); // Open the stream writer for the temp log. - builder.AppendLine($@"using (System.IO.StreamWriter tempLogSw = System.IO.File.AppendText(""{assemblyName}.templog.xml""))"); - builder.AppendLine($@"using (System.IO.StreamWriter statsCsvSw = System.IO.File.AppendText(""{assemblyName}.testStats.csv""))"); + builder.AppendLine($"using (System.IO.StreamWriter tempLogSw = System.IO.File.AppendText(tempLogPath))"); + builder.AppendLine($"using (System.IO.StreamWriter statsCsvSw = System.IO.File.AppendText(testStatsPath))"); CodeBuilder testExecutorBuilder = new(); using (builder.NewBracesScope()) diff --git a/src/tests/Common/helixpublishwitharcade.proj b/src/tests/Common/helixpublishwitharcade.proj index 5a44eaeb794639..3be616d333f42e 100644 --- a/src/tests/Common/helixpublishwitharcade.proj +++ b/src/tests/Common/helixpublishwitharcade.proj @@ -331,13 +331,19 @@ + + + <_AppBundleRunScriptName>RunTests + <_AppBundleRunScriptName Condition="'$(TargetsAppleMobile)' == 'true' and '$(NeedsToBuildAppsOnHelix)' == 'true'">build-apple-app + + <_MergedWrapperMarker Include="$(TestBinDir)**\*.MergedTestAssembly" Exclude="$(TestBinDir)**\supportFiles\*.MergedTestAssembly" /> <_MergedWrapperMarker Update="@(_MergedWrapperMarker)"> $([System.IO.Path]::ChangeExtension('%(Identity)', '.$(TestScriptExtension)')) - %(RootDir)%(Directory)AppBundle/RunTests.$(TestScriptExtension) + %(RootDir)%(Directory)AppBundle/$(_AppBundleRunScriptName).$(TestScriptExtension) @@ -536,7 +542,7 @@ @@ -573,9 +579,45 @@ - + + + + + + <_MergedWrapperDirectory>%(_MergedWrapperMarker.RootDir)%(Directory) + <_MergedWrapperName>%(_MergedWrapperMarker.FileName) + + + + <_MergedPayloadGroups Include="$(_MergedWrapperName)" /> + <_MergedPayloadFiles Include="$(_MergedWrapperDirectory)AppBundle/**" /> + <_MergedPayloadFiles Update="@(_MergedPayloadFiles)" Condition="'@(_MergedPayloadFiles)' != ''" > + + $([System.IO.Path]::GetRelativePath('$(_MergedWrapperDirectory)AppBundle/', %(FullPath))) + + + <_TestExclusionListPlaceholder Include="@(_MergedPayloadFiles)" Condition="$([System.String]::new('%(FileName)').EndsWith('TestExclusionList'))" /> + <_MergedPayloadFiles Remove="@(_TestExclusionListPlaceholder)" /> + + + + + + - + @@ -592,7 +634,9 @@ DestinationFile="$(LegacyPayloadsRootDirectory)\%(LegacyPayloads.PayloadGroup).zip" /> - + @@ -863,6 +907,61 @@ + + + + $([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'src', 'mono', 'msbuild', 'apple', 'build')) + $([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'src', 'mono', 'msbuild', 'common')) + https://netcorenativeassets.blob.core.windows.net/resource-packages/external/macos/cmake/cmake-3.28.0-macos-universal.tar.gz + + <_XHarnessAppleCustomCommand> + source build-apple-app.sh + + <_RuntimeComponentManifestDir>$([MSBuild]::NormalizeDirectory('$(MonoArtifactsPath)', 'build')) + + + + + + + + + + + + + + + + + + + + + + <_XHarnessAppBundleZipWorkItems Include="@(XHarnessAppBundleToTest->'$(MergedPayloadsRootDirectory)%(PayloadGroup).zip')" RemoveMetadata="AppBundlePath"> + $(_XHarnessAppleCustomCommand) + + + + + + + $(HelixPreCommands);codesign -s - -f --preserve-metadata=entitlements $HELIX_CORRELATION_PAYLOAD/createdump diff --git a/src/tests/Common/mergedrunnermobile.targets b/src/tests/Common/mergedrunnermobile.targets index 7371cdc702c5a0..187120666f49f8 100644 --- a/src/tests/Common/mergedrunnermobile.targets +++ b/src/tests/Common/mergedrunnermobile.targets @@ -5,6 +5,8 @@ $(AssemblyName).dll $(AssemblyName).dll GeneratedRunner + + false @@ -44,4 +46,4 @@ - \ No newline at end of file + diff --git a/src/tests/Directory.Build.targets b/src/tests/Directory.Build.targets index 85404d96386aee..ab104f7a4deedd 100644 --- a/src/tests/Directory.Build.targets +++ b/src/tests/Directory.Build.targets @@ -9,29 +9,6 @@ - - $(TargetOS).AnyCPU.$(Configuration) - $(ArtifactsDir)helix/ - $(TestArchiveRoot)tests/ - $(TestArchiveTestsRoot)$(OSPlatformConfig)/ - $(TestArchiveRoot)runtime/ - - BuildMonoiOSApp - BuildMonoiOSApp - GenerateRunScript - - true - - - - - - - $(ArtifactsDir)/tests/coreclr/obj/$(TargetOS).$(Platform).$(Configuration)/Managed/build/iOSApps/$(TestProjectName)/AppBundle - - - true @@ -43,6 +20,8 @@ $(NoWarn);CS2008 + + false - - - - - @@ -486,19 +354,6 @@ _CMDDIR=%(TestDirectories.Identity) - - - - + @@ -530,7 +385,6 @@ - @@ -631,6 +485,11 @@ $(GroupBuildCmd) "/p:IlcMultiModule=true" $(GroupBuildCmd) "/p:IlcUseServerGc=false" $(GroupBuildCmd) "/p:BuildNativeAotFrameworkObjects=true" + $(GroupBuildCmd) /p:ContinuousIntegrationBuild=true + $(GroupBuildCmd) "/p:BuildTestsOnHelix=true" + $(GroupBuildCmd) "/p:MonoForceInterpreter=true" + $(GroupBuildCmd) "/p:RunAOTCompilation=true" + $(GroupBuildCmd) "/p:DevTeamProvisioning=$(DevTeamProvisioning)" diff --git a/src/tests/issues.targets b/src/tests/issues.targets index 3549319d01c23c..6bd846800fce0c 100644 --- a/src/tests/issues.targets +++ b/src/tests/issues.targets @@ -1182,9 +1182,6 @@ https://github.com/dotnet/runtime/issues/88775 - - https://github.com/dotnet/runtime/issues/88689 - https://github.com/dotnet/runtime/issues/90308 @@ -1835,12 +1832,6 @@ Mono doesn't support interop BestFitMapping and ThrowOnUnmappableChar attributes - - https://github.com/dotnet/runtime/issues/70279 - - - Tests coreclr's handling of switches on natively sized integers - https://github.com/dotnet/runtime/issues/70820 @@ -2107,9 +2098,6 @@ needs triage - - https://github.com/dotnet/runtime/issues/74687 - https://github.com/dotnet/runtime/issues/71656