From 6611f11bed1b4576c3f11c488e5b51c1342657f2 Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Wed, 27 Mar 2024 16:19:27 -0500 Subject: [PATCH 01/48] Enable scenario test execution in VMR build --- eng/pipelines/templates/jobs/vmr-build.yml | 67 ++++++--- eng/pipelines/templates/stages/vmr-build.yml | 41 ++++++ src/SourceBuild/content/Directory.Build.props | 2 + .../content/Directory.Build.targets | 14 +- src/SourceBuild/content/build.proj | 129 ++++++++++++++++++ src/SourceBuild/content/build.sh | 93 ++++++++----- src/SourceBuild/content/eng/build.ps1 | 33 ++++- 7 files changed, 316 insertions(+), 63 deletions(-) diff --git a/eng/pipelines/templates/jobs/vmr-build.yml b/eng/pipelines/templates/jobs/vmr-build.yml index 4959ab0900fe..7ed9b1c19989 100644 --- a/eng/pipelines/templates/jobs/vmr-build.yml +++ b/eng/pipelines/templates/jobs/vmr-build.yml @@ -173,7 +173,7 @@ jobs: displayName: Export VMR sources workingDirectory: $(Build.StagingDirectory) - - ${{ if and(ne(variables['System.TeamProject'], 'public'), eq(parameters.runTests, 'True')) }}: + - ${{ if and(ne(variables['System.TeamProject'], 'public'), eq(parameters.buildSourceOnly, 'True'), eq(parameters.runTests, 'True')) }}: - script: cp "$(sourcesPath)/src/installer/NuGet.config" "$(sourcesPath)/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/online.NuGet.Config" displayName: Copy Test NuGet Config @@ -233,7 +233,11 @@ jobs: - script: | call $(sourcesPath)\build.cmd -ci -cleanWhileBuilding -prepareMachine ${{ parameters.extraProperties }} displayName: Build - + + - ${{ if eq(parameters.runTests, 'True') }}: + - script: | + call $(sourcesPath)\build.cmd -test -testnobuild + displayName: Run Tests - ${{ else }}: - ${{ if eq(parameters.buildSourceOnly, 'true') }}: - script: | @@ -341,21 +345,35 @@ jobs: fi displayName: Build - # Only run tests if enabled - - ${{ if eq(parameters.runTests, 'True') }}: - - script: | - set -ex + # Only run tests if enabled + - ${{ if eq(parameters.runTests, 'True') }}: + - script: | + set -ex - dockerVolumeArgs="-v $(sourcesPath):/vmr" - dockerEnvArgs="-e SMOKE_TESTS_EXCLUDE_OMNISHARP=${{ parameters.excludeOmniSharpTests }} -e SMOKE_TESTS_WARN_SDK_CONTENT_DIFFS=true -e SMOKE_TESTS_RUNNING_IN_CI=true" - poisonArg='' + buildArgs="--test --testnobuild $(additionalBuildArgs)" - if [[ '${{ parameters.enablePoison }}' == 'True' ]]; then - poisonArg='--poison' - fi + if [[ -n "${{ parameters.container }}" ]]; then + dockerVolumeArgs="-v $(sourcesPath):/vmr" + dockerEnvArgs="" + + if [[ '${{ parameters.buildSourceOnly }}' == 'True' ]]; then + dockerEnvArgs="-e SMOKE_TESTS_EXCLUDE_OMNISHARP=${{ parameters.excludeOmniSharpTests }} -e SMOKE_TESTS_WARN_SDK_CONTENT_DIFFS=true -e SMOKE_TESTS_RUNNING_IN_CI=true" + + poisonArg="" + + if [[ '${{ parameters.enablePoison }}' == 'True' ]]; then + poisonArg="--poison" + fi - docker run --rm $dockerVolumeArgs -w /vmr $dockerEnvArgs ${{ parameters.container }} ./build.sh --source-only $poisonArg --test $(additionalBuildArgs) /p:SmokeTestConsoleVerbosity=detailed - displayName: Run Tests + buildArgs="$buildArgs --source-only $poisonArg /p:SmokeTestConsoleVerbosity=detailed" + fi + + docker run --rm $dockerVolumeArgs -w /vmr $dockerEnvArgs ${{ parameters.container }} ./build.sh $buildArgs + else + cd $(sourcesPath) + ./build.sh $buildArgs + fi + displayName: Run Tests - ${{ if eq(parameters.targetOS, 'windows') }}: @@ -424,17 +442,30 @@ jobs: # Only upload test results if enabled - ${{ if eq(parameters.runTests, 'True') }}: + - ${{ if eq(parameters.buildSourceOnly, 'True') }}: + - task: PublishTestResults@2 + displayName: Publish Source Build Smoke Test Results + condition: succeededOrFailed() + continueOnError: true + inputs: + testRunner: vSTest + testResultsFiles: 'test/**/*.trx' + searchFolder: $(sourcesPath) + mergeTestResults: true + publishRunAttachments: true + testRunTitle: SourceBuild_SmokeTests_$(Agent.JobName) + - task: PublishTestResults@2 - displayName: Publish Test Results + displayName: Publish Scenario Test Results condition: succeededOrFailed() continueOnError: true inputs: - testRunner: vSTest - testResultsFiles: 'test/**/*.trx' + testRunner: xUnit + testResultsFiles: 'artifacts/TestResults/**/*.xml' searchFolder: $(sourcesPath) mergeTestResults: true publishRunAttachments: true - testRunTitle: SourceBuild_SmokeTests_$(Agent.JobName) + testRunTitle: ScenarioTests_$(Agent.JobName) - task: CopyFiles@2 inputs: diff --git a/eng/pipelines/templates/stages/vmr-build.yml b/eng/pipelines/templates/stages/vmr-build.yml index f92fb52ecbab..2a7dbf06e0a5 100644 --- a/eng/pipelines/templates/stages/vmr-build.yml +++ b/eng/pipelines/templates/stages/vmr-build.yml @@ -341,6 +341,7 @@ stages: container: ${{ variables.ubuntu2204Container }} targetOS: linux targetArchitecture: x64 + runTests: true - template: ../jobs/vmr-build.yml parameters: @@ -351,6 +352,7 @@ stages: pool: ${{ parameters.pool_Windows }} targetOS: windows targetArchitecture: x64 + runTests: true - template: ../jobs/vmr-build.yml parameters: @@ -362,6 +364,7 @@ stages: container: ${{ variables.androidCrossContainer }} targetOS: android targetArchitecture: arm64 + runTests: false - template: ../jobs/vmr-build.yml parameters: @@ -374,6 +377,7 @@ stages: crossRootFs: '/crossrootfs/x64' targetOS: browser targetArchitecture: wasm + runTests: false - template: ../jobs/vmr-build.yml parameters: @@ -384,6 +388,7 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: iossimulator targetArchitecture: arm64 + runTests: false ### Additional jobs for full build ### - ${{ if in(parameters.scope, 'full') }}: @@ -398,6 +403,7 @@ stages: container: ${{ variables.androidCrossContainer }} targetOS: android targetArchitecture: arm + runTests: false - template: ../jobs/vmr-build.yml parameters: @@ -409,6 +415,7 @@ stages: container: ${{ variables.androidCrossContainer }} targetOS: android targetArchitecture: x64 + runTests: false - template: ../jobs/vmr-build.yml parameters: @@ -420,6 +427,7 @@ stages: container: ${{ variables.androidCrossContainer }} targetOS: android targetArchitecture: x86 + runTests: false - template: ../jobs/vmr-build.yml parameters: @@ -432,6 +440,7 @@ stages: crossRootFs: '/crossrootfs/x64' targetOS: browser targetArchitecture: wasm + runTests: false extraProperties: /p:DotNetBuildRuntimeWasmEnableThreads=true - template: ../jobs/vmr-build.yml @@ -445,6 +454,7 @@ stages: crossRootFs: '/crossrootfs/x64' targetOS: linux-bionic targetArchitecture: arm64 + runTests: false - template: ../jobs/vmr-build.yml parameters: @@ -457,6 +467,7 @@ stages: crossRootFs: '/crossrootfs/x64' targetOS: linux-bionic targetArchitecture: arm64 + runTests: false extraProperties: /p:DotNetBuildRuntimeNativeAOTRuntimePack=true - template: ../jobs/vmr-build.yml @@ -470,6 +481,7 @@ stages: crossRootFs: '/crossrootfs/x64' targetOS: linux-bionic targetArchitecture: x64 + runTests: false - template: ../jobs/vmr-build.yml parameters: @@ -482,6 +494,7 @@ stages: crossRootFs: '/crossrootfs/x64' targetOS: linux-bionic targetArchitecture: x64 + runTests: false extraProperties: /p:DotNetBuildRuntimeNativeAOTRuntimePack=true - template: ../jobs/vmr-build.yml @@ -493,6 +506,7 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: ios targetArchitecture: arm64 + runTests: false - template: ../jobs/vmr-build.yml parameters: @@ -503,6 +517,7 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: ios targetArchitecture: arm64 + runTests: false extraProperties: /p:DotNetBuildRuntimeNativeAOTRuntimePack=true - template: ../jobs/vmr-build.yml @@ -514,6 +529,7 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: iossimulator targetArchitecture: arm64 + runTests: false extraProperties: /p:DotNetBuildRuntimeNativeAOTRuntimePack=true - template: ../jobs/vmr-build.yml @@ -525,6 +541,7 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: iossimulator targetArchitecture: x64 + runTests: false - template: ../jobs/vmr-build.yml parameters: @@ -535,6 +552,7 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: iossimulator targetArchitecture: x64 + runTests: false extraProperties: /p:DotNetBuildRuntimeNativeAOTRuntimePack=true - template: ../jobs/vmr-build.yml @@ -546,6 +564,7 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: maccatalyst targetArchitecture: arm64 + runTests: false - template: ../jobs/vmr-build.yml parameters: @@ -556,6 +575,7 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: maccatalyst targetArchitecture: arm64 + runTests: false extraProperties: /p:DotNetBuildRuntimeNativeAOTRuntimePack=true - template: ../jobs/vmr-build.yml @@ -567,6 +587,7 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: maccatalyst targetArchitecture: x64 + runTests: false - template: ../jobs/vmr-build.yml parameters: @@ -577,6 +598,7 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: maccatalyst targetArchitecture: x64 + runTests: false extraProperties: /p:DotNetBuildRuntimeNativeAOTRuntimePack=true - template: ../jobs/vmr-build.yml @@ -588,6 +610,7 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: tvos targetArchitecture: arm64 + runTests: false - template: ../jobs/vmr-build.yml parameters: @@ -598,6 +621,7 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: tvos targetArchitecture: arm64 + runTests: false extraProperties: /p:DotNetBuildRuntimeNativeAOTRuntimePack=true - template: ../jobs/vmr-build.yml @@ -609,6 +633,7 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: tvossimulator targetArchitecture: arm64 + runTests: false - template: ../jobs/vmr-build.yml parameters: @@ -619,6 +644,7 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: tvossimulator targetArchitecture: arm64 + runTests: false extraProperties: /p:DotNetBuildRuntimeNativeAOTRuntimePack=true - template: ../jobs/vmr-build.yml @@ -630,6 +656,7 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: tvossimulator targetArchitecture: x64 + runTests: false - template: ../jobs/vmr-build.yml parameters: @@ -640,6 +667,7 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: tvossimulator targetArchitecture: x64 + runTests: false extraProperties: /p:DotNetBuildRuntimeNativeAOTRuntimePack=true - template: ../jobs/vmr-build.yml @@ -653,6 +681,7 @@ stages: crossRootFs: '/crossrootfs/x64' targetOS: wasi targetArchitecture: wasm + runTests: false - template: ../jobs/vmr-build.yml parameters: @@ -663,6 +692,7 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: osx targetArchitecture: x64 + runTests: true - template: ../jobs/vmr-build.yml parameters: @@ -674,6 +704,7 @@ stages: useMonoRuntime: true targetOS: osx targetArchitecture: x64 + runTests: true - template: ../jobs/vmr-build.yml parameters: @@ -686,6 +717,7 @@ stages: crossRootFs: '/crossrootfs/x64' targetOS: linux targetArchitecture: x64 + runTests: true - template: ../jobs/vmr-build.yml parameters: @@ -699,6 +731,7 @@ stages: useMonoRuntime: true targetOS: linux targetArchitecture: x64 + runTests: true # Mariner x64->non-x64 builds are currently broken, see https://github.com/dotnet/source-build/issues/3698 @@ -713,6 +746,7 @@ stages: # crossRootFs: '/crossrootfs/arm64' # targetOS: linux # targetArchitecture: arm64 + # runTests: true - template: ../jobs/vmr-build.yml parameters: @@ -723,6 +757,7 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: osx targetArchitecture: arm64 + runTests: true - template: ../jobs/vmr-build.yml parameters: @@ -734,6 +769,7 @@ stages: useMonoRuntime: true targetOS: osx targetArchitecture: arm64 + runTests: true - template: ../jobs/vmr-build.yml parameters: @@ -744,6 +780,7 @@ stages: pool: ${{ parameters.pool_Windows }} targetOS: windows targetArchitecture: arm64 + runTests: true - template: ../jobs/vmr-build.yml parameters: @@ -755,6 +792,7 @@ stages: useMonoRuntime: true targetOS: windows targetArchitecture: x64 + runTests: true - template: ../jobs/vmr-build.yml parameters: @@ -765,6 +803,7 @@ stages: pool: ${{ parameters.pool_Windows }} targetOS: windows targetArchitecture: x86 + runTests: true - template: ../jobs/vmr-build.yml parameters: @@ -776,6 +815,7 @@ stages: useMonoRuntime: true targetOS: windows targetArchitecture: x86 + runTests: true - template: ../jobs/vmr-build.yml parameters: @@ -786,4 +826,5 @@ stages: pool: ${{ parameters.pool_Windows }} targetOS: windows targetArchitecture: x64 + runTests: true extraProperties: /p:PgoInstrument=true diff --git a/src/SourceBuild/content/Directory.Build.props b/src/SourceBuild/content/Directory.Build.props index 5d78608c260b..fefd3efc20b7 100644 --- a/src/SourceBuild/content/Directory.Build.props +++ b/src/SourceBuild/content/Directory.Build.props @@ -99,6 +99,8 @@ $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'obj')) $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'bin')) $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'log', '$(Configuration)')) + $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'tmp', '$(Configuration)')) + $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'TestResults', '$(Configuration)')) $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'packages', '$(Configuration)')) $([MSBuild]::NormalizeDirectory('$(ArtifactsPackagesDir)', 'NonShipping')) $([MSBuild]::NormalizeDirectory('$(ArtifactsPackagesDir)', 'Shipping')) diff --git a/src/SourceBuild/content/Directory.Build.targets b/src/SourceBuild/content/Directory.Build.targets index 9ebfcf3bbfda..c6863e94a4f4 100644 --- a/src/SourceBuild/content/Directory.Build.targets +++ b/src/SourceBuild/content/Directory.Build.targets @@ -2,14 +2,18 @@ - + - dotnet-sdk- + dotnet-sdk- + - + + + - %(SdkTarballItem.Filename)%(SdkTarballItem.Extension) - $(SdkFilename.Replace('$(SdkFilenamePrefix)','').Replace('-$(TargetRid)$(ArchiveExtension)','')) + <_DotNetSdkArtifactFileName>%(SdkTarballItem.Filename)%(SdkTarballItem.Extension) + $(_DotNetSdkArtifactFileName.Replace('$(DotNetSdkFilenamePrefix)','').Replace('-$(TargetRid)$(ArchiveExtension)','')) diff --git a/src/SourceBuild/content/build.proj b/src/SourceBuild/content/build.proj index f3a4a5217e28..8b240b390075 100644 --- a/src/SourceBuild/content/build.proj +++ b/src/SourceBuild/content/build.proj @@ -5,8 +5,17 @@ netstandard2.0 true + + $([MSBuild]::NormalizeDirectory('$(ArtifactsTmpDir)', 'extracted-dotnet-sdk')) + $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'scenario-tests')) + $([MSBuild]::NormalizeDirectory('$(ScenarioTestsArtifactsDir)', 'runs')) + $([MSBuild]::NormalizeDirectory('$(ScenarioTestsArtifactsDir)', 'feed')) + $([MSBuild]::NormalizeDirectory('$(ScenarioTestsArtifactsDir)', 'pkg')) + $([MSBuild]::NormalizeDirectory('$(ArtifactsTestResultsDir)', 'scenario-tests')) + + @@ -42,6 +51,126 @@ VmrBuildNumber="$(VmrBuildNumber)" /> + + SetupScenarioTestsArtifacts;GetDotNetSdkArtifactPath + $(ExtractDotNetSdkArchiveDependsOn);ExtractDotNetSdkZip + $(ExtractDotNetSdkArchiveDependsOn);ExtractDotNetSdkTarball + + + + + + <_ScenarioTestsNuGetConfig>$(ScenarioTestsArtifactsDir)NuGet.config + <_InstallerNuGetConfig>$(RepoRoot)src/installer/NuGet.config + + + + + + + + + + + <_ArtifactsPackage Include="$(ArtifactsShippingPackagesDir)**; + $(ArtifactsNonShippingPackagesDir)**" + Condition="!$([System.String]::Copy('%(Identity)').EndsWith('.symbols.nupkg'))" /> + + + + + + + + + + + + + + + <_DirectoryProjFiles Include="$(ScenarioTestsArtifactsDir)Directory.Build.props" /> + <_DirectoryProjFiles Include="$(ScenarioTestsArtifactsDir)Directory.Build.targets" /> + + + + + + + + + SetupScenarioTestsArtifacts;GetDotNetSdkTarball + $(ExtractDotNetSdkArchiveDependsOn);ExtractDotNetSdkZip + $(ExtractDotNetSdkArchiveDependsOn);ExtractDotNetSdkTarball + + + + + + + + + + + + + + + + + <_ScenarioTestPackage Include="$(ArtifactsShippingPackagesDir)scenario-tests/**/*.nupkg" /> + + + + + + <_ScenarioTestDll Include="$(ScenarioTestsPackageExtractDir)tools/**/Microsoft.DotNet.ScenarioTests.SdkTemplateTests.dll" /> + + + + + + + + <_DotNetPath Include="$(DotNetInstallDir)sdk/**/dotnet.dll" /> + + + + <_CurrentDateTime>$([System.DateTime]::Now.ToString("yyyy-MM-dd_HH_mm_ss")) + <_TestXmlOutputPath>$(ScenarioTestsResultsDir)$(_CurrentDateTime).xml + <_ScenarioTestsArgs>--dotnet-root $(DotNetInstallDir) --xml $(_TestXmlOutputPath) --target-rid $(TargetRid) --test-root $(ScenarioTestsRunsDir)$(_CurrentDateTime) --no-cleanup --no-traits Category=MultiTFM + <_MSBuildSdksDir>/%(_DotNetPath.Directory)Sdks + + + + <_ScenarioTestsEnvVars Include="LOCAL_FEED_PATH=$(ArtifactsShippingPackagesDir)" /> + <_ScenarioTestsEnvVars Include="MSBuildSDKsPath=$(_MSBuildSdksDir)" /> + + + + + + + diff --git a/src/SourceBuild/content/build.sh b/src/SourceBuild/content/build.sh index a56de7c8fc7f..a4cb11646502 100755 --- a/src/SourceBuild/content/build.sh +++ b/src/SourceBuild/content/build.sh @@ -18,7 +18,8 @@ usage() echo "Actions:" echo " --clean Clean the solution" echo " --help Print help and exit (short: -h)" - echo " --test Run smoke tests (short: -t)" + echo " --test Run scenario tests (short: -t)" + echo " Use in conjunction with --testnobuild to run tests without building" echo "" echo "Source-only settings:" @@ -33,12 +34,13 @@ usage() echo "" echo "Advanced settings:" - echo " --build-tests Build repository tests. May not be supported with --source-only" + echo " --build-repo-tests Build repository tests. May not be supported with --source-only" echo " --ci Set when running on CI server" echo " --clean-while-building Cleans each repo after building (reduces disk space usage, short: -cwb)" echo " --excludeCIBinarylog Don't output binary log (short: -nobl)" echo " --prepareMachine Prepare machine for CI run, clean up processes after build" echo " --use-mono-runtime Output uses the mono runtime" + echo " --testnobuild Run scenario tests without building when invoked with --test" echo "" echo "Command line arguments not listed above are passed thru to msbuild." echo "Arguments can also be passed in with a single hyphen." @@ -85,6 +87,7 @@ packagesPreviouslySourceBuiltDir="${packagesDir}previously-source-built/" ci=false exclude_ci_binary_log=false prepare_machine=false +test_no_build=false properties='' while [[ $# > 0 ]]; do @@ -112,8 +115,6 @@ while [[ $# > 0 ]]; do exit 0 ;; -test|-t) - export NUGET_PACKAGES=$NUGET_PACKAGES/smoke-tests - properties="$properties /t:RunSmokeTest" test=true ;; @@ -162,7 +163,7 @@ while [[ $# > 0 ]]; do ;; # Advanced settings - -build-tests) + -build-repo-tests) properties="$properties /p:DotNetBuildTests=true" ;; -ci) @@ -180,6 +181,9 @@ while [[ $# > 0 ]]; do -use-mono-runtime) properties="$properties /p:SourceBuildUseMonoRuntime=true" ;; + -testnobuild) + test_no_build=true + ;; *) properties="$properties $1" @@ -193,49 +197,61 @@ if [[ "$ci" == true ]]; then if [[ "$exclude_ci_binary_log" == false ]]; then binary_log=true fi + + properties="$properties /p:ContinuousIntegrationBuild=true" fi . "$scriptroot/eng/common/tools.sh" function Build { - if [[ "$sourceOnly" != "true" ]]; then + if [[ "$sourceOnly" == "true" ]]; then + "$CLI_ROOT/dotnet" build-server shutdown + InvokeMsBuild "$scriptroot/eng/tools/init-build.proj" "ExtractToolPackage,BuildMSBuildSdkResolver" "BuildMSBuildSdkResolver" + + # kill off the MSBuild server so that on future invocations we pick up our custom SDK Resolver + "$CLI_ROOT/dotnet" build-server shutdown + + # Point MSBuild to the custom SDK resolvers folder, so it will pick up our custom SDK Resolver + export MSBUILDADDITIONALSDKRESOLVERSFOLDER="$scriptroot/artifacts/toolset/VSSdkResolvers/" + + fi + + InvokeMsBuild "$scriptroot/build.proj" "Build" "Build" +} + +function Test { + if [[ "$sourceOnly" == "true" ]]; then + NUGET_PACKAGES=$NUGET_PACKAGES/smoke-tests InvokeMsBuild "$scriptroot/build.proj" "RunSmokeTest" "SourceBuildSmokeTests" + fi + + InvokeMsBuild "$scriptroot/build.proj" "Test" "ScenarioTests" +} + +function InvokeMsBuild { + local projectPath="$1" + local target="$2" + local logName="$3" + + if [[ "$sourceOnly" == "true" ]]; then + "$CLI_ROOT/dotnet" msbuild "$projectPath" \ + -t:$target \ + -bl:"$scriptroot/artifacts/log/$configuration/$logName.binlog" \ + -flp:LogFile="$scriptroot/artifacts/log/$configuration/$logName.log" \ + -clp:v=m \ + $properties + else InitializeToolset local bl="" if [[ "$binary_log" == true ]]; then - bl="/bl:\"$log_dir/Build.binlog\"" + bl="/bl:\"$log_dir/$logName.binlog\"" fi - - MSBuild "$scriptroot/build.proj" \ + MSBuild "$projectPath" \ + -t:$target \ $bl \ /p:Configuration=$configuration \ $properties - - ExitWithExitCode 0 - - else - - if [ "$ci" == "true" ]; then - properties="$properties /p:ContinuousIntegrationBuild=true" - fi - - "$CLI_ROOT/dotnet" build-server shutdown - - if [ "$test" == "true" ]; then - "$CLI_ROOT/dotnet" msbuild "$scriptroot/build.proj" -bl:"$scriptroot/artifacts/log/$configuration/BuildTests.binlog" -flp:"LogFile=$scriptroot/artifacts/log/$configuration/BuildTests.log" -clp:v=m $properties - else - "$CLI_ROOT/dotnet" msbuild "$scriptroot/eng/tools/init-build.proj" -bl:"$scriptroot/artifacts/log/$configuration/BuildMSBuildSdkResolver.binlog" -flp:LogFile="$scriptroot/artifacts/log/$configuration/BuildMSBuildSdkResolver.log" /t:ExtractToolPackage,BuildMSBuildSdkResolver $properties - - # kill off the MSBuild server so that on future invocations we pick up our custom SDK Resolver - "$CLI_ROOT/dotnet" build-server shutdown - - # Point MSBuild to the custom SDK resolvers folder, so it will pick up our custom SDK Resolver - export MSBUILDADDITIONALSDKRESOLVERSFOLDER="$scriptroot/artifacts/toolset/VSSdkResolvers/" - - "$CLI_ROOT/dotnet" msbuild "$scriptroot/build.proj" -bl:"$scriptroot/artifacts/log/$configuration/Build.binlog" -flp:"LogFile=$scriptroot/artifacts/log/$configuration/Build.log" $properties - fi - fi } @@ -367,4 +383,11 @@ if [[ "$sourceOnly" == "true" ]]; then echo "Found bootstrap SDK $SDK_VERSION, bootstrap Arcade $ARCADE_BOOTSTRAP_VERSION" fi -Build +# Run the build as long as we're not only running tests +if [[ !("$test" == "true" && "$test_no_build" == "true") ]]; then + Build +fi + +if [ "$test" == "true" ]; then + Test +fi diff --git a/src/SourceBuild/content/eng/build.ps1 b/src/SourceBuild/content/eng/build.ps1 index b354a83422ef..ee2a4ffc62fd 100644 --- a/src/SourceBuild/content/eng/build.ps1 +++ b/src/SourceBuild/content/eng/build.ps1 @@ -8,9 +8,11 @@ Param( # Actions [switch]$clean, [switch][Alias('h')]$help, + [switch][Alias('t')]$test, # Advanced settings - [switch]$buildTests, + [switch]$buildRepoTests, + [switch]$testNoBuild, [switch]$ci, [switch][Alias('cwb')]$cleanWhileBuilding, [switch][Alias('nobl')]$excludeCIBinarylog, @@ -28,10 +30,13 @@ function Get-Usage() { Write-Host "Actions:" Write-Host " -clean Clean the solution" Write-Host " -help Print help and exit (short: -h)" + Write-Host " -test Run scenario tests (short: -t)" + Write-Host " Use in conjunction with -testNoBuild to run tests without building" Write-Host "" Write-Host "Advanced settings:" - Write-Host " -build-tests Build repository tests" + Write-Host " -buildRepoTests Build repository tests" + Write-Host " -testNoBuild Run scenario tests without building when invoked with -test" Write-Host " -ci Set when running on CI server" Write-Host " -cleanWhileBuilding Cleans each repo after building (reduces disk space usage, short: -cwb)" Write-Host " -excludeCIBinarylog Don't output binary log (short: -nobl)" @@ -50,13 +55,14 @@ if ($help) { exit 0 } +$buildProj = Join-Path $RepoRoot 'build.proj' + function Build { InitializeToolset $bl = if ($binaryLog) { '/bl:' + (Join-Path $LogDir 'Build.binlog') } else { '' } $cwb = if ($cleanWhileBuilding) { '/p:CleanWhileBuilding=true' } else { '' } - $btst = if ($buildTests) { '/p:DotNetBuildTests=true' } else { '' } - $buildProj = Join-Path $RepoRoot 'build.proj' + $btst = if ($buildRepoTests) { '/p:DotNetBuildTests=true' } else { '' } MSBuild $buildProj ` $bl ` @@ -66,6 +72,17 @@ function Build { @properties } +function Test { + InitializeToolset + + $bl = if ($binaryLog) { '/bl:' + (Join-Path $LogDir 'ScenarioTests.binlog') } else { '' } + + MSBuild $buildProj ` + $bl ` + /t:Test ` + @properties +} + try { if ($clean) { if (Test-Path $ArtifactsDir) { @@ -81,7 +98,13 @@ try { } } - Build + if (-not ($test -and $testNoBuild)) { + Build + } + + if ($test) { + Test + } } catch { Write-Host $_.ScriptStackTrace From aa1f65efd63839fa07607dcdfb722bc19343db02 Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Mon, 1 Apr 2024 16:26:22 -0500 Subject: [PATCH 02/48] Update descriptions of script options --- src/SourceBuild/content/build.sh | 4 ++-- src/SourceBuild/content/eng/build.ps1 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SourceBuild/content/build.sh b/src/SourceBuild/content/build.sh index a4cb11646502..e072269c333e 100755 --- a/src/SourceBuild/content/build.sh +++ b/src/SourceBuild/content/build.sh @@ -18,7 +18,7 @@ usage() echo "Actions:" echo " --clean Clean the solution" echo " --help Print help and exit (short: -h)" - echo " --test Run scenario tests (short: -t)" + echo " --test Run tests (repo tests omitted by default) (short: -t)" echo " Use in conjunction with --testnobuild to run tests without building" echo "" @@ -40,7 +40,7 @@ usage() echo " --excludeCIBinarylog Don't output binary log (short: -nobl)" echo " --prepareMachine Prepare machine for CI run, clean up processes after build" echo " --use-mono-runtime Output uses the mono runtime" - echo " --testnobuild Run scenario tests without building when invoked with --test" + echo " --testnobuild Run tests without building when invoked with --test" echo "" echo "Command line arguments not listed above are passed thru to msbuild." echo "Arguments can also be passed in with a single hyphen." diff --git a/src/SourceBuild/content/eng/build.ps1 b/src/SourceBuild/content/eng/build.ps1 index ee2a4ffc62fd..4ac42666c005 100644 --- a/src/SourceBuild/content/eng/build.ps1 +++ b/src/SourceBuild/content/eng/build.ps1 @@ -30,13 +30,13 @@ function Get-Usage() { Write-Host "Actions:" Write-Host " -clean Clean the solution" Write-Host " -help Print help and exit (short: -h)" - Write-Host " -test Run scenario tests (short: -t)" + Write-Host " -test Run tests (repo tests omitted by default) (short: -t)" Write-Host " Use in conjunction with -testNoBuild to run tests without building" Write-Host "" Write-Host "Advanced settings:" Write-Host " -buildRepoTests Build repository tests" - Write-Host " -testNoBuild Run scenario tests without building when invoked with -test" + Write-Host " -testNoBuild Run tests without building when invoked with -test" Write-Host " -ci Set when running on CI server" Write-Host " -cleanWhileBuilding Cleans each repo after building (reduces disk space usage, short: -cwb)" Write-Host " -excludeCIBinarylog Don't output binary log (short: -nobl)" From 81af398edb6090899a4329e158b94b0e04a22937 Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Mon, 1 Apr 2024 16:27:58 -0500 Subject: [PATCH 03/48] Provide option to specify the test projects to run --- src/SourceBuild/content/build.proj | 13 ++++++++++--- src/SourceBuild/content/build.sh | 14 ++++++++------ src/SourceBuild/content/eng/build.ps1 | 4 ++++ .../content/eng/build.sourcebuild.targets | 8 ++++++-- 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/src/SourceBuild/content/build.proj b/src/SourceBuild/content/build.proj index d3e969d9cfb2..348549747a0c 100644 --- a/src/SourceBuild/content/build.proj +++ b/src/SourceBuild/content/build.proj @@ -12,6 +12,7 @@ $([MSBuild]::NormalizeDirectory('$(ScenarioTestsArtifactsDir)', 'feed')) $([MSBuild]::NormalizeDirectory('$(ScenarioTestsArtifactsDir)', 'pkg')) $([MSBuild]::NormalizeDirectory('$(ArtifactsTestResultsDir)', 'scenario-tests')) + Microsoft.DotNet.ScenarioTests.SdkTemplateTests @@ -142,12 +143,18 @@ - <_ScenarioTestDll Include="$(ScenarioTestsPackageExtractDir)tools/**/Microsoft.DotNet.ScenarioTests.SdkTemplateTests.dll" /> + <_ScenarioTestDll Include="$(ScenarioTestsPackageExtractDir)tools/**/$(ScenarioTestsProjectName).dll" /> - + + $(RunTestsTargets);RunScenarioTests + + + + + diff --git a/src/SourceBuild/content/build.sh b/src/SourceBuild/content/build.sh index e072269c333e..43aac0c243c1 100755 --- a/src/SourceBuild/content/build.sh +++ b/src/SourceBuild/content/build.sh @@ -41,6 +41,7 @@ usage() echo " --prepareMachine Prepare machine for CI run, clean up processes after build" echo " --use-mono-runtime Output uses the mono runtime" echo " --testnobuild Run tests without building when invoked with --test" + echo " --test-projects Run tests for the specified projects" echo "" echo "Command line arguments not listed above are passed thru to msbuild." echo "Arguments can also be passed in with a single hyphen." @@ -184,7 +185,12 @@ while [[ $# > 0 ]]; do -testnobuild) test_no_build=true ;; - + -test-projects) + # In order to support multiple values delimited by semicolons, it needs to be properly quoted so that + # MSBuild can parse it correctly. See https://github.com/dotnet/sdk/issues/8792#issuecomment-393756980 + properties="$properties /p:DotNetTestProjectsToRun='\"$2\"'" + shift + ;; *) properties="$properties $1" ;; @@ -221,11 +227,7 @@ function Build { } function Test { - if [[ "$sourceOnly" == "true" ]]; then - NUGET_PACKAGES=$NUGET_PACKAGES/smoke-tests InvokeMsBuild "$scriptroot/build.proj" "RunSmokeTest" "SourceBuildSmokeTests" - fi - - InvokeMsBuild "$scriptroot/build.proj" "Test" "ScenarioTests" + InvokeMsBuild "$scriptroot/build.proj" "Test" "Test" } function InvokeMsBuild { diff --git a/src/SourceBuild/content/eng/build.ps1 b/src/SourceBuild/content/eng/build.ps1 index 4ac42666c005..9c7c053a8918 100644 --- a/src/SourceBuild/content/eng/build.ps1 +++ b/src/SourceBuild/content/eng/build.ps1 @@ -13,6 +13,7 @@ Param( # Advanced settings [switch]$buildRepoTests, [switch]$testNoBuild, + [string]$testProjects, [switch]$ci, [switch][Alias('cwb')]$cleanWhileBuilding, [switch][Alias('nobl')]$excludeCIBinarylog, @@ -37,6 +38,7 @@ function Get-Usage() { Write-Host "Advanced settings:" Write-Host " -buildRepoTests Build repository tests" Write-Host " -testNoBuild Run tests without building when invoked with -test" + Write-Host " -testProjects Run tests only for the specified projects" Write-Host " -ci Set when running on CI server" Write-Host " -cleanWhileBuilding Cleans each repo after building (reduces disk space usage, short: -cwb)" Write-Host " -excludeCIBinarylog Don't output binary log (short: -nobl)" @@ -76,10 +78,12 @@ function Test { InitializeToolset $bl = if ($binaryLog) { '/bl:' + (Join-Path $LogDir 'ScenarioTests.binlog') } else { '' } + $tp = if ($testProjects) { '/p:DotNetTestProjectsToRun="' + $testProjects + '"' } else { '' } MSBuild $buildProj ` $bl ` /t:Test ` + $tp ` @properties } diff --git a/src/SourceBuild/content/eng/build.sourcebuild.targets b/src/SourceBuild/content/eng/build.sourcebuild.targets index b86787acada4..4f0d668b597b 100644 --- a/src/SourceBuild/content/eng/build.sourcebuild.targets +++ b/src/SourceBuild/content/eng/build.sourcebuild.targets @@ -1,7 +1,9 @@ - $([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'test', 'Microsoft.DotNet.SourceBuild.SmokeTests')) + Microsoft.DotNet.SourceBuild.SmokeTests + $([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'test', '$(SmokeTestProjectName)')) + $(RunTestsTargets);RunSmokeTest @@ -122,7 +124,8 @@ - + @@ -145,6 +148,7 @@ SMOKE_TESTS_TARGET_RID=$(TargetRid); SMOKE_TESTS_PORTABLE_RID=$(PortableRid); SMOKE_TESTS_CUSTOM_PACKAGES_PATH=$(CustomSourceBuiltPackagesPath); + NUGET_PACKAGES=$(NUGET_PACKAGES)/smoke-tests $(CustomTestEnvVars)" /> From b74d5fb4c0680ad2022d724d0e00e68585689c19 Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Tue, 2 Apr 2024 10:07:26 -0500 Subject: [PATCH 04/48] Use "archive" instead of "tarball" --- src/SourceBuild/content/Directory.Build.targets | 8 ++++---- src/SourceBuild/content/build.proj | 6 +++--- src/SourceBuild/content/eng/build.sourcebuild.targets | 6 +++--- src/SourceBuild/content/eng/sdkArchiveDiff.targets | 2 +- src/SourceBuild/content/repo-projects/installer.proj | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/SourceBuild/content/Directory.Build.targets b/src/SourceBuild/content/Directory.Build.targets index c6863e94a4f4..63ef0498c31b 100644 --- a/src/SourceBuild/content/Directory.Build.targets +++ b/src/SourceBuild/content/Directory.Build.targets @@ -2,18 +2,18 @@ - + dotnet-sdk- - + + DependsOnTargets="GetDotNetSdkArchive"> - <_DotNetSdkArtifactFileName>%(SdkTarballItem.Filename)%(SdkTarballItem.Extension) + <_DotNetSdkArtifactFileName>%(SdkArchiveItem.Filename)%(SdkArchiveItem.Extension) $(_DotNetSdkArtifactFileName.Replace('$(DotNetSdkFilenamePrefix)','').Replace('-$(TargetRid)$(ArchiveExtension)','')) diff --git a/src/SourceBuild/content/build.proj b/src/SourceBuild/content/build.proj index 348549747a0c..9234a62ebef1 100644 --- a/src/SourceBuild/content/build.proj +++ b/src/SourceBuild/content/build.proj @@ -117,7 +117,7 @@ - SetupScenarioTestsArtifacts;GetDotNetSdkTarball + SetupScenarioTestsArtifacts;GetDotNetSdkArchive $(ExtractDotNetSdkArchiveDependsOn);ExtractDotNetSdkZip $(ExtractDotNetSdkArchiveDependsOn);ExtractDotNetSdkTarball @@ -127,12 +127,12 @@ - + - + diff --git a/src/SourceBuild/content/eng/build.sourcebuild.targets b/src/SourceBuild/content/eng/build.sourcebuild.targets index 4f0d668b597b..0fdaa903a2b9 100644 --- a/src/SourceBuild/content/eng/build.sourcebuild.targets +++ b/src/SourceBuild/content/eng/build.sourcebuild.targets @@ -42,7 +42,7 @@ $(BaseIntermediateOutputPath)SdkSymbols $(BaseIntermediateOutputPath)Sdk - %(SdkTarballItem.Identity) + %(SdkArchiveItem.Identity) @@ -127,13 +127,13 @@ - + SMOKE_TESTS_POISON_REPORT_PATH=$(PoisonUsageReportFile); - %(SdkTarballItem.Identity) + %(SdkArchiveItem.Identity) %(SourceBuiltArtifactsItem.Identity) normal diff --git a/src/SourceBuild/content/eng/sdkArchiveDiff.targets b/src/SourceBuild/content/eng/sdkArchiveDiff.targets index c3bc8078763a..047d3217b107 100644 --- a/src/SourceBuild/content/eng/sdkArchiveDiff.targets +++ b/src/SourceBuild/content/eng/sdkArchiveDiff.targets @@ -11,7 +11,7 @@ - diff --git a/src/SourceBuild/content/repo-projects/installer.proj b/src/SourceBuild/content/repo-projects/installer.proj index e834755ea1e2..44e32903bdcc 100644 --- a/src/SourceBuild/content/repo-projects/installer.proj +++ b/src/SourceBuild/content/repo-projects/installer.proj @@ -142,7 +142,7 @@ AfterTargets="Build" DependsOnTargets="DetermineSourceBuiltSdkVersion"> - From 28ddf277572e32ae696a73f2dd4c2d38b714040f Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Thu, 4 Apr 2024 16:16:27 -0500 Subject: [PATCH 05/48] Revert test project selection option --- src/SourceBuild/content/build.sh | 7 ------- src/SourceBuild/content/eng/build.ps1 | 3 --- src/SourceBuild/content/eng/build.sourcebuild.targets | 1 - 3 files changed, 11 deletions(-) diff --git a/src/SourceBuild/content/build.sh b/src/SourceBuild/content/build.sh index 43aac0c243c1..f012da18297b 100755 --- a/src/SourceBuild/content/build.sh +++ b/src/SourceBuild/content/build.sh @@ -41,7 +41,6 @@ usage() echo " --prepareMachine Prepare machine for CI run, clean up processes after build" echo " --use-mono-runtime Output uses the mono runtime" echo " --testnobuild Run tests without building when invoked with --test" - echo " --test-projects Run tests for the specified projects" echo "" echo "Command line arguments not listed above are passed thru to msbuild." echo "Arguments can also be passed in with a single hyphen." @@ -185,12 +184,6 @@ while [[ $# > 0 ]]; do -testnobuild) test_no_build=true ;; - -test-projects) - # In order to support multiple values delimited by semicolons, it needs to be properly quoted so that - # MSBuild can parse it correctly. See https://github.com/dotnet/sdk/issues/8792#issuecomment-393756980 - properties="$properties /p:DotNetTestProjectsToRun='\"$2\"'" - shift - ;; *) properties="$properties $1" ;; diff --git a/src/SourceBuild/content/eng/build.ps1 b/src/SourceBuild/content/eng/build.ps1 index 9c7c053a8918..f0cd141e7340 100644 --- a/src/SourceBuild/content/eng/build.ps1 +++ b/src/SourceBuild/content/eng/build.ps1 @@ -13,7 +13,6 @@ Param( # Advanced settings [switch]$buildRepoTests, [switch]$testNoBuild, - [string]$testProjects, [switch]$ci, [switch][Alias('cwb')]$cleanWhileBuilding, [switch][Alias('nobl')]$excludeCIBinarylog, @@ -78,12 +77,10 @@ function Test { InitializeToolset $bl = if ($binaryLog) { '/bl:' + (Join-Path $LogDir 'ScenarioTests.binlog') } else { '' } - $tp = if ($testProjects) { '/p:DotNetTestProjectsToRun="' + $testProjects + '"' } else { '' } MSBuild $buildProj ` $bl ` /t:Test ` - $tp ` @properties } diff --git a/src/SourceBuild/content/eng/build.sourcebuild.targets b/src/SourceBuild/content/eng/build.sourcebuild.targets index 4d92100b847e..f22058a2121b 100644 --- a/src/SourceBuild/content/eng/build.sourcebuild.targets +++ b/src/SourceBuild/content/eng/build.sourcebuild.targets @@ -124,7 +124,6 @@ From 1b4412e1dc69a0b504c2172d08909e77d7b05c13 Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Thu, 4 Apr 2024 16:21:36 -0500 Subject: [PATCH 06/48] Delete runTests param usage for Shortstack jobs --- eng/pipelines/templates/stages/vmr-build.yml | 27 -------------------- 1 file changed, 27 deletions(-) diff --git a/eng/pipelines/templates/stages/vmr-build.yml b/eng/pipelines/templates/stages/vmr-build.yml index 2a7dbf06e0a5..a53c8a8b4639 100644 --- a/eng/pipelines/templates/stages/vmr-build.yml +++ b/eng/pipelines/templates/stages/vmr-build.yml @@ -364,7 +364,6 @@ stages: container: ${{ variables.androidCrossContainer }} targetOS: android targetArchitecture: arm64 - runTests: false - template: ../jobs/vmr-build.yml parameters: @@ -377,7 +376,6 @@ stages: crossRootFs: '/crossrootfs/x64' targetOS: browser targetArchitecture: wasm - runTests: false - template: ../jobs/vmr-build.yml parameters: @@ -388,7 +386,6 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: iossimulator targetArchitecture: arm64 - runTests: false ### Additional jobs for full build ### - ${{ if in(parameters.scope, 'full') }}: @@ -403,7 +400,6 @@ stages: container: ${{ variables.androidCrossContainer }} targetOS: android targetArchitecture: arm - runTests: false - template: ../jobs/vmr-build.yml parameters: @@ -415,7 +411,6 @@ stages: container: ${{ variables.androidCrossContainer }} targetOS: android targetArchitecture: x64 - runTests: false - template: ../jobs/vmr-build.yml parameters: @@ -427,7 +422,6 @@ stages: container: ${{ variables.androidCrossContainer }} targetOS: android targetArchitecture: x86 - runTests: false - template: ../jobs/vmr-build.yml parameters: @@ -440,7 +434,6 @@ stages: crossRootFs: '/crossrootfs/x64' targetOS: browser targetArchitecture: wasm - runTests: false extraProperties: /p:DotNetBuildRuntimeWasmEnableThreads=true - template: ../jobs/vmr-build.yml @@ -454,7 +447,6 @@ stages: crossRootFs: '/crossrootfs/x64' targetOS: linux-bionic targetArchitecture: arm64 - runTests: false - template: ../jobs/vmr-build.yml parameters: @@ -467,7 +459,6 @@ stages: crossRootFs: '/crossrootfs/x64' targetOS: linux-bionic targetArchitecture: arm64 - runTests: false extraProperties: /p:DotNetBuildRuntimeNativeAOTRuntimePack=true - template: ../jobs/vmr-build.yml @@ -481,7 +472,6 @@ stages: crossRootFs: '/crossrootfs/x64' targetOS: linux-bionic targetArchitecture: x64 - runTests: false - template: ../jobs/vmr-build.yml parameters: @@ -494,7 +484,6 @@ stages: crossRootFs: '/crossrootfs/x64' targetOS: linux-bionic targetArchitecture: x64 - runTests: false extraProperties: /p:DotNetBuildRuntimeNativeAOTRuntimePack=true - template: ../jobs/vmr-build.yml @@ -506,7 +495,6 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: ios targetArchitecture: arm64 - runTests: false - template: ../jobs/vmr-build.yml parameters: @@ -517,7 +505,6 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: ios targetArchitecture: arm64 - runTests: false extraProperties: /p:DotNetBuildRuntimeNativeAOTRuntimePack=true - template: ../jobs/vmr-build.yml @@ -529,7 +516,6 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: iossimulator targetArchitecture: arm64 - runTests: false extraProperties: /p:DotNetBuildRuntimeNativeAOTRuntimePack=true - template: ../jobs/vmr-build.yml @@ -541,7 +527,6 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: iossimulator targetArchitecture: x64 - runTests: false - template: ../jobs/vmr-build.yml parameters: @@ -552,7 +537,6 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: iossimulator targetArchitecture: x64 - runTests: false extraProperties: /p:DotNetBuildRuntimeNativeAOTRuntimePack=true - template: ../jobs/vmr-build.yml @@ -564,7 +548,6 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: maccatalyst targetArchitecture: arm64 - runTests: false - template: ../jobs/vmr-build.yml parameters: @@ -575,7 +558,6 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: maccatalyst targetArchitecture: arm64 - runTests: false extraProperties: /p:DotNetBuildRuntimeNativeAOTRuntimePack=true - template: ../jobs/vmr-build.yml @@ -587,7 +569,6 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: maccatalyst targetArchitecture: x64 - runTests: false - template: ../jobs/vmr-build.yml parameters: @@ -598,7 +579,6 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: maccatalyst targetArchitecture: x64 - runTests: false extraProperties: /p:DotNetBuildRuntimeNativeAOTRuntimePack=true - template: ../jobs/vmr-build.yml @@ -610,7 +590,6 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: tvos targetArchitecture: arm64 - runTests: false - template: ../jobs/vmr-build.yml parameters: @@ -621,7 +600,6 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: tvos targetArchitecture: arm64 - runTests: false extraProperties: /p:DotNetBuildRuntimeNativeAOTRuntimePack=true - template: ../jobs/vmr-build.yml @@ -633,7 +611,6 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: tvossimulator targetArchitecture: arm64 - runTests: false - template: ../jobs/vmr-build.yml parameters: @@ -644,7 +621,6 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: tvossimulator targetArchitecture: arm64 - runTests: false extraProperties: /p:DotNetBuildRuntimeNativeAOTRuntimePack=true - template: ../jobs/vmr-build.yml @@ -656,7 +632,6 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: tvossimulator targetArchitecture: x64 - runTests: false - template: ../jobs/vmr-build.yml parameters: @@ -667,7 +642,6 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: tvossimulator targetArchitecture: x64 - runTests: false extraProperties: /p:DotNetBuildRuntimeNativeAOTRuntimePack=true - template: ../jobs/vmr-build.yml @@ -681,7 +655,6 @@ stages: crossRootFs: '/crossrootfs/x64' targetOS: wasi targetArchitecture: wasm - runTests: false - template: ../jobs/vmr-build.yml parameters: From f5a97a340109d761d938e9d7f685a8d543974b95 Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Wed, 10 Apr 2024 13:45:41 -0500 Subject: [PATCH 07/48] Move extraction of SDK to installer --- src/SourceBuild/content/Directory.Build.props | 1 + src/SourceBuild/content/build.proj | 35 ++----------------- .../content/eng/build.sourcebuild.targets | 7 +--- .../CreateSdkSymbolsLayout.cs | 4 ++- .../content/repo-projects/installer.proj | 10 +++++- 5 files changed, 17 insertions(+), 40 deletions(-) diff --git a/src/SourceBuild/content/Directory.Build.props b/src/SourceBuild/content/Directory.Build.props index 0914fc08602a..de145436a56c 100644 --- a/src/SourceBuild/content/Directory.Build.props +++ b/src/SourceBuild/content/Directory.Build.props @@ -181,6 +181,7 @@ $([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', 'AssetManifests')) $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'assets', '$(Configuration)')) $([MSBuild]::NormalizeDirectory('$(ArtifactsAssetsDir)', 'Symbols')) + $([MSBuild]::NormalizeDirectory('$(ArtifactsAssetsDir)', 'extracted-dotnet-sdk')) $([MSBuild]::NormalizeDirectory('$(PrereqsPackagesDir)', 'prebuilt')) $([MSBuild]::NormalizeDirectory('$(PrereqsPackagesDir)', 'previouslyRestored')) diff --git a/src/SourceBuild/content/build.proj b/src/SourceBuild/content/build.proj index 29aea81d449d..b822f6a4e05e 100644 --- a/src/SourceBuild/content/build.proj +++ b/src/SourceBuild/content/build.proj @@ -6,7 +6,6 @@ netstandard2.0 true - $([MSBuild]::NormalizeDirectory('$(ArtifactsTmpDir)', 'extracted-dotnet-sdk')) $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'scenario-tests')) $([MSBuild]::NormalizeDirectory('$(ScenarioTestsArtifactsDir)', 'runs')) $([MSBuild]::NormalizeDirectory('$(ScenarioTestsArtifactsDir)', 'feed')) @@ -53,15 +52,6 @@ VmrBuildNumber="$(BUILD_BUILDNUMBER)" /> - - SetupScenarioTestsArtifacts;GetDotNetSdkArchive - $(ExtractDotNetSdkArchiveDependsOn);ExtractDotNetSdkZip - $(ExtractDotNetSdkArchiveDependsOn);ExtractDotNetSdkTarball - - - - <_ScenarioTestsNuGetConfig>$(ScenarioTestsArtifactsDir)NuGet.config <_InstallerNuGetConfig>$(RepoRoot)src/installer/NuGet.config @@ -132,25 +122,6 @@ CreateScenarioTestsDirectoryBuildFiles"> - - SetupScenarioTestsArtifacts;GetDotNetSdkArchive - $(ExtractDotNetSdkArchiveDependsOn);ExtractDotNetSdkZip - $(ExtractDotNetSdkArchiveDependsOn);ExtractDotNetSdkTarball - - - - - - - - - - - - - - <_ScenarioTestPackage Include="$(ArtifactsShippingPackagesDir)scenario-tests/**/*.nupkg" /> @@ -167,20 +138,20 @@ $(RunTestsTargets);RunScenarioTests - + - <_DotNetPath Include="$(DotNetInstallDir)sdk/**/dotnet.dll" /> + <_DotNetPath Include="$(DotNetSdkExtractDir)sdk/**/dotnet.dll" /> <_CurrentDateTime>$([System.DateTime]::Now.ToString("yyyy-MM-dd_HH_mm_ss")) <_TestXmlOutputPath>$(ScenarioTestsResultsDir)$(_CurrentDateTime).xml - <_ScenarioTestsArgs>--dotnet-root $(DotNetInstallDir) --xml $(_TestXmlOutputPath) --target-rid $(TargetRid) --test-root $(ScenarioTestsRunsDir)$(_CurrentDateTime) --no-cleanup --no-traits Category=MultiTFM + <_ScenarioTestsArgs>--dotnet-root $(DotNetSdkExtractDir) --xml $(_TestXmlOutputPath) --target-rid $(TargetRid) --test-root $(ScenarioTestsRunsDir)$(_CurrentDateTime) --no-cleanup --no-traits Category=MultiTFM <_MSBuildSdksDir>/%(_DotNetPath.Directory)Sdks diff --git a/src/SourceBuild/content/eng/build.sourcebuild.targets b/src/SourceBuild/content/eng/build.sourcebuild.targets index f22058a2121b..2c429438b6da 100644 --- a/src/SourceBuild/content/eng/build.sourcebuild.targets +++ b/src/SourceBuild/content/eng/build.sourcebuild.targets @@ -41,13 +41,9 @@ $(ArtifactsAssetsDir)dotnet-symbols-sdk-$(SourceBuiltSdkVersion)-$(TargetRid)$(ArchiveExtension) $(BaseIntermediateOutputPath)SdkSymbols - $(BaseIntermediateOutputPath)Sdk - - - - @@ -59,7 +55,6 @@ - + DependsOnTargets="GetDotNetSdkArchive"> + + + + + Date: Wed, 10 Apr 2024 14:21:13 -0500 Subject: [PATCH 08/48] Delete unnecessary local package feed --- src/SourceBuild/content/build.proj | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/src/SourceBuild/content/build.proj b/src/SourceBuild/content/build.proj index b822f6a4e05e..0173fe9fd592 100644 --- a/src/SourceBuild/content/build.proj +++ b/src/SourceBuild/content/build.proj @@ -8,7 +8,6 @@ $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'scenario-tests')) $([MSBuild]::NormalizeDirectory('$(ScenarioTestsArtifactsDir)', 'runs')) - $([MSBuild]::NormalizeDirectory('$(ScenarioTestsArtifactsDir)', 'feed')) $([MSBuild]::NormalizeDirectory('$(ScenarioTestsArtifactsDir)', 'pkg')) $([MSBuild]::NormalizeDirectory('$(ArtifactsTestResultsDir)', 'scenario-tests')) Microsoft.DotNet.ScenarioTests.SdkTemplateTests @@ -64,26 +63,6 @@ - - - - - <_ArtifactsPackage Include="$(ArtifactsShippingPackagesDir)**; - $(ArtifactsNonShippingPackagesDir)**" - Condition="!$([System.String]::Copy('%(Identity)').EndsWith('.symbols.nupkg'))" /> - - - - - - - - - From 7e91377d5ad2c127fe08ca5497733a269e42c454 Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Wed, 10 Apr 2024 14:26:20 -0500 Subject: [PATCH 09/48] Update testRunner name --- eng/pipelines/templates/jobs/vmr-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/jobs/vmr-build.yml b/eng/pipelines/templates/jobs/vmr-build.yml index e6593e9b0bcb..c22d095ad305 100644 --- a/eng/pipelines/templates/jobs/vmr-build.yml +++ b/eng/pipelines/templates/jobs/vmr-build.yml @@ -464,7 +464,7 @@ jobs: condition: succeededOrFailed() continueOnError: true inputs: - testRunner: vSTest + testRunner: VSTest testResultsFiles: 'test/**/*.trx' searchFolder: $(sourcesPath) mergeTestResults: true From 4ad40634d16a550ede3a66ebd4a058702e5facb7 Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Wed, 10 Apr 2024 14:27:54 -0500 Subject: [PATCH 10/48] Update ExtractScenarioTestsPackage target name --- src/SourceBuild/content/build.proj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SourceBuild/content/build.proj b/src/SourceBuild/content/build.proj index 0173fe9fd592..75f0b2c52d3c 100644 --- a/src/SourceBuild/content/build.proj +++ b/src/SourceBuild/content/build.proj @@ -100,7 +100,7 @@ CreateScenarioTestsDirectoryBuildFiles"> - + <_ScenarioTestPackage Include="$(ArtifactsShippingPackagesDir)scenario-tests/**/*.nupkg" /> @@ -116,7 +116,7 @@ $(RunTestsTargets);RunScenarioTests - + From 7bef2e3fcfe6bf3763bc74e869529a080ed3ea3a Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Thu, 11 Apr 2024 14:40:21 -0500 Subject: [PATCH 11/48] Move more test execution MSBuild logic to scenario-tests --- src/SourceBuild/content/build.proj | 77 +++++------------------------- 1 file changed, 11 insertions(+), 66 deletions(-) diff --git a/src/SourceBuild/content/build.proj b/src/SourceBuild/content/build.proj index 75f0b2c52d3c..409e471373f5 100644 --- a/src/SourceBuild/content/build.proj +++ b/src/SourceBuild/content/build.proj @@ -7,10 +7,7 @@ true $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'scenario-tests')) - $([MSBuild]::NormalizeDirectory('$(ScenarioTestsArtifactsDir)', 'runs')) - $([MSBuild]::NormalizeDirectory('$(ScenarioTestsArtifactsDir)', 'pkg')) $([MSBuild]::NormalizeDirectory('$(ArtifactsTestResultsDir)', 'scenario-tests')) - Microsoft.DotNet.ScenarioTests.SdkTemplateTests @@ -65,83 +62,31 @@ - - - - - - <_DirectoryBuildPropsContent> -<Project> - <PropertyGroup> - <ManagePackageVersionsCentrally> - false - </ManagePackageVersionsCentrally> - </PropertyGroup> -</Project> - - - - - - - - - - - <_ScenarioTestPackage Include="$(ArtifactsShippingPackagesDir)scenario-tests/**/*.nupkg" /> - - - - - - <_ScenarioTestDll Include="$(ScenarioTestsPackageExtractDir)tools/**/$(ScenarioTestsProjectName).dll" /> - - - $(RunTestsTargets);RunScenarioTests - + + DependsOnTargets="DetermineSourceBuiltSdkVersion"> - - - <_DotNetPath Include="$(DotNetSdkExtractDir)sdk/**/dotnet.dll" /> - - <_CurrentDateTime>$([System.DateTime]::Now.ToString("yyyy-MM-dd_HH_mm_ss")) <_TestXmlOutputPath>$(ScenarioTestsResultsDir)$(_CurrentDateTime).xml - <_ScenarioTestsArgs>--dotnet-root $(DotNetSdkExtractDir) --xml $(_TestXmlOutputPath) --target-rid $(TargetRid) --test-root $(ScenarioTestsRunsDir)$(_CurrentDateTime) --no-cleanup --no-traits Category=MultiTFM - <_MSBuildSdksDir>/%(_DotNetPath.Directory)Sdks + <_ScenarioTestsAdditionalArgs>--xml $(_TestXmlOutputPath) --target-rid $(TargetRid) --no-cleanup --no-traits Category=MultiTFM + + + <_TestRoot>$(ScenarioTestsArtifactsDir)artifacts/ - - <_ScenarioTestsEnvVars Include="LOCAL_FEED_PATH=$(ArtifactsShippingPackagesDir)" /> - <_ScenarioTestsEnvVars Include="MSBuildSDKsPath=$(_MSBuildSdksDir)" /> - + - + - + From 2621b96ed1f9077757b089187b767b87e23a136f Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Wed, 17 Apr 2024 13:26:09 -0500 Subject: [PATCH 12/48] Integrate with test infra after merge from main --- src/SourceBuild/content/build.proj | 45 ---------------- src/SourceBuild/content/build.sh | 50 ++--------------- src/SourceBuild/content/eng/build.ps1 | 2 +- .../content/repo-projects/dotnet.proj | 1 - ...osoft.DotNet.SourceBuild.SmokeTests.csproj | 2 +- ...Microsoft.DotNet.UnifiedBuild.Tests.csproj | 2 +- .../content/test/scenario-tests.proj | 53 +++++++++++++++++++ src/SourceBuild/content/test/tests.proj | 30 ++++++++++- 8 files changed, 89 insertions(+), 96 deletions(-) create mode 100644 src/SourceBuild/content/test/scenario-tests.proj diff --git a/src/SourceBuild/content/build.proj b/src/SourceBuild/content/build.proj index 324cd2905539..65f27db57da0 100644 --- a/src/SourceBuild/content/build.proj +++ b/src/SourceBuild/content/build.proj @@ -36,51 +36,6 @@ - - $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'scenario-tests')) - $([MSBuild]::NormalizeDirectory('$(ArtifactsTestResultsDir)', 'scenario-tests')) - <_ScenarioTestsNuGetConfig>$(ScenarioTestsArtifactsDir)NuGet.config - <_InstallerNuGetConfig>$(RepoRoot)src/installer/NuGet.config - - - - - - - - - - $(RunTestsTargets);RunScenarioTests - - - - - - - - <_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/ - - - - - - - - - - - diff --git a/src/SourceBuild/content/build.sh b/src/SourceBuild/content/build.sh index 468602677f21..20003c2d6066 100755 --- a/src/SourceBuild/content/build.sh +++ b/src/SourceBuild/content/build.sh @@ -39,7 +39,6 @@ usage() echo " --excludeCIBinarylog Don't output binary log (short: -nobl)" echo " --prepareMachine Prepare machine for CI run, clean up processes after build" echo " --use-mono-runtime Output uses the mono runtime" - echo " --testnobuild Run tests without building when invoked with --test" echo "" echo "Command line arguments not listed above are passed thru to msbuild." echo "Arguments can also be passed in with a single hyphen." @@ -83,7 +82,6 @@ packagesPreviouslySourceBuiltDir="${packagesDir}previously-source-built/" ci=false exclude_ci_binary_log=false prepare_machine=false -test_no_build=false properties='' while [[ $# > 0 ]]; do @@ -189,8 +187,6 @@ if [[ "$ci" == true ]]; then if [[ "$exclude_ci_binary_log" == false ]]; then binary_log=true fi - - properties="$properties /p:ContinuousIntegrationBuild=true" fi # Never use the global nuget cache folder @@ -204,43 +200,12 @@ targets="/t:Build" # This repo uses the VSTest integration instead of the Arcade Test target if [[ "$test" == true ]]; then project="$scriptroot/test/tests.proj" - targets="$targets;VSTest" + targets="/t:RunTests" fi function Build { - if [[ "$sourceOnly" == "true" ]]; then - "$CLI_ROOT/dotnet" build-server shutdown - - InvokeMsBuild "$scriptroot/eng/tools/init-build.proj" "ExtractToolPackage,BuildMSBuildSdkResolver" "BuildMSBuildSdkResolver" - - # kill off the MSBuild server so that on future invocations we pick up our custom SDK Resolver - "$CLI_ROOT/dotnet" build-server shutdown - - # Point MSBuild to the custom SDK resolvers folder, so it will pick up our custom SDK Resolver - export MSBUILDADDITIONALSDKRESOLVERSFOLDER="$scriptroot/artifacts/toolset/VSSdkResolvers/" - - fi - - InvokeMsBuild "$scriptroot/build.proj" "Build" "Build" -} + if [[ "$sourceOnly" != "true" ]]; then -function Test { - InvokeMsBuild "$scriptroot/build.proj" "Test" "Test" -} - -function InvokeMsBuild { - local projectPath="$1" - local target="$2" - local logName="$3" - - if [[ "$sourceOnly" == "true" ]]; then - "$CLI_ROOT/dotnet" msbuild "$projectPath" \ - -t:$target \ - -bl:"$scriptroot/artifacts/log/$configuration/$logName.binlog" \ - -flp:LogFile="$scriptroot/artifacts/log/$configuration/$logName.log" \ - -clp:v=m \ - $properties - else InitializeToolset # Manually unset NUGET_PACKAGES as InitializeToolset sets it unconditionally. @@ -249,7 +214,7 @@ function InvokeMsBuild { local bl="" if [[ "$binary_log" == true ]]; then - bl="/bl:\"$log_dir/$logName.binlog\"" + bl="/bl:\"$log_dir/Build.binlog\"" fi MSBuild --restore \ @@ -445,11 +410,4 @@ if [[ "$sourceOnly" == "true" ]]; then echo "Found bootstrap versions: SDK $SDK_VERSION, Arcade $ARCADE_BOOTSTRAP_VERSION, NoTargets $NOTARGETS_BOOTSTRAP_VERSION and Traversal $TRAVERSAL_BOOTSTRAP_VERSION" fi -# Run the build as long as we're not only running tests -if [[ !("$test" == "true" && "$test_no_build" == "true") ]]; then - Build -fi - -if [ "$test" == "true" ]; then - Test -fi +Build diff --git a/src/SourceBuild/content/eng/build.ps1 b/src/SourceBuild/content/eng/build.ps1 index 433d39243064..b7fb088d11d2 100644 --- a/src/SourceBuild/content/eng/build.ps1 +++ b/src/SourceBuild/content/eng/build.ps1 @@ -57,7 +57,7 @@ $targets = "/t:Build" # This repo uses the VSTest integration instead of the Arcade Test target if ($test) { $project = Join-Path (Join-Path $RepoRoot "test") "tests.proj" - $targets += ";VSTest" + $targets = "/t:RunTests" } if ($buildRepoTests) { diff --git a/src/SourceBuild/content/repo-projects/dotnet.proj b/src/SourceBuild/content/repo-projects/dotnet.proj index 25d66b251b8d..49a133b14897 100644 --- a/src/SourceBuild/content/repo-projects/dotnet.proj +++ b/src/SourceBuild/content/repo-projects/dotnet.proj @@ -12,7 +12,6 @@ - diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/Microsoft.DotNet.SourceBuild.SmokeTests.csproj b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/Microsoft.DotNet.SourceBuild.SmokeTests.csproj index 8c698bb9024d..bacf81d3309a 100644 --- a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/Microsoft.DotNet.SourceBuild.SmokeTests.csproj +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/Microsoft.DotNet.SourceBuild.SmokeTests.csproj @@ -76,7 +76,7 @@ $(SmokeTestsPrereqsPath) - $(SdkTarballPath) + $(SdkArchivePath) $(SourceBuiltArtifactsPath) diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.UnifiedBuild.Tests/Microsoft.DotNet.UnifiedBuild.Tests.csproj b/src/SourceBuild/content/test/Microsoft.DotNet.UnifiedBuild.Tests/Microsoft.DotNet.UnifiedBuild.Tests.csproj index 9bf09b66abdc..0e55bfcd433e 100644 --- a/src/SourceBuild/content/test/Microsoft.DotNet.UnifiedBuild.Tests/Microsoft.DotNet.UnifiedBuild.Tests.csproj +++ b/src/SourceBuild/content/test/Microsoft.DotNet.UnifiedBuild.Tests/Microsoft.DotNet.UnifiedBuild.Tests.csproj @@ -25,7 +25,7 @@ $(ArtifactsTestResultsDir) - $(SdkTarballPath) + $(SdkArchivePath) $(TargetRid) diff --git a/src/SourceBuild/content/test/scenario-tests.proj b/src/SourceBuild/content/test/scenario-tests.proj new file mode 100644 index 000000000000..9e0ac6910e70 --- /dev/null +++ b/src/SourceBuild/content/test/scenario-tests.proj @@ -0,0 +1,53 @@ + + + + $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'scenario-tests')) + $([MSBuild]::NormalizeDirectory('$(ArtifactsTestResultsDir)', 'scenario-tests')) + <_ScenarioTestsNuGetConfig>$(ScenarioTestsArtifactsDir)NuGet.config + <_InstallerNuGetConfig>$(RepoRoot)src/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/ + + + + + + <_ScenarioTestProperties Include=" + Configuration=$(Configuration); + RunScenarioTests=true; + TestRoot=$(_TestRoot); + DotNetRoot=$(DotNetSdkExtractDir); + NETCoreSdkVersion=$(SourceBuiltSdkVersion); + AdditionalTestArgs=$(_ScenarioTestsAdditionalArgs); + DOTNET_INSTALL_DIR=$(DotNetRoot)" /> + + + + + diff --git a/src/SourceBuild/content/test/tests.proj b/src/SourceBuild/content/test/tests.proj index 582cb92574da..91749a5fdc29 100644 --- a/src/SourceBuild/content/test/tests.proj +++ b/src/SourceBuild/content/test/tests.proj @@ -7,4 +7,32 @@ Condition="'$(ShortStack)' != 'true' and '$(PortableBuild)' == 'true' and '$(PgoInstrument)' != 'true'" /> - \ No newline at end of file + + + + + $(MSBuildLastTaskResult) + + + + + + + + + $(MSBuildLastTaskResult) + + + + + + + From 49c04fc531de986bab872236a4cb7a8b651be539 Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Thu, 18 Apr 2024 09:03:23 -0500 Subject: [PATCH 13/48] Remove unnecessary changes in build.ps1 --- src/SourceBuild/content/eng/build.ps1 | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/src/SourceBuild/content/eng/build.ps1 b/src/SourceBuild/content/eng/build.ps1 index b7fb088d11d2..50e70ccd0b69 100644 --- a/src/SourceBuild/content/eng/build.ps1 +++ b/src/SourceBuild/content/eng/build.ps1 @@ -86,17 +86,6 @@ function Build { @arguments } -function Test { - InitializeToolset - - $bl = if ($binaryLog) { '/bl:' + (Join-Path $LogDir 'ScenarioTests.binlog') } else { '' } - - MSBuild $buildProj ` - $bl ` - /t:Test ` - @properties -} - try { if ($clean) { if (Test-Path $ArtifactsDir) { @@ -112,13 +101,7 @@ try { } } - if (-not ($test -and $testNoBuild)) { - Build - } - - if ($test) { - Test - } + Build } catch { Write-Host $_.ScriptStackTrace From 877fc86f36de9eedf8bb854d2fc6797951eab6c4 Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Thu, 18 Apr 2024 09:04:33 -0500 Subject: [PATCH 14/48] Clean up pipeline --- eng/pipelines/templates/jobs/vmr-build.yml | 3 ++- eng/pipelines/templates/stages/vmr-build.yml | 13 ------------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/eng/pipelines/templates/jobs/vmr-build.yml b/eng/pipelines/templates/jobs/vmr-build.yml index fea82deaf2bf..a0114a2c9e3e 100644 --- a/eng/pipelines/templates/jobs/vmr-build.yml +++ b/eng/pipelines/templates/jobs/vmr-build.yml @@ -474,7 +474,7 @@ jobs: testRunTitle: SourceBuild_SmokeTests_$(Agent.JobName) - task: PublishTestResults@2 - displayName: Publish Scenario Test Results + displayName: Publish Test Results condition: succeededOrFailed() continueOnError: true inputs: @@ -484,6 +484,7 @@ jobs: mergeTestResults: true publishRunAttachments: true testRunTitle: Tests_$(Agent.JobName) + - task: PublishTestResults@2 displayName: Publish Scenario Test Results condition: succeededOrFailed() diff --git a/eng/pipelines/templates/stages/vmr-build.yml b/eng/pipelines/templates/stages/vmr-build.yml index df9264226b9e..3fd08da5eae0 100644 --- a/eng/pipelines/templates/stages/vmr-build.yml +++ b/eng/pipelines/templates/stages/vmr-build.yml @@ -311,7 +311,6 @@ stages: container: ${{ variables.ubuntu2204Container }} targetOS: linux targetArchitecture: x64 - runTests: true - template: ../jobs/vmr-build.yml parameters: @@ -322,7 +321,6 @@ stages: pool: ${{ parameters.pool_Windows }} targetOS: windows targetArchitecture: x64 - runTests: true - template: ../jobs/vmr-build.yml parameters: @@ -662,7 +660,6 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: osx targetArchitecture: x64 - runTests: true - template: ../jobs/vmr-build.yml parameters: @@ -674,7 +671,6 @@ stages: useMonoRuntime: true targetOS: osx targetArchitecture: x64 - runTests: true - template: ../jobs/vmr-build.yml parameters: @@ -687,7 +683,6 @@ stages: crossRootFs: '/crossrootfs/x64' targetOS: linux targetArchitecture: x64 - runTests: true - template: ../jobs/vmr-build.yml parameters: @@ -714,7 +709,6 @@ stages: useMonoRuntime: true targetOS: linux targetArchitecture: x64 - runTests: true - template: ../jobs/vmr-build.yml parameters: @@ -841,7 +835,6 @@ stages: pool: ${{ parameters.pool_Mac }} targetOS: osx targetArchitecture: arm64 - runTests: true - template: ../jobs/vmr-build.yml parameters: @@ -853,7 +846,6 @@ stages: useMonoRuntime: true targetOS: osx targetArchitecture: arm64 - runTests: true - template: ../jobs/vmr-build.yml parameters: @@ -888,7 +880,6 @@ stages: pool: ${{ parameters.pool_Windows }} targetOS: windows targetArchitecture: arm64 - runTests: true - template: ../jobs/vmr-build.yml parameters: @@ -900,7 +891,6 @@ stages: useMonoRuntime: true targetOS: windows targetArchitecture: x64 - runTests: true - template: ../jobs/vmr-build.yml parameters: @@ -911,7 +901,6 @@ stages: pool: ${{ parameters.pool_Windows }} targetOS: windows targetArchitecture: x86 - runTests: true - template: ../jobs/vmr-build.yml parameters: @@ -923,7 +912,6 @@ stages: useMonoRuntime: true targetOS: windows targetArchitecture: x86 - runTests: true - template: ../jobs/vmr-build.yml parameters: @@ -934,7 +922,6 @@ stages: pool: ${{ parameters.pool_Windows }} targetOS: windows targetArchitecture: x64 - runTests: true extraProperties: /p:PgoInstrument=true - template: ../jobs/vmr-build.yml From d979155c2996046df609fa0107c2f099fac950ba Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Thu, 18 Apr 2024 09:05:14 -0500 Subject: [PATCH 15/48] Clean up D.B.props --- src/SourceBuild/content/Directory.Build.props | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/SourceBuild/content/Directory.Build.props b/src/SourceBuild/content/Directory.Build.props index e9baaed63164..0d0f4df6c49f 100644 --- a/src/SourceBuild/content/Directory.Build.props +++ b/src/SourceBuild/content/Directory.Build.props @@ -93,12 +93,6 @@ $([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'artifacts')) $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'obj')) $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'bin')) - $([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'eng')) From c56edf54fef702c9c5d0417514b54d7970fee46a Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Thu, 18 Apr 2024 09:06:51 -0500 Subject: [PATCH 16/48] Skip scenario tests for cross platform scenarios --- src/SourceBuild/content/test/tests.proj | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/SourceBuild/content/test/tests.proj b/src/SourceBuild/content/test/tests.proj index 91749a5fdc29..3351b1b0ba65 100644 --- a/src/SourceBuild/content/test/tests.proj +++ b/src/SourceBuild/content/test/tests.proj @@ -22,13 +22,30 @@ an executable that is used to run the tests and so using the VSTest runner doesn't work with them. They also require some setup steps to be configured with the VMR. --> - + <_HostArchitecture>$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture) + <_RunScenarioTests>true + + + <_RunScenarioTests Condition="'$(_HostArchitecture.ToLower())' != '$(TargetArchitecture.ToLower())'">false + + + <_RunScenarioTests Condition="'$(__PortableTargetOS.ToLower())' != '$(TargetOS.ToLower())'">false + + + - $(MSBuildLastTaskResult) + true + $(MSBuildLastTaskResult) From fa6b2e41ab74487c1ce5d88c8528d83bdb97ac75 Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Fri, 19 Apr 2024 10:42:10 -0500 Subject: [PATCH 17/48] Revert refactoring of DetermineSourceBuiltSdkVersion --- .../content/Directory.Build.targets | 18 ++++++------------ .../content/repo-projects/installer.proj | 8 ++++---- ...rosoft.DotNet.SourceBuild.SmokeTests.csproj | 2 +- .../Microsoft.DotNet.UnifiedBuild.Tests.csproj | 8 ++++---- 4 files changed, 15 insertions(+), 21 deletions(-) diff --git a/src/SourceBuild/content/Directory.Build.targets b/src/SourceBuild/content/Directory.Build.targets index 4640e85af4e9..41405bafd5f7 100644 --- a/src/SourceBuild/content/Directory.Build.targets +++ b/src/SourceBuild/content/Directory.Build.targets @@ -2,22 +2,15 @@ - + - dotnet-sdk- + dotnet-sdk- - + - - - %(SdkArchiveItem.Identity) - - - - <_DotNetSdkArtifactFileName>%(SdkArchiveItem.Filename)%(SdkArchiveItem.Extension) - $(_DotNetSdkArtifactFileName.Replace('$(DotNetSdkFilenamePrefix)','').Replace('-$(TargetRid)$(ArchiveExtension)','')) + %(SdkTarballItem.Filename)%(SdkTarballItem.Extension) + %(SdkTarballItem.Identity) + $(SdkFilename.Replace('$(SdkFilenamePrefix)','').Replace('-$(TargetRid)$(ArchiveExtension)','')) diff --git a/src/SourceBuild/content/repo-projects/installer.proj b/src/SourceBuild/content/repo-projects/installer.proj index 63bbdfa2b472..9d30bc1f2ce0 100644 --- a/src/SourceBuild/content/repo-projects/installer.proj +++ b/src/SourceBuild/content/repo-projects/installer.proj @@ -78,9 +78,9 @@ + DependsOnTargets="DetermineSourceBuiltSdkVersion"> - @@ -88,9 +88,9 @@ + Command="tar -xzf $(SdkTarballPath) -C $(DotNetSdkExtractDir)" /> diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/Microsoft.DotNet.SourceBuild.SmokeTests.csproj b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/Microsoft.DotNet.SourceBuild.SmokeTests.csproj index bacf81d3309a..8c698bb9024d 100644 --- a/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/Microsoft.DotNet.SourceBuild.SmokeTests.csproj +++ b/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/Microsoft.DotNet.SourceBuild.SmokeTests.csproj @@ -76,7 +76,7 @@ $(SmokeTestsPrereqsPath) - $(SdkArchivePath) + $(SdkTarballPath) $(SourceBuiltArtifactsPath) diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.UnifiedBuild.Tests/Microsoft.DotNet.UnifiedBuild.Tests.csproj b/src/SourceBuild/content/test/Microsoft.DotNet.UnifiedBuild.Tests/Microsoft.DotNet.UnifiedBuild.Tests.csproj index 87054672f1da..3548c6cf5dce 100644 --- a/src/SourceBuild/content/test/Microsoft.DotNet.UnifiedBuild.Tests/Microsoft.DotNet.UnifiedBuild.Tests.csproj +++ b/src/SourceBuild/content/test/Microsoft.DotNet.UnifiedBuild.Tests/Microsoft.DotNet.UnifiedBuild.Tests.csproj @@ -43,15 +43,15 @@ - - $(SdkArchivePath) + + $(SdkTarballPath) $(SourceBuiltSdkVersion) - - $(UBTestsMsftSdkArchivePath) + + $(UBTestsMsftSdkTarballPath) From 41b46b4cc39f962914c83d2257e9a2f4b75364e3 Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Fri, 19 Apr 2024 10:43:27 -0500 Subject: [PATCH 18/48] Move SDK extraction --- src/SourceBuild/content/Directory.Build.props | 2 +- .../content/eng/extract-sdk-archive.proj | 18 ++++++++++++++++++ .../content/eng/finish-source-only.proj | 1 + .../content/repo-projects/installer.proj | 7 ------- src/SourceBuild/content/test/tests.proj | 1 + 5 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 src/SourceBuild/content/eng/extract-sdk-archive.proj diff --git a/src/SourceBuild/content/Directory.Build.props b/src/SourceBuild/content/Directory.Build.props index ce1c4aa877d5..465fbad19cf3 100644 --- a/src/SourceBuild/content/Directory.Build.props +++ b/src/SourceBuild/content/Directory.Build.props @@ -160,7 +160,7 @@ $([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', 'Symbols')) $([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', 'AssetManifests')) $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'assets', '$(Configuration)')) - $([MSBuild]::NormalizeDirectory('$(ArtifactsAssetsDir)', 'extracted-dotnet-sdk')) + $([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', 'extracted-dotnet-sdk')) $([MSBuild]::NormalizeDirectory('$(PrereqsPackagesDir)', 'prebuilt')) $([MSBuild]::NormalizeDirectory('$(PrereqsPackagesDir)', 'previouslyRestored')) 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 000000000000..b6c7ac52b378 --- /dev/null +++ b/src/SourceBuild/content/eng/extract-sdk-archive.proj @@ -0,0 +1,18 @@ + + + + $(NetCurrent) + + + + + + + + + + + diff --git a/src/SourceBuild/content/eng/finish-source-only.proj b/src/SourceBuild/content/eng/finish-source-only.proj index e63f54cbd23d..8debf6be72dd 100644 --- a/src/SourceBuild/content/eng/finish-source-only.proj +++ b/src/SourceBuild/content/eng/finish-source-only.proj @@ -10,6 +10,7 @@ + diff --git a/src/SourceBuild/content/repo-projects/installer.proj b/src/SourceBuild/content/repo-projects/installer.proj index 9d30bc1f2ce0..1b9d2068c178 100644 --- a/src/SourceBuild/content/repo-projects/installer.proj +++ b/src/SourceBuild/content/repo-projects/installer.proj @@ -85,13 +85,6 @@ SkipUnchangedFiles="true" UseHardlinksIfPossible="true" /> - - - - diff --git a/src/SourceBuild/content/test/tests.proj b/src/SourceBuild/content/test/tests.proj index 3351b1b0ba65..609865581322 100644 --- a/src/SourceBuild/content/test/tests.proj +++ b/src/SourceBuild/content/test/tests.proj @@ -5,6 +5,7 @@ Condition="'$(DotNetBuildSourceOnly)' == 'true'" /> + From 09b93d4d4ac9a4d396086c5e96dc7b15a52359d8 Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Mon, 22 Apr 2024 08:18:35 -0500 Subject: [PATCH 19/48] Run build/test from repo-project --- .../repo-projects/Directory.Build.props | 11 +++++ .../content/repo-projects/dotnet.proj | 1 + .../content/repo-projects/scenario-tests.proj | 45 +++++++++++++++++++ src/SourceBuild/content/test/tests.proj | 2 +- 4 files changed, 58 insertions(+), 1 deletion(-) diff --git a/src/SourceBuild/content/repo-projects/Directory.Build.props b/src/SourceBuild/content/repo-projects/Directory.Build.props index 8a27e0ee9277..d27901886ed9 100644 --- a/src/SourceBuild/content/repo-projects/Directory.Build.props +++ b/src/SourceBuild/content/repo-projects/Directory.Build.props @@ -93,6 +93,17 @@ $(BuildArgs) /p:ReferencePackageNupkgCacheDir="$(ReferencePackagesDir)" + + $(FlagParameterPrefix)restore + $(TestActions) $(FlagParameterPrefix)test + + $(FlagParameterPrefix)ci + $(TestArgs) $(FlagParameterPrefix)configuration $(Configuration) + $(TestArgs) -bl:artifacts/log/$(Configuration)/Test.binlog + + $(BuildScript) $(TestActions) $(TestArgs) + + $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'msbuild-debug')) $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'roslyn-debug')) diff --git a/src/SourceBuild/content/repo-projects/dotnet.proj b/src/SourceBuild/content/repo-projects/dotnet.proj index 49a133b14897..25d66b251b8d 100644 --- a/src/SourceBuild/content/repo-projects/dotnet.proj +++ b/src/SourceBuild/content/repo-projects/dotnet.proj @@ -12,6 +12,7 @@ + diff --git a/src/SourceBuild/content/repo-projects/scenario-tests.proj b/src/SourceBuild/content/repo-projects/scenario-tests.proj index 600ff4f6006b..40e30d7d2493 100644 --- a/src/SourceBuild/content/repo-projects/scenario-tests.proj +++ b/src/SourceBuild/content/repo-projects/scenario-tests.proj @@ -10,4 +10,49 @@ + + $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'scenario-tests')) + $([MSBuild]::NormalizeDirectory('$(ArtifactsTestResultsDir)', 'scenario-tests')) + <_ScenarioTestsNuGetConfig>$(ScenarioTestsArtifactsDir)NuGet.config + <_InstallerNuGetConfig>$(RepoRoot)src/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/ + + + + + + <_ScenarioTestEnvVars Include=" + TestRoot=$(_TestRoot); + DotNetRoot=$(DotNetSdkExtractDir); + NETCoreSdkVersion=$(SourceBuiltSdkVersion); + AdditionalTestArgs=$(_ScenarioTestsAdditionalArgs); + DOTNET_INSTALL_DIR=$(DotNetRoot)" /> + + + + + diff --git a/src/SourceBuild/content/test/tests.proj b/src/SourceBuild/content/test/tests.proj index 609865581322..b2f57bdf95a3 100644 --- a/src/SourceBuild/content/test/tests.proj +++ b/src/SourceBuild/content/test/tests.proj @@ -39,7 +39,7 @@ From 8e9b075f98eb1bb5ec618d1964b8bf679c271d71 Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Mon, 22 Apr 2024 08:22:25 -0500 Subject: [PATCH 20/48] Delete obsolete pipeline step --- eng/pipelines/templates/jobs/vmr-build.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/eng/pipelines/templates/jobs/vmr-build.yml b/eng/pipelines/templates/jobs/vmr-build.yml index a0114a2c9e3e..2afdd96c2e08 100644 --- a/eng/pipelines/templates/jobs/vmr-build.yml +++ b/eng/pipelines/templates/jobs/vmr-build.yml @@ -460,18 +460,6 @@ jobs: # Only upload test results if enabled - ${{ if eq(parameters.runTests, 'True') }}: - - ${{ if eq(parameters.buildSourceOnly, 'True') }}: - - task: PublishTestResults@2 - displayName: Publish Source Build Smoke Test Results - condition: succeededOrFailed() - continueOnError: true - inputs: - testRunner: VSTest - testResultsFiles: 'test/**/*.trx' - searchFolder: $(sourcesPath) - mergeTestResults: true - publishRunAttachments: true - testRunTitle: SourceBuild_SmokeTests_$(Agent.JobName) - task: PublishTestResults@2 displayName: Publish Test Results From 7bb0e4a3be844601edee86c6f66d76a702a8a056 Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Mon, 22 Apr 2024 08:29:05 -0500 Subject: [PATCH 21/48] Clarify path for scenario-tests test results for publishing --- eng/pipelines/templates/jobs/vmr-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/jobs/vmr-build.yml b/eng/pipelines/templates/jobs/vmr-build.yml index 2afdd96c2e08..f1296761dbf2 100644 --- a/eng/pipelines/templates/jobs/vmr-build.yml +++ b/eng/pipelines/templates/jobs/vmr-build.yml @@ -479,7 +479,7 @@ jobs: continueOnError: true inputs: testRunner: xUnit - testResultsFiles: 'artifacts/TestResults/**/*.xml' + testResultsFiles: 'artifacts/TestResults/**/scenario-tests/*.xml' searchFolder: $(sourcesPath) mergeTestResults: true publishRunAttachments: true From b7bf1bb33102e085eac8e96121d081e3c288a32b Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Mon, 22 Apr 2024 09:04:17 -0500 Subject: [PATCH 22/48] Consume BuildArchitecture property --- src/SourceBuild/content/test/tests.proj | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/SourceBuild/content/test/tests.proj b/src/SourceBuild/content/test/tests.proj index b2f57bdf95a3..62559cf0a026 100644 --- a/src/SourceBuild/content/test/tests.proj +++ b/src/SourceBuild/content/test/tests.proj @@ -24,13 +24,12 @@ some setup steps to be configured with the VMR. --> - <_HostArchitecture>$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture) <_RunScenarioTests>true - <_RunScenarioTests Condition="'$(_HostArchitecture.ToLower())' != '$(TargetArchitecture.ToLower())'">false + <_RunScenarioTests Condition="'$(BuildArchitecture.ToLower())' != '$(TargetArchitecture.ToLower())'">false + + + + 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 000000000000..c5ee42abe7d5 --- /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 62559cf0a026..a7c795bf7add 100644 --- a/src/SourceBuild/content/test/tests.proj +++ b/src/SourceBuild/content/test/tests.proj @@ -1,55 +1,26 @@ + + <_RunScenarioTests>true + + + <_RunScenarioTests Condition="'$(BuildArchitecture.ToLower())' != '$(TargetArchitecture.ToLower())'">false + + + <_RunScenarioTests Condition="'$(__PortableTargetOS.ToLower())' != '$(TargetOS.ToLower())'">false + + + - + - - - - - $(MSBuildLastTaskResult) - - - - - - - <_RunScenarioTests>true - - - <_RunScenarioTests Condition="'$(BuildArchitecture.ToLower())' != '$(TargetArchitecture.ToLower())'">false - - - <_RunScenarioTests Condition="'$(__PortableTargetOS.ToLower())' != '$(TargetOS.ToLower())'">false - - - - - - true - $(MSBuildLastTaskResult) - - - - - - From 9745f7ad22ade03719c6882e91d31ba4070078bf Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Tue, 23 Apr 2024 09:36:33 -0500 Subject: [PATCH 24/48] Allow scenario tests to run on Windows --- src/SourceBuild/content/test/tests.proj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SourceBuild/content/test/tests.proj b/src/SourceBuild/content/test/tests.proj index a7c795bf7add..24a62f22414e 100644 --- a/src/SourceBuild/content/test/tests.proj +++ b/src/SourceBuild/content/test/tests.proj @@ -11,7 +11,7 @@ - <_RunScenarioTests Condition="'$(__PortableTargetOS.ToLower())' != '$(TargetOS.ToLower())'">false + <_RunScenarioTests Condition="'$(OS)' != 'Windows_NT' and '$(__PortableTargetOS.ToLower())' != '$(TargetOS.ToLower())'">false From 069f2a63158fc584bb408e897d2fe93a1df99fac Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Tue, 23 Apr 2024 12:19:38 -0500 Subject: [PATCH 25/48] Set targetOS for Alpine SB legs --- eng/pipelines/templates/stages/vmr-build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eng/pipelines/templates/stages/vmr-build.yml b/eng/pipelines/templates/stages/vmr-build.yml index bc0ae0e92fdf..4d6e347c64da 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 # 🚫 From 1760ffad712db0065d34b281c5c5a61e9500c240 Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Tue, 23 Apr 2024 14:15:53 -0500 Subject: [PATCH 26/48] disable cleaning for scenario tests repo --- src/SourceBuild/content/repo-projects/scenario-tests.proj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/SourceBuild/content/repo-projects/scenario-tests.proj b/src/SourceBuild/content/repo-projects/scenario-tests.proj index 40e30d7d2493..de47e46bcae8 100644 --- a/src/SourceBuild/content/repo-projects/scenario-tests.proj +++ b/src/SourceBuild/content/repo-projects/scenario-tests.proj @@ -11,6 +11,10 @@ + + false + $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'scenario-tests')) $([MSBuild]::NormalizeDirectory('$(ArtifactsTestResultsDir)', 'scenario-tests')) <_ScenarioTestsNuGetConfig>$(ScenarioTestsArtifactsDir)NuGet.config From 1e5f25630e84652761d4a085ec38a735503a7977 Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Tue, 23 Apr 2024 14:27:48 -0500 Subject: [PATCH 27/48] Use BuildOS instead of OS property --- src/SourceBuild/content/test/tests.proj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SourceBuild/content/test/tests.proj b/src/SourceBuild/content/test/tests.proj index 24a62f22414e..7e1c2aa421b4 100644 --- a/src/SourceBuild/content/test/tests.proj +++ b/src/SourceBuild/content/test/tests.proj @@ -11,7 +11,7 @@ - <_RunScenarioTests Condition="'$(OS)' != 'Windows_NT' and '$(__PortableTargetOS.ToLower())' != '$(TargetOS.ToLower())'">false + <_RunScenarioTests Condition="'$(BuildOS)' != 'windows' and '$(__PortableTargetOS.ToLower())' != '$(TargetOS.ToLower())'">false From 41767978bffff8aa66f667d162ecae3748f4e905 Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Wed, 24 Apr 2024 09:20:54 -0500 Subject: [PATCH 28/48] Fix disabling of build clean for scenario-tests --- src/SourceBuild/content/repo-projects/Directory.Build.targets | 3 +++ src/SourceBuild/content/repo-projects/scenario-tests.proj | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/SourceBuild/content/repo-projects/Directory.Build.targets b/src/SourceBuild/content/repo-projects/Directory.Build.targets index 8e4e9e2cd488..7349e74fe869 100644 --- a/src/SourceBuild/content/repo-projects/Directory.Build.targets +++ b/src/SourceBuild/content/repo-projects/Directory.Build.targets @@ -513,8 +513,11 @@ Condition="'@(_InnerPackageCacheFiles)' != ''" /> + - false - $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'scenario-tests')) $([MSBuild]::NormalizeDirectory('$(ArtifactsTestResultsDir)', 'scenario-tests')) <_ScenarioTestsNuGetConfig>$(ScenarioTestsArtifactsDir)NuGet.config From def2454a3f57de4407993bb11872fe2b09905f38 Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Wed, 24 Apr 2024 09:21:36 -0500 Subject: [PATCH 29/48] Add back missing symbol task fix --- .../CreateSdkSymbolsLayout.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SourceBuild/content/eng/tools/tasks/Microsoft.DotNet.UnifiedBuild.Tasks/CreateSdkSymbolsLayout.cs b/src/SourceBuild/content/eng/tools/tasks/Microsoft.DotNet.UnifiedBuild.Tasks/CreateSdkSymbolsLayout.cs index 491deee86e77..7caabc76089b 100644 --- a/src/SourceBuild/content/eng/tools/tasks/Microsoft.DotNet.UnifiedBuild.Tasks/CreateSdkSymbolsLayout.cs +++ b/src/SourceBuild/content/eng/tools/tasks/Microsoft.DotNet.UnifiedBuild.Tasks/CreateSdkSymbolsLayout.cs @@ -89,8 +89,9 @@ private IList GenerateSymbolsLayout(Hashtable allPdbGuids) { // Copy matching pdb to symbols path, preserving sdk binary's hierarchy string sourcePath = (string)allPdbGuids[debugId]!; + string fileRelativePath = file.Substring(SdkLayoutPath.Length); string destinationPath = - file.Replace(SdkLayoutPath, SdkSymbolsLayoutPath) + Path.Combine(SdkSymbolsLayoutPath, fileRelativePath) .Replace(Path.GetFileName(file), Path.GetFileName(sourcePath)); Directory.CreateDirectory(Path.GetDirectoryName(destinationPath)!); From f7e0a034cd9fa11f24856fb0366b951a769abfd2 Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Wed, 24 Apr 2024 11:17:48 -0500 Subject: [PATCH 30/48] Fix repository name for clean --- src/SourceBuild/content/repo-projects/Directory.Build.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SourceBuild/content/repo-projects/Directory.Build.targets b/src/SourceBuild/content/repo-projects/Directory.Build.targets index 7349e74fe869..ed692bde9860 100644 --- a/src/SourceBuild/content/repo-projects/Directory.Build.targets +++ b/src/SourceBuild/content/repo-projects/Directory.Build.targets @@ -517,7 +517,7 @@ by the repos build (locally within the repo). A clean would otherwise delete those necessary files. --> From 71a9649cf8ab7f05a4a74a83b81fe647db7cf34f Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Wed, 24 Apr 2024 13:45:50 -0500 Subject: [PATCH 32/48] Fixes to call scenario tests --- .../content/repo-projects/scenario-tests.proj | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/SourceBuild/content/repo-projects/scenario-tests.proj b/src/SourceBuild/content/repo-projects/scenario-tests.proj index 40e30d7d2493..b1fa1745adc4 100644 --- a/src/SourceBuild/content/repo-projects/scenario-tests.proj +++ b/src/SourceBuild/content/repo-projects/scenario-tests.proj @@ -37,6 +37,11 @@ <_TestRoot>$(ScenarioTestsArtifactsDir)artifacts/ + + + <_DotNetTool Condition="'$(BuildOS)' == 'windows'">$(DotNetSdkExtractDir)dotnet.exe + <_DotNetTool Condition="'$(BuildOS)' != 'windows'">$(DotNetSdkExtractDir)dotnet @@ -45,9 +50,9 @@ <_ScenarioTestEnvVars Include=" TestRoot=$(_TestRoot); DotNetRoot=$(DotNetSdkExtractDir); - NETCoreSdkVersion=$(SourceBuiltSdkVersion); + TestSdkVersion=$(SourceBuiltSdkVersion); AdditionalTestArgs=$(_ScenarioTestsAdditionalArgs); - DOTNET_INSTALL_DIR=$(DotNetRoot)" /> + DotNetTool=$(_DotNetTool)" /> Date: Wed, 24 Apr 2024 13:52:08 -0500 Subject: [PATCH 33/48] Revert property name changes for UB tests --- .../Microsoft.DotNet.UnifiedBuild.Tests.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/SourceBuild/content/test/Microsoft.DotNet.UnifiedBuild.Tests/Microsoft.DotNet.UnifiedBuild.Tests.csproj b/src/SourceBuild/content/test/Microsoft.DotNet.UnifiedBuild.Tests/Microsoft.DotNet.UnifiedBuild.Tests.csproj index dc741a2339c3..86b3f1f15955 100644 --- a/src/SourceBuild/content/test/Microsoft.DotNet.UnifiedBuild.Tests/Microsoft.DotNet.UnifiedBuild.Tests.csproj +++ b/src/SourceBuild/content/test/Microsoft.DotNet.UnifiedBuild.Tests/Microsoft.DotNet.UnifiedBuild.Tests.csproj @@ -43,15 +43,15 @@ - + $(SdkTarballPath) $(SourceBuiltSdkVersion) - - $(UBTestsMsftSdkTarballPath) + + $(UBTestsMsftSdkArchivePath) From 0da9a75c36698d3e5ee86205062efbf9596a6bfa Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Wed, 24 Apr 2024 14:19:35 -0500 Subject: [PATCH 34/48] Fix property name typo --- src/SourceBuild/content/repo-projects/scenario-tests.proj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SourceBuild/content/repo-projects/scenario-tests.proj b/src/SourceBuild/content/repo-projects/scenario-tests.proj index b1fa1745adc4..77f359ec7f02 100644 --- a/src/SourceBuild/content/repo-projects/scenario-tests.proj +++ b/src/SourceBuild/content/repo-projects/scenario-tests.proj @@ -40,8 +40,8 @@ - <_DotNetTool Condition="'$(BuildOS)' == 'windows'">$(DotNetSdkExtractDir)dotnet.exe - <_DotNetTool Condition="'$(BuildOS)' != 'windows'">$(DotNetSdkExtractDir)dotnet + <_DotNetTool Condition="'$(BuildOS)' == 'windows'">$(DotNetSdkExtractDir)dotnet.exe + <_DotNetTool Condition="'$(BuildOS)' != 'windows'">$(DotNetSdkExtractDir)dotnet From 003fbc4c5b7e6a10b3ad320318343664c1288726 Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Wed, 24 Apr 2024 17:50:39 -0500 Subject: [PATCH 35/48] Set _InitializeDotNetCli to support custom SDK (source build) --- src/SourceBuild/content/repo-projects/scenario-tests.proj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SourceBuild/content/repo-projects/scenario-tests.proj b/src/SourceBuild/content/repo-projects/scenario-tests.proj index 77f359ec7f02..7e4e2b06d7b3 100644 --- a/src/SourceBuild/content/repo-projects/scenario-tests.proj +++ b/src/SourceBuild/content/repo-projects/scenario-tests.proj @@ -52,7 +52,8 @@ DotNetRoot=$(DotNetSdkExtractDir); TestSdkVersion=$(SourceBuiltSdkVersion); AdditionalTestArgs=$(_ScenarioTestsAdditionalArgs); - DotNetTool=$(_DotNetTool)" /> + DotNetTool=$(_DotNetTool); + _InitializeDotNetCli=$(DotNetSdkExtractDir)" /> Date: Thu, 25 Apr 2024 08:49:20 -0500 Subject: [PATCH 36/48] Override CleanWhileBuilding in scenario-tests.proj --- .../content/repo-projects/Directory.Build.targets | 3 --- src/SourceBuild/content/repo-projects/scenario-tests.proj | 5 ++++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SourceBuild/content/repo-projects/Directory.Build.targets b/src/SourceBuild/content/repo-projects/Directory.Build.targets index ed692bde9860..8e4e9e2cd488 100644 --- a/src/SourceBuild/content/repo-projects/Directory.Build.targets +++ b/src/SourceBuild/content/repo-projects/Directory.Build.targets @@ -513,11 +513,8 @@ Condition="'@(_InnerPackageCacheFiles)' != ''" /> - + false + $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'scenario-tests')) $([MSBuild]::NormalizeDirectory('$(ArtifactsTestResultsDir)', 'scenario-tests')) <_ScenarioTestsNuGetConfig>$(ScenarioTestsArtifactsDir)NuGet.config From d14add1f6aba3265d03e70ada527840c7b73a3bc Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Thu, 25 Apr 2024 09:38:06 -0500 Subject: [PATCH 37/48] Set fx-version --- .../content/repo-projects/scenario-tests.proj | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/SourceBuild/content/repo-projects/scenario-tests.proj b/src/SourceBuild/content/repo-projects/scenario-tests.proj index 8e22f9adab05..0bb978565dfb 100644 --- a/src/SourceBuild/content/repo-projects/scenario-tests.proj +++ b/src/SourceBuild/content/repo-projects/scenario-tests.proj @@ -31,11 +31,11 @@ - + <_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 + <_ScenarioTestsAdditionalTestArgs>--xml $(_TestXmlOutputPath) --target-rid $(TargetRid) --no-cleanup --no-traits Category=MultiTFM @@ -47,6 +47,22 @@ <_DotNetTool Condition="'$(BuildOS)' != 'windows'">$(DotNetSdkExtractDir)dotnet + + + + + + <_RuntimeVersion>$([System.Text.RegularExpressions.Regex]::Match($(_Runtimes), 'Microsoft\.NETCore\.App\s+(.*)\s+\[').Groups[1].Value) + + + <_ScenarioTestsAdditionalDotNetArgs>--fx-version $(_RuntimeVersion) + + @@ -54,7 +70,8 @@ TestRoot=$(_TestRoot); DotNetRoot=$(DotNetSdkExtractDir); TestSdkVersion=$(SourceBuiltSdkVersion); - AdditionalTestArgs=$(_ScenarioTestsAdditionalArgs); + AdditionalDotNetArgs=$(_ScenarioTestsAdditionalDotNetArgs); + AdditionalTestArgs=$(_ScenarioTestsAdditionalTestArgs); DotNetTool=$(_DotNetTool); _InitializeDotNetCli=$(DotNetSdkExtractDir)" /> From cb6d71abace7bb4a3ac3eb5890ae16181e69b5b7 Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Thu, 25 Apr 2024 15:47:04 -0500 Subject: [PATCH 38/48] Use local package feed to support DevVersions leg --- src/SourceBuild/content/Directory.Build.props | 1 + src/SourceBuild/content/eng/local-feed.proj | 27 +++++++++++++++++++ .../content/repo-projects/scenario-tests.proj | 4 +++ .../test/scenario-tests/scenario-tests.proj | 5 ++++ 4 files changed, 37 insertions(+) create mode 100644 src/SourceBuild/content/eng/local-feed.proj diff --git a/src/SourceBuild/content/Directory.Build.props b/src/SourceBuild/content/Directory.Build.props index 465fbad19cf3..c2de8bbee2da 100644 --- a/src/SourceBuild/content/Directory.Build.props +++ b/src/SourceBuild/content/Directory.Build.props @@ -161,6 +161,7 @@ $([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', 'AssetManifests')) $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'assets', '$(Configuration)')) $([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', 'extracted-dotnet-sdk')) + $([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', 'package-feed')) $([MSBuild]::NormalizeDirectory('$(PrereqsPackagesDir)', 'prebuilt')) $([MSBuild]::NormalizeDirectory('$(PrereqsPackagesDir)', 'previouslyRestored')) diff --git a/src/SourceBuild/content/eng/local-feed.proj b/src/SourceBuild/content/eng/local-feed.proj new file mode 100644 index 000000000000..2c61b2905ca1 --- /dev/null +++ b/src/SourceBuild/content/eng/local-feed.proj @@ -0,0 +1,27 @@ + + + + $(NetCurrent) + + + + + + + <_ArtifactsPackage Include="$(ArtifactsShippingPackagesDir)**" + Condition="!$([System.String]::Copy('%(Identity)').EndsWith('.symbols.nupkg'))" /> + + + + + + + + + + diff --git a/src/SourceBuild/content/repo-projects/scenario-tests.proj b/src/SourceBuild/content/repo-projects/scenario-tests.proj index 0bb978565dfb..ec66dba460fb 100644 --- a/src/SourceBuild/content/repo-projects/scenario-tests.proj +++ b/src/SourceBuild/content/repo-projects/scenario-tests.proj @@ -27,6 +27,10 @@ + true + + + + From d2d54f503bdd0dbb671fb2c039f2bdd4f6f7683f Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Thu, 25 Apr 2024 15:49:39 -0500 Subject: [PATCH 39/48] Revert "Use local package feed to support DevVersions leg" --- src/SourceBuild/content/Directory.Build.props | 1 - src/SourceBuild/content/eng/local-feed.proj | 27 ------------------- .../content/repo-projects/scenario-tests.proj | 4 --- .../test/scenario-tests/scenario-tests.proj | 5 ---- 4 files changed, 37 deletions(-) delete mode 100644 src/SourceBuild/content/eng/local-feed.proj diff --git a/src/SourceBuild/content/Directory.Build.props b/src/SourceBuild/content/Directory.Build.props index c2de8bbee2da..465fbad19cf3 100644 --- a/src/SourceBuild/content/Directory.Build.props +++ b/src/SourceBuild/content/Directory.Build.props @@ -161,7 +161,6 @@ $([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', 'AssetManifests')) $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'assets', '$(Configuration)')) $([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', 'extracted-dotnet-sdk')) - $([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', 'package-feed')) $([MSBuild]::NormalizeDirectory('$(PrereqsPackagesDir)', 'prebuilt')) $([MSBuild]::NormalizeDirectory('$(PrereqsPackagesDir)', 'previouslyRestored')) diff --git a/src/SourceBuild/content/eng/local-feed.proj b/src/SourceBuild/content/eng/local-feed.proj deleted file mode 100644 index 2c61b2905ca1..000000000000 --- a/src/SourceBuild/content/eng/local-feed.proj +++ /dev/null @@ -1,27 +0,0 @@ - - - - $(NetCurrent) - - - - - - - <_ArtifactsPackage Include="$(ArtifactsShippingPackagesDir)**" - Condition="!$([System.String]::Copy('%(Identity)').EndsWith('.symbols.nupkg'))" /> - - - - - - - - - - diff --git a/src/SourceBuild/content/repo-projects/scenario-tests.proj b/src/SourceBuild/content/repo-projects/scenario-tests.proj index ec66dba460fb..0bb978565dfb 100644 --- a/src/SourceBuild/content/repo-projects/scenario-tests.proj +++ b/src/SourceBuild/content/repo-projects/scenario-tests.proj @@ -27,10 +27,6 @@ - true - - - - From 3575d65fba43e276029321482a5b5dca38da131d Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Thu, 25 Apr 2024 15:50:28 -0500 Subject: [PATCH 40/48] Revert "Set fx-version" --- .../content/repo-projects/scenario-tests.proj | 23 +++---------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/src/SourceBuild/content/repo-projects/scenario-tests.proj b/src/SourceBuild/content/repo-projects/scenario-tests.proj index 0bb978565dfb..8e22f9adab05 100644 --- a/src/SourceBuild/content/repo-projects/scenario-tests.proj +++ b/src/SourceBuild/content/repo-projects/scenario-tests.proj @@ -31,11 +31,11 @@ - + <_CurrentDateTime>$([System.DateTime]::Now.ToString("yyyy-MM-dd_HH_mm_ss")) <_TestXmlOutputPath>$(ScenarioTestsResultsDir)$(_CurrentDateTime).xml - <_ScenarioTestsAdditionalTestArgs>--xml $(_TestXmlOutputPath) --target-rid $(TargetRid) --no-cleanup --no-traits Category=MultiTFM + <_ScenarioTestsAdditionalArgs>--xml $(_TestXmlOutputPath) --target-rid $(TargetRid) --no-cleanup --no-traits Category=MultiTFM @@ -47,22 +47,6 @@ <_DotNetTool Condition="'$(BuildOS)' != 'windows'">$(DotNetSdkExtractDir)dotnet - - - - - - <_RuntimeVersion>$([System.Text.RegularExpressions.Regex]::Match($(_Runtimes), 'Microsoft\.NETCore\.App\s+(.*)\s+\[').Groups[1].Value) - - - <_ScenarioTestsAdditionalDotNetArgs>--fx-version $(_RuntimeVersion) - - @@ -70,8 +54,7 @@ TestRoot=$(_TestRoot); DotNetRoot=$(DotNetSdkExtractDir); TestSdkVersion=$(SourceBuiltSdkVersion); - AdditionalDotNetArgs=$(_ScenarioTestsAdditionalDotNetArgs); - AdditionalTestArgs=$(_ScenarioTestsAdditionalTestArgs); + AdditionalTestArgs=$(_ScenarioTestsAdditionalArgs); DotNetTool=$(_DotNetTool); _InitializeDotNetCli=$(DotNetSdkExtractDir)" /> From a5b08c2aa36a19210c2cff40b6fa027c33fb11d6 Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Thu, 25 Apr 2024 18:20:27 -0500 Subject: [PATCH 41/48] Disable scenario tests for unofficial build versioning --- eng/pipelines/templates/jobs/vmr-build.yml | 14 +++++++++----- src/SourceBuild/content/test/tests.proj | 3 +++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/eng/pipelines/templates/jobs/vmr-build.yml b/eng/pipelines/templates/jobs/vmr-build.yml index 3a5c4fad172e..8033b6cea99c 100644 --- a/eng/pipelines/templates/jobs/vmr-build.yml +++ b/eng/pipelines/templates/jobs/vmr-build.yml @@ -363,7 +363,7 @@ jobs: set -ex dockerVolumeArgs="-v $(sourcesPath):/vmr" - sourceOnlyArgs='' + customBuildArgs='' extraBuildProperties='' if [[ ! -z '${{ parameters.targetOS }}' ]]; then @@ -374,11 +374,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 @@ -387,10 +391,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 diff --git a/src/SourceBuild/content/test/tests.proj b/src/SourceBuild/content/test/tests.proj index 7e1c2aa421b4..0a9c5c150957 100644 --- a/src/SourceBuild/content/test/tests.proj +++ b/src/SourceBuild/content/test/tests.proj @@ -12,6 +12,9 @@ since the tests require the ability to execute the built SDK. An example of where this would be disabled is cross-build of using Mariner to build for Alpine (linux vs linux-musl). --> <_RunScenarioTests Condition="'$(BuildOS)' != 'windows' and '$(__PortableTargetOS.ToLower())' != '$(TargetOS.ToLower())'">false + + + <_RunScenarioTests Condition="'$(UseOfficialBuildVersioning)' == 'false'">false From 9b2c70760f65119f2a7fb6cbaea1797922c50db9 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Fri, 26 Apr 2024 07:48:19 +0200 Subject: [PATCH 42/48] Delete src/SourceBuild/content/test/scenario-tests.proj --- .../content/test/scenario-tests.proj | 53 ------------------- 1 file changed, 53 deletions(-) delete mode 100644 src/SourceBuild/content/test/scenario-tests.proj diff --git a/src/SourceBuild/content/test/scenario-tests.proj b/src/SourceBuild/content/test/scenario-tests.proj deleted file mode 100644 index 9e0ac6910e70..000000000000 --- a/src/SourceBuild/content/test/scenario-tests.proj +++ /dev/null @@ -1,53 +0,0 @@ - - - - $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'scenario-tests')) - $([MSBuild]::NormalizeDirectory('$(ArtifactsTestResultsDir)', 'scenario-tests')) - <_ScenarioTestsNuGetConfig>$(ScenarioTestsArtifactsDir)NuGet.config - <_InstallerNuGetConfig>$(RepoRoot)src/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/ - - - - - - <_ScenarioTestProperties Include=" - Configuration=$(Configuration); - RunScenarioTests=true; - TestRoot=$(_TestRoot); - DotNetRoot=$(DotNetSdkExtractDir); - NETCoreSdkVersion=$(SourceBuiltSdkVersion); - AdditionalTestArgs=$(_ScenarioTestsAdditionalArgs); - DOTNET_INSTALL_DIR=$(DotNetRoot)" /> - - - - - From 83b9e46884fb8475af250f423a44c2abc1e244fe Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Fri, 26 Apr 2024 09:57:33 -0500 Subject: [PATCH 43/48] Apply suggestions from code review Co-authored-by: Viktor Hofer --- eng/pipelines/templates/jobs/vmr-build.yml | 1 - src/SourceBuild/content/eng/build.ps1 | 2 +- src/SourceBuild/content/eng/extract-sdk-archive.proj | 8 +++++--- .../content/repo-projects/Directory.Build.props | 2 +- src/SourceBuild/content/repo-projects/installer.proj | 2 -- src/SourceBuild/content/repo-projects/scenario-tests.proj | 5 ++--- .../content/test/scenario-tests/scenario-tests.proj | 1 + src/SourceBuild/content/test/tests.proj | 4 ++-- 8 files changed, 12 insertions(+), 13 deletions(-) diff --git a/eng/pipelines/templates/jobs/vmr-build.yml b/eng/pipelines/templates/jobs/vmr-build.yml index 8033b6cea99c..d5d761eda85f 100644 --- a/eng/pipelines/templates/jobs/vmr-build.yml +++ b/eng/pipelines/templates/jobs/vmr-build.yml @@ -478,7 +478,6 @@ jobs: # Only upload test results if enabled - ${{ if eq(parameters.runTests, 'True') }}: - - task: PublishTestResults@2 displayName: Publish Test Results condition: succeededOrFailed() diff --git a/src/SourceBuild/content/eng/build.ps1 b/src/SourceBuild/content/eng/build.ps1 index 765aea87af91..08f7cdeb6f2b 100644 --- a/src/SourceBuild/content/eng/build.ps1 +++ b/src/SourceBuild/content/eng/build.ps1 @@ -59,7 +59,7 @@ $targets = "/t:Build" # This repo uses the VSTest integration instead of the Arcade Test target if ($test) { $project = Join-Path (Join-Path $RepoRoot "test") "tests.proj" - $targets = "$targets;VSTest" + $targets += ";$VSTest" } if ($buildRepoTests) { diff --git a/src/SourceBuild/content/eng/extract-sdk-archive.proj b/src/SourceBuild/content/eng/extract-sdk-archive.proj index b6c7ac52b378..d170c43954ee 100644 --- a/src/SourceBuild/content/eng/extract-sdk-archive.proj +++ b/src/SourceBuild/content/eng/extract-sdk-archive.proj @@ -4,15 +4,17 @@ $(NetCurrent) - - + - diff --git a/src/SourceBuild/content/repo-projects/Directory.Build.props b/src/SourceBuild/content/repo-projects/Directory.Build.props index 28aafc3eaba6..5d77122ac020 100644 --- a/src/SourceBuild/content/repo-projects/Directory.Build.props +++ b/src/SourceBuild/content/repo-projects/Directory.Build.props @@ -98,7 +98,7 @@ $(FlagParameterPrefix)restore $(TestActions) $(FlagParameterPrefix)test - $(FlagParameterPrefix)ci + $(FlagParameterPrefix)ci $(TestArgs) $(FlagParameterPrefix)configuration $(Configuration) $(TestArgs) -bl:artifacts/log/$(Configuration)/Test.binlog diff --git a/src/SourceBuild/content/repo-projects/installer.proj b/src/SourceBuild/content/repo-projects/installer.proj index 1b9d2068c178..39098c28df1e 100644 --- a/src/SourceBuild/content/repo-projects/installer.proj +++ b/src/SourceBuild/content/repo-projects/installer.proj @@ -79,12 +79,10 @@ - - diff --git a/src/SourceBuild/content/repo-projects/scenario-tests.proj b/src/SourceBuild/content/repo-projects/scenario-tests.proj index 8e22f9adab05..383fb57baf28 100644 --- a/src/SourceBuild/content/repo-projects/scenario-tests.proj +++ b/src/SourceBuild/content/repo-projects/scenario-tests.proj @@ -17,7 +17,7 @@ $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'scenario-tests')) $([MSBuild]::NormalizeDirectory('$(ArtifactsTestResultsDir)', 'scenario-tests')) <_ScenarioTestsNuGetConfig>$(ScenarioTestsArtifactsDir)NuGet.config - <_InstallerNuGetConfig>$(RepoRoot)src/installer/NuGet.config + <_InstallerNuGetConfig>$([MSBuild]::NormalizePath('$(SrcDir)', 'installer', 'NuGet.config')) - <_DotNetTool Condition="'$(BuildOS)' == 'windows'">$(DotNetSdkExtractDir)dotnet.exe - <_DotNetTool Condition="'$(BuildOS)' != 'windows'">$(DotNetSdkExtractDir)dotnet + <_DotNetTool>$(DotNetSdkExtractDir)$([System.IO.Path]::GetFileName('$(DotNetTool)')) diff --git a/src/SourceBuild/content/test/scenario-tests/scenario-tests.proj b/src/SourceBuild/content/test/scenario-tests/scenario-tests.proj index 03a07dead422..410ac2f54c4c 100644 --- a/src/SourceBuild/content/test/scenario-tests/scenario-tests.proj +++ b/src/SourceBuild/content/test/scenario-tests/scenario-tests.proj @@ -1,4 +1,5 @@ + $(NetCurrent) true diff --git a/src/SourceBuild/content/test/tests.proj b/src/SourceBuild/content/test/tests.proj index 0a9c5c150957..cf3d38e47075 100644 --- a/src/SourceBuild/content/test/tests.proj +++ b/src/SourceBuild/content/test/tests.proj @@ -6,12 +6,12 @@ - <_RunScenarioTests Condition="'$(BuildArchitecture.ToLower())' != '$(TargetArchitecture.ToLower())'">false + <_RunScenarioTests Condition="'$(BuildArchitecture.ToLowerInvariant())' != '$(TargetArchitecture.ToLowerInvariant())'">false - <_RunScenarioTests Condition="'$(BuildOS)' != 'windows' and '$(__PortableTargetOS.ToLower())' != '$(TargetOS.ToLower())'">false + <_RunScenarioTests Condition="'$(BuildOS)' != 'windows' and '$(__PortableTargetOS.ToLowerInvariant())' != '$(TargetOS.ToLowerInvariant())'">false <_RunScenarioTests Condition="'$(UseOfficialBuildVersioning)' == 'false'">false From 497ba53c6645bd11456422e2cb1e2d424fcb2602 Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Fri, 26 Apr 2024 09:53:17 -0500 Subject: [PATCH 44/48] Fix binlog option to work for windows --- src/SourceBuild/content/repo-projects/Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SourceBuild/content/repo-projects/Directory.Build.props b/src/SourceBuild/content/repo-projects/Directory.Build.props index 5d77122ac020..e7f24d4ec8d3 100644 --- a/src/SourceBuild/content/repo-projects/Directory.Build.props +++ b/src/SourceBuild/content/repo-projects/Directory.Build.props @@ -100,7 +100,7 @@ $(FlagParameterPrefix)ci $(TestArgs) $(FlagParameterPrefix)configuration $(Configuration) - $(TestArgs) -bl:artifacts/log/$(Configuration)/Test.binlog + $(TestArgs) /bl:artifacts/log/$(Configuration)/Test.binlog $(BuildScript) $(TestActions) $(TestArgs) From 75a5684aa8bdb25db38440fb46055fe53d696820 Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Fri, 26 Apr 2024 12:10:33 -0500 Subject: [PATCH 45/48] Fix typo --- src/SourceBuild/content/eng/build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SourceBuild/content/eng/build.ps1 b/src/SourceBuild/content/eng/build.ps1 index 08f7cdeb6f2b..128315cab9b3 100644 --- a/src/SourceBuild/content/eng/build.ps1 +++ b/src/SourceBuild/content/eng/build.ps1 @@ -59,7 +59,7 @@ $targets = "/t:Build" # This repo uses the VSTest integration instead of the Arcade Test target if ($test) { $project = Join-Path (Join-Path $RepoRoot "test") "tests.proj" - $targets += ";$VSTest" + $targets += ";VSTest" } if ($buildRepoTests) { From ee9f229cebe38708b4321e11e215b5a1087fbfe4 Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Fri, 26 Apr 2024 16:42:55 -0500 Subject: [PATCH 46/48] Publish binlogs from scenario tests --- eng/pipelines/templates/jobs/vmr-build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/pipelines/templates/jobs/vmr-build.yml b/eng/pipelines/templates/jobs/vmr-build.yml index c3c8adf09a3e..b8eb73a9a7d5 100644 --- a/eng/pipelines/templates/jobs/vmr-build.yml +++ b/eng/pipelines/templates/jobs/vmr-build.yml @@ -455,6 +455,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} \; From 1d24ea40e7e1ebbd5f96891f7c976f7a91fc454d Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Mon, 29 Apr 2024 07:45:57 -0500 Subject: [PATCH 47/48] Publish binlogs from scenario tests for windows --- eng/pipelines/templates/jobs/vmr-build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eng/pipelines/templates/jobs/vmr-build.yml b/eng/pipelines/templates/jobs/vmr-build.yml index b8eb73a9a7d5..1c0ba7b4e010 100644 --- a/eng/pipelines/templates/jobs/vmr-build.yml +++ b/eng/pipelines/templates/jobs/vmr-build.yml @@ -428,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" From bf33d8c752c93e3649c7b26f533f2c2395f049b9 Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Tue, 30 Apr 2024 12:06:46 -0500 Subject: [PATCH 48/48] Patches to disable scenario tests --- .../0001-Disable-Aspire-scenario-test.patch | 23 +++++++++++++++++++ .../0002-Disable-WPF-scenario-test.patch | 23 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 src/SourceBuild/patches/scenario-tests/0001-Disable-Aspire-scenario-test.patch create mode 100644 src/SourceBuild/patches/scenario-tests/0002-Disable-WPF-scenario-test.patch 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 000000000000..f2a5f62d399e --- /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 000000000000..ba5dfa3aee6b --- /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")]