diff --git a/eng/pipelines/templates/jobs/vmr-build.yml b/eng/pipelines/templates/jobs/vmr-build.yml index 68101af79..1c0ba7b4e 100644 --- a/eng/pipelines/templates/jobs/vmr-build.yml +++ b/eng/pipelines/templates/jobs/vmr-build.yml @@ -370,7 +370,7 @@ jobs: set -ex dockerVolumeArgs="-v $(sourcesPath):/vmr" - sourceOnlyArgs='' + customBuildArgs='' extraBuildProperties='' if [[ ! -z '${{ parameters.targetOS }}' ]]; then @@ -381,11 +381,15 @@ jobs: extraBuildProperties="$extraBuildProperties /p:TargetArchitecture=${{ parameters.targetArchitecture }}" fi + if [[ '${{ parameters.useDevVersions }}' == 'True' ]]; then + customBuildArgs="$customBuildArgs --dev" + fi + if [[ '${{ parameters.buildSourceOnly }}' == 'True' ]]; then if [[ '${{ parameters.enablePoison }}' == 'True' ]]; then - sourceOnlyArgs='--poison' + customBuildArgs="$customBuildArgs --poison" fi - sourceOnlyArgs="$sourceOnlyArgs --source-only /p:SmokeTestsWarnOnSdkContentDiffs=true /p:SmokeTestsExcludeOmniSharpTests=${{ parameters.excludeOmniSharpTests }}" + customBuildArgs="$customBuildArgs --source-only /p:SmokeTestsWarnOnSdkContentDiffs=true /p:SmokeTestsExcludeOmniSharpTests=${{ parameters.excludeOmniSharpTests }}" fi if [[ -n "${{ parameters.extraProperties }}" ]]; then @@ -394,10 +398,10 @@ jobs: # Only use Docker when a container is specified if [[ -n "${{ parameters.container }}" ]]; then - docker run --rm $dockerVolumeArgs -w /vmr ${{ parameters.container }} ./build.sh /bl:artifacts/log/Release/Test.binlog --test $sourceOnlyArgs $extraBuildProperties $(additionalBuildArgs) + docker run --rm $dockerVolumeArgs -w /vmr ${{ parameters.container }} ./build.sh /bl:artifacts/log/Release/Test.binlog --test $customBuildArgs $extraBuildProperties $(additionalBuildArgs) else cd $(sourcesPath) - ./build.sh /bl:artifacts/log/Release/Test.binlog --test $sourceOnlyArgs $extraBuildProperties $(additionalBuildArgs) + ./build.sh /bl:artifacts/log/Release/Test.binlog --test $customBuildArgs $extraBuildProperties $(additionalBuildArgs) fi displayName: Run Tests @@ -424,6 +428,10 @@ jobs: CopyWithRelativeFolders "src/" $targetFolder "*.binlog" CopyWithRelativeFolders "src/" $targetFolder "*.log" + if (Test-Path "artifacts/scenario-tests/") { + CopyWithRelativeFolders "artifacts/scenario-tests/" $targetFolder "*.binlog" + } + if (Test-Path "artifacts/TestResults/*") { CopyWithRelativeFolders "artifacts/TestResults/" $targetFolder "*.binlog" CopyWithRelativeFolders "artifacts/TestResults/" $targetFolder "*.diff" @@ -451,6 +459,7 @@ jobs: cd "$(sourcesPath)" find artifacts/log/ -type f -name "*.binlog" -exec rsync -R {} -t ${targetFolder} \; find artifacts/log/ -type f -name "*.log" -exec rsync -R {} -t ${targetFolder} \; + [ -d "artifacts/scenario-tests/" ] && find artifacts/scenario-tests/ -type f -name "*.binlog" -exec rsync -R {} -t ${targetFolder} \; find artifacts/TestResults/ -type f -name "*.binlog" -exec rsync -R {} -t ${targetFolder} \; find artifacts/TestResults/ -type f -name "*.diff" -exec rsync -R {} -t ${targetFolder} \; find artifacts/TestResults/ -type f -name "Updated*.txt" -exec rsync -R {} -t ${targetFolder} \; @@ -486,13 +495,25 @@ jobs: condition: succeededOrFailed() continueOnError: true inputs: - testRunner: vSTest + testRunner: VSTest testResultsFiles: 'artifacts/TestResults/Release/*.trx' searchFolder: $(sourcesPath) mergeTestResults: true publishRunAttachments: true testRunTitle: Tests_$(Agent.JobName) + - task: PublishTestResults@2 + displayName: Publish Scenario Test Results + condition: succeededOrFailed() + continueOnError: true + inputs: + testRunner: xUnit + testResultsFiles: 'artifacts/TestResults/**/scenario-tests/*.xml' + searchFolder: $(sourcesPath) + mergeTestResults: true + publishRunAttachments: true + testRunTitle: ScenarioTests_$(Agent.JobName) + - task: CopyFiles@2 inputs: SourceFolder: $(sourcesPath)/artifacts diff --git a/eng/pipelines/templates/stages/vmr-build.yml b/eng/pipelines/templates/stages/vmr-build.yml index 2f9c1ed10..21e2c2ce6 100644 --- a/eng/pipelines/templates/stages/vmr-build.yml +++ b/eng/pipelines/templates/stages/vmr-build.yml @@ -123,6 +123,7 @@ stages: artifactsRid: alpine.3.19-x64 pool: ${{ parameters.pool_Linux }} container: ${{ variables.alpine319Container }} + targetOS: linux-musl buildFromArchive: false # 🚫 buildSourceOnly: true # ✅ enablePoison: true # ✅ @@ -143,6 +144,7 @@ stages: architecture: x64 pool: ${{ parameters.pool_Linux }} container: ${{ variables.alpine319Container }} + targetOS: linux-musl buildFromArchive: false # 🚫 buildSourceOnly: true # ✅ enablePoison: false # 🚫 diff --git a/src/SourceBuild/content/Directory.Build.props b/src/SourceBuild/content/Directory.Build.props index d68801f19..465fbad19 100644 --- a/src/SourceBuild/content/Directory.Build.props +++ b/src/SourceBuild/content/Directory.Build.props @@ -160,6 +160,7 @@ $([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', 'Symbols')) $([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', 'AssetManifests')) $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'assets', '$(Configuration)')) + $([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', 'extracted-dotnet-sdk')) $([MSBuild]::NormalizeDirectory('$(PrereqsPackagesDir)', 'prebuilt')) $([MSBuild]::NormalizeDirectory('$(PrereqsPackagesDir)', 'previouslyRestored')) diff --git a/src/SourceBuild/content/build.sh b/src/SourceBuild/content/build.sh index abda941cc..252feba6f 100755 --- a/src/SourceBuild/content/build.sh +++ b/src/SourceBuild/content/build.sh @@ -162,7 +162,7 @@ while [[ $# > 0 ]]; do ;; # Advanced settings - -build-tests) + -build-repo-tests) properties="$properties /p:DotNetBuildTests=true" ;; -ci) diff --git a/src/SourceBuild/content/eng/extract-sdk-archive.proj b/src/SourceBuild/content/eng/extract-sdk-archive.proj new file mode 100644 index 000000000..d170c4395 --- /dev/null +++ b/src/SourceBuild/content/eng/extract-sdk-archive.proj @@ -0,0 +1,20 @@ + + + + $(NetCurrent) + + + + + + + + + diff --git a/src/SourceBuild/content/eng/finish-source-only.proj b/src/SourceBuild/content/eng/finish-source-only.proj index 24dc4a640..f6d93bcb2 100644 --- a/src/SourceBuild/content/eng/finish-source-only.proj +++ b/src/SourceBuild/content/eng/finish-source-only.proj @@ -10,6 +10,7 @@ + @@ -59,13 +60,9 @@ Outputs="$(SdkSymbolsTarball)"> $(BaseIntermediateOutputPath)SdkSymbols - $(BaseIntermediateOutputPath)Sdk - - - - @@ -76,7 +73,6 @@ - + false + + $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'scenario-tests')) + $([MSBuild]::NormalizeDirectory('$(ArtifactsTestResultsDir)', 'scenario-tests')) + <_ScenarioTestsNuGetConfig>$(ScenarioTestsArtifactsDir)NuGet.config + <_InstallerNuGetConfig>$([MSBuild]::NormalizePath('$(SrcDir)', 'installer', 'NuGet.config')) + + + + + + + + + + + + <_CurrentDateTime>$([System.DateTime]::Now.ToString("yyyy-MM-dd_HH_mm_ss")) + <_TestXmlOutputPath>$(ScenarioTestsResultsDir)$(_CurrentDateTime).xml + <_ScenarioTestsAdditionalArgs>--xml $(_TestXmlOutputPath) --target-rid $(TargetRid) --no-cleanup --no-traits Category=MultiTFM + + + <_TestRoot>$(ScenarioTestsArtifactsDir)artifacts/ + + + <_DotNetTool>$(DotNetSdkExtractDir)$([System.IO.Path]::GetFileName('$(DotNetTool)')) + + + + + + <_ScenarioTestEnvVars Include=" + TestRoot=$(_TestRoot); + DotNetRoot=$(DotNetSdkExtractDir); + TestSdkVersion=$(SourceBuiltSdkVersion); + AdditionalTestArgs=$(_ScenarioTestsAdditionalArgs); + DotNetTool=$(_DotNetTool); + _InitializeDotNetCli=$(DotNetSdkExtractDir)" /> + + + + + diff --git a/src/SourceBuild/content/test/scenario-tests/Directory.Build.targets b/src/SourceBuild/content/test/scenario-tests/Directory.Build.targets new file mode 100644 index 000000000..56dccb479 --- /dev/null +++ b/src/SourceBuild/content/test/scenario-tests/Directory.Build.targets @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/SourceBuild/content/test/scenario-tests/scenario-tests.proj b/src/SourceBuild/content/test/scenario-tests/scenario-tests.proj new file mode 100644 index 000000000..410ac2f54 --- /dev/null +++ b/src/SourceBuild/content/test/scenario-tests/scenario-tests.proj @@ -0,0 +1,17 @@ + + + + $(NetCurrent) + true + + + + + + + + diff --git a/src/SourceBuild/content/test/tests.proj b/src/SourceBuild/content/test/tests.proj index 582cb9257..cf3d38e47 100644 --- a/src/SourceBuild/content/test/tests.proj +++ b/src/SourceBuild/content/test/tests.proj @@ -1,10 +1,29 @@ + + <_RunScenarioTests>true + + + <_RunScenarioTests Condition="'$(BuildArchitecture.ToLowerInvariant())' != '$(TargetArchitecture.ToLowerInvariant())'">false + + + <_RunScenarioTests Condition="'$(BuildOS)' != 'windows' and '$(__PortableTargetOS.ToLowerInvariant())' != '$(TargetOS.ToLowerInvariant())'">false + + + <_RunScenarioTests Condition="'$(UseOfficialBuildVersioning)' == 'false'">false + + + + - \ No newline at end of file + diff --git a/src/SourceBuild/patches/scenario-tests/0001-Disable-Aspire-scenario-test.patch b/src/SourceBuild/patches/scenario-tests/0001-Disable-Aspire-scenario-test.patch new file mode 100644 index 000000000..f2a5f62d3 --- /dev/null +++ b/src/SourceBuild/patches/scenario-tests/0001-Disable-Aspire-scenario-test.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Matt Thalman +Date: Tue, 30 Apr 2024 08:34:08 -0500 +Subject: [PATCH] Disable Aspire scenario test + +Backport: https://github.com/dotnet/sdk/pull/40485 +--- + .../SdkTemplateTests.cs | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/Microsoft.DotNet.ScenarioTests.SdkTemplateTests/SdkTemplateTests.cs b/src/Microsoft.DotNet.ScenarioTests.SdkTemplateTests/SdkTemplateTests.cs +index c43fdd6..bb5c52d 100644 +--- a/src/Microsoft.DotNet.ScenarioTests.SdkTemplateTests/SdkTemplateTests.cs ++++ b/src/Microsoft.DotNet.ScenarioTests.SdkTemplateTests/SdkTemplateTests.cs +@@ -217,7 +217,7 @@ public class SdkTemplateTests : IClassFixture + newTest.Execute(_sdkHelper, _scenarioTestInput.TestRoot, "wasm-tools"); + } + +- [Fact] ++ //[Fact] + [Trait("Category", "Workload")] + [Trait("Category", "InProgress")] + public void VerifyAspireTemplate() diff --git a/src/SourceBuild/patches/scenario-tests/0002-Disable-WPF-scenario-test.patch b/src/SourceBuild/patches/scenario-tests/0002-Disable-WPF-scenario-test.patch new file mode 100644 index 000000000..ba5dfa3ae --- /dev/null +++ b/src/SourceBuild/patches/scenario-tests/0002-Disable-WPF-scenario-test.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Matt Thalman +Date: Tue, 30 Apr 2024 10:21:32 -0500 +Subject: [PATCH] Disable WPF scenario test + +Backport: https://github.com/dotnet/source-build/issues/4361 +--- + .../SdkTemplateTests.cs | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/Microsoft.DotNet.ScenarioTests.SdkTemplateTests/SdkTemplateTests.cs b/src/Microsoft.DotNet.ScenarioTests.SdkTemplateTests/SdkTemplateTests.cs +index c43fdd6..35279a9 100644 +--- a/src/Microsoft.DotNet.ScenarioTests.SdkTemplateTests/SdkTemplateTests.cs ++++ b/src/Microsoft.DotNet.ScenarioTests.SdkTemplateTests/SdkTemplateTests.cs +@@ -84,7 +84,7 @@ public class SdkTemplateTests : IClassFixture + newTest.Execute(_sdkHelper, _scenarioTestInput.TestRoot); + } + +- [Theory] ++ //[Theory] + [InlineData(DotNetLanguage.CSharp)] + [InlineData(DotNetLanguage.VB)] + [Trait("Category", "Offline")]