diff --git a/.github/skills/vstest-build-test/SKILL.md b/.github/skills/vstest-build-test/SKILL.md index a96ab8e922..836797ebd7 100644 --- a/.github/skills/vstest-build-test/SKILL.md +++ b/.github/skills/vstest-build-test/SKILL.md @@ -152,7 +152,7 @@ See [CONTRIBUTING.md](../../../CONTRIBUTING.md#running-a-specific-test) for more ### Running tests locally (DOTNET_ROOT gotcha) -Test executables are built against the repo's preview TFM (e.g. `net11.0`), and integration and +Test executables are built against the repo's preview TFM (e.g. `net12.0`), and integration and smoke tests additionally launch test-asset apphosts built the same way. An apphost resolves its shared runtime from `DOTNET_ROOT`, falling back to the machine-wide install (`C:\Program Files\dotnet`), which usually lacks the preview runtime — so it fails instantly with diff --git a/Directory.Build.props b/Directory.Build.props index 115635dc23..64853cb14a 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -138,8 +138,6 @@ $(TestRunnerExternalArguments) $(TestRunnerAdditionalArguments) --filter "TestCategory!=Windows&TestCategory!=Windows-Review" - - $(TestRunnerAdditionalArguments) --progress off false diff --git a/NuGet.config b/NuGet.config index 498b314d98..3db9940ca7 100644 --- a/NuGet.config +++ b/NuGet.config @@ -22,6 +22,7 @@ + diff --git a/eng/Version.Details.props b/eng/Version.Details.props index ef80f41831..c66984f5ac 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -6,7 +6,7 @@ This file should be imported by eng/Versions.props - 12.0.0-beta.26469.3 + 12.0.0-beta.26569.6 2.0.0 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c492cc1aba..dfd94b696d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -26,9 +26,9 @@ - + https://github.com/dotnet/arcade - 63c79a28ca6e086d59c5553e7ed69cacb1d52fbd + c27ac90fa251c0460888a432a4fb41f22643a64f https://github.com/dotnet/symreader-converter diff --git a/eng/common/Get-GitHubAppToken.ps1 b/eng/common/Get-GitHubAppToken.ps1 index ec005e487c..8b26d303b4 100644 --- a/eng/common/Get-GitHubAppToken.ps1 +++ b/eng/common/Get-GitHubAppToken.ps1 @@ -1,11 +1,12 @@ # Mints a short-lived GitHub App installation access token by signing a JWT -# with an RSA private key (RS256). The signed JWT is exchanged with the GitHub -# API for a token scoped to a single installation. +# via Azure Key Vault's RSA signing operation (RS256). The private key never +# leaves Key Vault. The JWT is exchanged for a single installation's token. # # Requirements: -# - A GitHub App ID and PEM private key stored as Azure Key Vault secrets. -# - The federated Azure service connection running this script must have -# `Get` access to those two secrets. +# - The GitHub App's private key imported as a Key Vault RSA key. +# - Read access to the configured App-ID secret projection. +# - The federated Azure service connection must have the `Sign` action on +# that key. Reading private-key secrets is neither required nor supported. # - The App must be installed on the target organization/account # (`InstallationOwner`) with the permissions/repositories it needs. # @@ -14,17 +15,19 @@ [CmdletBinding()] param( - # Name of the Key Vault holding the GitHub App credentials. + # Key Vault holding the App-ID projection and RSA signing key. [Parameter(Mandatory = $true)] [string] $KeyVaultName, - # Secret Manager projection containing the GitHub App ID. + # Name of the RSA signing key, not a Key Vault secret. [Parameter(Mandatory = $true)] - [string] $AppIdSecretName, + [ValidateNotNullOrEmpty()] + [string] $KeyName, - # Secret Manager projection containing the PEM private key. + # Secret Manager projection containing the GitHub App's public ID. [Parameter(Mandatory = $true)] - [string] $AppPrivateKeySecretName, + [ValidateNotNullOrEmpty()] + [string] $AppIdSecretName, # Login of the organization or user account whose installation we should # mint the token for (e.g. `dotnet`, `microsoft`). @@ -51,55 +54,33 @@ function ConvertTo-Base64Url([byte[]] $bytes) { return [Convert]::ToBase64String($bytes).TrimEnd('=').Replace('+', '-').Replace('/', '_') } +Write-Host "Reading GitHub App ID from secret '$AppIdSecretName' in vault '$KeyVaultName'..." $previousNativeCommandErrorPreference = $PSNativeCommandUseErrorActionPreference try { - # Azure CLI can emit non-fatal Python warnings to stderr. $PSNativeCommandUseErrorActionPreference = $false - $keyVaultAccessToken = az account get-access-token ` + # az keyvault secret show fails for this projection with Errno 22; az rest keeps authentication in Azure CLI. + $escapedSecretName = [Uri]::EscapeDataString($AppIdSecretName) + $appId = az rest ` + --method get ` + --url "https://$KeyVaultName.vault.azure.net/secrets/${escapedSecretName}?api-version=7.4" ` --resource https://vault.azure.net ` - --query accessToken ` + --query value ` --output tsv ` --only-show-errors - $tokenExitCode = $LASTEXITCODE + $secretExitCode = $LASTEXITCODE } catch { - Write-PipelineTelemetryError -Category 'Build' -Message "Failed to acquire an Azure Key Vault access token: $_" + Write-PipelineTelemetryError -Category 'Build' -Message "Failed to read App ID secret '$AppIdSecretName' from vault '$KeyVaultName' with Azure CLI: $_" exit 1 } finally { $PSNativeCommandUseErrorActionPreference = $previousNativeCommandErrorPreference } -if ($tokenExitCode -ne 0 -or [string]::IsNullOrWhiteSpace($keyVaultAccessToken)) { - Write-PipelineTelemetryError -Category 'Build' -Message "'az account get-access-token' exited with code $tokenExitCode while acquiring an Azure Key Vault access token." +if ($secretExitCode -ne 0 -or [string]::IsNullOrWhiteSpace($appId)) { + Write-PipelineTelemetryError -Category 'Build' -Message "'az rest' failed with exit code $secretExitCode while reading App ID secret '$AppIdSecretName' from vault '$KeyVaultName'. Verify the service connection can read this App-ID projection." exit 1 } -function Get-KeyVaultSecret([string] $SecretName) { - # Use the data-plane REST API because `az keyvault secret show` can fail - # with Errno 22 on hosted Windows agents when reading these projections. - $escapedSecretName = [Uri]::EscapeDataString($SecretName) - $secretUri = "https://$KeyVaultName.vault.azure.net/secrets/$escapedSecretName`?api-version=7.4" - try { - $response = Invoke-RestMethod ` - -Uri $secretUri ` - -Headers @{ Authorization = "Bearer $keyVaultAccessToken" } ` - -Method Get - } - catch { - Write-PipelineTelemetryError -Category 'Build' -Message "Failed to read secret '$SecretName' from vault '$KeyVaultName': $_. Verify the secret exists and the service connection has 'Key Vault Secrets User' access to it." - exit 1 - } - if ([string]::IsNullOrWhiteSpace($response.value)) { - Write-PipelineTelemetryError -Category 'Build' -Message "Secret '$SecretName' in vault '$KeyVaultName' is empty." - exit 1 - } - return [string] $response.value -} - -Write-Host "Reading GitHub App credentials from vault '$KeyVaultName'..." -$appId = Get-KeyVaultSecret $AppIdSecretName -$privateKey = Get-KeyVaultSecret $AppPrivateKeySecretName - # Build JWT header and payload. Use [ordered] hashtables so JSON # serialization is deterministic. $jwtHeader = [ordered]@{ @@ -125,23 +106,34 @@ finally { $sha256.Dispose() } -Write-Host 'Signing JWT with the GitHub App private key...' -$rsa = [System.Security.Cryptography.RSA]::Create() +$digestBase64 = [Convert]::ToBase64String($digestBytes) +Write-Host "Signing JWT with key '$KeyName' in vault '$KeyVaultName'..." +$previousNativeCommandErrorPreference = $PSNativeCommandUseErrorActionPreference try { - $rsa.ImportFromPem($privateKey) - $signatureBytes = $rsa.SignHash( - $digestBytes, - [System.Security.Cryptography.HashAlgorithmName]::SHA256, - [System.Security.Cryptography.RSASignaturePadding]::Pkcs1) - $signatureUrl = ConvertTo-Base64Url $signatureBytes + # Azure CLI can emit non-fatal Python warnings to stderr. + $PSNativeCommandUseErrorActionPreference = $false + $signatureBase64 = az keyvault key sign ` + --vault-name $KeyVaultName ` + --name $KeyName ` + --algorithm RS256 ` + --digest $digestBase64 ` + --query signature ` + --output tsv ` + --only-show-errors + $signExitCode = $LASTEXITCODE } catch { - Write-PipelineTelemetryError -Category 'Build' -Message "Failed to sign the GitHub App JWT with the supplied private key: $_" + Write-PipelineTelemetryError -Category 'Build' -Message "Failed to sign the JWT via Key Vault (key '$KeyName', vault '$KeyVaultName'): $_. Verify the service connection has the Sign action on the key." exit 1 } finally { - $rsa.Dispose() + $PSNativeCommandUseErrorActionPreference = $previousNativeCommandErrorPreference +} +if ($signExitCode -ne 0 -or [string]::IsNullOrWhiteSpace($signatureBase64)) { + Write-PipelineTelemetryError -Category 'Build' -Message "'az keyvault key sign' exited with code $signExitCode for key '$KeyName' in vault '$KeyVaultName'. Verify the service connection has the Sign action on the key." + exit 1 } +$signatureUrl = $signatureBase64.Trim().TrimEnd('=').Replace('+', '-').Replace('/', '_') $jwt = "$signingInput.$signatureUrl" $headers = @{ @@ -198,6 +190,11 @@ catch { exit 1 } +if ([string]::IsNullOrWhiteSpace($tokenResponse.token)) { + Write-PipelineTelemetryError -Category 'Build' -Message "GitHub returned an empty installation token for '$InstallationOwner'." + exit 1 +} + Write-Host "Got installation token for '$InstallationOwner' (expires $($tokenResponse.expires_at))." if ($OutputVariableName) { Write-Host "Setting pipeline variable '$OutputVariableName'." diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index 305132a6d6..64c5ed1026 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -181,10 +181,6 @@ try { if (-not $PSBoundParameters.ContainsKey('nodeReuse')) { $nodeReuse = $false } - # MSBuild's multi-threaded mode isn't run on CI unless it was explicitly requested via -msbuildMultiThreaded. - if (-not $PSBoundParameters.ContainsKey('msbuildMultiThreaded')) { - $msbuildMultiThreaded = $false - } } if (-not [string]::IsNullOrEmpty($binaryLogName)) { diff --git a/eng/common/core-templates/job/helix-job-monitor.yml b/eng/common/core-templates/job/helix-job-monitor.yml index 7417afdf3e..ef8ee08fbd 100644 --- a/eng/common/core-templates/job/helix-job-monitor.yml +++ b/eng/common/core-templates/job/helix-job-monitor.yml @@ -63,7 +63,7 @@ parameters: type: boolean default: false -# Azure service connection ID authorized for Helix. Required when +# Workload identity federation service connection name authorized for Helix. Required when # useEntraAuthentication is true. - name: azureSubscription type: string @@ -94,13 +94,12 @@ parameters: type: boolean default: false -# When true, test results are reported to Azure DevOps using the fully qualified test name -# (Namespace.Type.Method) as the stable automatedTestName and the visible title is qualified as -# well (--use-fully-qualified-test-name). Opt-in because it changes AzDO test identity and display; -# primarily useful for frameworks like MSTest whose display name is only the method name. +# When true (the default), test results are reported to Azure DevOps using the fully qualified test +# name (Namespace.Type.Method) as the stable automatedTestName and the visible title is qualified as +# well (--use-fully-qualified-test-name). Set to false to preserve framework-provided display names. - name: useFullyQualifiedTestName type: boolean - default: false + default: true # Controls per-test output attachments. Defaults to Failed. - name: testResultAttachmentMode @@ -136,6 +135,20 @@ jobs: displayName: Monitor Helix Jobs timeoutInMinutes: ${{ parameters.timeoutInMinutes }} continueOnError: ${{ parameters.continueOnError }} + variables: + HELIX_MONITOR_BASE_URI: ${{ parameters.helixBaseUri }} + HELIX_MONITOR_USE_ENTRA_AUTHENTICATION: ${{ parameters.useEntraAuthentication }} + HELIX_MONITOR_POLLING_INTERVAL_SECONDS: ${{ parameters.pollingIntervalSeconds }} + HELIX_MONITOR_FAIL_ON_FAILED_TESTS: ${{ parameters.failWorkItemsWithFailedTests }} + HELIX_MONITOR_ALLOW_NO_HELIX_JOBS: ${{ parameters.allowNoHelixJobs }} + HELIX_MONITOR_USE_FULLY_QUALIFIED_TEST_NAME: ${{ parameters.useFullyQualifiedTestName }} + HELIX_MONITOR_TIMEOUT_IN_MINUTES: ${{ parameters.timeoutInMinutes }} + HELIX_MONITOR_TEST_RESULT_UPLOAD_PARALLELISM: ${{ parameters.testResultUploadParallelism }} + HELIX_MONITOR_ORGANIZATION: ${{ parameters.organization }} + HELIX_MONITOR_REPOSITORY: ${{ parameters.repository }} + HELIX_MONITOR_TEST_RESULT_ATTACHMENT_MODE: ${{ parameters.testResultAttachmentMode }} + HELIX_MONITOR_TOOL_NUPKG_ARTIFACT_NAME: ${{ parameters.toolNupkgArtifactName }} + HELIX_MONITOR_TOOL_COMMAND: ${{ parameters.toolCommand }} ${{ if ne(length(parameters.dependsOn), 0) }}: dependsOn: ${{ parameters.dependsOn }} ${{ if ne(parameters.condition, '') }}: @@ -157,22 +170,6 @@ jobs: - pwsh: throw "azureSubscription must be set when useEntraAuthentication is true." displayName: Validate Helix Entra authentication - - ${{ if eq(parameters.useEntraAuthentication, true) }}: - - task: AzureCLI@2 - displayName: Initialize Helix Entra authentication - inputs: - azureSubscription: ${{ parameters.azureSubscription }} - addSpnToEnvironment: true - scriptType: pscore - scriptLocation: inlineScript - inlineScript: | - if ([string]::IsNullOrWhiteSpace($env:servicePrincipalId) -or [string]::IsNullOrWhiteSpace($env:tenantId)) { - throw "The Helix Azure service connection did not provide a service principal or tenant ID." - } - - Write-Host "##vso[task.setvariable variable=HelixEntraClientId]$env:servicePrincipalId" - Write-Host "##vso[task.setvariable variable=HelixEntraTenantId]$env:tenantId" - - ${{ if ne(parameters.toolNupkgArtifactName, '') }}: - task: DownloadPipelineArtifact@2 displayName: Download Helix Job Monitor artifact @@ -241,76 +238,26 @@ jobs: - bash: ./eng/common/dotnet.sh tool restore displayName: Restore Helix Job Monitor - - bash: | - set -euo pipefail - - toolArgs=( - --helix-base-uri '${{ parameters.helixBaseUri }}' - --use-entra-authentication '${{ parameters.useEntraAuthentication }}' - --polling-interval-seconds '${{ parameters.pollingIntervalSeconds }}' - --fail-on-failed-tests '${{ parameters.failWorkItemsWithFailedTests }}' - --allow-no-helix-jobs '${{ parameters.allowNoHelixJobs }}' - --use-fully-qualified-test-name '${{ parameters.useFullyQualifiedTestName }}' - --max-wait-minutes "$((${{ parameters.timeoutInMinutes }} - 5))" # Set the tool's timeout slightly lower than the Azure DevOps job timeout to allow it to exit gracefully. - --stage-name '$(System.StageName)' - --stage-attempt '$(System.StageAttempt)' - --job-attempt '$(System.JobAttempt)' - --test-result-upload-parallelism '${{ parameters.testResultUploadParallelism }}' - ) - - organization='${{ parameters.organization }}' - repository='${{ parameters.repository }}' - testResultAttachmentMode='${{ parameters.testResultAttachmentMode }}' - - # Fall back to Azure DevOps-provided environment variables when the caller did not - # supply organization / repository explicitly. BUILD_REPOSITORY_NAME is typically - # 'owner/repo' for GitHub-backed builds and 'owner-repo' for internal builds. - if [ -z "$organization" ] || [ -z "$repository" ]; then - buildRepoName="${BUILD_REPOSITORY_NAME:-}" - if [ -n "$buildRepoName" ] && [[ "$buildRepoName" == */* ]]; then - repoOwner="${buildRepoName%%/*}" - repoName="${buildRepoName#*/}" - elif [ -n "$buildRepoName" ] && [[ "$buildRepoName" == *-* ]]; then - repoOwner="${buildRepoName%%-*}" - repoName="${buildRepoName#*-}" - fi - - if [ -n "${repoOwner:-}" ] && [ -n "${repoName:-}" ]; then - if [ -z "$organization" ]; then organization="$repoOwner"; fi - if [ -z "$repository" ]; then repository="$repoName"; fi - fi - fi - - if [ -n "$organization" ]; then toolArgs+=( --organization "$organization" ); fi - if [ -n "$repository" ]; then toolArgs+=( --repository "$repository" ); fi - if [ -n "$testResultAttachmentMode" ]; then - toolArgs+=( --test-result-attachment-mode "$testResultAttachmentMode" ) - fi - - # Build.Reason and Build.SourceBranch are required to derive the Helix source filter - # the same way the Helix SDK submitter does (PR -> 'pr', internal -> 'official', - # otherwise -> 'ci'). Without these, manually-queued / scheduled / CI builds would - # be looked up under the wrong source prefix and find zero jobs. - toolArgs+=( --build-reason "$(Build.Reason)" ) - toolArgs+=( --source-branch "$(Build.SourceBranch)" ) - - if [ -n '${{ parameters.toolNupkgArtifactName }}' ]; then - # Tool was installed from a local nupkg; run the DLL via the repo-local dotnet. - export DOTNET_ROOT="$(Build.SourcesDirectory)/.dotnet" - ./eng/common/dotnet.sh exec "$(HelixJobMonitorDll)" "${toolArgs[@]}" - else - # Tool was restored from the local .config/dotnet-tools.json manifest; invoke it - # through the manifest from the repo root. - pushd "$BUILD_SOURCESDIRECTORY" > /dev/null - trap 'popd > /dev/null' EXIT - ./eng/common/dotnet.sh tool run '${{ parameters.toolCommand }}' -- "${toolArgs[@]}" - fi - displayName: Monitor Helix Jobs - env: - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - ${{ if eq(parameters.useEntraAuthentication, false) }}: + - ${{ if eq(parameters.useEntraAuthentication, true) }}: + - task: AzureCLI@2 + displayName: Monitor Helix Jobs + inputs: + azureSubscription: ${{ parameters.azureSubscription }} + keepAzSessionActive: true + scriptType: bash + scriptLocation: inlineScript + inlineScript: | + set -euo pipefail + + # AzureCLI@2 replaces SYSTEM_ACCESSTOKEN with the service connection token. + export SYSTEM_ACCESSTOKEN="$HELIX_AZDO_ACCESSTOKEN" + bash "$BUILD_SOURCESDIRECTORY/eng/common/run-helix-job-monitor.sh" + env: + HELIX_AZDO_ACCESSTOKEN: $(System.AccessToken) + + - ${{ if eq(parameters.useEntraAuthentication, false) }}: + - bash: bash "$BUILD_SOURCESDIRECTORY/eng/common/run-helix-job-monitor.sh" + displayName: Monitor Helix Jobs + env: + SYSTEM_ACCESSTOKEN: $(System.AccessToken) HELIX_ACCESSTOKEN: ${{ parameters.helixAccessToken }} - ${{ if eq(parameters.useEntraAuthentication, true) }}: - AZURESUBSCRIPTION_CLIENT_ID: $(HelixEntraClientId) - AZURESUBSCRIPTION_TENANT_ID: $(HelixEntraTenantId) - AZURESUBSCRIPTION_SERVICE_CONNECTION_ID: ${{ parameters.azureSubscription }} diff --git a/eng/common/core-templates/job/onelocbuild.yml b/eng/common/core-templates/job/onelocbuild.yml index b772dc5788..555a656289 100644 --- a/eng/common/core-templates/job/onelocbuild.yml +++ b/eng/common/core-templates/job/onelocbuild.yml @@ -12,7 +12,7 @@ parameters: GitHubAppServiceConnection: 'dnceng-oneloc-githubapp' GitHubAppKeyVaultName: 'EngKeyVault' GitHubAppIdSecretName: 'oneloc-localization-app-app-id' - GitHubAppPrivateKeySecretName: 'oneloc-localization-app-app-private-key' + GitHubAppKeyName: 'oneloc-localization-app-key' SourcesDirectory: $(System.DefaultWorkingDirectory) CreatePr: true @@ -101,12 +101,12 @@ jobs: azureSubscription: ${{ parameters.GitHubAppServiceConnection }} keyVaultName: ${{ parameters.GitHubAppKeyVaultName }} appIdSecretName: ${{ parameters.GitHubAppIdSecretName }} - appPrivateKeySecretName: ${{ parameters.GitHubAppPrivateKeySecretName }} + keyName: ${{ parameters.GitHubAppKeyName }} installationOwner: ${{ parameters.GitHubOrg }} outputVariableName: 'GitHubAppInstallationToken' condition: ${{ parameters.condition }} - - task: OneLocBuild@2 + - task: OneLocBuild@3 displayName: OneLocBuild env: SYSTEM_ACCESSTOKEN: $(System.AccessToken) diff --git a/eng/common/core-templates/job/publish-build-assets.yml b/eng/common/core-templates/job/publish-build-assets.yml index 330225ae09..31f76d242c 100644 --- a/eng/common/core-templates/job/publish-build-assets.yml +++ b/eng/common/core-templates/job/publish-build-assets.yml @@ -187,10 +187,10 @@ jobs: PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} is1ESPipeline: ${{ parameters.is1ESPipeline }} - # Darc is targeting 8.0, so make sure it's installed + # Darc is targeting 10.0, so make sure it's installed - task: UseDotNet@2 inputs: - version: 8.0.x + version: 10.0.x - task: AzureCLI@2 displayName: Publish Using Darc @@ -201,7 +201,7 @@ jobs: scriptPath: $(System.DefaultWorkingDirectory)/eng/common/post-build/publish-using-darc.ps1 arguments: > -BuildId $(BARBuildId) - -PublishingInfraVersion 3 + -PublishingInfraVersion ${{ parameters.publishingVersion }} -AzdoToken '$(System.AccessToken)' -WaitPublishingFinish true -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' diff --git a/eng/common/core-templates/post-build/post-build.yml b/eng/common/core-templates/post-build/post-build.yml index 6dcee6664d..b1b0d17ea2 100644 --- a/eng/common/core-templates/post-build/post-build.yml +++ b/eng/common/core-templates/post-build/post-build.yml @@ -301,7 +301,7 @@ stages: - task: UseDotNet@2 inputs: - version: 8.0.x + version: 10.0.x - task: AzureCLI@2 displayName: Publish Using Darc @@ -312,7 +312,7 @@ stages: scriptPath: $(System.DefaultWorkingDirectory)/eng/common/post-build/publish-using-darc.ps1 arguments: > -BuildId $(BARBuildId) - -PublishingInfraVersion 3 + -PublishingInfraVersion ${{ parameters.publishingInfraVersion }} -AzdoToken '$(System.AccessToken)' -WaitPublishingFinish true -RequireDefaultChannels ${{ parameters.requireDefaultChannels }} diff --git a/eng/common/core-templates/stages/renovate.yml b/eng/common/core-templates/stages/renovate.yml index cfa9683794..e046d1be03 100644 --- a/eng/common/core-templates/stages/renovate.yml +++ b/eng/common/core-templates/stages/renovate.yml @@ -60,7 +60,7 @@ parameters: # Renovate version used in the container image tag. - name: renovateVersion - default: 43 + default: 44 type: number # Pool configuration for SDL analysis. diff --git a/eng/common/core-templates/steps/astred-artifacts.yml b/eng/common/core-templates/steps/astred-artifacts.yml index b914082f58..86420925b4 100644 --- a/eng/common/core-templates/steps/astred-artifacts.yml +++ b/eng/common/core-templates/steps/astred-artifacts.yml @@ -21,7 +21,7 @@ steps: FeedUrl: 'https://pkgs.dev.azure.com/dnceng/_packaging/dotnet-internal-FoSSE/nuget/v3/index.json' - pwsh: | - $ErrorActionPreference = 'Continue' + $ErrorActionPreference = 'Stop' $apjOut = Join-Path $env:ASTRED_CAPTURE_PATH 'apj' New-Item -ItemType Directory -Force -Path $apjOut | Out-Null @@ -34,17 +34,19 @@ steps: $project = Join-Path $apjOut '.astred.project.json' $binlogPaths = @($binlogs.FullName) + $responseFile = Join-Path $apjOut 'binlogs.rsp' + $binlogPaths | ForEach-Object { '"{0}"' -f $_ } | + Set-Content -LiteralPath $responseFile -Encoding utf8 Write-Host "astproj: processing $($binlogPaths.Count) binlog(s)" - astred astproj -nofolders @binlogPaths "-o:$project" + astred astproj -nofolders "@$responseFile" "-o:$project" if ($LASTEXITCODE -ne 0) { - Write-Host "##vso[task.logissue type=warning]astproj failed (exit $LASTEXITCODE)" + throw "astproj failed (exit $LASTEXITCODE)" } displayName: Generate Astred Project Files workingDirectory: ${{ parameters.sourcesPath }} env: ASTRED_BINLOG_DIR: ${{ parameters.binlogDir }} ASTRED_CAPTURE_PATH: ${{ parameters.capturePath }} - condition: succeededOrFailed() continueOnError: true - pwsh: | @@ -91,12 +93,12 @@ steps: env: ASTRED_SOURCES_PATH: ${{ parameters.sourcesPath }} ASTRED_CAPTURE_PATH: ${{ parameters.capturePath }} - condition: succeededOrFailed() continueOnError: true - task: UploadAstred@0 displayName: Upload Digest to Astred - condition: and(succeededOrFailed(), eq(variables['ASTRED_DIGEST_READY'], 'true')) + condition: and(succeeded(), eq(variables['ASTRED_DIGEST_READY'], 'true')) + continueOnError: true inputs: SourcePath: ${{ parameters.capturePath }}/upload env: diff --git a/eng/common/core-templates/steps/get-github-app-token.yml b/eng/common/core-templates/steps/get-github-app-token.yml index 3eeb5a4c1b..66c6440e8a 100644 --- a/eng/common/core-templates/steps/get-github-app-token.yml +++ b/eng/common/core-templates/steps/get-github-app-token.yml @@ -1,11 +1,12 @@ # Mints a short-lived GitHub App installation access token by signing a JWT -# with an RSA private key (RS256). The JWT is exchanged with the GitHub API -# for a token scoped to a single installation. +# via Azure Key Vault's RSA signing operation (RS256), without reading the +# private key. The JWT is exchanged for a single installation's token. # # Requirements (per GitHub App you want to authenticate as): -# - A GitHub App ID and PEM private key stored as Azure Key Vault secrets. +# - The GitHub App's private key imported as a Key Vault RSA key. +# - Read access to the configured App-ID secret projection. # - The Azure service connection passed via `azureSubscription` must have -# `Get` access to those two secrets. +# the `Sign` action on that key. # - The App must be installed on the target organization/account # (`installationOwner`) with the permissions/repositories you need. # @@ -15,18 +16,18 @@ # enterprise classic-PAT lifetime policy. parameters: -# Azure DevOps service connection (federated) that can read the App credentials. +# Federated service connection authorized to sign with the App's RSA key. - name: azureSubscription type: string -# Name of the Key Vault holding Secret Manager's github-app-secret projections. +# Name of the Key Vault holding the App's RSA key. - name: keyVaultName type: string -- name: appIdSecretName +- name: keyName type: string -- name: appPrivateKeySecretName +- name: appIdSecretName type: string # Login of the organization or user account whose installation we should @@ -66,7 +67,7 @@ steps: inlineScript: | & "$(System.DefaultWorkingDirectory)/eng/common/Get-GitHubAppToken.ps1" ` -KeyVaultName '${{ parameters.keyVaultName }}' ` + -KeyName '${{ parameters.keyName }}' ` -AppIdSecretName '${{ parameters.appIdSecretName }}' ` - -AppPrivateKeySecretName '${{ parameters.appPrivateKeySecretName }}' ` -InstallationOwner '${{ parameters.installationOwner }}' ` -OutputVariableName '${{ parameters.outputVariableName }}' diff --git a/eng/common/core-templates/steps/send-to-helix.yml b/eng/common/core-templates/steps/send-to-helix.yml index 62cce4d4ea..dba2f1b0af 100644 --- a/eng/common/core-templates/steps/send-to-helix.yml +++ b/eng/common/core-templates/steps/send-to-helix.yml @@ -6,7 +6,7 @@ parameters: HelixTargetQueues: '' # required -- semicolon-delimited list of Helix queues to test on; see https://helix.dot.net/ for a list of queues HelixAccessToken: '' # optional -- legacy access token; not forwarded when HelixUseEntraAuthentication is true HelixUseEntraAuthentication: false # optional -- use refreshable Entra authentication instead of a PAT or anonymous access - HelixAzureSubscription: '' # required when HelixUseEntraAuthentication is true -- Azure service connection ID authorized for Helix + HelixAzureSubscription: '' # required when HelixUseEntraAuthentication is true -- workload identity federation service connection name authorized for Helix HelixProjectPath: 'eng/common/helixpublish.proj' # optional -- path to the project file to build relative to BUILD_SOURCESDIRECTORY HelixProjectArguments: '' # optional -- arguments passed to the build command HelixConfiguration: '' # optional -- additional property attached to a job @@ -41,106 +41,176 @@ steps: - ${{ if eq(parameters.HelixUseEntraAuthentication, true) }}: - task: AzureCLI@2 - displayName: Initialize Helix Entra authentication + displayName: ${{ parameters.DisplayNamePrefix }} (Windows) inputs: azureSubscription: ${{ parameters.HelixAzureSubscription }} - addSpnToEnvironment: true + keepAzSessionActive: true scriptType: pscore scriptLocation: inlineScript inlineScript: | - if ([string]::IsNullOrWhiteSpace($env:servicePrincipalId) -or [string]::IsNullOrWhiteSpace($env:tenantId)) { - throw "The Helix Azure service connection did not provide a service principal or tenant ID." - } + # AzureCLI@2 replaces SYSTEM_ACCESSTOKEN with the service connection token. + $env:SYSTEM_ACCESSTOKEN = $env:HELIX_AZDO_ACCESSTOKEN - Write-Host "##vso[task.setvariable variable=HelixEntraClientId]$env:servicePrincipalId" - Write-Host "##vso[task.setvariable variable=HelixEntraTenantId]$env:tenantId" - condition: ${{ parameters.condition }} + $(Build.SourcesDirectory)\eng\common\msbuild.ps1 ` + $(Build.SourcesDirectory)/${{ parameters.HelixProjectPath }} ` + /restore ` + /p:TreatWarningsAsErrors=false ` + /p:EnableHelixJobMonitor=${{ parameters.UseHelixMonitor }} ` + /p:HelixUseEntraAuthentication=${{ parameters.HelixUseEntraAuthentication }} ` + ${{ parameters.HelixProjectArguments }} ` + /t:Test ` + /bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/SendToHelix.binlog + env: + BuildConfig: $(_BuildConfig) + HelixSource: ${{ parameters.HelixSource }} + HelixType: ${{ parameters.HelixType }} + HelixBuild: ${{ parameters.HelixBuild }} + HelixConfiguration: ${{ parameters.HelixConfiguration }} + HelixTargetQueues: ${{ parameters.HelixTargetQueues }} + HelixPreCommands: ${{ parameters.HelixPreCommands }} + HelixPostCommands: ${{ parameters.HelixPostCommands }} + WorkItemDirectory: ${{ parameters.WorkItemDirectory }} + WorkItemCommand: ${{ parameters.WorkItemCommand }} + WorkItemTimeout: ${{ parameters.WorkItemTimeout }} + CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} + XUnitProjects: ${{ parameters.XUnitProjects }} + XUnitWorkItemTimeout: ${{ parameters.XUnitWorkItemTimeout }} + XUnitPublishTargetFramework: ${{ parameters.XUnitPublishTargetFramework }} + XUnitRuntimeTargetFramework: ${{ parameters.XUnitRuntimeTargetFramework }} + XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} + IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} + DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} + DotNetCliVersion: ${{ parameters.DotNetCliVersion }} + WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} + HelixBaseUri: ${{ parameters.HelixBaseUri }} + Creator: ${{ parameters.Creator }} + HELIX_AZDO_ACCESSTOKEN: $(System.AccessToken) + condition: and(${{ parameters.condition }}, eq(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} + - task: AzureCLI@2 + displayName: ${{ parameters.DisplayNamePrefix }} (Unix) + inputs: + azureSubscription: ${{ parameters.HelixAzureSubscription }} + keepAzSessionActive: true + scriptType: bash + scriptLocation: inlineScript + inlineScript: | + # AzureCLI@2 replaces SYSTEM_ACCESSTOKEN with the service connection token. + export SYSTEM_ACCESSTOKEN="$HELIX_AZDO_ACCESSTOKEN" + + $(Build.SourcesDirectory)/eng/common/msbuild.sh \ + $(Build.SourcesDirectory)/${{ parameters.HelixProjectPath }} \ + /restore \ + /p:TreatWarningsAsErrors=false \ + /p:EnableHelixJobMonitor=${{ parameters.UseHelixMonitor }} \ + /p:HelixUseEntraAuthentication=${{ parameters.HelixUseEntraAuthentication }} \ + ${{ parameters.HelixProjectArguments }} \ + /t:Test \ + /bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/SendToHelix.binlog + env: + BuildConfig: $(_BuildConfig) + HelixSource: ${{ parameters.HelixSource }} + HelixType: ${{ parameters.HelixType }} + HelixBuild: ${{ parameters.HelixBuild }} + HelixConfiguration: ${{ parameters.HelixConfiguration }} + HelixTargetQueues: ${{ parameters.HelixTargetQueues }} + HelixPreCommands: ${{ parameters.HelixPreCommands }} + HelixPostCommands: ${{ parameters.HelixPostCommands }} + WorkItemDirectory: ${{ parameters.WorkItemDirectory }} + WorkItemCommand: ${{ parameters.WorkItemCommand }} + WorkItemTimeout: ${{ parameters.WorkItemTimeout }} + CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} + XUnitProjects: ${{ parameters.XUnitProjects }} + XUnitWorkItemTimeout: ${{ parameters.XUnitWorkItemTimeout }} + XUnitPublishTargetFramework: ${{ parameters.XUnitPublishTargetFramework }} + XUnitRuntimeTargetFramework: ${{ parameters.XUnitRuntimeTargetFramework }} + XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} + IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} + DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} + DotNetCliVersion: ${{ parameters.DotNetCliVersion }} + WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} + HelixBaseUri: ${{ parameters.HelixBaseUri }} + Creator: ${{ parameters.Creator }} + HELIX_AZDO_ACCESSTOKEN: $(System.AccessToken) + condition: and(${{ parameters.condition }}, ne(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} - - powershell: > - $(Build.SourcesDirectory)\eng\common\msbuild.ps1 - $(Build.SourcesDirectory)/${{ parameters.HelixProjectPath }} - /restore - /p:TreatWarningsAsErrors=false - /p:EnableHelixJobMonitor=${{ parameters.UseHelixMonitor }} - /p:HelixUseEntraAuthentication=${{ parameters.HelixUseEntraAuthentication }} - ${{ parameters.HelixProjectArguments }} - /t:Test - /bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/SendToHelix.binlog - displayName: ${{ parameters.DisplayNamePrefix }} (Windows) - env: - BuildConfig: $(_BuildConfig) - HelixSource: ${{ parameters.HelixSource }} - HelixType: ${{ parameters.HelixType }} - HelixBuild: ${{ parameters.HelixBuild }} - HelixConfiguration: ${{ parameters.HelixConfiguration }} - HelixTargetQueues: ${{ parameters.HelixTargetQueues }} - ${{ if eq(parameters.HelixUseEntraAuthentication, false) }}: + - ${{ if eq(parameters.HelixUseEntraAuthentication, false) }}: + - powershell: > + $(Build.SourcesDirectory)\eng\common\msbuild.ps1 + $(Build.SourcesDirectory)/${{ parameters.HelixProjectPath }} + /restore + /p:TreatWarningsAsErrors=false + /p:EnableHelixJobMonitor=${{ parameters.UseHelixMonitor }} + /p:HelixUseEntraAuthentication=${{ parameters.HelixUseEntraAuthentication }} + ${{ parameters.HelixProjectArguments }} + /t:Test + /bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/SendToHelix.binlog + displayName: ${{ parameters.DisplayNamePrefix }} (Windows) + env: + BuildConfig: $(_BuildConfig) + HelixSource: ${{ parameters.HelixSource }} + HelixType: ${{ parameters.HelixType }} + HelixBuild: ${{ parameters.HelixBuild }} + HelixConfiguration: ${{ parameters.HelixConfiguration }} + HelixTargetQueues: ${{ parameters.HelixTargetQueues }} HelixAccessToken: ${{ parameters.HelixAccessToken }} - ${{ if eq(parameters.HelixUseEntraAuthentication, true) }}: - AZURESUBSCRIPTION_CLIENT_ID: $(HelixEntraClientId) - AZURESUBSCRIPTION_TENANT_ID: $(HelixEntraTenantId) - AZURESUBSCRIPTION_SERVICE_CONNECTION_ID: ${{ parameters.HelixAzureSubscription }} - HelixPreCommands: ${{ parameters.HelixPreCommands }} - HelixPostCommands: ${{ parameters.HelixPostCommands }} - WorkItemDirectory: ${{ parameters.WorkItemDirectory }} - WorkItemCommand: ${{ parameters.WorkItemCommand }} - WorkItemTimeout: ${{ parameters.WorkItemTimeout }} - CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} - XUnitProjects: ${{ parameters.XUnitProjects }} - XUnitWorkItemTimeout: ${{ parameters.XUnitWorkItemTimeout }} - XUnitPublishTargetFramework: ${{ parameters.XUnitPublishTargetFramework }} - XUnitRuntimeTargetFramework: ${{ parameters.XUnitRuntimeTargetFramework }} - XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} - IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} - DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} - DotNetCliVersion: ${{ parameters.DotNetCliVersion }} - WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} - HelixBaseUri: ${{ parameters.HelixBaseUri }} - Creator: ${{ parameters.Creator }} - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - condition: and(${{ parameters.condition }}, eq(variables['Agent.Os'], 'Windows_NT')) - continueOnError: ${{ parameters.continueOnError }} - - script: > - $(Build.SourcesDirectory)/eng/common/msbuild.sh - $(Build.SourcesDirectory)/${{ parameters.HelixProjectPath }} - /restore - /p:TreatWarningsAsErrors=false - /p:EnableHelixJobMonitor=${{ parameters.UseHelixMonitor }} - /p:HelixUseEntraAuthentication=${{ parameters.HelixUseEntraAuthentication }} - ${{ parameters.HelixProjectArguments }} - /t:Test - /bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/SendToHelix.binlog - displayName: ${{ parameters.DisplayNamePrefix }} (Unix) - env: - BuildConfig: $(_BuildConfig) - HelixSource: ${{ parameters.HelixSource }} - HelixType: ${{ parameters.HelixType }} - HelixBuild: ${{ parameters.HelixBuild }} - HelixConfiguration: ${{ parameters.HelixConfiguration }} - HelixTargetQueues: ${{ parameters.HelixTargetQueues }} - ${{ if eq(parameters.HelixUseEntraAuthentication, false) }}: + HelixPreCommands: ${{ parameters.HelixPreCommands }} + HelixPostCommands: ${{ parameters.HelixPostCommands }} + WorkItemDirectory: ${{ parameters.WorkItemDirectory }} + WorkItemCommand: ${{ parameters.WorkItemCommand }} + WorkItemTimeout: ${{ parameters.WorkItemTimeout }} + CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} + XUnitProjects: ${{ parameters.XUnitProjects }} + XUnitWorkItemTimeout: ${{ parameters.XUnitWorkItemTimeout }} + XUnitPublishTargetFramework: ${{ parameters.XUnitPublishTargetFramework }} + XUnitRuntimeTargetFramework: ${{ parameters.XUnitRuntimeTargetFramework }} + XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} + IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} + DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} + DotNetCliVersion: ${{ parameters.DotNetCliVersion }} + WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} + HelixBaseUri: ${{ parameters.HelixBaseUri }} + Creator: ${{ parameters.Creator }} + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + condition: and(${{ parameters.condition }}, eq(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} + - script: > + $(Build.SourcesDirectory)/eng/common/msbuild.sh + $(Build.SourcesDirectory)/${{ parameters.HelixProjectPath }} + /restore + /p:TreatWarningsAsErrors=false + /p:EnableHelixJobMonitor=${{ parameters.UseHelixMonitor }} + /p:HelixUseEntraAuthentication=${{ parameters.HelixUseEntraAuthentication }} + ${{ parameters.HelixProjectArguments }} + /t:Test + /bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/SendToHelix.binlog + displayName: ${{ parameters.DisplayNamePrefix }} (Unix) + env: + BuildConfig: $(_BuildConfig) + HelixSource: ${{ parameters.HelixSource }} + HelixType: ${{ parameters.HelixType }} + HelixBuild: ${{ parameters.HelixBuild }} + HelixConfiguration: ${{ parameters.HelixConfiguration }} + HelixTargetQueues: ${{ parameters.HelixTargetQueues }} HelixAccessToken: ${{ parameters.HelixAccessToken }} - ${{ if eq(parameters.HelixUseEntraAuthentication, true) }}: - AZURESUBSCRIPTION_CLIENT_ID: $(HelixEntraClientId) - AZURESUBSCRIPTION_TENANT_ID: $(HelixEntraTenantId) - AZURESUBSCRIPTION_SERVICE_CONNECTION_ID: ${{ parameters.HelixAzureSubscription }} - HelixPreCommands: ${{ parameters.HelixPreCommands }} - HelixPostCommands: ${{ parameters.HelixPostCommands }} - WorkItemDirectory: ${{ parameters.WorkItemDirectory }} - WorkItemCommand: ${{ parameters.WorkItemCommand }} - WorkItemTimeout: ${{ parameters.WorkItemTimeout }} - CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} - XUnitProjects: ${{ parameters.XUnitProjects }} - XUnitWorkItemTimeout: ${{ parameters.XUnitWorkItemTimeout }} - XUnitPublishTargetFramework: ${{ parameters.XUnitPublishTargetFramework }} - XUnitRuntimeTargetFramework: ${{ parameters.XUnitRuntimeTargetFramework }} - XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} - IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} - DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} - DotNetCliVersion: ${{ parameters.DotNetCliVersion }} - WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} - HelixBaseUri: ${{ parameters.HelixBaseUri }} - Creator: ${{ parameters.Creator }} - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - condition: and(${{ parameters.condition }}, ne(variables['Agent.Os'], 'Windows_NT')) - continueOnError: ${{ parameters.continueOnError }} + HelixPreCommands: ${{ parameters.HelixPreCommands }} + HelixPostCommands: ${{ parameters.HelixPostCommands }} + WorkItemDirectory: ${{ parameters.WorkItemDirectory }} + WorkItemCommand: ${{ parameters.WorkItemCommand }} + WorkItemTimeout: ${{ parameters.WorkItemTimeout }} + CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} + XUnitProjects: ${{ parameters.XUnitProjects }} + XUnitWorkItemTimeout: ${{ parameters.XUnitWorkItemTimeout }} + XUnitPublishTargetFramework: ${{ parameters.XUnitPublishTargetFramework }} + XUnitRuntimeTargetFramework: ${{ parameters.XUnitRuntimeTargetFramework }} + XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} + IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} + DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} + DotNetCliVersion: ${{ parameters.DotNetCliVersion }} + WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} + HelixBaseUri: ${{ parameters.HelixBaseUri }} + Creator: ${{ parameters.Creator }} + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + condition: and(${{ parameters.condition }}, ne(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} diff --git a/eng/common/core-templates/steps/source-build.yml b/eng/common/core-templates/steps/source-build.yml index b75f59c428..c501b9ad3a 100644 --- a/eng/common/core-templates/steps/source-build.yml +++ b/eng/common/core-templates/steps/source-build.yml @@ -50,7 +50,7 @@ steps: ${{ parameters.platform.buildArguments }} \ $internalRuntimeDownloadArgs \ $targetRidArgs \ - $portableBuildArgs \ + $portableBuildArgs displayName: Build - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index 3fea306bc2..f58a96e78a 100644 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -5,7 +5,7 @@ set -e usage() { echo "Usage: $0 [BuildArch] [CodeName] [lldbx.y] [llvmx[.y]] [--skipunmount] --rootfsdir ]" - echo "BuildArch can be: arm(default), arm64, loongarch64, ppc64le, riscv64, s390x, x64, x86" + echo "BuildArch can be: arm(default), arm64, loongarch64, ppc64le, riscv64, s390x, x64" echo "CodeName - optional, Code name for Linux, can be: xenial(default), zesty, bionic, alpine" echo " for alpine can be specified with version: alpineX.YY or alpineedge" echo " for FreeBSD can be: freebsd14, freebsd15" @@ -230,12 +230,6 @@ while :; do __HaikuArch=x86_64 __UbuntuRepo="https://archive.ubuntu.com/ubuntu/" ;; - x86) - __BuildArch=x86 - __UbuntuArch=i386 - __AlpineArch=x86 - __UbuntuRepo="https://archive.ubuntu.com/ubuntu/" - ;; lldb*) version="$(echo "$lowerI" | tr -d '[:alpha:]-=')" majorVersion="${version%%.*}" @@ -457,16 +451,18 @@ case "$__AlpineVersion" in 3.17) __AlpinePackages+=" llvm15-libs" ;; edge) __AlpineLlvmLibsLookup=1 ;; *) + __AlpineVersionNumber=0 + if [[ -n "$__AlpineMajorVersion" ]]; then + __AlpineVersionNumber=$((10#$__AlpineMajorVersion * 100 + 10#$__AlpineMinorVersion)) + fi + if [[ "$__AlpineArch" =~ s390x|ppc64le ]]; then __AlpineVersion=3.15 # minimum version that supports lldb-dev __AlpinePackages+=" llvm12-libs" - elif [[ "$__AlpineArch" == "x86" ]]; then - __AlpineVersion=3.17 # minimum version that supports lldb-dev - __AlpinePackages+=" llvm15-libs" - elif [[ "$__AlpineArch" == "loongarch64" ]]; then + elif [[ "$__AlpineArch" == "loongarch64" ]] && (( __AlpineVersionNumber <= 321 )); then __AlpineVersion=3.21 # minimum version that supports lldb-dev __AlpinePackages+=" llvm19-libs" - elif [[ "$__AlpineArch" == "riscv64" ]]; then + elif [[ "$__AlpineArch" == "riscv64" ]] && (( __AlpineVersionNumber <= 322 )); then __AlpineVersion=3.22 # lldb-dev requires 3.21+, but 3.22+ provides the newer linux-headers needed for RISC-V extension probes __AlpinePackages+=" llvm20-libs" elif [[ -n "$__AlpineMajorVersion" ]]; then @@ -532,7 +528,7 @@ ensureDownloadTool() } if [[ "$__CodeName" == "alpine" ]]; then - __ApkToolsVersion=2.14.4-r1 + __ApkToolsVersion=3.0.9-r0 __ApkToolsDir="$(mktemp -d)" __ApkKeysDir="$(mktemp -d)" arch="$(uname -m)" @@ -540,7 +536,7 @@ if [[ "$__CodeName" == "alpine" ]]; then ensureDownloadTool __ApkToolsPackage="$__ApkToolsDir/apk-tools-static.apk" - __ApkToolsUrl="$__AlpineRepo/v3.20/main/$arch/apk-tools-static-$__ApkToolsVersion.apk" + __ApkToolsUrl="$__AlpineRepo/v3.24/main/$arch/apk-tools-static-$__ApkToolsVersion.apk" if [[ "$__hasWget" == 1 ]]; then wget -O "$__ApkToolsPackage" "$__ApkToolsUrl" @@ -549,9 +545,9 @@ if [[ "$__CodeName" == "alpine" ]]; then fi if [[ "$arch" == "x86_64" ]]; then - __ApkToolsSHA512SUM="b1b3cc382aa0ec26a2c24b742701a1f9885d0678365f9aea15d3d005926b06ecc802659cec8a7deba2717af99c19c708a17c23e1f0f07742268ee5be5400eb9e" + __ApkToolsSHA512SUM="c97f27bef2940bb6c23323bf9fe0f3c60932a3c676f1cea23d5f5664ee8be27f349bb0c905f5f3e1fe0b04cfd79d6e422829c49b12cacbce21b02d9b2d1fa083" elif [[ "$arch" == "aarch64" ]]; then - __ApkToolsSHA512SUM="61f9a636c5ac4e96e7a3f69fd65e60fc57b3ec8b23619c4df86f59b89e71d1309b3e406388945bdf0dd9168dac22df376943a70ff3efa179e5687e586f825fb0" + __ApkToolsSHA512SUM="121b77c2e1ac3c856e168c335d57887ab9716bf6b704e30309c37cf8d0935f72a1775aa6628ec1f73eeec0ca7282f4b40836887e62dac94063485b496ad460c9" else >&2 echo "ERROR: Unsupported apk-tools-static host architecture '$arch'." exit 1 diff --git a/eng/common/cross/install-debs.py b/eng/common/cross/install-debs.py index 1d1dfabf7d..e2d5ef4030 100644 --- a/eng/common/cross/install-debs.py +++ b/eng/common/cross/install-debs.py @@ -36,6 +36,8 @@ async def download_file(session, url, dest_path, max_retries=3, retry_delay=2, t f.write(content) print(f"Downloaded {url} at {dest_path}") return + elif response.status >= 500 or response.status in (408, 429): + response.raise_for_status() else: raise Exception(f"Failed to download {url}, Status Code: {response.status}") except (asyncio.CancelledError, asyncio.TimeoutError, aiohttp.ClientError) as e: diff --git a/eng/common/cross/tizen-build-rootfs.sh b/eng/common/cross/tizen-build-rootfs.sh index ba31c93285..2f86370665 100644 --- a/eng/common/cross/tizen-build-rootfs.sh +++ b/eng/common/cross/tizen-build-rootfs.sh @@ -15,9 +15,6 @@ case "$ARCH" in arm64) TIZEN_ARCH="aarch64" ;; - x86) - TIZEN_ARCH="i686" - ;; x64) TIZEN_ARCH="x86_64" LINK_ARCH="x86" diff --git a/eng/common/cross/toolchain.cmake b/eng/common/cross/toolchain.cmake index 70b71395e3..71f10f422b 100644 --- a/eng/common/cross/toolchain.cmake +++ b/eng/common/cross/toolchain.cmake @@ -6,6 +6,7 @@ unset(FREEBSD) unset(OPENBSD) unset(ILLUMOS) unset(ANDROID) +unset(OPENHARMONY) unset(TIZEN) unset(HAIKU) @@ -35,6 +36,8 @@ if(EXISTS ${CROSS_ROOTFS}/etc/tizen-release) set(TIZEN 1) elseif(EXISTS ${CROSS_ROOTFS}/android_platform) set(ANDROID 1) +elseif(EXISTS ${CROSS_ROOTFS}/../build/cmake/ohos.toolchain.cmake) + set(OPENHARMONY 1) endif() if(TARGET_ARCH_NAME STREQUAL "arm") @@ -127,18 +130,8 @@ elseif(TARGET_ARCH_NAME STREQUAL "x64") elseif(HAIKU) set(TOOLCHAIN "x86_64-unknown-haiku") endif() -elseif(TARGET_ARCH_NAME STREQUAL "x86") - set(CMAKE_SYSTEM_PROCESSOR i686) - if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/i586-alpine-linux-musl) - set(TOOLCHAIN "i586-alpine-linux-musl") - else() - set(TOOLCHAIN "i686-linux-gnu") - endif() - if(TIZEN) - set(TIZEN_TOOLCHAIN "i586-tizen-linux-gnu") - endif() else() - message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only arm, arm64, armel, armv6, loongarch64, ppc64le, riscv64, s390x, x64 and x86 are supported!") + message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only arm, arm64, armel, armv6, loongarch64, ppc64le, riscv64, s390x and x64 are supported!") endif() if(DEFINED ENV{TOOLCHAIN}) @@ -156,7 +149,7 @@ if(TIZEN) set(TIZEN_TOOLCHAIN_PATH "${prefix}/${TOOLCHAIN_VERSION}" PARENT_SCOPE) endfunction() - if(TARGET_ARCH_NAME MATCHES "^(arm|armel|x86)$") + if(TARGET_ARCH_NAME MATCHES "^(arm|armel)$") find_toolchain_dir("${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") else() find_toolchain_dir("${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}") @@ -204,6 +197,17 @@ if(ANDROID) # include official NDK toolchain script include(${CROSS_ROOTFS}/../build/cmake/android.toolchain.cmake) +elseif(OPENHARMONY) + if(TARGET_ARCH_NAME STREQUAL "arm") + set(OHOS_ARCH armeabi-v7a) + elseif(TARGET_ARCH_NAME STREQUAL "arm64") + set(OHOS_ARCH arm64-v8a) + elseif(TARGET_ARCH_NAME STREQUAL "x64") + set(OHOS_ARCH x86_64) + endif() + + # include official OHOS NDK toolchain script + include(${CROSS_ROOTFS}/../build/cmake/ohos.toolchain.cmake) elseif(FREEBSD OR OPENBSD) # we cross-compile by instructing clang set(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN}) @@ -286,18 +290,6 @@ elseif(TARGET_ARCH_NAME MATCHES "^(arm64|x64|riscv64)$") endif() elseif(TARGET_ARCH_NAME STREQUAL "s390x") add_toolchain_linker_flag("--target=${TOOLCHAIN}") -elseif(TARGET_ARCH_NAME STREQUAL "x86") - if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/i586-alpine-linux-musl) - add_toolchain_linker_flag("--target=${TOOLCHAIN}") - add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/usr/lib/gcc/${TOOLCHAIN}") - endif() - add_toolchain_linker_flag(-m32) - if(TIZEN) - add_toolchain_linker_flag("-B${TIZEN_TOOLCHAIN_PATH}") - add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib") - add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/lib") - add_toolchain_linker_flag("-L${TIZEN_TOOLCHAIN_PATH}") - endif() elseif(ILLUMOS) add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib/amd64") add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/amd64/lib") @@ -308,7 +300,7 @@ endif() # Specify compile options -if((TARGET_ARCH_NAME MATCHES "^(arm|arm64|armel|armv6|loongarch64|ppc64le|riscv64|s390x|x64|x86)$" AND NOT ANDROID AND NOT FREEBSD AND NOT OPENBSD) OR ILLUMOS OR HAIKU) +if((TARGET_ARCH_NAME MATCHES "^(arm|arm64|armel|armv6|loongarch64|ppc64le|riscv64|s390x|x64)$" AND NOT ANDROID AND NOT OPENHARMONY AND NOT FREEBSD AND NOT OPENBSD) OR ILLUMOS OR HAIKU) set(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN}) set(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN}) set(CMAKE_ASM_COMPILER_TARGET ${TOOLCHAIN}) @@ -335,46 +327,26 @@ if(TARGET_ARCH_NAME MATCHES "^(arm|armel)$") endif() elseif(TARGET_ARCH_NAME STREQUAL "s390x") add_compile_options("--target=${TOOLCHAIN}") -elseif(TARGET_ARCH_NAME STREQUAL "x86") - if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/i586-alpine-linux-musl) - add_compile_options(--target=${TOOLCHAIN}) - endif() - add_compile_options(-m32) - add_compile_options(-Wno-error=unused-command-line-argument) endif() if(TIZEN) - if(TARGET_ARCH_NAME MATCHES "^(arm|armel|arm64|x86)$") + if(TARGET_ARCH_NAME MATCHES "^(arm|armel|arm64)$") add_compile_options(-Wno-deprecated-declarations) # compile-time option add_compile_options(-D__extern_always_inline=inline) # compile-time option endif() endif() # Set LLDB include and library paths for builds that need lldb. -if(TARGET_ARCH_NAME MATCHES "^(arm|armel|x86)$") - if(TARGET_ARCH_NAME STREQUAL "x86") - set(LLVM_CROSS_DIR "$ENV{LLVM_CROSS_HOME}") - else() # arm/armel case - set(LLVM_CROSS_DIR "$ENV{LLVM_ARM_HOME}") - endif() +if(TARGET_ARCH_NAME MATCHES "^(arm|armel)$") + set(LLVM_CROSS_DIR "$ENV{LLVM_ARM_HOME}") if(LLVM_CROSS_DIR) set(WITH_LLDB_LIBS "${LLVM_CROSS_DIR}/lib/" CACHE STRING "") set(WITH_LLDB_INCLUDES "${LLVM_CROSS_DIR}/include" CACHE STRING "") set(LLDB_H "${WITH_LLDB_INCLUDES}" CACHE STRING "") set(LLDB "${LLVM_CROSS_DIR}/lib/liblldb.so" CACHE STRING "") else() - if(TARGET_ARCH_NAME STREQUAL "x86") - set(WITH_LLDB_LIBS "${CROSS_ROOTFS}/usr/lib/i386-linux-gnu" CACHE STRING "") - set(CHECK_LLVM_DIR "${CROSS_ROOTFS}/usr/lib/llvm-3.8/include") - if(EXISTS "${CHECK_LLVM_DIR}" AND IS_DIRECTORY "${CHECK_LLVM_DIR}") - set(WITH_LLDB_INCLUDES "${CHECK_LLVM_DIR}") - else() - set(WITH_LLDB_INCLUDES "${CROSS_ROOTFS}/usr/lib/llvm-3.6/include") - endif() - else() # arm/armel case - set(WITH_LLDB_LIBS "${CROSS_ROOTFS}/usr/lib/${TOOLCHAIN}" CACHE STRING "") - set(WITH_LLDB_INCLUDES "${CROSS_ROOTFS}/usr/lib/llvm-3.6/include" CACHE STRING "") - endif() + set(WITH_LLDB_LIBS "${CROSS_ROOTFS}/usr/lib/${TOOLCHAIN}" CACHE STRING "") + set(WITH_LLDB_INCLUDES "${CROSS_ROOTFS}/usr/lib/llvm-3.6/include" CACHE STRING "") endif() endif() diff --git a/eng/common/cross/x86/tizen/tizen.patch b/eng/common/cross/x86/tizen/tizen.patch deleted file mode 100644 index f4fe8838ad..0000000000 --- a/eng/common/cross/x86/tizen/tizen.patch +++ /dev/null @@ -1,9 +0,0 @@ -diff -u -r a/usr/lib/libc.so b/usr/lib/libc.so ---- a/usr/lib/libc.so 2016-12-30 23:00:08.284951863 +0900 -+++ b/usr/lib/libc.so 2016-12-30 23:00:32.140951815 +0900 -@@ -2,4 +2,4 @@ - Use the shared library, but some functions are only in - the static library, so try that secondarily. */ - OUTPUT_FORMAT(elf32-i386) --GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED ( /lib/ld-linux.so.2 ) ) -+GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld-linux.so.2 ) ) diff --git a/eng/common/msbuild.ps1 b/eng/common/msbuild.ps1 index 8076945064..161f8e8077 100644 --- a/eng/common/msbuild.ps1 +++ b/eng/common/msbuild.ps1 @@ -19,11 +19,6 @@ try { $nodeReuse = $false } - # MSBuild's multi-threaded mode isn't run on CI unless it was explicitly requested via -msbuildMultiThreaded. - if ($ci -and -not $PSBoundParameters.ContainsKey('msbuildMultiThreaded')) { - $msbuildMultiThreaded = $false - } - MSBuild @extraArgs } catch { diff --git a/eng/common/native/NativeAotSupported.props b/eng/common/native/NativeAotSupported.props index cdff9ef036..002aa9c248 100644 --- a/eng/common/native/NativeAotSupported.props +++ b/eng/common/native/NativeAotSupported.props @@ -3,16 +3,15 @@ <_NativeAotSupportedOS Condition=" - '$(TargetOS)' != 'browser' and '$(TargetOS)' != 'haiku' and '$(TargetOS)' != 'illumos' and '$(TargetOS)' != 'netbsd' and - '$(TargetOS)' != 'solaris' + '$(TargetOS)' != 'solaris' and + '$(TargetOS)' != 'openharmony' ">true <_NativeAotSupportedArch Condition=" - '$(TargetArchitecture)' != 'wasm' and '$(TargetArchitecture)' != 's390x' and '$(TargetArchitecture)' != 'ppc64le' and ('$(TargetArchitecture)' != 'x86' or '$(TargetOS)' == 'windows') diff --git a/eng/common/native/init-distro-rid.sh b/eng/common/native/init-distro-rid.sh index 8fc6d2fec7..abb3e23117 100644 --- a/eng/common/native/init-distro-rid.sh +++ b/eng/common/native/init-distro-rid.sh @@ -41,6 +41,9 @@ getNonPortableDistroRid() nonPortableRid="freebsd.$__freebsd_major_version-${targetArch}" elif [ "$targetOs" = "openbsd" ]; then nonPortableRid="openbsd.$(uname -r)-${targetArch}" + elif [ "$targetOs" = "openharmony" ] && command -v param >/dev/null && param get const.ohos.fullname 2>/dev/null | grep -qi '^openharmony'; then + __openharmony_api_version=$(param get const.ohos.apiversion | tr -d '[:space:]') + nonPortableRid="openharmony.$__openharmony_api_version-${targetArch}" elif command -v getprop >/dev/null && getprop ro.product.system.model | grep -qi android; then __android_sdk_version=$(getprop ro.build.version.sdk) nonPortableRid="android.$__android_sdk_version-${targetArch}" @@ -101,10 +104,14 @@ initDistroRidGlobal() STRINGS="$(command -v llvm-strings || true)" fi - # Check for musl-based distros (e.g. Alpine Linux, Void Linux). - if "${rootfsDir}/usr/bin/ldd" --version 2>&1 | grep -q musl || - ( [ -n "$STRINGS" ] && "$STRINGS" "${rootfsDir}/usr/bin/ldd" 2>&1 | grep -q musl ); then - __PortableTargetOS="linux-musl" + # Check for musl-based distros (e.g. Alpine Linux, Void Linux). Only linux targets + # have a musl/glibc portable flavor; skip the check for other targets so that a + # musl-based build host does not clobber their portable OS (e.g. openharmony). + if [ "$targetOs" = "linux" ]; then + if "${rootfsDir}/usr/bin/ldd" --version 2>&1 | grep -q musl || + ( [ -n "$STRINGS" ] && "$STRINGS" "${rootfsDir}/usr/bin/ldd" 2>&1 | grep -q musl ); then + __PortableTargetOS="linux-musl" + fi fi fi diff --git a/eng/common/native/init-os-and-arch.sh b/eng/common/native/init-os-and-arch.sh index 62d62fed52..c3e2122843 100644 --- a/eng/common/native/init-os-and-arch.sh +++ b/eng/common/native/init-os-and-arch.sh @@ -7,9 +7,17 @@ if command -v getprop && getprop ro.product.system.model 2>&1 | grep -qi android OSName="android" fi +# OpenHarmony/HarmonyOS hosts report `HarmonyOS` (or `Linux` on some devices) +# from uname, so query the OHOS parameter service as well. +if command -v param >/dev/null 2>&1 && param get const.ohos.fullname 2>/dev/null | grep -qi '^openharmony'; then + OSName="openharmony" +fi + case "$OSName" in freebsd|linux|netbsd|openbsd|sunos|android|haiku) os="$OSName" ;; +harmonyos|openharmony) + os=openharmony ;; darwin) os=osx ;; *) diff --git a/eng/common/native/install-dependencies.sh b/eng/common/native/install-dependencies.sh index aff839fa09..be405fd62e 100644 --- a/eng/common/native/install-dependencies.sh +++ b/eng/common/native/install-dependencies.sh @@ -26,7 +26,7 @@ case "$os" in apt install -y build-essential gettext locales cmake llvm clang lld lldb liblldb-dev libunwind8-dev libicu-dev liblttng-ust-dev \ libssl-dev libkrb5-dev pigz cpio ninja-build file - localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 + localedef -i en_US -c -f UTF-8 en_US.UTF-8 elif [ "$ID" = "fedora" ] || [ "$ID" = "rhel" ] || [ "$ID" = "azurelinux" ] || [ "$ID" = "centos" ]; then pkg_mgr="$(command -v tdnf 2>/dev/null || command -v dnf)" $pkg_mgr install -y cmake llvm lld lldb clang python curl libicu-devel openssl-devel krb5-devel lttng-ust-devel pigz cpio ninja-build file diff --git a/eng/common/run-helix-job-monitor.sh b/eng/common/run-helix-job-monitor.sh new file mode 100644 index 0000000000..dda140bc9a --- /dev/null +++ b/eng/common/run-helix-job-monitor.sh @@ -0,0 +1,64 @@ +#!/usr/bin/env bash +set -euo pipefail + +scriptroot="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +. "$scriptroot/pipeline-logging-functions.sh" + +toolArgs=( + --helix-base-uri "$HELIX_MONITOR_BASE_URI" + --use-entra-authentication "$HELIX_MONITOR_USE_ENTRA_AUTHENTICATION" + --polling-interval-seconds "$HELIX_MONITOR_POLLING_INTERVAL_SECONDS" + --fail-on-failed-tests "$HELIX_MONITOR_FAIL_ON_FAILED_TESTS" + --allow-no-helix-jobs "$HELIX_MONITOR_ALLOW_NO_HELIX_JOBS" + --use-fully-qualified-test-name "$HELIX_MONITOR_USE_FULLY_QUALIFIED_TEST_NAME" + --max-wait-minutes "$((HELIX_MONITOR_TIMEOUT_IN_MINUTES - 5))" + --stage-name "$SYSTEM_STAGENAME" + --stage-attempt "$SYSTEM_STAGEATTEMPT" + --job-attempt "$SYSTEM_JOBATTEMPT" + --test-result-upload-parallelism "$HELIX_MONITOR_TEST_RESULT_UPLOAD_PARALLELISM" +) + +organization="${HELIX_MONITOR_ORGANIZATION:-}" +repository="${HELIX_MONITOR_REPOSITORY:-}" + +# Fall back to Azure DevOps-provided environment variables when the caller did not +# supply organization or repository explicitly. +if [ -z "$organization" ] || [ -z "$repository" ]; then + buildRepoName="${BUILD_REPOSITORY_NAME:-}" + if [ -n "$buildRepoName" ] && [[ "$buildRepoName" == */* ]]; then + repoOwner="${buildRepoName%%/*}" + repoName="${buildRepoName#*/}" + elif [ -n "$buildRepoName" ] && [[ "$buildRepoName" == *-* ]]; then + repoOwner="${buildRepoName%%-*}" + repoName="${buildRepoName#*-}" + fi + + if [ -n "${repoOwner:-}" ] && [ -n "${repoName:-}" ]; then + if [ -z "$organization" ]; then organization="$repoOwner"; fi + if [ -z "$repository" ]; then repository="$repoName"; fi + fi +fi + +if [ -n "$organization" ]; then toolArgs+=( --organization "$organization" ); fi +if [ -n "$repository" ]; then toolArgs+=( --repository "$repository" ); fi +if [ -n "${HELIX_MONITOR_TEST_RESULT_ATTACHMENT_MODE:-}" ]; then + toolArgs+=( --test-result-attachment-mode "$HELIX_MONITOR_TEST_RESULT_ATTACHMENT_MODE" ) +fi + +# These values let the monitor derive the same Helix source filter as the SDK submitter. +toolArgs+=( --build-reason "$BUILD_REASON" ) +toolArgs+=( --source-branch "$BUILD_SOURCEBRANCH" ) + +cd "$BUILD_SOURCESDIRECTORY" +exitCode=0 +if [ -n "${HELIX_MONITOR_TOOL_NUPKG_ARTIFACT_NAME:-}" ]; then + export DOTNET_ROOT="$BUILD_SOURCESDIRECTORY/.dotnet" + ./eng/common/dotnet.sh exec "$HELIXJOBMONITORDLL" "${toolArgs[@]}" || exitCode=$? +else + ./eng/common/dotnet.sh tool run "$HELIX_MONITOR_TOOL_COMMAND" -- "${toolArgs[@]}" || exitCode=$? +fi + +if [ "$exitCode" -ne 0 ]; then + Write-PipelineTelemetryError -force -category 'Helix' "Helix job monitor failed (exit code '$exitCode')." + exit "$exitCode" +fi diff --git a/eng/common/sdk-task.ps1 b/eng/common/sdk-task.ps1 index 8d72d803dd..ad35ccb0dd 100644 --- a/eng/common/sdk-task.ps1 +++ b/eng/common/sdk-task.ps1 @@ -49,15 +49,16 @@ function Print-Usage() { Write-Host "Command line arguments not listed above are passed thru to msbuild." } -function Build([string]$target) { - $logSuffix = if ($target -eq 'Execute') { '' } else { ".$target" } - $log = Join-Path $LogDir "$task$logSuffix.binlog" +# Restore is driven by MSBuild's /restore switch, which the shared MSBuild helper adds +# whenever restore is enabled. No separate restore invocation is necessary. +function Build() { + $log = Join-Path $LogDir "$task.binlog" $binaryLogArg = if ($binaryLog) { "/bl:$log" } else { "" } $outputPath = Join-Path $ToolsetDir "$task\" MSBuild $taskProject ` $binaryLogArg ` - /t:$target ` + /t:Execute ` /p:Configuration=$configuration ` /p:RepoRoot=$RepoRoot ` /p:BaseIntermediateOutputPath=$outputPath ` @@ -88,11 +89,7 @@ try { ExitWithExitCode 1 } - if ($restore) { - Build 'Restore' - } - - Build 'Execute' + Build } catch { Write-Host $_.ScriptStackTrace diff --git a/eng/common/sdk-task.sh b/eng/common/sdk-task.sh index a7f1ba060d..0c14d45a9c 100644 --- a/eng/common/sdk-task.sh +++ b/eng/common/sdk-task.sh @@ -28,18 +28,17 @@ while [[ -h "$source" ]]; do done scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" +# Restore is driven by MSBuild's /restore switch, which the shared MSBuild helper adds +# whenever restore is enabled. No separate restore invocation is necessary. Build() { - local target=$1 - local log_suffix="" - [[ "$target" != "Execute" ]] && log_suffix=".$target" - local log="$log_dir/$task$log_suffix.binlog" + local log="$log_dir/$task.binlog" local binaryLogArg="" [[ $binary_log == true ]] && binaryLogArg="/bl:$log" local output_path="$toolset_dir/$task/" MSBuild "$taskProject" \ $binaryLogArg \ - /t:"$target" \ + /t:Execute \ /p:Configuration="$configuration" \ /p:RepoRoot="$repo_root" \ /p:BaseIntermediateOutputPath="$output_path" \ @@ -121,11 +120,7 @@ if [[ ! -e "$taskProject" ]]; then ExitWithExitCode 1 fi -if $restore; then - Build "Restore" -fi - -Build "Execute" +Build ExitWithExitCode 0 diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index cea14279b8..f2e42780a2 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -31,8 +31,9 @@ # Set to true to reuse msbuild nodes. Recommended to not reuse on CI. [bool]$nodeReuse = if (Test-Path variable:nodeReuse) { $nodeReuse } else { !$ci } -# Set to true to build with MSBuild's multi-threaded mode (-mt). Enabled by default for local builds and not run on CI. -[bool]$msbuildMultiThreaded = if (Test-Path variable:msbuildMultiThreaded) { $msbuildMultiThreaded } else { !$ci } +# Set to true to build with MSBuild's multi-threaded mode (-mt). Enabled by default for both local and CI builds. +# Not applied when building with msbuild.exe (VS MSBuild). +[bool]$msbuildMultiThreaded = if (Test-Path variable:msbuildMultiThreaded) { $msbuildMultiThreaded } else { $true } # Configures warning treatment in msbuild. [bool]$warnAsError = if (Test-Path variable:warnAsError) { $warnAsError } else { $true } @@ -184,7 +185,7 @@ function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) { } } - $dotnetSdkVersion = $GlobalJson.tools.dotnet + $dotnetSdkVersion = GetDotNetSdkVersion # Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version, # otherwise install the dotnet CLI and SDK to repo local .dotnet directory to avoid potential permission issues. @@ -240,6 +241,24 @@ function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) { return $global:_DotNetInstallDir = $dotnetRoot } +# Returns the .NET SDK version to install: 'tools.dotnet' if specified, otherwise 'sdk.version', otherwise $null. +function GetDotNetSdkVersion() { + if ((Get-Member -InputObject $GlobalJson.tools -Name 'dotnet') -and $GlobalJson.tools.dotnet) { + return $GlobalJson.tools.dotnet + } + + if ((Get-Member -InputObject $GlobalJson -Name 'sdk') -and (Get-Member -InputObject $GlobalJson.sdk -Name 'version') -and $GlobalJson.sdk.version) { + return $GlobalJson.sdk.version + } + + return $null +} + +# True if global.json specifies a .NET SDK version to install, either via 'tools.dotnet' or via 'sdk.version'. +function GlobalJsonSpecifiesDotNetSdk() { + return [bool](GetDotNetSdkVersion) +} + function Retry($downloadBlock, $maxRetries = 5) { $retries = 1 @@ -587,15 +606,15 @@ function InitializeBuildTool() { $msbuildEngine = GetDefaultMSBuildEngine } - # Initialize dotnet cli if listed in 'tools' + # Initialize dotnet cli if global.json specifies a .NET SDK version ('tools.dotnet' or 'sdk.version') $dotnetRoot = $null - if (Get-Member -InputObject $GlobalJson.tools -Name 'dotnet') { + if (GlobalJsonSpecifiesDotNetSdk) { $dotnetRoot = InitializeDotNetCli -install:$restore } if ($msbuildEngine -eq 'dotnet') { if (!$dotnetRoot) { - Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "/global.json must specify 'tools.dotnet'." + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "/global.json must specify 'tools.dotnet' or 'sdk.version'." ExitWithExitCode 1 } $dotnetPath = Join-Path $dotnetRoot (GetExecutableFileName 'dotnet') @@ -624,11 +643,11 @@ function GetDefaultMSBuildEngine() { return 'vs' } - if (Get-Member -InputObject $GlobalJson.tools -Name 'dotnet') { + if (GlobalJsonSpecifiesDotNetSdk) { return 'dotnet' } - Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "-msbuildEngine must be specified, or /global.json must specify 'tools.dotnet' or 'tools.vs'." + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "-msbuildEngine must be specified, or /global.json must specify 'tools.dotnet', 'sdk.version' or 'tools.vs'." ExitWithExitCode 1 } @@ -810,10 +829,13 @@ function MSBuild() { } } - $cmdArgs = "$($buildTool.Command) /m /nologo /clp:Summary /v:$verbosity /nr:$nodeReuse /p:ContinuousIntegrationBuild=$ci" + $restoreSwitch = if ($restore) { ' /restore' } else { '' } - # Build with MSBuild's multi-threaded mode. - if ($msbuildMultiThreaded) { + $cmdArgs = "$($buildTool.Command)$restoreSwitch /m /nologo /clp:Summary /v:$verbosity /nr:$nodeReuse /p:ContinuousIntegrationBuild=$ci" + + # Build with MSBuild's multi-threaded mode, but not with msbuild.exe (VS MSBuild) for now. + # TODO: Enable for VS MSBuild as well: https://github.com/dotnet/dotnet/issues/9989 + if ($msbuildMultiThreaded -and [System.IO.Path]::GetFileName($buildTool.Path) -ne 'msbuild.exe') { $cmdArgs += ' -mt' } @@ -934,8 +956,13 @@ $ToolsDir = Join-Path $RepoRoot '.tools' $LogDir = Join-Path (Join-Path $ArtifactsDir 'log') $configuration $TempDir = Join-Path (Join-Path $ArtifactsDir 'tmp') $configuration $GlobalJson = Get-Content -Raw -Path (Join-Path $RepoRoot 'global.json') | ConvertFrom-Json +# The 'tools' section is optional (the SDK version can come from 'sdk.version'). Default it to an empty object +# so that code inspecting it doesn't need to handle a missing section. +if (-not (Get-Member -InputObject $GlobalJson -Name 'tools')) { + $GlobalJson | Add-Member -NotePropertyName 'tools' -NotePropertyValue ([pscustomobject]@{}) +} # true if global.json contains a "runtimes" section -$globalJsonHasRuntimes = if ($GlobalJson.tools.PSObject.Properties.Name -Match 'runtimes') { $true } else { $false } +$globalJsonHasRuntimes = [bool](Get-Member -InputObject $GlobalJson.tools -Name 'runtimes') Create-Directory $ToolsetDir Create-Directory $TempDir diff --git a/eng/common/tools.sh b/eng/common/tools.sh index fdbc19243f..28286b7052 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -60,13 +60,9 @@ else node_reuse=${node_reuse:-true} fi -# Set to true to build with MSBuild's multi-threaded mode (-mt). Enabled by default for local builds and not run on CI. +# Set to true to build with MSBuild's multi-threaded mode (-mt). Enabled by default for both local and CI builds. msbuild_multi_threaded=$(NormalizeBoolArg "${msbuild_multi_threaded:-}") -if [[ "$ci" == true ]]; then - msbuild_multi_threaded=${msbuild_multi_threaded:-false} -else - msbuild_multi_threaded=${msbuild_multi_threaded:-true} -fi +msbuild_multi_threaded=${msbuild_multi_threaded:-true} # Configures warning treatment in msbuild. warn_as_error=$(NormalizeBoolArg "${warn_as_error:-}") @@ -134,6 +130,31 @@ function ReadGlobalVersion { fi } +# Reads the .NET SDK version to install from global.json: 'tools.dotnet' if specified, otherwise 'sdk.version'. +function ReadDotNetSdkVersion { + _ReadDotNetSdkVersion="" + + if command -v jq &> /dev/null; then + _ReadDotNetSdkVersion="$(jq -r '.tools.dotnet // .sdk.version // empty' "$global_json_file")" + else + local global_json + global_json="$(cat "$global_json_file")" + # Matches "sdk": { ... "version": "" }. Quoted strings are consumed as a whole so that braces + # inside them (e.g. in "errorMessage") don't end the sdk object. The version is the third capture group. + local sdk_version_regex='"sdk"[[:space:]]*:[[:space:]]*[{]([^"}]|"([^"\\]|\\.)*")*"version"[[:space:]]*:[[:space:]]*"([^"]+)"' + if [[ "$global_json" =~ \"dotnet\"[[:space:]\:]*\"([^\"]+) ]]; then + _ReadDotNetSdkVersion=${BASH_REMATCH[1]} + elif [[ "$global_json" =~ $sdk_version_regex ]]; then + _ReadDotNetSdkVersion=${BASH_REMATCH[3]} + fi + fi + + if [[ -z "$_ReadDotNetSdkVersion" ]]; then + Write-PipelineTelemetryError -category 'InitializeToolset' "Error: /global.json must specify 'tools.dotnet' or 'sdk.version'." + ExitWithExitCode 1 + fi +} + function InitializeDotNetCli { if [[ -n "${_InitializeDotNetCli:-}" ]]; then return @@ -162,8 +183,8 @@ function InitializeDotNetCli { fi fi - ReadGlobalVersion "dotnet" - local dotnet_sdk_version=$_ReadGlobalVersion + ReadDotNetSdkVersion + local dotnet_sdk_version=$_ReadDotNetSdkVersion local dotnet_root="" # Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version, @@ -619,7 +640,12 @@ function MSBuild { warnnotaserror_switch="/warnnotaserror:$warn_not_as_error /p:AdditionalWarningsNotAsErrors=${warn_not_as_error//;/%3B}" fi - RunBuildTool "$_InitializeBuildToolCommand" /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch $mt_switch $warnnotaserror_switch ${logger_switch[@]+"${logger_switch[@]}"} /p:TreatWarningsAsErrors=$warn_as_error /p:ContinuousIntegrationBuild=$ci "$@" + local restore_switch="" + if [[ "$restore" == true ]]; then + restore_switch="/restore" + fi + + RunBuildTool "$_InitializeBuildToolCommand" $restore_switch /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch $mt_switch $warnnotaserror_switch ${logger_switch[@]+"${logger_switch[@]}"} /p:TreatWarningsAsErrors=$warn_as_error /p:ContinuousIntegrationBuild=$ci "$@" } function GetDarc { diff --git a/global.json b/global.json index c97480b9ec..50920dcfb7 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "11.0.100", + "version": "12.0.100-alpha.1.26555.106", "paths": [ ".dotnet", "$host$" @@ -14,10 +14,10 @@ "vs": { "version": "17.8.0" }, - "dotnet": "11.0.100" + "dotnet": "12.0.100-alpha.1.26555.106" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "12.0.0-beta.26469.3" + "Microsoft.DotNet.Arcade.Sdk": "12.0.0-beta.26569.6" }, "test": { "runner": "Microsoft.Testing.Platform" diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/BaseRunTests.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/BaseRunTests.cs index 18d226c606..2bb52d0b59 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/BaseRunTests.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/BaseRunTests.cs @@ -40,6 +40,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution; /// /// The base run tests. /// +[SuppressMessage("Design", "CA1001:Types that own disposable fields should be disposable", Justification = "TestRunCache and FrameworkHandle are disposed at the end of RunTests. Implementing IDisposable would cascade to the public ExecutionManager type.")] internal abstract class BaseRunTests { private readonly ITestCaseEventsHandler? _testCaseEventsHandler; @@ -198,6 +199,7 @@ protected BaseRunTests( public void RunTests() { using (TestRunCache) + using (FrameworkHandle) { TimeSpan? elapsedTime = null; Exception? exception = null; diff --git a/test/Intent.Primitives/Intent.Primitives.csproj b/test/Intent.Primitives/Intent.Primitives.csproj index fb4db384a4..41da8317f2 100644 --- a/test/Intent.Primitives/Intent.Primitives.csproj +++ b/test/Intent.Primitives/Intent.Primitives.csproj @@ -1,7 +1,7 @@ - net11.0 + net12.0 enable enable diff --git a/test/Intent/Intent.csproj b/test/Intent/Intent.csproj index 45761a1dc9..b271db7086 100644 --- a/test/Intent/Intent.csproj +++ b/test/Intent/Intent.csproj @@ -2,7 +2,7 @@ Exe - net11.0 + net12.0 enable enable diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/BlameDataCollectorTests.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/BlameDataCollectorTests.cs index 42e8aeffd0..bd74c815df 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/BlameDataCollectorTests.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/BlameDataCollectorTests.cs @@ -22,8 +22,8 @@ namespace Microsoft.TestPlatform.AcceptanceTests; [TestCategory("Windows-Review")] public class BlameDataCollectorTests : AcceptanceTestBase { - public const string NETCOREANDFX = "net481;net11.0"; - public const string NET = "net11.0"; + public const string NETCOREANDFX = "net481;net12.0"; + public const string NET = "net12.0"; private readonly string _procDumpPath; public BlameDataCollectorTests() @@ -246,7 +246,7 @@ public void HangDumpShouldNotHangWhenTestHostFailsToStart(RunnerInfo runnerInfo) // after TestHostLaunched, which never fires here. SetTestEnvironment(_testEnvironment, runnerInfo); const string testAssetProjectName = "SimpleTestProjectMessedUpTargetFramework"; - var assemblyPath = GetTestDllForFramework(testAssetProjectName + ".dll", Core11TargetFramework); + var assemblyPath = GetTestDllForFramework(testAssetProjectName + ".dll", Core12TargetFramework); // Make testhost fail immediately by targeting a non-existent runtime. var runtimeConfigJson = Path.Combine(Path.GetDirectoryName(assemblyPath)!, testAssetProjectName + ".runtimeconfig.json"); diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/CodeCoveragePublishTests.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/CodeCoveragePublishTests.cs index 413a1593a6..f8065bdcaf 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/CodeCoveragePublishTests.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/CodeCoveragePublishTests.cs @@ -55,7 +55,7 @@ public void PublishKeepsPrivateDependenciesIsolatedRegardlessOfTimestamp(int cov File.WriteAllText(projectPath, $""" - {Core11TargetFramework} + {Core12TargetFramework} false true diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DataCollectorTests.Coverlet.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DataCollectorTests.Coverlet.cs index 848a6e55a7..d8181e3542 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DataCollectorTests.Coverlet.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DataCollectorTests.Coverlet.cs @@ -20,7 +20,7 @@ public void RunCoverletCoverage(RunnerInfo runnerInfo) SetTestEnvironment(_testEnvironment, runnerInfo); // We use netcoreapp runner - // "...\vstest\tools\dotnet\dotnet.exe "...\vstest\artifacts\Debug\net11.0\vstest.console.dll" --collect:"XPlat Code Coverage" ... + // "...\vstest\tools\dotnet\dotnet.exe "...\vstest\artifacts\Debug\net12.0\vstest.console.dll" --collect:"XPlat Code Coverage" ... var resultsDir = new TempDirectory(); string coverletAdapterPath = Path.GetDirectoryName(Directory.GetFiles(_testEnvironment.GetNugetPackage("coverlet.collector"), "coverlet.collector.dll", SearchOption.AllDirectories).Single())!; diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetArchitectureSwitchTests.Windows.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetArchitectureSwitchTests.Windows.cs index a2e0e38b39..8ff44e2047 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetArchitectureSwitchTests.Windows.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetArchitectureSwitchTests.Windows.cs @@ -53,7 +53,7 @@ public void Use_EnvironmentVariables(string architectureFrom, string architectur { environmentVariables.Add("DOTNET_ROOT(x86)", Path.GetDirectoryName(dotnetPathTo)!); } - ExecuteApplication(dotnetPath, "new mstest", out _, out string _, out _, environmentVariables, TempDirectory.Path); + ExecuteApplication(dotnetPath, $"new mstest --framework {Core12TargetFramework}", out _, out string _, out _, environmentVariables, TempDirectory.Path); // Patch test file File.WriteAllText(Path.Combine(TempDirectory.Path, "UnitTest1.cs"), diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetArchitectureSwitchTests.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetArchitectureSwitchTests.cs index bfdd9a7ebf..fc3bd01a49 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetArchitectureSwitchTests.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetArchitectureSwitchTests.cs @@ -53,7 +53,7 @@ public void GlobalInstallation() }; // Verify native architecture - ExecuteApplication(GetDefaultDotnetMuxerLocation, $"test {projectPath} --framework net11.0", out string stdOut, out _, out _, env, projectDirectory); + ExecuteApplication(GetDefaultDotnetMuxerLocation, $"test {projectPath} --framework net12.0", out string stdOut, out _, out _, env, projectDirectory); if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { Assert.Contains("Runtime location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App", stdOut); @@ -67,11 +67,11 @@ public void GlobalInstallation() // Verify switch using csproj - ExecuteApplication(GetDefaultDotnetMuxerLocation, $"test {projectPath} --framework net11.0 --arch x64", out stdOut, out _, out _, env, projectDirectory); + ExecuteApplication(GetDefaultDotnetMuxerLocation, $"test {projectPath} --framework net12.0 --arch x64", out stdOut, out _, out _, env, projectDirectory); AssertSwitch(stdOut); // Verify switch using test container - var buildAssemblyPath = GetTestDllForFramework("ArchitectureSwitch.dll", "net11.0"); + var buildAssemblyPath = GetTestDllForFramework("ArchitectureSwitch.dll", "net12.0"); ExecuteApplication(GetDefaultDotnetMuxerLocation, $"test {buildAssemblyPath} --arch x64", out stdOut, out _, out _, env, projectDirectory); AssertSwitch(stdOut); @@ -106,7 +106,7 @@ public void DOTNET_ROOTS_EnvironmentVariables(bool dotnetRoot, bool dotnetRootX6 var projectDirectory = Path.GetDirectoryName(projectPath); // Verify native architecture - ExecuteApplication(GetDefaultDotnetMuxerLocation, $"test {projectPath} --framework net11.0", out string stdOut, out _, out _, env, projectDirectory); + ExecuteApplication(GetDefaultDotnetMuxerLocation, $"test {projectPath} --framework net12.0", out string stdOut, out _, out _, env, projectDirectory); if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { Assert.Contains("Runtime location: /usr/local/share/dotnet/shared/Microsoft.NETCore.App", stdOut, "Unexpected runtime location"); @@ -131,12 +131,12 @@ public void DOTNET_ROOTS_EnvironmentVariables(bool dotnetRoot, bool dotnetRootX6 } // Verify switch using csproj - ExecuteApplication($"{s_privateX64Installation}/{GetMuxerName}", $"test {projectPath} --framework net11.0 --arch x64", out stdOut, out _, out _, env, projectDirectory); + ExecuteApplication($"{s_privateX64Installation}/{GetMuxerName}", $"test {projectPath} --framework net12.0 --arch x64", out stdOut, out _, out _, env, projectDirectory); AssertSwitch(stdOut); // Verify switch using test container - var buildAssemblyPath = GetTestDllForFramework("ArchitectureSwitch.dll", "net11.0"); - ExecuteApplication($"{s_privateX64Installation}/{GetMuxerName}", $"test {buildAssemblyPath} --framework net11.0 --arch x64", out stdOut, out _, out _, env, projectDirectory); + var buildAssemblyPath = GetTestDllForFramework("ArchitectureSwitch.dll", "net12.0"); + ExecuteApplication($"{s_privateX64Installation}/{GetMuxerName}", $"test {buildAssemblyPath} --framework net12.0 --arch x64", out stdOut, out _, out _, env, projectDirectory); AssertSwitch(stdOut); void AssertSwitch(string output) @@ -164,18 +164,18 @@ public void PrivateX64BuildToGlobalArmInstallation() var projectDirectory = Path.GetDirectoryName(projectPath); // Verify native architecture - ExecuteApplication(privateInstallationMuxer, $"test {projectPath} --framework net11.0", out string stdOut, out _, out _, env, projectDirectory); + ExecuteApplication(privateInstallationMuxer, $"test {projectPath} --framework net12.0", out string stdOut, out _, out _, env, projectDirectory); Assert.IsTrue(Regex.IsMatch(stdOut.Replace(@"\", "/"), $"Runtime location: .*{s_privateX64Installation.Replace(@"\", "/")}.*shared.*Microsoft.NETCore.App"), "Unexpected runtime location"); Assert.Contains("OSArchitecture: X64", stdOut, "Unexpected OSArchitecture"); Assert.Contains("ProcessArchitecture: X64", stdOut, "Unexpected ProcessArchitecture"); // Verify switch using csproj - ExecuteApplication($"{s_privateX64Installation}/{GetMuxerName}", $"test {projectPath} --framework net11.0 --arch arm64", out stdOut, out _, out _, env, projectDirectory); + ExecuteApplication($"{s_privateX64Installation}/{GetMuxerName}", $"test {projectPath} --framework net12.0 --arch arm64", out stdOut, out _, out _, env, projectDirectory); AssertSwitch(stdOut); // Verify switch using test container - var buildAssemblyPath = GetTestDllForFramework("ArchitectureSwitch.dll", "net11.0"); - ExecuteApplication($"{s_privateX64Installation}/{GetMuxerName}", $"test {buildAssemblyPath} --framework net11.0 --arch arm64", out stdOut, out _, out _, env, projectDirectory); + var buildAssemblyPath = GetTestDllForFramework("ArchitectureSwitch.dll", "net12.0"); + ExecuteApplication($"{s_privateX64Installation}/{GetMuxerName}", $"test {buildAssemblyPath} --framework net12.0 --arch arm64", out stdOut, out _, out _, env, projectDirectory); AssertSwitch(stdOut); static void AssertSwitch(string output) @@ -203,7 +203,7 @@ public void PrivateX64BuildToDOTNET_ROOTS_EnvironmentVariables(bool dotnetRoot, var projectDirectory = Path.GetDirectoryName(projectPath); // Verify native architecture - ExecuteApplication(privateInstallationMuxer, $"test {projectPath} --framework net11.0", out string stdOut, out _, out _, env, projectDirectory); + ExecuteApplication(privateInstallationMuxer, $"test {projectPath} --framework net12.0", out string stdOut, out _, out _, env, projectDirectory); Assert.IsTrue(Regex.IsMatch(stdOut.Replace(@"\", "/"), $"Runtime location: .*{s_privateX64Installation.Replace(@"\", "/")}.*shared.*Microsoft.NETCore.App"), "Unexpected runtime location"); Assert.Contains("OSArchitecture: X64", stdOut, "Unexpected OSArchitecture"); Assert.Contains("ProcessArchitecture: X64", stdOut, "Unexpected ProcessArchitecture"); @@ -221,12 +221,12 @@ public void PrivateX64BuildToDOTNET_ROOTS_EnvironmentVariables(bool dotnetRoot, } // Verify switch using csproj - ExecuteApplication($"{s_privateX64Installation}/{GetMuxerName}", $"test {projectPath} --framework net11.0 --arch arm64", out stdOut, out _, out _, env, projectDirectory); + ExecuteApplication($"{s_privateX64Installation}/{GetMuxerName}", $"test {projectPath} --framework net12.0 --arch arm64", out stdOut, out _, out _, env, projectDirectory); AssertSwitch(stdOut); // Verify switch using test container - var buildAssemblyPath = GetTestDllForFramework("ArchitectureSwitch.dll", "net11.0"); - ExecuteApplication($"{s_privateX64Installation}/{GetMuxerName}", $"test {buildAssemblyPath} --framework net11.0 --arch arm64", out stdOut, out _, out _, env, projectDirectory); + var buildAssemblyPath = GetTestDllForFramework("ArchitectureSwitch.dll", "net12.0"); + ExecuteApplication($"{s_privateX64Installation}/{GetMuxerName}", $"test {buildAssemblyPath} --framework net12.0 --arch arm64", out stdOut, out _, out _, env, projectDirectory); AssertSwitch(stdOut); void AssertSwitch(string output) @@ -270,7 +270,7 @@ public void SilentlyForceX64() "/usr/local/share/dotnet/x64" : $@"{Environment.ExpandEnvironmentVariables("%ProgramFiles%")}\dotnet\x64"; - private static string GetFrameworkVersionToForceToX64 => "net11.0"; + private static string GetFrameworkVersionToForceToX64 => "net12.0"; private static string GetDefaultLocation => RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? $"/usr/local/share/dotnet" : diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetHostArchitectureVerifierTests.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetHostArchitectureVerifierTests.cs index 68f6efc752..ea071c2609 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetHostArchitectureVerifierTests.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetHostArchitectureVerifierTests.cs @@ -45,7 +45,7 @@ public void VerifyHostArchitecture(string architecture) ["DOTNET_CLI_HOME"] = CreateIsolatedTemplateEngineHome(TempDirectory.Path) }; - ExecuteApplication(dotnetPath, "new mstest", out _, out _, out _, environmentVariables, TempDirectory.Path); + ExecuteApplication(dotnetPath, $"new mstest --framework {AcceptanceTestBase.Core12TargetFramework}", out _, out _, out _, environmentVariables, TempDirectory.Path); // Patch test file File.WriteAllText(Path.Combine(TempDirectory.Path, "UnitTest1.cs"), diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetRootArchitectureMismatchTests.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetRootArchitectureMismatchTests.cs index c3492b4331..cfe7834a6c 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetRootArchitectureMismatchTests.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetRootArchitectureMismatchTests.cs @@ -37,12 +37,12 @@ public class DotnetRootArchitectureMismatchTests : AcceptanceTestBase public void RunningX86NetTestThroughVsTestConsoleExeWithX64DotnetRootRunsWithoutErrors() { // Desktop runner => vstest.console.exe (.NET Framework) is invoked directly, which is the - // scenario where the SDK does not pass VSTEST_DOTNET_ROOT_PATH. Target net11.0 + /Platform:x86 + // scenario where the SDK does not pass VSTEST_DOTNET_ROOT_PATH. Target net12.0 + /Platform:x86 // makes vstest launch an x86 testhost that resolves its runtime from the DOTNET_ROOT* variables. SetTestEnvironment(_testEnvironment, new RunnerInfo { RunnerFramework = DesktopRunnerFramework, - TargetFramework = Core11TargetFramework, + TargetFramework = Core12TargetFramework, InIsolationValue = InIsolation, }); @@ -52,7 +52,7 @@ public void RunningX86NetTestThroughVsTestConsoleExeWithX64DotnetRootRunsWithout var x86DotnetRoot = Path.GetDirectoryName(GetDownloadedDotnetMuxerFromTools("X86"))!; var arguments = PrepareArguments( - GetTestDllForFramework("SimpleTestProject.dll", Core11TargetFramework, automaticallyResolveCompatibilityTestAsset: false), + GetTestDllForFramework("SimpleTestProject.dll", Core12TargetFramework, automaticallyResolveCompatibilityTestAsset: false), GetTestAdapterPath(), string.Empty, FrameworkArgValue, diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/FrameworkTests.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/FrameworkTests.cs index 925b1edd59..0eb71788ab 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/FrameworkTests.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/FrameworkTests.cs @@ -79,8 +79,8 @@ public void RunSpecificTestsShouldWorkWithFrameworkInCompatibleWarning(RunnerInf InvokeVsTest(arguments); - // When this test runs it provides an incorrect desired framework for the run. E.g. the dll is actually net11.0 - // but we request to run as .NET Framework 4.0. On windows this has predictable results, for net11.0 dll we fail + // When this test runs it provides an incorrect desired framework for the run. E.g. the dll is actually net12.0 + // but we request to run as .NET Framework 4.0. On windows this has predictable results, for net12.0 dll we fail // to load it into .NET Framework testhost.exe, and fail with "No test is available". For .NET Framework dll, we // just log a warning saying that we provided .NET Framework 481 dlls (or whatever the current tfm for test dlls is), // but the settings requested .NET Framework 4.0. The test will still run because .NET Framework is compatible, and in reality @@ -93,7 +93,7 @@ public void RunSpecificTestsShouldWorkWithFrameworkInCompatibleWarning(RunnerInf { StdErrorContains("Running .NET Framework tests is supported on Windows only"); } - else if (runnerInfo.TargetFramework.Contains("net11")) + else if (runnerInfo.TargetFramework.Contains("net12")) { StdOutputContains("No test is available"); } diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Microsoft.TestPlatform.Acceptance.IntegrationTests.csproj b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Microsoft.TestPlatform.Acceptance.IntegrationTests.csproj index b161f9fefb..981e9a8950 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Microsoft.TestPlatform.Acceptance.IntegrationTests.csproj +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Microsoft.TestPlatform.Acceptance.IntegrationTests.csproj @@ -9,7 +9,7 @@ Exe - net11.0 + net12.0 diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/MtpUnderVstestTests.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/MtpUnderVstestTests.cs index ea238bb9c9..d0fb7774ad 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/MtpUnderVstestTests.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/MtpUnderVstestTests.cs @@ -62,7 +62,7 @@ public void MtpApplicationIsNotRunWhenMtpTestHostIsDisabled(RunnerInfo runnerInf } [TestMethod] - // MTP apps are .NET (Core) applications. Pin the testhost axis to .NET so we drive the net11.0 MTP app + // MTP apps are .NET (Core) applications. Pin the testhost axis to .NET so we drive the net12.0 MTP app // from both the .NET Framework and the .NET console (the .NET Framework console exercises the Jsonite // JSON-RPC path; it is Windows-only and skipped elsewhere by the matrix). [TestMatrix(testHost: Target.Net)] diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/PostProcessingTests.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/PostProcessingTests.cs index ad7a2c8608..06cfa64759 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/PostProcessingTests.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/PostProcessingTests.cs @@ -42,7 +42,7 @@ public void DotnetSDKSimulation_PostProcessing() // Create and build a single test project once, then reuse it for all parallel vstest runs. string projectFolder = Path.Combine(TempDirectory.Path, "testproject"); // Give this test its own template cache; the shared one races with other scaffolds. - ExecuteApplication(GetConsoleRunnerPath(), $"new mstest -o {projectFolder}", out string setupStdOut, out string setupStdError, out int setupExitCode, new Dictionary { ["DOTNET_CLI_HOME"] = CreateIsolatedTemplateEngineHome(TempDirectory.Path) }); + ExecuteApplication(GetConsoleRunnerPath(), $"new mstest --framework {Core12TargetFramework} -o {projectFolder}", out string setupStdOut, out string setupStdError, out int setupExitCode, new Dictionary { ["DOTNET_CLI_HOME"] = CreateIsolatedTemplateEngineHome(TempDirectory.Path) }); Assert.AreEqual(0, setupExitCode); ExecuteApplication(GetConsoleRunnerPath(), $"build {projectFolder} -c release", out setupStdOut, out setupStdError, out setupExitCode); Assert.AreEqual(0, setupExitCode); diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/ProcessesInteractionTests.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/ProcessesInteractionTests.cs index 6f1034fec7..1fbcd78cd5 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/ProcessesInteractionTests.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/ProcessesInteractionTests.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.IO; +using System.Text.RegularExpressions; using Microsoft.TestPlatform.TestUtilities; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -17,31 +18,39 @@ public class ProcessesInteractionTests : AcceptanceTestBase /// flush its output and error streams).See https://github.com/microsoft/vstest/issues/3375 /// [TestMethod] + [DoNotParallelize] // Modifies the test asset's runtimeconfig.json on disk. [TestMatrix(testHost: Net)] public void WhenTestHostProcessExitsBecauseTheTargetedRuntimeIsNoFoundThenTheMessageIsCapturedFromTheErrorOutput(RunnerInfo runnerInfo) { // Arrange SetTestEnvironment(_testEnvironment, runnerInfo); const string testAssetProjectName = "SimpleTestProjectMessedUpTargetFramework"; - var assemblyPath = GetTestDllForFramework(testAssetProjectName + ".dll", Core11TargetFramework); - UpdateRuntimeConfigJsonWithInvalidFramework(assemblyPath, testAssetProjectName); + var assemblyPath = GetTestDllForFramework(testAssetProjectName + ".dll", Core12TargetFramework); - // Act - InvokeVsTest(assemblyPath); + // On the contrary to other tests, we need to modify the test asset we are using to replace + // the target framework with an invalid framework. This is why we have a specific test asset + // that's only meant to be used by this project. + var runtimeConfigJson = Path.Combine(Path.GetDirectoryName(assemblyPath)!, testAssetProjectName + ".runtimeconfig.json"); + var originalContent = File.ReadAllText(runtimeConfigJson); + try + { + // The version the SDK writes here is its own runtime version, not the one of the TFM, so don't match a fixed + // version. Use a version that cannot be found, because DOTNET_ROLL_FORWARD=LatestMajor would roll + // a low version like 0.0.0 forward to the installed runtime. + var updatedContent = Regex.Replace(originalContent, @"""version""\s*:\s*""[^""]+""", @"""version"": ""9999.0.0"""); + Assert.AreNotEqual(originalContent, updatedContent, "The framework version in runtimeconfig.json was not rewritten, did the test asset layout change?"); + File.WriteAllText(runtimeConfigJson, updatedContent); - // Assert - ExitCodeEquals(1); - StdErrorRegexIsMatch("You must install or update \\.NET to run this application\\. App: .*testhost\\.(exe|dll) Architecture: x64 Framework: 'Microsoft\\.NETCore\\.App', version '0\\.0\\.0.*' \\(x64\\)"); + // Act + InvokeVsTest(assemblyPath); - static void UpdateRuntimeConfigJsonWithInvalidFramework(string assemblyPath, string testAssetProjectName) + // Assert + ExitCodeEquals(1); + StdErrorRegexIsMatch("You must install or update \\.NET to run this application\\. App: .*testhost\\.(exe|dll) Architecture: x64 Framework: 'Microsoft\\.NETCore\\.App', version '9999\\.0\\.0' \\(x64\\)"); + } + finally { - // On the contrary to other tests, we need to modify the test asset we are using to replace - // the target framework with an invalid framework. This is why we have a specific test asset - // that's only meant to be used by this project. - var runtimeConfigJson = Path.Combine(Path.GetDirectoryName(assemblyPath)!, testAssetProjectName + ".runtimeconfig.json"); - var fileContent = File.ReadAllText(runtimeConfigJson); - var updatedContent = fileContent.Replace("\"version\": \"11.0.0", "\"version\": \"0.0.0"); - File.WriteAllText(runtimeConfigJson, updatedContent); + File.WriteAllText(runtimeConfigJson, originalContent); } } } diff --git a/test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/Microsoft.TestPlatform.AdapterUtilities.UnitTests.csproj b/test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/Microsoft.TestPlatform.AdapterUtilities.UnitTests.csproj index 5bd5286b9a..123f1b3e8a 100644 --- a/test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/Microsoft.TestPlatform.AdapterUtilities.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/Microsoft.TestPlatform.AdapterUtilities.UnitTests.csproj @@ -5,7 +5,7 @@ - net11.0;net481 + net12.0;net481 Exe Microsoft.TestPlatform.AdapterUtilities.UnitTests true diff --git a/test/Microsoft.TestPlatform.Build.UnitTests/Microsoft.TestPlatform.Build.UnitTests.csproj b/test/Microsoft.TestPlatform.Build.UnitTests/Microsoft.TestPlatform.Build.UnitTests.csproj index c3513f9dab..c570f4cad0 100644 --- a/test/Microsoft.TestPlatform.Build.UnitTests/Microsoft.TestPlatform.Build.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.Build.UnitTests/Microsoft.TestPlatform.Build.UnitTests.csproj @@ -6,7 +6,7 @@ - net11.0;net481 + net12.0;net481 Exe Microsoft.TestPlatform.Build.UnitTests diff --git a/test/Microsoft.TestPlatform.Client.UnitTests/Microsoft.TestPlatform.Client.UnitTests.csproj b/test/Microsoft.TestPlatform.Client.UnitTests/Microsoft.TestPlatform.Client.UnitTests.csproj index 0e07600f36..19ebfdcaed 100644 --- a/test/Microsoft.TestPlatform.Client.UnitTests/Microsoft.TestPlatform.Client.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.Client.UnitTests/Microsoft.TestPlatform.Client.UnitTests.csproj @@ -6,7 +6,7 @@ - net11.0;net481 + net12.0;net481 Exe Microsoft.TestPlatform.Client.UnitTests diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/Microsoft.TestPlatform.Common.UnitTests.csproj b/test/Microsoft.TestPlatform.Common.UnitTests/Microsoft.TestPlatform.Common.UnitTests.csproj index d0d6a2f8bc..fd74a03ff9 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/Microsoft.TestPlatform.Common.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.Common.UnitTests/Microsoft.TestPlatform.Common.UnitTests.csproj @@ -6,7 +6,7 @@ - net11.0;net481 + net12.0;net481 Exe Microsoft.TestPlatform.Common.UnitTests diff --git a/test/Microsoft.TestPlatform.CommunicationUtilities.Platform.UnitTests/Microsoft.TestPlatform.CommunicationUtilities.Platform.UnitTests.csproj b/test/Microsoft.TestPlatform.CommunicationUtilities.Platform.UnitTests/Microsoft.TestPlatform.CommunicationUtilities.Platform.UnitTests.csproj index d5d7341edd..f326e5d4c7 100644 --- a/test/Microsoft.TestPlatform.CommunicationUtilities.Platform.UnitTests/Microsoft.TestPlatform.CommunicationUtilities.Platform.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.CommunicationUtilities.Platform.UnitTests/Microsoft.TestPlatform.CommunicationUtilities.Platform.UnitTests.csproj @@ -6,7 +6,7 @@ - net11.0;net481 + net12.0;net481 Exe Microsoft.TestPlatform.CommunicationUtilities.PlatformTests diff --git a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/Microsoft.TestPlatform.CommunicationUtilities.UnitTests.csproj b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/Microsoft.TestPlatform.CommunicationUtilities.UnitTests.csproj index dd40863a45..4c373b7119 100644 --- a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/Microsoft.TestPlatform.CommunicationUtilities.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/Microsoft.TestPlatform.CommunicationUtilities.UnitTests.csproj @@ -6,7 +6,7 @@ - net11.0;net481 + net12.0;net481 Exe Microsoft.TestPlatform.CommunicationUtilities.UnitTests diff --git a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/NativeAotCompatibilityTests.cs b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/NativeAotCompatibilityTests.cs index 7f1aace69f..a97a4c3edf 100644 --- a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/NativeAotCompatibilityTests.cs +++ b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/NativeAotCompatibilityTests.cs @@ -30,7 +30,7 @@ public class NativeAotCompatibilityTests { private static readonly string TestAssetPath = Path.GetFullPath( Path.Combine( - // Navigate from the test output directory (artifacts/bin//Debug/net11.0) + // Navigate from the test output directory (artifacts/bin//Debug/net12.0) // to the repo root, then into the test asset. AppContext.BaseDirectory, "..", "..", "..", "..", "..", diff --git a/test/Microsoft.TestPlatform.CoreUtilities.UnitTests/Microsoft.TestPlatform.CoreUtilities.UnitTests.csproj b/test/Microsoft.TestPlatform.CoreUtilities.UnitTests/Microsoft.TestPlatform.CoreUtilities.UnitTests.csproj index ff49f2e7a8..e22d5eba06 100644 --- a/test/Microsoft.TestPlatform.CoreUtilities.UnitTests/Microsoft.TestPlatform.CoreUtilities.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.CoreUtilities.UnitTests/Microsoft.TestPlatform.CoreUtilities.UnitTests.csproj @@ -6,7 +6,7 @@ - net11.0;net481 + net12.0;net481 Exe Microsoft.TestPlatform.CoreUtilities.UnitTests diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/BaseRunTestsTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/BaseRunTestsTests.cs index 05567c804c..a8c5132cc3 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/BaseRunTestsTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/BaseRunTestsTests.cs @@ -586,6 +586,16 @@ public void RunTestsShouldRaiseTestRunComplete() Assert.AreSequenceEqual(expectedUris, _receivedExecutorUris!.ToArray()); } + [TestMethod] + public void RunTestsShouldDisposeFrameworkHandle() + { + SetUpTestRunEvents(); + + _runTestsInstance.RunTests(); + + Assert.ThrowsExactly(() => _runTestsInstance.GetFrameworkHandle.LaunchProcessWithDebuggerAttached(null!, null, null, null)); + } + [TestMethod] public void RunTestsShouldNotCloneTestCaseAndTestResultsObjectForNonPackageSource() { diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Microsoft.TestPlatform.CrossPlatEngine.UnitTests.csproj b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Microsoft.TestPlatform.CrossPlatEngine.UnitTests.csproj index 38243e0c1e..19ed8444d3 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Microsoft.TestPlatform.CrossPlatEngine.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Microsoft.TestPlatform.CrossPlatEngine.UnitTests.csproj @@ -7,7 +7,7 @@ Microsoft.TestPlatform.CrossPlatEngine.UnitTests - net11.0;net481 + net12.0;net481 Exe diff --git a/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests.csproj b/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests.csproj index 81f6179c04..3cdd41e56b 100644 --- a/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests.csproj @@ -19,7 +19,7 @@ Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests - net11.0;net481 + net12.0;net481 Exe Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests diff --git a/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests.csproj b/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests.csproj index aaa0487d1e..0f145d2cef 100644 --- a/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests.csproj @@ -6,7 +6,7 @@ - net11.0;net481 + net12.0;net481 Exe diff --git a/test/Microsoft.TestPlatform.Extensions.TestIdsLogger.UnitTests/Microsoft.TestPlatform.Extensions.TestIdsLogger.UnitTests.csproj b/test/Microsoft.TestPlatform.Extensions.TestIdsLogger.UnitTests/Microsoft.TestPlatform.Extensions.TestIdsLogger.UnitTests.csproj index ee6c46e5d9..4e1975e043 100644 --- a/test/Microsoft.TestPlatform.Extensions.TestIdsLogger.UnitTests/Microsoft.TestPlatform.Extensions.TestIdsLogger.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.Extensions.TestIdsLogger.UnitTests/Microsoft.TestPlatform.Extensions.TestIdsLogger.UnitTests.csproj @@ -6,7 +6,7 @@ - net11.0;net481 + net12.0;net481 Exe $(NoWarn);VSTEST001 diff --git a/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests.csproj b/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests.csproj index db5b8acd2b..7cf67b9003 100644 --- a/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests.csproj @@ -6,7 +6,7 @@ - net11.0;net481 + net12.0;net481 Exe Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests diff --git a/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/TrxLoggerTests.cs b/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/TrxLoggerTests.cs index 9f7a34dc3c..59045eb390 100644 --- a/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/TrxLoggerTests.cs +++ b/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/TrxLoggerTests.cs @@ -723,14 +723,14 @@ public void DefaultTrxFileShouldCreateIfLogFileNameParameterNotPassed() public void DefaultTrxFileNameShouldIncludeFrameworkWhenAvailable() { _parameters.Remove(TrxLoggerConstants.LogFileNameKey); - _parameters[DefaultLoggerParameterNames.TargetFramework] = ".NETCoreApp,Version=v11.0"; + _parameters[DefaultLoggerParameterNames.TargetFramework] = ".NETCoreApp,Version=v12.0"; _testableTrxLogger.Initialize(_events.Object, _parameters); MakeTestRunComplete(); var fileName = Path.GetFileName(_testableTrxLogger.TrxFile); Assert.IsNotNull(fileName); - Assert.Contains("_net11.0", fileName, $"Expected TFM 'net11.0' in filename but got: {fileName}"); + Assert.Contains("_net12.0", fileName, $"Expected TFM 'net12.0' in filename but got: {fileName}"); Assert.EndsWith(".trx", fileName, $"Expected .trx extension but got: {fileName}"); } diff --git a/test/Microsoft.TestPlatform.Library.IntegrationTests/AssemblyMetadataProviderTests.cs b/test/Microsoft.TestPlatform.Library.IntegrationTests/AssemblyMetadataProviderTests.cs index 4171983657..8ec8a1df8f 100644 --- a/test/Microsoft.TestPlatform.Library.IntegrationTests/AssemblyMetadataProviderTests.cs +++ b/test/Microsoft.TestPlatform.Library.IntegrationTests/AssemblyMetadataProviderTests.cs @@ -56,7 +56,7 @@ public void Cleanup() [TestMethod] [DataRow("net481")] - [DataRow("net11.0")] + [DataRow("net12.0")] public void GetArchitectureShouldReturnCorrentArchForx64Assembly(string framework) { TestDotnetAssemblyArch("SimpleTestProject3", framework, Architecture.X64, expectedElapsedTime: ExpectedTimeForFindingArchForDotNetAssembly); @@ -64,7 +64,7 @@ public void GetArchitectureShouldReturnCorrentArchForx64Assembly(string framewor [TestMethod] [DataRow("net481")] - [DataRow("net11.0")] + [DataRow("net12.0")] public void GetArchitectureShouldReturnCorrentArchForx86Assembly(string framework) { TestDotnetAssemblyArch("SimpleTestProjectx86", framework, Architecture.X86, expectedElapsedTime: ExpectedTimeForFindingArchForDotNetAssembly); @@ -72,7 +72,7 @@ public void GetArchitectureShouldReturnCorrentArchForx86Assembly(string framewor [TestMethod] [DataRow("net481")] - [DataRow("net11.0")] + [DataRow("net12.0")] public void GetArchitectureShouldReturnCorrentArchForAnyCpuAssembly(string framework) { TestDotnetAssemblyArch("SimpleTestProject", framework, Architecture.AnyCPU, expectedElapsedTime: ExpectedTimeForFindingArchForDotNetAssembly); @@ -80,7 +80,7 @@ public void GetArchitectureShouldReturnCorrentArchForAnyCpuAssembly(string frame [TestMethod] [DataRow("net481")] - [DataRow("net11.0")] + [DataRow("net12.0")] public void GetArchitectureShouldReturnCorrentArchForArm64Assembly(string framework) { TestDotnetAssemblyArch("SimpleTestProjectARM64", framework, Architecture.ARM64, expectedElapsedTime: ExpectedTimeForFindingArchForDotNetAssembly); @@ -109,7 +109,7 @@ public void GetArchitectureForNativeDll(string platform) [TestMethod] [DataRow("net481")] - [DataRow("net11.0")] + [DataRow("net12.0")] public void GetFrameWorkForDotNetAssembly(string framework) { var expectedElapsedTime = 5; @@ -127,7 +127,7 @@ public void GetFrameWorkForDotNetAssembly(string framework) } else { - Assert.AreEqual(".NETCoreApp,Version=v11.0", actualFx.FullName); + Assert.AreEqual(".NETCoreApp,Version=v12.0", actualFx.FullName); } Console.WriteLine("Framework:{0}, {1}", framework, string.Format(CultureInfo.CurrentCulture, PerfAssertMessageFormat, expectedElapsedTime, stopWatch.ElapsedMilliseconds)); diff --git a/test/Microsoft.TestPlatform.Library.IntegrationTests/AssemblyPropertiesTests.cs b/test/Microsoft.TestPlatform.Library.IntegrationTests/AssemblyPropertiesTests.cs index 6db4d2ae19..ab8a074515 100644 --- a/test/Microsoft.TestPlatform.Library.IntegrationTests/AssemblyPropertiesTests.cs +++ b/test/Microsoft.TestPlatform.Library.IntegrationTests/AssemblyPropertiesTests.cs @@ -20,7 +20,7 @@ public AssemblyPropertiesTests() [TestMethod] [DataRow("net481")] - [DataRow("net11.0")] + [DataRow("net12.0")] public void GetAssemblyTypeForManagedDll(string framework) { var assemblyPath = _testEnvironment.GetTestAsset("SimpleTestProject3.dll", framework); @@ -48,7 +48,7 @@ public void GetAssemblyTypeForManagedExe() } [TestMethod] - [DataRow("net11.0")] + [DataRow("net12.0")] public void GetAssemblyTypeForNetCoreManagedExe(string framework) { var assemblyPath = _testEnvironment.GetTestAsset("ConsoleManagedApp.dll", framework); diff --git a/test/Microsoft.TestPlatform.Library.IntegrationTests/DiaSessionTests.cs b/test/Microsoft.TestPlatform.Library.IntegrationTests/DiaSessionTests.cs index 414e903f02..61b05cf4e1 100644 --- a/test/Microsoft.TestPlatform.Library.IntegrationTests/DiaSessionTests.cs +++ b/test/Microsoft.TestPlatform.Library.IntegrationTests/DiaSessionTests.cs @@ -20,7 +20,7 @@ public class DiaSessionTests : AcceptanceTestBase #if NETFRAMEWORK "net481"; #else - "net11.0"; + "net12.0"; #endif return currentTargetFrameWork; } diff --git a/test/Microsoft.TestPlatform.Library.IntegrationTests/Microsoft.TestPlatform.Library.IntegrationTests.csproj b/test/Microsoft.TestPlatform.Library.IntegrationTests/Microsoft.TestPlatform.Library.IntegrationTests.csproj index af740dde10..b23f05d970 100644 --- a/test/Microsoft.TestPlatform.Library.IntegrationTests/Microsoft.TestPlatform.Library.IntegrationTests.csproj +++ b/test/Microsoft.TestPlatform.Library.IntegrationTests/Microsoft.TestPlatform.Library.IntegrationTests.csproj @@ -9,7 +9,7 @@ Exe - net11.0;net481 + net12.0;net481 diff --git a/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Microsoft.TestPlatform.ObjectModel.UnitTests.csproj b/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Microsoft.TestPlatform.ObjectModel.UnitTests.csproj index 9506c545f6..c7e9505228 100644 --- a/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Microsoft.TestPlatform.ObjectModel.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Microsoft.TestPlatform.ObjectModel.UnitTests.csproj @@ -6,7 +6,7 @@ - net11.0;net481 + net12.0;net481 Exe Microsoft.TestPlatform.ObjectModel.UnitTests diff --git a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Microsoft.TestPlatform.TestHostProvider.UnitTests.csproj b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Microsoft.TestPlatform.TestHostProvider.UnitTests.csproj index 9f71ccd9af..e4d18b7e87 100644 --- a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Microsoft.TestPlatform.TestHostProvider.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Microsoft.TestPlatform.TestHostProvider.UnitTests.csproj @@ -7,7 +7,7 @@ Microsoft.TestPlatform.TestHostProvider.UnitTests - net11.0;net481 + net12.0;net481 Exe diff --git a/test/Microsoft.TestPlatform.TestUtilities/AcceptanceTestBase.cs b/test/Microsoft.TestPlatform.TestUtilities/AcceptanceTestBase.cs index 26b03549a5..06b461d694 100644 --- a/test/Microsoft.TestPlatform.TestUtilities/AcceptanceTestBase.cs +++ b/test/Microsoft.TestPlatform.TestUtilities/AcceptanceTestBase.cs @@ -13,14 +13,14 @@ public class AcceptanceTestBase : IntegrationTestBase // Target framework constants for test assets. public const string Net462TargetFramework = "net462"; public const string Net481TargetFramework = "net481"; - public const string Core11TargetFramework = "net11.0"; + public const string Core12TargetFramework = "net12.0"; public const string DesktopTargetFramework = Net481TargetFramework; // Framework argument values for vstest.console --framework parameter. public const string Net462FrameworkArgValue = ".NETFramework,Version=v4.6.2"; public const string Net481FrameworkArgValue = ".NETFramework,Version=v4.8.1"; - public const string Core11FrameworkArgValue = ".NETCoreApp,Version=v11.0"; + public const string Core12FrameworkArgValue = ".NETCoreApp,Version=v12.0"; public const string DesktopFrameworkArgValue = Net481FrameworkArgValue; @@ -30,17 +30,17 @@ public class AcceptanceTestBase : IntegrationTestBase // Test asset target framework lists. public const string NETFX = Net481TargetFramework; - public const string NETFX_AND_NET = "net481;net11.0"; + public const string NETFX_AND_NET = "net481;net12.0"; // Runner frameworks. public const string RUNNER_NETFX = Net481TargetFramework; - public const string RUNNER_NET = Core11TargetFramework; - public const string RUNNER_NETFX_AND_NET = "net481;net11.0"; + public const string RUNNER_NET = Core12TargetFramework; + public const string RUNNER_NETFX_AND_NET = "net481;net12.0"; // Host frameworks (test asset TFMs). public const string HOST_NETFX = Net481TargetFramework; - public const string HOST_NET = Core11TargetFramework; - public const string HOST_NETFX_AND_NET = "net481;net11.0"; + public const string HOST_NET = Core12TargetFramework; + public const string HOST_NETFX_AND_NET = "net481;net12.0"; public const string LATEST_TO_LEGACY = "Latest;LatestPreview;LatestStable;RecentStable;MostDownloaded;PreviousStable;LegacyStable"; public const string LATEST_TO_RECENT_STABLE = "Latest;LatestPreview;LatestStable;RecentStable"; @@ -73,7 +73,7 @@ protected static void SetTestEnvironment(IntegrationTestEnvironment testEnvironm protected static string DeriveFrameworkArgValue(IntegrationTestEnvironment testEnvironment) => testEnvironment.TargetFramework switch { - Core11TargetFramework => Core11FrameworkArgValue, + Core12TargetFramework => Core12FrameworkArgValue, Net462TargetFramework => Net462FrameworkArgValue, Net481TargetFramework => Net481FrameworkArgValue, _ => throw new NotSupportedException($"{testEnvironment.TargetFramework} is not supported TargetFramework value."), diff --git a/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs b/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs index 34a3f04134..acbb1eaa6c 100644 --- a/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs +++ b/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs @@ -32,7 +32,7 @@ namespace Microsoft.TestPlatform.TestUtilities; public class IntegrationTestBase { public const string DesktopRunnerFramework = "net481"; - public const string CoreRunnerFramework = "net11.0"; + public const string CoreRunnerFramework = "net12.0"; private const string TotalTestsMessage = "Total tests: {0}"; private const string PassedTestsMessage = " Passed: {0}"; diff --git a/test/Microsoft.TestPlatform.TestUtilities/Microsoft.TestPlatform.TestUtilities.csproj b/test/Microsoft.TestPlatform.TestUtilities/Microsoft.TestPlatform.TestUtilities.csproj index 96f326e130..66e1f853b9 100644 --- a/test/Microsoft.TestPlatform.TestUtilities/Microsoft.TestPlatform.TestUtilities.csproj +++ b/test/Microsoft.TestPlatform.TestUtilities/Microsoft.TestPlatform.TestUtilities.csproj @@ -3,7 +3,7 @@ Microsoft.TestPlatform.TestUtilities - net11.0;net481 + net12.0;net481 false true diff --git a/test/Microsoft.TestPlatform.TestUtilities/NetCoreTargetFrameworkDataSourceAttribute.cs b/test/Microsoft.TestPlatform.TestUtilities/NetCoreTargetFrameworkDataSourceAttribute.cs index f8d9a3cfb2..e8f18995d7 100644 --- a/test/Microsoft.TestPlatform.TestUtilities/NetCoreTargetFrameworkDataSourceAttribute.cs +++ b/test/Microsoft.TestPlatform.TestUtilities/NetCoreTargetFrameworkDataSourceAttribute.cs @@ -66,14 +66,14 @@ public IEnumerable GetData(MethodInfo methodInfo) { var runnerFramework = IntegrationTestBase.DesktopRunnerFramework; - AddRunnerDataRow(dataRows, runnerFramework, AcceptanceTestBase.Core11TargetFramework); + AddRunnerDataRow(dataRows, runnerFramework, AcceptanceTestBase.Core12TargetFramework); } if (_useCoreRunner) { var runnerFramework = IntegrationTestBase.CoreRunnerFramework; - AddRunnerDataRow(dataRows, runnerFramework, AcceptanceTestBase.Core11TargetFramework); + AddRunnerDataRow(dataRows, runnerFramework, AcceptanceTestBase.Core12TargetFramework); } return dataRows; diff --git a/test/Microsoft.TestPlatform.TestUtilities/TestMatrixAttribute.cs b/test/Microsoft.TestPlatform.TestUtilities/TestMatrixAttribute.cs index d914a2b564..49532e0f53 100644 --- a/test/Microsoft.TestPlatform.TestUtilities/TestMatrixAttribute.cs +++ b/test/Microsoft.TestPlatform.TestUtilities/TestMatrixAttribute.cs @@ -16,7 +16,7 @@ namespace Microsoft.TestPlatform.TestUtilities; /// using the locally-built bits. Each generated row is handed to the test as a . /// /// With no arguments the test runs the full matrix: both consoles — .NET Framework (vstest.console.exe) -/// and .NET (dotnet vstest.console.dll) — against both testhost target frameworks (net481 and net11.0). +/// and .NET (dotnet vstest.console.dll) — against both testhost target frameworks (net481 and net12.0). /// Pin an axis to narrow it, e.g. [TestMatrix(testHost: Net)] keeps both consoles but only the /// .NET testhost, and [TestMatrix(console: Net)] keeps both testhosts but only the .NET console. /// @@ -36,7 +36,7 @@ public sealed class TestMatrixAttribute : Attribute, ITestDataSource /// Initializes a new instance of the class. /// /// Which vstest.console to run: both (default), only .NET Framework, or only .NET. - /// Which testhost target framework to run against: both (default), only net481, or only net11.0. + /// Which testhost target framework to run against: both (default), only net481, or only net12.0. /// Emit the /InIsolation row for the .NET Framework console × .NET Framework testhost cell (default ). Ignored for every other cell. /// Additionally run the .NET Framework console × .NET Framework testhost cell in-process (without /InIsolation). Ignored for every other cell. /// Additively run the vstest.console shipped in the Visual Studio VSIX as its own row (a .NET Framework console and testhost), independent of the and axes. Windows-only. @@ -70,7 +70,7 @@ public IEnumerable GetData(MethodInfo methodInfo) var wantNetHost = _testHost is Target.Both or Target.Net; // .NET Framework testhost (net481) is Windows-only in its entirety. Emitted first so that for the - // both-testhost matrix the rows are ordered net481 then net11.0, matching the legacy attributes. + // both-testhost matrix the rows are ordered net481 then net12.0, matching the legacy attributes. if (wantNetFxHost && isWindows) { if (wantNetConsole) @@ -99,19 +99,19 @@ public IEnumerable GetData(MethodInfo methodInfo) AddRow(dataRows, IntegrationTestBase.DesktopRunnerFramework, AcceptanceTestBase.DesktopTargetFramework, inIsolationValue: null, vsixConsole: true); } - // .NET testhost (net11.0). + // .NET testhost (net12.0). if (wantNetHost) { // .NET Framework console driving a .NET testhost is Windows-only; never isolated. if (wantNetFxConsole && isWindows) { - AddRow(dataRows, IntegrationTestBase.DesktopRunnerFramework, AcceptanceTestBase.Core11TargetFramework, inIsolationValue: null); + AddRow(dataRows, IntegrationTestBase.DesktopRunnerFramework, AcceptanceTestBase.Core12TargetFramework, inIsolationValue: null); } // .NET console driving a .NET testhost runs on every OS. if (wantNetConsole) { - AddRow(dataRows, IntegrationTestBase.CoreRunnerFramework, AcceptanceTestBase.Core11TargetFramework, inIsolationValue: null); + AddRow(dataRows, IntegrationTestBase.CoreRunnerFramework, AcceptanceTestBase.Core12TargetFramework, inIsolationValue: null); } } @@ -155,7 +155,7 @@ private void AddRow(List dataRows, string runnerFramework, string targ /// /// Selects a runtime family — .NET Framework or .NET — for an axis of . /// Shared by the console axis (vstest.console.exe vs dotnet vstest.console.dll) and the -/// testHost axis (net481 vs net11.0); the parameter name selects which axis it applies to. +/// testHost axis (net481 vs net12.0); the parameter name selects which axis it applies to. /// public enum Target { @@ -165,6 +165,6 @@ public enum Target /// Run only the .NET Framework variant (vstest.console.exe / net481 testhost). NetFx, - /// Run only the .NET variant (dotnet vstest.console.dll / net11.0 testhost). + /// Run only the .NET variant (dotnet vstest.console.dll / net12.0 testhost). Net, } diff --git a/test/Microsoft.TestPlatform.Utilities.UnitTests/Microsoft.TestPlatform.Utilities.UnitTests.csproj b/test/Microsoft.TestPlatform.Utilities.UnitTests/Microsoft.TestPlatform.Utilities.UnitTests.csproj index 454342e6e5..c6ec429168 100644 --- a/test/Microsoft.TestPlatform.Utilities.UnitTests/Microsoft.TestPlatform.Utilities.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.Utilities.UnitTests/Microsoft.TestPlatform.Utilities.UnitTests.csproj @@ -7,7 +7,7 @@ - net11.0;net481 + net12.0;net481 Exe Microsoft.TestPlatform.Utilities.UnitTests diff --git a/test/TestAssets/ArchitectureSwitch/ArchitectureSwitch.csproj b/test/TestAssets/ArchitectureSwitch/ArchitectureSwitch.csproj index 4bfb0ad26b..6e24064a90 100644 --- a/test/TestAssets/ArchitectureSwitch/ArchitectureSwitch.csproj +++ b/test/TestAssets/ArchitectureSwitch/ArchitectureSwitch.csproj @@ -1,7 +1,7 @@ - net11.0 - net11.0 + net12.0 + net12.0 false diff --git a/test/TestAssets/Directory.Build.props b/test/TestAssets/Directory.Build.props index af14015d9a..0276a1cfdf 100644 --- a/test/TestAssets/Directory.Build.props +++ b/test/TestAssets/Directory.Build.props @@ -31,9 +31,9 @@ net481 - net11.0 + net12.0 net481 - net11.0 + net12.0 $(NetFrameworkTargetFrameworks);$(NetCoreAppTargetFrameworks) Latest diff --git a/test/TestAssets/MtpMSTestProject/MtpMSTestProject.csproj b/test/TestAssets/MtpMSTestProject/MtpMSTestProject.csproj index ac56343cab..e0308a8bea 100644 --- a/test/TestAssets/MtpMSTestProject/MtpMSTestProject.csproj +++ b/test/TestAssets/MtpMSTestProject/MtpMSTestProject.csproj @@ -2,9 +2,9 @@ - - net8.0;net11.0 + net8.0;net12.0 Exe enable diff --git a/test/TestAssets/SelfContainedAppTestProject/SelfContainedAppTestProject.csproj b/test/TestAssets/SelfContainedAppTestProject/SelfContainedAppTestProject.csproj index 2a94afebb8..f872310731 100644 --- a/test/TestAssets/SelfContainedAppTestProject/SelfContainedAppTestProject.csproj +++ b/test/TestAssets/SelfContainedAppTestProject/SelfContainedAppTestProject.csproj @@ -2,7 +2,7 @@ - net11.0 + net12.0 win-x64 diff --git a/test/TestAssets/Tools/Tools.csproj b/test/TestAssets/Tools/Tools.csproj index 0b09419270..28fbf6c125 100644 --- a/test/TestAssets/Tools/Tools.csproj +++ b/test/TestAssets/Tools/Tools.csproj @@ -6,7 +6,7 @@ - net11.0 + net12.0 Exe hanging_child diff --git a/test/TestAssets/child-crash/UnitTest1.cs b/test/TestAssets/child-crash/UnitTest1.cs index 15778d34a9..9d8caa9d06 100644 --- a/test/TestAssets/child-crash/UnitTest1.cs +++ b/test/TestAssets/child-crash/UnitTest1.cs @@ -24,7 +24,7 @@ public void TestMethod1() var directory = "Release"; #endif // wait for child to crash - var childProcess = Path.GetFullPath($@"../../../problematic-child/{directory}/net11.0/problematic-child{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : ".dll")}"); + var childProcess = Path.GetFullPath($@"../../../problematic-child/{directory}/net12.0/problematic-child{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : ".dll")}"); if (!File.Exists(childProcess)) { throw new FileNotFoundException(childProcess); diff --git a/test/TestAssets/child-crash/child-crash.csproj b/test/TestAssets/child-crash/child-crash.csproj index f34fb5f98a..1decfe8b12 100644 --- a/test/TestAssets/child-crash/child-crash.csproj +++ b/test/TestAssets/child-crash/child-crash.csproj @@ -6,7 +6,7 @@ - net11.0 + net12.0 child_crash false diff --git a/test/TestAssets/child-hang/UnitTest1.cs b/test/TestAssets/child-hang/UnitTest1.cs index ba33b903f7..6e3eb06f6b 100644 --- a/test/TestAssets/child-hang/UnitTest1.cs +++ b/test/TestAssets/child-hang/UnitTest1.cs @@ -25,7 +25,7 @@ public void TestMethod1() var directory = "Release"; #endif // wait for child to hang - var childProcess = Path.GetFullPath($@"../../../hanging-child/{directory}/net11.0/hanging-child{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : ".dll")}"); + var childProcess = Path.GetFullPath($@"../../../hanging-child/{directory}/net12.0/hanging-child{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : ".dll")}"); // 1 child, that is 2 hanging processes var process = (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? Process.Start(childProcess, "1") : Process.Start(GetFullPath("dotnet"), $"{childProcess} 1")); process.WaitForExit(); diff --git a/test/TestAssets/hanging-child/hanging-child.csproj b/test/TestAssets/hanging-child/hanging-child.csproj index 03db694ed0..e5b8b5db4e 100644 --- a/test/TestAssets/hanging-child/hanging-child.csproj +++ b/test/TestAssets/hanging-child/hanging-child.csproj @@ -6,7 +6,7 @@ - net11.0 + net12.0 Exe hanging_child diff --git a/test/TestAssets/performance/MSTest1000Passing/MSTest1000Passing.csproj b/test/TestAssets/performance/MSTest1000Passing/MSTest1000Passing.csproj index b35311993f..4a64031852 100644 --- a/test/TestAssets/performance/MSTest1000Passing/MSTest1000Passing.csproj +++ b/test/TestAssets/performance/MSTest1000Passing/MSTest1000Passing.csproj @@ -1,7 +1,7 @@ - net11.0;net481 + net12.0;net481 false diff --git a/test/TestAssets/performance/MSTest100Passing/MSTest100Passing.csproj b/test/TestAssets/performance/MSTest100Passing/MSTest100Passing.csproj index b35311993f..4a64031852 100644 --- a/test/TestAssets/performance/MSTest100Passing/MSTest100Passing.csproj +++ b/test/TestAssets/performance/MSTest100Passing/MSTest100Passing.csproj @@ -1,7 +1,7 @@ - net11.0;net481 + net12.0;net481 false diff --git a/test/TestAssets/performance/MSTest10kPassing/MSTest10kPassing.csproj b/test/TestAssets/performance/MSTest10kPassing/MSTest10kPassing.csproj index b35311993f..4a64031852 100644 --- a/test/TestAssets/performance/MSTest10kPassing/MSTest10kPassing.csproj +++ b/test/TestAssets/performance/MSTest10kPassing/MSTest10kPassing.csproj @@ -1,7 +1,7 @@ - net11.0;net481 + net12.0;net481 false diff --git a/test/TestAssets/performance/MSTest1Passing/MSTest1Passing.csproj b/test/TestAssets/performance/MSTest1Passing/MSTest1Passing.csproj index b35311993f..4a64031852 100644 --- a/test/TestAssets/performance/MSTest1Passing/MSTest1Passing.csproj +++ b/test/TestAssets/performance/MSTest1Passing/MSTest1Passing.csproj @@ -1,7 +1,7 @@ - net11.0;net481 + net12.0;net481 false diff --git a/test/TestAssets/performance/NUnit1000Passing/NUnit1000Passing.csproj b/test/TestAssets/performance/NUnit1000Passing/NUnit1000Passing.csproj index 53c58ae068..92203b35ee 100644 --- a/test/TestAssets/performance/NUnit1000Passing/NUnit1000Passing.csproj +++ b/test/TestAssets/performance/NUnit1000Passing/NUnit1000Passing.csproj @@ -1,7 +1,7 @@ - net11.0;net481 + net12.0;net481 diff --git a/test/TestAssets/performance/NUnit100Passing/NUnit100Passing.csproj b/test/TestAssets/performance/NUnit100Passing/NUnit100Passing.csproj index 53c58ae068..92203b35ee 100644 --- a/test/TestAssets/performance/NUnit100Passing/NUnit100Passing.csproj +++ b/test/TestAssets/performance/NUnit100Passing/NUnit100Passing.csproj @@ -1,7 +1,7 @@ - net11.0;net481 + net12.0;net481 diff --git a/test/TestAssets/performance/NUnit10kPassing/NUnit10kPassing.csproj b/test/TestAssets/performance/NUnit10kPassing/NUnit10kPassing.csproj index 53c58ae068..92203b35ee 100644 --- a/test/TestAssets/performance/NUnit10kPassing/NUnit10kPassing.csproj +++ b/test/TestAssets/performance/NUnit10kPassing/NUnit10kPassing.csproj @@ -1,7 +1,7 @@ - net11.0;net481 + net12.0;net481 diff --git a/test/TestAssets/performance/NUnit1Passing/NUnit1Passing.csproj b/test/TestAssets/performance/NUnit1Passing/NUnit1Passing.csproj index 53c58ae068..92203b35ee 100644 --- a/test/TestAssets/performance/NUnit1Passing/NUnit1Passing.csproj +++ b/test/TestAssets/performance/NUnit1Passing/NUnit1Passing.csproj @@ -1,7 +1,7 @@ - net11.0;net481 + net12.0;net481 diff --git a/test/TestAssets/performance/Perfy.TestAdapter/Perfy.TestAdapter.csproj b/test/TestAssets/performance/Perfy.TestAdapter/Perfy.TestAdapter.csproj index 4163d6f05a..2c2d673fd8 100644 --- a/test/TestAssets/performance/Perfy.TestAdapter/Perfy.TestAdapter.csproj +++ b/test/TestAssets/performance/Perfy.TestAdapter/Perfy.TestAdapter.csproj @@ -1,7 +1,7 @@ - net481;net11.0 + net481;net12.0 false diff --git a/test/TestAssets/performance/XUnit1000Passing/XUnit1000Passing.csproj b/test/TestAssets/performance/XUnit1000Passing/XUnit1000Passing.csproj index f9aec05ebf..6d7718e13c 100644 --- a/test/TestAssets/performance/XUnit1000Passing/XUnit1000Passing.csproj +++ b/test/TestAssets/performance/XUnit1000Passing/XUnit1000Passing.csproj @@ -1,7 +1,7 @@ - net11.0;net481 + net12.0;net481 false diff --git a/test/TestAssets/performance/XUnit100Passing/XUnit100Passing.csproj b/test/TestAssets/performance/XUnit100Passing/XUnit100Passing.csproj index f9aec05ebf..6d7718e13c 100644 --- a/test/TestAssets/performance/XUnit100Passing/XUnit100Passing.csproj +++ b/test/TestAssets/performance/XUnit100Passing/XUnit100Passing.csproj @@ -1,7 +1,7 @@ - net11.0;net481 + net12.0;net481 false diff --git a/test/TestAssets/performance/XUnit10kPassing/XUnit10kPassing.csproj b/test/TestAssets/performance/XUnit10kPassing/XUnit10kPassing.csproj index f9aec05ebf..6d7718e13c 100644 --- a/test/TestAssets/performance/XUnit10kPassing/XUnit10kPassing.csproj +++ b/test/TestAssets/performance/XUnit10kPassing/XUnit10kPassing.csproj @@ -1,7 +1,7 @@ - net11.0;net481 + net12.0;net481 false diff --git a/test/TestAssets/performance/XUnit1Passing/XUnit1Passing.csproj b/test/TestAssets/performance/XUnit1Passing/XUnit1Passing.csproj index f9aec05ebf..6d7718e13c 100644 --- a/test/TestAssets/performance/XUnit1Passing/XUnit1Passing.csproj +++ b/test/TestAssets/performance/XUnit1Passing/XUnit1Passing.csproj @@ -1,7 +1,7 @@ - net11.0;net481 + net12.0;net481 false diff --git a/test/TestAssets/problematic-child/problematic-child.csproj b/test/TestAssets/problematic-child/problematic-child.csproj index 34f2e35b35..bb0abcbd83 100644 --- a/test/TestAssets/problematic-child/problematic-child.csproj +++ b/test/TestAssets/problematic-child/problematic-child.csproj @@ -6,7 +6,7 @@ - net11.0 + net12.0 Exe problematic_child diff --git a/test/TranslationLayer.UnitTests/TranslationLayer.UnitTests.csproj b/test/TranslationLayer.UnitTests/TranslationLayer.UnitTests.csproj index 53225dd818..5c76952abd 100644 --- a/test/TranslationLayer.UnitTests/TranslationLayer.UnitTests.csproj +++ b/test/TranslationLayer.UnitTests/TranslationLayer.UnitTests.csproj @@ -6,7 +6,7 @@ - net11.0;net481 + net12.0;net481 Exe TranslationLayer.UnitTests diff --git a/test/coverlet.collector/coverlet.collector.csproj b/test/coverlet.collector/coverlet.collector.csproj index 8a2ae01490..c19291e47f 100644 --- a/test/coverlet.collector/coverlet.collector.csproj +++ b/test/coverlet.collector/coverlet.collector.csproj @@ -1,6 +1,6 @@ - net11.0;net481 + net12.0;net481 false 9.9.9.9 diff --git a/test/datacollector.PlatformTests/datacollector.PlatformTests.csproj b/test/datacollector.PlatformTests/datacollector.PlatformTests.csproj index 72350cc2bf..cf015229f9 100644 --- a/test/datacollector.PlatformTests/datacollector.PlatformTests.csproj +++ b/test/datacollector.PlatformTests/datacollector.PlatformTests.csproj @@ -8,7 +8,7 @@ Microsoft.VisualStudio.TestPlatform.DataCollector.PlatformTests - net11.0;net481 + net12.0;net481 Exe datacollector.PlatformTests diff --git a/test/datacollector.UnitTests/datacollector.UnitTests.csproj b/test/datacollector.UnitTests/datacollector.UnitTests.csproj index e3a43c405e..f8dbce8824 100644 --- a/test/datacollector.UnitTests/datacollector.UnitTests.csproj +++ b/test/datacollector.UnitTests/datacollector.UnitTests.csproj @@ -10,7 +10,7 @@ Exe - net11.0;net481 + net12.0;net481 datacollector.UnitTests diff --git a/test/testhost.UnitTests/testhost.UnitTests.csproj b/test/testhost.UnitTests/testhost.UnitTests.csproj index 79eda2040e..e7a6bfb710 100644 --- a/test/testhost.UnitTests/testhost.UnitTests.csproj +++ b/test/testhost.UnitTests/testhost.UnitTests.csproj @@ -6,7 +6,7 @@ - net11.0;net481 + net12.0;net481 Exe testhost.UnitTests x64 diff --git a/test/vstest.ProgrammerTests/vstest.ProgrammerTests.csproj b/test/vstest.ProgrammerTests/vstest.ProgrammerTests.csproj index a83c5eb50d..f5ade8236f 100644 --- a/test/vstest.ProgrammerTests/vstest.ProgrammerTests.csproj +++ b/test/vstest.ProgrammerTests/vstest.ProgrammerTests.csproj @@ -8,7 +8,7 @@ enable true - net11.0 + net12.0 Exe diff --git a/test/vstest.console.UnitTests/vstest.console.UnitTests.csproj b/test/vstest.console.UnitTests/vstest.console.UnitTests.csproj index f4c3128d4c..70b3cfe523 100644 --- a/test/vstest.console.UnitTests/vstest.console.UnitTests.csproj +++ b/test/vstest.console.UnitTests/vstest.console.UnitTests.csproj @@ -6,7 +6,7 @@ - net11.0;net481 + net12.0;net481 Exe vstest.console.UnitTests