From 6402fd92d43d37034610b9f14159601b3746cae7 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sat, 27 Apr 2024 19:28:50 -0700 Subject: [PATCH 01/29] Detect provision-image.ps1 failure. [tested] Use case-sensitive matching for 'PROVISION_IMAGE_SUCCEEDED'. --- azure-devops/create-1es-hosted-pool.ps1 | 11 +++++++++++ azure-devops/provision-image.ps1 | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/azure-devops/create-1es-hosted-pool.ps1 b/azure-devops/create-1es-hosted-pool.ps1 index 0814678ed9..736cee5bbf 100644 --- a/azure-devops/create-1es-hosted-pool.ps1 +++ b/azure-devops/create-1es-hosted-pool.ps1 @@ -220,6 +220,17 @@ $ProvisionImageResult = Invoke-AzVMRunCommand ` Write-Host $ProvisionImageResult.value.Message +if ($ProvisionImageResult.value.Message -cnotmatch 'PROVISION_IMAGE_SUCCEEDED') { + Write-Host 'provision-image.ps1 failed, stopping VM...' + + Stop-AzVM ` + -ResourceGroupName $ResourceGroupName ` + -Name $ProtoVMName ` + -Force | Out-Null + + Write-Error "VM stopped. Remember to delete unusable resource group: $ResourceGroupName" +} + #################################################################################################### Display-ProgressBar -Status 'Restarting VM' diff --git a/azure-devops/provision-image.ps1 b/azure-devops/provision-image.ps1 index 99f75eeee9..e09d39cafe 100644 --- a/azure-devops/provision-image.ps1 +++ b/azure-devops/provision-image.ps1 @@ -170,6 +170,7 @@ Write-Host 'Setting environment variables...' # The STL's PR/CI builds are totally unrepresentative of customer usage. [Environment]::SetEnvironmentVariable('VSCMD_SKIP_SENDTELEMETRY', '1', 'Machine') -Write-Host 'Done!' +# Tell create-1es-hosted-pool.ps1 that we succeeded. +Write-Host 'PROVISION_IMAGE_SUCCEEDED' exit From 2632a7604a2e5c001301af9fc50bf9a4fa8511db Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sat, 27 Apr 2024 22:10:39 -0700 Subject: [PATCH 02/29] Permanently install PowerShell 7.4.2. [tested] We need to preserve the original filename 'PowerShell-7.4.2-win-x64.msi' instead of generating 'RANDOM.exe'. --- azure-devops/provision-image.ps1 | 81 ++++---------------------------- 1 file changed, 10 insertions(+), 71 deletions(-) diff --git a/azure-devops/provision-image.ps1 b/azure-devops/provision-image.ps1 index e09d39cafe..afb9a16b22 100644 --- a/azure-devops/provision-image.ps1 +++ b/azure-devops/provision-image.ps1 @@ -15,76 +15,6 @@ for setting up new VMs in the scale set. $ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' -<# -.SYNOPSIS -Gets a random file path in the temp directory. - -.DESCRIPTION -Get-TempFilePath takes an extension, and returns a path with a random -filename component in the temporary directory with that extension. - -.PARAMETER Extension -The extension to use for the path. -#> -Function Get-TempFilePath { - [CmdletBinding(PositionalBinding=$false)] - Param( - [Parameter(Mandatory)][String]$Extension - ) - - $tempPath = [System.IO.Path]::GetTempPath() - $tempName = [System.IO.Path]::GetRandomFileName() + '.' + $Extension - return Join-Path $tempPath $tempName -} - -<# -.SYNOPSIS -Downloads and extracts a ZIP file to a newly created temporary subdirectory. - -.DESCRIPTION -DownloadAndExtractZip returns a path containing the extracted contents. - -.PARAMETER Url -The URL of the ZIP file to download. -#> -Function DownloadAndExtractZip { - [CmdletBinding(PositionalBinding=$false)] - Param( - [Parameter(Mandatory)][String]$Url - ) - - $ZipPath = Get-TempFilePath -Extension 'zip' - curl.exe -L -o $ZipPath -s -S $Url - $TempSubdirPath = Get-TempFilePath -Extension 'dir' - Expand-Archive -Path $ZipPath -DestinationPath $TempSubdirPath -Force - Remove-Item -Path $ZipPath - - return $TempSubdirPath -} - -if ($PSVersionTable.PSVersion -lt [Version]::new('7.4.2')) { - Write-Host "Old PowerShell version: $($PSVersionTable.PSVersion)" - - # https://github.com/PowerShell/PowerShell/releases/latest - $PowerShellZipUrl = 'https://github.com/PowerShell/PowerShell/releases/download/v7.4.2/PowerShell-7.4.2-win-x64.zip' - Write-Host "Downloading: $PowerShellZipUrl" - $ExtractedPowerShellPath = DownloadAndExtractZip -Url $PowerShellZipUrl - $PwshPath = Join-Path $ExtractedPowerShellPath 'pwsh.exe' - - $PwshArgs = @( - '-ExecutionPolicy', - 'Unrestricted', - '-File', - $PSCommandPath - ) - Write-Host "Executing: $PwshPath $PwshArgs" - & $PwshPath $PwshArgs - - Write-Host 'Cleaning up...' - Remove-Item -Recurse -Path $ExtractedPowerShellPath - exit -} - $VisualStudioWorkloads = @( 'Microsoft.VisualStudio.Component.VC.ASAN', 'Microsoft.VisualStudio.Component.VC.CLI.Support', @@ -105,6 +35,10 @@ foreach ($workload in $VisualStudioWorkloads) { $VisualStudioArgs += $workload } +# https://github.com/PowerShell/PowerShell/releases/latest +$PowerShellUrl = 'https://github.com/PowerShell/PowerShell/releases/download/v7.4.2/PowerShell-7.4.2-win-x64.msi' +$PowerShellArgs = @('/quiet', '/norestart') + $PythonUrl = 'https://www.python.org/ftp/python/3.12.3/python-3.12.3-amd64.exe' $PythonArgs = @('/quiet', 'InstallAllUsers=1', 'PrependPath=1', 'CompileAll=1', 'Include_doc=0') @@ -137,7 +71,9 @@ Function DownloadAndInstall { try { Write-Host "Downloading $Name..." - [string]$installerPath = Get-TempFilePath -Extension 'exe' + $tempPath = [System.IO.Path]::GetTempPath() + $fileName = [uri]::new($Url).Segments[-1] + $installerPath = Join-Path $tempPath $fileName curl.exe -L -o $installerPath -s -S $Url Write-Host "Installing $Name..." @@ -158,9 +94,12 @@ Function DownloadAndInstall { } } +Write-Host "Old PowerShell version: $($PSVersionTable.PSVersion)" + # Print the Windows version, so we can verify whether Patch Tuesday has been picked up. cmd /c ver +DownloadAndInstall -Name 'PowerShell' -Url $PowerShellUrl -Args $PowerShellArgs DownloadAndInstall -Name 'Python' -Url $PythonUrl -Args $PythonArgs DownloadAndInstall -Name 'Visual Studio' -Url $VisualStudioUrl -Args $VisualStudioArgs DownloadAndInstall -Name 'CUDA' -Url $CudaUrl -Args $CudaArgs From 08328dc2b62c6e6058511269c29087b009c282c7 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sun, 28 Apr 2024 23:59:37 -0700 Subject: [PATCH 03/29] Download installers to `D:\installerTemp`. [tested] CUDA is 3 GB, so this may be helpful. --- azure-devops/provision-image.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-devops/provision-image.ps1 b/azure-devops/provision-image.ps1 index afb9a16b22..afa61f45e5 100644 --- a/azure-devops/provision-image.ps1 +++ b/azure-devops/provision-image.ps1 @@ -71,7 +71,8 @@ Function DownloadAndInstall { try { Write-Host "Downloading $Name..." - $tempPath = [System.IO.Path]::GetTempPath() + $tempPath = 'D:\installerTemp' + mkdir $tempPath -Force | Out-Null $fileName = [uri]::new($Url).Segments[-1] $installerPath = Join-Path $tempPath $fileName curl.exe -L -o $installerPath -s -S $Url From 0c4ed3ac06fcdde9cde43aeea5b88f5c804d2eea Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Mon, 6 May 2024 14:34:04 -0700 Subject: [PATCH 04/29] Guard against locally running provision-image.ps1. [tested] This uses a case-sensitive comparison; the default is case-insensitive. --- azure-devops/provision-image.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/azure-devops/provision-image.ps1 b/azure-devops/provision-image.ps1 index afa61f45e5..c30e19c8b7 100644 --- a/azure-devops/provision-image.ps1 +++ b/azure-devops/provision-image.ps1 @@ -15,6 +15,10 @@ for setting up new VMs in the scale set. $ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' +if ($Env:COMPUTERNAME -cne 'PROTOTYPE') { + Write-Error 'You should not run provision-image.ps1 on your local machine.' +} + $VisualStudioWorkloads = @( 'Microsoft.VisualStudio.Component.VC.ASAN', 'Microsoft.VisualStudio.Component.VC.CLI.Support', From 1722de07afccf0fbe83322566efdfa86923fa2ea Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Mon, 6 May 2024 15:40:38 -0700 Subject: [PATCH 05/29] Skip a blank line emitted by `cmd /c ver`. [tested] --- azure-devops/provision-image.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-devops/provision-image.ps1 b/azure-devops/provision-image.ps1 index c30e19c8b7..f89dfae192 100644 --- a/azure-devops/provision-image.ps1 +++ b/azure-devops/provision-image.ps1 @@ -102,7 +102,8 @@ Function DownloadAndInstall { Write-Host "Old PowerShell version: $($PSVersionTable.PSVersion)" # Print the Windows version, so we can verify whether Patch Tuesday has been picked up. -cmd /c ver +# Skip a blank line to improve the output. +(cmd /c ver)[1] DownloadAndInstall -Name 'PowerShell' -Url $PowerShellUrl -Args $PowerShellArgs DownloadAndInstall -Name 'Python' -Url $PythonUrl -Args $PythonArgs From bc1e34807b4f5c9ea1d625dfc148ad05c3f6ac33 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sat, 27 Apr 2024 22:22:22 -0700 Subject: [PATCH 06/29] Set `pwsh: true`. [tested] --- azure-devops/checkout-submodule.yml | 1 + azure-devops/format-validation.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/azure-devops/checkout-submodule.yml b/azure-devops/checkout-submodule.yml index 3822543e9d..205ef6d8a5 100644 --- a/azure-devops/checkout-submodule.yml +++ b/azure-devops/checkout-submodule.yml @@ -13,6 +13,7 @@ steps: displayName: 'Checkout ${{ parameters.path }} Submodule' condition: and(succeeded(), ${{ parameters.enabled }}) inputs: + pwsh: true targetType: inline script: | $submodule = '${{ parameters.path }}' diff --git a/azure-devops/format-validation.yml b/azure-devops/format-validation.yml index 62553a627a..9293382d4b 100644 --- a/azure-devops/format-validation.yml +++ b/azure-devops/format-validation.yml @@ -34,6 +34,7 @@ jobs: - task: PowerShell@2 displayName: 'Create Diff' inputs: + pwsh: true filePath: azure-devops/create-prdiff.ps1 condition: succeededOrFailed() env: { TMP: $(tmpDir), TEMP: $(tmpDir) } From c1c61c8668267983d6993e7f3ff3a53be44cb9d8 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sat, 27 Apr 2024 22:28:46 -0700 Subject: [PATCH 07/29] GH 4632 Submodule checkout failure should short-circuit checks [tested] PowerShell 7.4 added `$PSNativeCommandUseErrorActionPreference`: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.4#psnativecommanduseerroractionpreference --- azure-devops/checkout-submodule.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-devops/checkout-submodule.yml b/azure-devops/checkout-submodule.yml index 205ef6d8a5..66663498c0 100644 --- a/azure-devops/checkout-submodule.yml +++ b/azure-devops/checkout-submodule.yml @@ -16,6 +16,7 @@ steps: pwsh: true targetType: inline script: | + $PSNativeCommandUseErrorActionPreference = $true $submodule = '${{ parameters.path }}' $rawStatus = git submodule status --cached $submodule $sha = $rawStatus -replace '^[ \-+]([0-9a-f]+) .*$', '$1' From 86b9599d80c22d56f62a0b9c70db370aabc2283f Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sun, 28 Apr 2024 00:10:00 -0700 Subject: [PATCH 08/29] Retry submodule checkout up to 4 times. [tested] See: https://learn.microsoft.com/en-us/azure/devops/release-notes/2021/pipelines/sprint-195-update#automatic-retries-for-a-task The release notes said "The failing task is retried immediately" but I now observe quadratic backoff, waiting 1, 4, 9 seconds. --- azure-devops/checkout-submodule.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-devops/checkout-submodule.yml b/azure-devops/checkout-submodule.yml index 66663498c0..a9f345dd06 100644 --- a/azure-devops/checkout-submodule.yml +++ b/azure-devops/checkout-submodule.yml @@ -12,6 +12,7 @@ steps: - task: PowerShell@2 displayName: 'Checkout ${{ parameters.path }} Submodule' condition: and(succeeded(), ${{ parameters.enabled }}) + retryCountOnTaskFailure: 4 inputs: pwsh: true targetType: inline From 9d84558f6f1874c697fff66e2bfcb7fde2b99bdc Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Mon, 6 May 2024 15:02:21 -0700 Subject: [PATCH 09/29] checkout-submodule.yml: Use case-sensitive `-creplace` and `-ceq`. [tested] `git submodule status` emits lowercase hexits, and we pass lowercase 'llvm-project'. Although PowerShell defaults to case-insensitive, choosing case-sensitive for string operations should align with C++ expectations and avoid surprises. --- azure-devops/checkout-submodule.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-devops/checkout-submodule.yml b/azure-devops/checkout-submodule.yml index a9f345dd06..3e038a5f65 100644 --- a/azure-devops/checkout-submodule.yml +++ b/azure-devops/checkout-submodule.yml @@ -20,14 +20,14 @@ steps: $PSNativeCommandUseErrorActionPreference = $true $submodule = '${{ parameters.path }}' $rawStatus = git submodule status --cached $submodule - $sha = $rawStatus -replace '^[ \-+]([0-9a-f]+) .*$', '$1' + $sha = $rawStatus -creplace '^[ \-+]([0-9a-f]+) .*$', '$1' cd $submodule git init if ((git remote) -eq $null) { git remote add submodule-upstream ${{ parameters.url }} } git fetch --filter=tree:0 --depth=1 submodule-upstream $sha - if ($submodule -eq 'llvm-project') { + if ($submodule -ceq 'llvm-project') { git sparse-checkout set --sparse-index libcxx/test libcxx/utils/libcxx llvm/utils/lit } git reset --quiet --hard FETCH_HEAD From 8c38eb2c76a84025bf3bf50fc2dcf170acec43e1 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sun, 28 Apr 2024 13:25:04 -0700 Subject: [PATCH 10/29] Style: Wrap Restart-AzVM arguments. [tested] --- azure-devops/create-1es-hosted-pool.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/azure-devops/create-1es-hosted-pool.ps1 b/azure-devops/create-1es-hosted-pool.ps1 index 736cee5bbf..b63d3e0e1c 100644 --- a/azure-devops/create-1es-hosted-pool.ps1 +++ b/azure-devops/create-1es-hosted-pool.ps1 @@ -234,7 +234,9 @@ if ($ProvisionImageResult.value.Message -cnotmatch 'PROVISION_IMAGE_SUCCEEDED') #################################################################################################### Display-ProgressBar -Status 'Restarting VM' -Restart-AzVM -ResourceGroupName $ResourceGroupName -Name $ProtoVMName | Out-Null +Restart-AzVM ` + -ResourceGroupName $ResourceGroupName ` + -Name $ProtoVMName | Out-Null #################################################################################################### Display-ProgressBar -Status 'Sleeping after restart' From a58d72e1a1521b3683611e8a24caea74f225e210 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sun, 28 Apr 2024 15:21:13 -0700 Subject: [PATCH 11/29] Move `Get-AzVM` up so we can use `$VM.ID` earlier. [tested] `$VM.ID` and `$VM.StorageProfile.OsDisk.Name` are unchanged between these locations. Calling `Get-AzVM` is necessary; the return value of `New-AzVm` isn't useful. --- azure-devops/create-1es-hosted-pool.ps1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/azure-devops/create-1es-hosted-pool.ps1 b/azure-devops/create-1es-hosted-pool.ps1 index b63d3e0e1c..6eadbedf1d 100644 --- a/azure-devops/create-1es-hosted-pool.ps1 +++ b/azure-devops/create-1es-hosted-pool.ps1 @@ -209,6 +209,12 @@ New-AzVm ` -Location $Location ` -VM $VM | Out-Null +$VM = Get-AzVM ` + -ResourceGroupName $ResourceGroupName ` + -Name $ProtoVMName + +$PrototypeOSDiskName = $VM.StorageProfile.OsDisk.Name + #################################################################################################### Display-ProgressBar -Status 'Running provision-image.ps1 in VM' @@ -275,12 +281,6 @@ Set-AzVM ` -Name $ProtoVMName ` -Generalized | Out-Null -$VM = Get-AzVM ` - -ResourceGroupName $ResourceGroupName ` - -Name $ProtoVMName - -$PrototypeOSDiskName = $VM.StorageProfile.OsDisk.Name - #################################################################################################### Display-ProgressBar -Status 'Creating gallery' From 578d523c84ddbc8f0405b0ca151e29d5eae3aa02 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sun, 28 Apr 2024 15:26:01 -0700 Subject: [PATCH 12/29] Inline away the `Wait-Shutdown` function. [tested] The progress bar message makes the `Write-Host` messages unnecessary. `-ResourceId $VM.ID` is much shorter than `-ResourceGroupName $ResourceGroupName -Name $Name`, allowing us to directly say `'PowerState/stopped'` without wrapping. The original implementation in GH 633 (named `Start-WaitForShutdown`) was verbose, justifying a separate function, but now a direct loop is clearer. --- azure-devops/create-1es-hosted-pool.ps1 | 34 +++---------------------- 1 file changed, 3 insertions(+), 31 deletions(-) diff --git a/azure-devops/create-1es-hosted-pool.ps1 b/azure-devops/create-1es-hosted-pool.ps1 index 6eadbedf1d..ddf1db929a 100644 --- a/azure-devops/create-1es-hosted-pool.ps1 +++ b/azure-devops/create-1es-hosted-pool.ps1 @@ -70,36 +70,6 @@ function New-Password { return $result } -<# -.SYNOPSIS -Waits for the shutdown of the specified resource. - -.DESCRIPTION -Wait-Shutdown takes a VM, and checks if there's a 'PowerState/stopped' -code; if there is, it returns. If there isn't, it waits 10 seconds and -tries again. - -.PARAMETER ResourceGroupName -The name of the resource group to look up the VM in. - -.PARAMETER Name -The name of the virtual machine to wait on. -#> -function Wait-Shutdown { - [CmdletBinding(PositionalBinding=$false)] - Param( - [Parameter(Mandatory)][string]$ResourceGroupName, - [Parameter(Mandatory)][string]$Name - ) - - Write-Host "Waiting for $Name to stop..." - $StoppedCode = 'PowerState/stopped' - while ($StoppedCode -notin (Get-AzVM -ResourceGroupName $ResourceGroupName -Name $Name -Status).Statuses.Code) { - Write-Host '... not stopped yet, sleeping for 10 seconds' - Start-Sleep -Seconds 10 - } -} - #################################################################################################### Display-ProgressBar -Status 'Silencing breaking change warnings' @@ -263,7 +233,9 @@ Invoke-AzVMRunCommand ` #################################################################################################### Display-ProgressBar -Status 'Waiting for VM to shut down' -Wait-Shutdown -ResourceGroupName $ResourceGroupName -Name $ProtoVMName +while ('PowerState/stopped' -notin (Get-AzVM -ResourceId $VM.ID -Status).Statuses.Code) { + Start-Sleep -Seconds 10 +} #################################################################################################### Display-ProgressBar -Status 'Stopping VM' From d6bb0bcf97d84d60b927d65966fb3b0aee37e59d Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sun, 28 Apr 2024 15:54:24 -0700 Subject: [PATCH 13/29] Consistently use `$VM.ID`. [tested] --- azure-devops/create-1es-hosted-pool.ps1 | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/azure-devops/create-1es-hosted-pool.ps1 b/azure-devops/create-1es-hosted-pool.ps1 index ddf1db929a..52397271a4 100644 --- a/azure-devops/create-1es-hosted-pool.ps1 +++ b/azure-devops/create-1es-hosted-pool.ps1 @@ -189,8 +189,7 @@ $PrototypeOSDiskName = $VM.StorageProfile.OsDisk.Name Display-ProgressBar -Status 'Running provision-image.ps1 in VM' $ProvisionImageResult = Invoke-AzVMRunCommand ` - -ResourceGroupName $ResourceGroupName ` - -VMName $ProtoVMName ` + -ResourceId $VM.ID ` -CommandId 'RunPowerShellScript' ` -ScriptPath "$PSScriptRoot\provision-image.ps1" @@ -200,8 +199,7 @@ if ($ProvisionImageResult.value.Message -cnotmatch 'PROVISION_IMAGE_SUCCEEDED') Write-Host 'provision-image.ps1 failed, stopping VM...' Stop-AzVM ` - -ResourceGroupName $ResourceGroupName ` - -Name $ProtoVMName ` + -Id $VM.ID ` -Force | Out-Null Write-Error "VM stopped. Remember to delete unusable resource group: $ResourceGroupName" @@ -211,8 +209,7 @@ if ($ProvisionImageResult.value.Message -cnotmatch 'PROVISION_IMAGE_SUCCEEDED') Display-ProgressBar -Status 'Restarting VM' Restart-AzVM ` - -ResourceGroupName $ResourceGroupName ` - -Name $ProtoVMName | Out-Null + -Id $VM.ID | Out-Null #################################################################################################### Display-ProgressBar -Status 'Sleeping after restart' @@ -225,8 +222,7 @@ Start-Sleep -Seconds 60 Display-ProgressBar -Status 'Running sysprep.ps1 in VM' Invoke-AzVMRunCommand ` - -ResourceGroupName $ResourceGroupName ` - -VMName $ProtoVMName ` + -ResourceId $VM.ID ` -CommandId 'RunPowerShellScript' ` -ScriptPath "$PSScriptRoot\sysprep.ps1" | Out-Null @@ -241,16 +237,14 @@ while ('PowerState/stopped' -notin (Get-AzVM -ResourceId $VM.ID -Status).Statuse Display-ProgressBar -Status 'Stopping VM' Stop-AzVM ` - -ResourceGroupName $ResourceGroupName ` - -Name $ProtoVMName ` + -Id $VM.ID ` -Force | Out-Null #################################################################################################### Display-ProgressBar -Status 'Generalizing VM' Set-AzVM ` - -ResourceGroupName $ResourceGroupName ` - -Name $ProtoVMName ` + -Id $VM.ID ` -Generalized | Out-Null #################################################################################################### From 85f381159d2d76f7f03ae5b447bdd1899f211a0c Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sun, 28 Apr 2024 17:13:32 -0700 Subject: [PATCH 14/29] Run sysprep with `-ScriptString`. [tested] `$ErrorActionPreference` wasn't useful because sysprep is a native command. `Write-Host` wasn't useful because we aren't printing the message returned by `Invoke-AzVMRunCommand`. The PowerShell call operator `&` wasn't useful because we aren't expanding any variables here. --- azure-devops/create-1es-hosted-pool.ps1 | 6 +++--- azure-devops/sysprep.ps1 | 6 ------ 2 files changed, 3 insertions(+), 9 deletions(-) delete mode 100644 azure-devops/sysprep.ps1 diff --git a/azure-devops/create-1es-hosted-pool.ps1 b/azure-devops/create-1es-hosted-pool.ps1 index 52397271a4..8a13045f5c 100644 --- a/azure-devops/create-1es-hosted-pool.ps1 +++ b/azure-devops/create-1es-hosted-pool.ps1 @@ -215,16 +215,16 @@ Restart-AzVM ` Display-ProgressBar -Status 'Sleeping after restart' # The VM appears to be busy immediately after restarting. -# This workaround waits for a minute before attempting to run sysprep.ps1. +# This workaround waits for a minute before attempting to run sysprep. Start-Sleep -Seconds 60 #################################################################################################### -Display-ProgressBar -Status 'Running sysprep.ps1 in VM' +Display-ProgressBar -Status 'Running sysprep in VM' Invoke-AzVMRunCommand ` -ResourceId $VM.ID ` -CommandId 'RunPowerShellScript' ` - -ScriptPath "$PSScriptRoot\sysprep.ps1" | Out-Null + -ScriptString 'C:\Windows\system32\sysprep\sysprep.exe /oobe /generalize /mode:vm /shutdown' | Out-Null #################################################################################################### Display-ProgressBar -Status 'Waiting for VM to shut down' diff --git a/azure-devops/sysprep.ps1 b/azure-devops/sysprep.ps1 deleted file mode 100644 index 285719366d..0000000000 --- a/azure-devops/sysprep.ps1 +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -$ErrorActionPreference = 'Stop' -Write-Host 'Running sysprep' -& C:\Windows\system32\sysprep\sysprep.exe /oobe /generalize /mode:vm /shutdown From 6c2dbfc83e011ad3074cd8155221765f40f4ef8f Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sun, 28 Apr 2024 17:33:53 -0700 Subject: [PATCH 15/29] Style: For `New-AzVMConfig`, use `-VMName` instead of the alias `-Name`. [tested] --- azure-devops/create-1es-hosted-pool.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-devops/create-1es-hosted-pool.ps1 b/azure-devops/create-1es-hosted-pool.ps1 index 8a13045f5c..04570eb8dd 100644 --- a/azure-devops/create-1es-hosted-pool.ps1 +++ b/azure-devops/create-1es-hosted-pool.ps1 @@ -139,7 +139,7 @@ Display-ProgressBar -Status 'Creating prototype VM' # Previously: -Priority 'Spot' $VM = New-AzVMConfig ` - -Name $ProtoVMName ` + -VMName $ProtoVMName ` -VMSize $VMSize ` -Priority 'Regular' From 0a8f3d8dd7cd824f97d3491ae4d3023d0af65a63 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sun, 28 Apr 2024 18:12:12 -0700 Subject: [PATCH 16/29] `New-AzVm` defaults to Trusted Launch as of Azure PowerShell 11.0.0 (November 2023). [verified] See: https://techcommunity.microsoft.com/t5/azure-compute-blog/breaking-change-for-vm-amp-vmss-powershell-cli-customers/ba-p/3937037 https://learn.microsoft.com/en-us/powershell/azure/release-notes-azureps?view=azps-11.5.0#azcompute-700 --- azure-devops/create-1es-hosted-pool.ps1 | 9 --------- 1 file changed, 9 deletions(-) diff --git a/azure-devops/create-1es-hosted-pool.ps1 b/azure-devops/create-1es-hosted-pool.ps1 index 04570eb8dd..c996e8d74b 100644 --- a/azure-devops/create-1es-hosted-pool.ps1 +++ b/azure-devops/create-1es-hosted-pool.ps1 @@ -165,15 +165,6 @@ $VM = Set-AzVMBootDiagnostic ` -VM $VM ` -Disable -$VM = Set-AzVMSecurityProfile ` - -VM $VM ` - -SecurityType 'TrustedLaunch' - -$VM = Set-AzVMUefi ` - -VM $VM ` - -EnableVtpm $true ` - -EnableSecureBoot $true - New-AzVm ` -ResourceGroupName $ResourceGroupName ` -Location $Location ` From c05e773d198822f84b6af444959698c55c385d69 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sun, 28 Apr 2024 23:38:10 -0700 Subject: [PATCH 17/29] Give `validationBuildOutputLocation` a dedicated name, and clean it. [tested] --- azure-devops/config.yml | 3 +++ azure-devops/format-validation.yml | 11 +++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/azure-devops/config.yml b/azure-devops/config.yml index f699f5d75c..4b8431a2c6 100644 --- a/azure-devops/config.yml +++ b/azure-devops/config.yml @@ -19,6 +19,9 @@ variables: - name: benchmarkBuildOutputLocation value: 'D:\benchmark' readonly: true +- name: validationBuildOutputLocation + value: 'D:\validation' + readonly: true - name: Codeql.SkipTaskAutoInjection value: true readonly: true diff --git a/azure-devops/format-validation.yml b/azure-devops/format-validation.yml index 9293382d4b..e9763c70cf 100644 --- a/azure-devops/format-validation.yml +++ b/azure-devops/format-validation.yml @@ -10,24 +10,27 @@ jobs: steps: - template: checkout-self.yml - script: | + if exist "$(validationBuildOutputLocation)" ( + rmdir /S /Q "$(validationBuildOutputLocation)" + ) call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^ -host_arch=x64 -arch=x64 -no_logo - cmake -G Ninja -S $(Build.SourcesDirectory)/tools -B $(tmpDir)/format-validate-build - cmake --build $(tmpDir)/format-validate-build + cmake -G Ninja -S $(Build.SourcesDirectory)/tools -B "$(validationBuildOutputLocation)" + cmake --build "$(validationBuildOutputLocation)" displayName: 'Build format and validation' timeoutInMinutes: 5 env: { TMP: $(tmpDir), TEMP: $(tmpDir) } - script: | call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^ -host_arch=x64 -arch=x64 -no_logo - cmake --build $(tmpDir)/format-validate-build --target run-format + cmake --build "$(validationBuildOutputLocation)" --target run-format displayName: 'clang-format Files' timeoutInMinutes: 5 env: { TMP: $(tmpDir), TEMP: $(tmpDir) } - script: | call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^ -host_arch=x64 -arch=x64 -no_logo - cmake --build $(tmpDir)/format-validate-build --target run-validate + cmake --build "$(validationBuildOutputLocation)" --target run-validate displayName: 'Validate Files' timeoutInMinutes: 2 env: { TMP: $(tmpDir), TEMP: $(tmpDir) } From 3ca0599a1607550cc83e97e03b203df1f8da3940 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 30 Apr 2024 22:07:01 -0700 Subject: [PATCH 18/29] Inline create-prdiff.ps1, part 1. [tested] No changes except for: * Drop redundant banner. * `$DiffFile` was never passed as an argument, so set it as an ordinary variable. * Indentation. --- azure-devops/create-prdiff.ps1 | 37 ------------------------------ azure-devops/format-validation.yml | 28 +++++++++++++++++++++- 2 files changed, 27 insertions(+), 38 deletions(-) delete mode 100644 azure-devops/create-prdiff.ps1 diff --git a/azure-devops/create-prdiff.ps1 b/azure-devops/create-prdiff.ps1 deleted file mode 100644 index 0274769e6c..0000000000 --- a/azure-devops/create-prdiff.ps1 +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -[CmdletBinding(PositionalBinding = $False)] -Param( - [Parameter()] - [String]$DiffFile -) - -if ([string]::IsNullOrEmpty($DiffFile)) { - $DiffFile = [System.IO.Path]::GetTempFileName() -} - -Start-Process -FilePath 'git' -ArgumentList 'diff', '--ignore-submodules' ` - -NoNewWindow -Wait ` - -RedirectStandardOutput $DiffFile -if (0 -ne (Get-Item -LiteralPath $DiffFile).Length) { - $message = @( - '##vso[task.logissue type=error]The formatting of the files in the repo was not what we expected.' - 'Please access the diff from format.diff in the build artifacts' - 'and apply it with `git apply`. To download the diff:' - '1. Click the failed Validation job,' - '2. Click "1 artifact produced",' - '3. Hover over format.diff,' - '4. Click the three dots that appear on the right,' - '5. Click "Download artifacts".' - 'Alternatively, you can run the `format` CMake target:' - ' cmake --build --target format' - '' - '##[group]Expected formatting - click to expand diff' - Get-Content -LiteralPath $DiffFile -Raw - '##[endgroup]' - "##vso[artifact.upload artifactname=format.diff]$DiffFile" - '##vso[task.complete result=Failed]DONE' - ) - Write-Host ($message -join "`n") -} diff --git a/azure-devops/format-validation.yml b/azure-devops/format-validation.yml index e9763c70cf..6591be67dc 100644 --- a/azure-devops/format-validation.yml +++ b/azure-devops/format-validation.yml @@ -38,6 +38,32 @@ jobs: displayName: 'Create Diff' inputs: pwsh: true - filePath: azure-devops/create-prdiff.ps1 + targetType: inline + script: | + $DiffFile = [System.IO.Path]::GetTempFileName() + Start-Process -FilePath 'git' -ArgumentList 'diff', '--ignore-submodules' ` + -NoNewWindow -Wait ` + -RedirectStandardOutput $DiffFile + if (0 -ne (Get-Item -LiteralPath $DiffFile).Length) { + $message = @( + '##vso[task.logissue type=error]The formatting of the files in the repo was not what we expected.' + 'Please access the diff from format.diff in the build artifacts' + 'and apply it with `git apply`. To download the diff:' + '1. Click the failed Validation job,' + '2. Click "1 artifact produced",' + '3. Hover over format.diff,' + '4. Click the three dots that appear on the right,' + '5. Click "Download artifacts".' + 'Alternatively, you can run the `format` CMake target:' + ' cmake --build --target format' + '' + '##[group]Expected formatting - click to expand diff' + Get-Content -LiteralPath $DiffFile -Raw + '##[endgroup]' + "##vso[artifact.upload artifactname=format.diff]$DiffFile" + '##vso[task.complete result=Failed]DONE' + ) + Write-Host ($message -join "`n") + } condition: succeededOrFailed() env: { TMP: $(tmpDir), TEMP: $(tmpDir) } From 0efc9faefb09142b68ea0c0abb2e097be9ae22dc Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 30 Apr 2024 23:02:12 -0700 Subject: [PATCH 19/29] Inline create-prdiff.ps1, part 2. [tested] Simplify by using the PowerShell redirection operator `>` instead of `Start-Process`. https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_redirection?view=powershell-7.4#powershell-redirection-operators Verified that the diff can be applied cleanly. --- azure-devops/format-validation.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/azure-devops/format-validation.yml b/azure-devops/format-validation.yml index 6591be67dc..717bd84a45 100644 --- a/azure-devops/format-validation.yml +++ b/azure-devops/format-validation.yml @@ -41,9 +41,7 @@ jobs: targetType: inline script: | $DiffFile = [System.IO.Path]::GetTempFileName() - Start-Process -FilePath 'git' -ArgumentList 'diff', '--ignore-submodules' ` - -NoNewWindow -Wait ` - -RedirectStandardOutput $DiffFile + git diff --ignore-submodules > $DiffFile if (0 -ne (Get-Item -LiteralPath $DiffFile).Length) { $message = @( '##vso[task.logissue type=error]The formatting of the files in the repo was not what we expected.' From 03094689a7a0dfe5816c667497136fe4ec72cc70 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 30 Apr 2024 23:57:31 -0700 Subject: [PATCH 20/29] Inline create-prdiff.ps1, part 3. [tested] Overhaul messaging. --- azure-devops/format-validation.yml | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/azure-devops/format-validation.yml b/azure-devops/format-validation.yml index 717bd84a45..fac4940bf7 100644 --- a/azure-devops/format-validation.yml +++ b/azure-devops/format-validation.yml @@ -44,22 +44,28 @@ jobs: git diff --ignore-submodules > $DiffFile if (0 -ne (Get-Item -LiteralPath $DiffFile).Length) { $message = @( - '##vso[task.logissue type=error]The formatting of the files in the repo was not what we expected.' - 'Please access the diff from format.diff in the build artifacts' - 'and apply it with `git apply`. To download the diff:' - '1. Click the failed Validation job,' - '2. Click "1 artifact produced",' - '3. Hover over format.diff,' - '4. Click the three dots that appear on the right,' - '5. Click "Download artifacts".' - 'Alternatively, you can run the `format` CMake target:' - ' cmake --build --target format' + '##vso[task.logissue type=error]The files in the repo need to be properly formatted.' '' - '##[group]Expected formatting - click to expand diff' + '##[section]To fix this, you can clang-format the entire repo with:' + ' cmake --preset x64' + ' cmake --build --preset x64 --target format' + '' + '##[section]Please avoid this in the future by configuring your editor to format-on-save.' + '' + '##[section]View expected formatting:' + '##[group] >>>>> Click this line to expand the diff: <<<<<' Get-Content -LiteralPath $DiffFile -Raw '##[endgroup]' + '' + '##[section]You can also download this as format.diff and apply it with `git apply`:' + ' 1. Click the failed Validation job (upper left, marked with a red X)' + ' 2. Click "1 artifact produced"' + ' 3. Hover over format.diff' + ' 4. Click the three dots that appear on the right' + ' 5. Click "Download artifacts"' + '' "##vso[artifact.upload artifactname=format.diff]$DiffFile" - '##vso[task.complete result=Failed]DONE' + '##vso[task.complete result=Failed]' ) Write-Host ($message -join "`n") } From dbc9096d84e9cc9cdec46ae99551f2381127379e Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Wed, 1 May 2024 00:38:09 -0700 Subject: [PATCH 21/29] Inline create-prdiff.ps1, part 4. [tested] Actually name the file format.diff before uploading, as this appears in the zip. --- azure-devops/format-validation.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/azure-devops/format-validation.yml b/azure-devops/format-validation.yml index fac4940bf7..2d9d825d4d 100644 --- a/azure-devops/format-validation.yml +++ b/azure-devops/format-validation.yml @@ -40,7 +40,9 @@ jobs: pwsh: true targetType: inline script: | - $DiffFile = [System.IO.Path]::GetTempFileName() + $TempSubDir = Join-Path ([System.IO.Path]::GetTempPath()) ([System.IO.Path]::GetRandomFileName()) + mkdir $TempSubDir -Force | Out-Null + $DiffFile = Join-Path $TempSubDir 'format.diff' git diff --ignore-submodules > $DiffFile if (0 -ne (Get-Item -LiteralPath $DiffFile).Length) { $message = @( From 58d93d11846b061f25051cd1badc73375c5acb6d Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Wed, 1 May 2024 01:12:17 -0700 Subject: [PATCH 22/29] Inline create-prdiff.ps1, part 5. [tested] Name the zip differently from the file within. --- azure-devops/format-validation.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/azure-devops/format-validation.yml b/azure-devops/format-validation.yml index 2d9d825d4d..726c9b1eb5 100644 --- a/azure-devops/format-validation.yml +++ b/azure-devops/format-validation.yml @@ -62,11 +62,12 @@ jobs: '##[section]You can also download this as format.diff and apply it with `git apply`:' ' 1. Click the failed Validation job (upper left, marked with a red X)' ' 2. Click "1 artifact produced"' - ' 3. Hover over format.diff' - ' 4. Click the three dots that appear on the right' - ' 5. Click "Download artifacts"' + ' 3. Click the ">" chevron to the left of "format-artifact"' + ' 4. Hover over "format.diff"' + ' 5. Click the three dots that appear on the right' + ' 6. Click "Download artifacts"' '' - "##vso[artifact.upload artifactname=format.diff]$DiffFile" + "##vso[artifact.upload artifactname=format-artifact]$DiffFile" '##vso[task.complete result=Failed]' ) Write-Host ($message -join "`n") From 4a3ac81de97b0bd6917f5a8b9926e13ff580df82 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Mon, 6 May 2024 14:50:09 -0700 Subject: [PATCH 23/29] Inline create-prdiff.ps1, part 6. [tested] Style: Avoid Yoda condition when checking `git diff` output. --- azure-devops/format-validation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-devops/format-validation.yml b/azure-devops/format-validation.yml index 726c9b1eb5..945c96d1b0 100644 --- a/azure-devops/format-validation.yml +++ b/azure-devops/format-validation.yml @@ -44,7 +44,7 @@ jobs: mkdir $TempSubDir -Force | Out-Null $DiffFile = Join-Path $TempSubDir 'format.diff' git diff --ignore-submodules > $DiffFile - if (0 -ne (Get-Item -LiteralPath $DiffFile).Length) { + if ((Get-Item -LiteralPath $DiffFile).Length -ne 0) { $message = @( '##vso[task.logissue type=error]The files in the repo need to be properly formatted.' '' From c87c0d2b23ea7e5079529cfd87191de32018a4fe Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Mon, 6 May 2024 13:03:21 -0700 Subject: [PATCH 24/29] Improve provision-image.ps1's synopsis/description. [comment only] They were talking about our old scale set system. Now they talk about hosted pools, and explain the overall process in more detail. --- azure-devops/provision-image.ps1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/azure-devops/provision-image.ps1 b/azure-devops/provision-image.ps1 index f89dfae192..4fb69a968f 100644 --- a/azure-devops/provision-image.ps1 +++ b/azure-devops/provision-image.ps1 @@ -3,13 +3,13 @@ <# .SYNOPSIS -Sets up a machine to be an image for a scale set. +Sets up a virtual machine to be an image for a hosted pool. .DESCRIPTION -provision-image.ps1 runs on an existing, freshly provisioned virtual machine, -and sets up that virtual machine as a build machine. After this is done, -(outside of this script), we take that machine and make it an image to be copied -for setting up new VMs in the scale set. +create-1es-hosted-pool.ps1 (running on an STL maintainer's machine) creates a "prototype" virtual machine in Azure, +then runs provision-image.ps1 on that VM. This gives us full control over what we install for building and testing +the STL. After provision-image.ps1 is done, create-1es-hosted-pool.ps1 makes an image of the prototype VM, +creates a 1ES Hosted Pool that will spin up copies of the image as worker VMs, and finally deletes the prototype VM. #> $ErrorActionPreference = 'Stop' From 3c8db2640c22487db188ee9f0be9fcc46cddbff7 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Mon, 29 Apr 2024 11:14:39 -0700 Subject: [PATCH 25/29] Require Node.js 22.2.0. --- .github/workflows/update-status-chart.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-status-chart.yml b/.github/workflows/update-status-chart.yml index 249c9d55ef..7379faf7c4 100644 --- a/.github/workflows/update-status-chart.yml +++ b/.github/workflows/update-status-chart.yml @@ -20,7 +20,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: ">=21.7.1" + node-version: ">=22.2.0" - name: Install Packages run: | npm ci From 659aeae16615018a63dea53d8d1c0794541b1b38 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 21 May 2024 18:22:17 -0700 Subject: [PATCH 26/29] New pool. --- azure-devops/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-devops/config.yml b/azure-devops/config.yml index 4b8431a2c6..9ecd9a9132 100644 --- a/azure-devops/config.yml +++ b/azure-devops/config.yml @@ -5,7 +5,7 @@ variables: - name: poolName - value: 'StlBuild-2024-04-17T1257-Pool' + value: 'StlBuild-2024-05-21T1719-Pool' readonly: true - name: poolDemands value: 'EnableSpotVM -equals false' From 9c345ae5dd68ec0dc0a8dd143b0686c5c9a7e95a Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 21 May 2024 18:24:17 -0700 Subject: [PATCH 27/29] VS 2022 17.11 Preview 1. Not yet required - the internal toolset is still 19.40. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 984b5d460f..499f7aa195 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ Just try to follow these rules, so we can spend more time fixing bugs and implem # How To Build With The Visual Studio IDE -1. Install Visual Studio 2022 17.10 Preview 4 or later. +1. Install Visual Studio 2022 17.11 Preview 1 or later. * Select "Windows 11 SDK (10.0.22621.0)" in the VS Installer. * We recommend selecting "C++ CMake tools for Windows" in the VS Installer. This will ensure that you're using supported versions of CMake and Ninja. @@ -156,7 +156,7 @@ Just try to follow these rules, so we can spend more time fixing bugs and implem # How To Build With A Native Tools Command Prompt -1. Install Visual Studio 2022 17.10 Preview 4 or later. +1. Install Visual Studio 2022 17.11 Preview 1 or later. * Select "Windows 11 SDK (10.0.22621.0)" in the VS Installer. * We recommend selecting "C++ CMake tools for Windows" in the VS Installer. This will ensure that you're using supported versions of CMake and Ninja. From b779f799baceaf01c6174ab02151d17f99f4ee79 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 21 May 2024 18:52:12 -0700 Subject: [PATCH 28/29] Remove compiler warning suppressions. MSVC no longer emits warning C4521 'multiple copy constructors specified', since at least MSVC-PR-368907 on 2021-12-09. --- tests/tr1/include/tfuns.h | 3 --- tests/tr1/tests/functional8/test.cpp | 3 --- 2 files changed, 6 deletions(-) diff --git a/tests/tr1/include/tfuns.h b/tests/tr1/include/tfuns.h index 700e4cd5f5..669351bc8d 100644 --- a/tests/tr1/include/tfuns.h +++ b/tests/tr1/include/tfuns.h @@ -35,8 +35,6 @@ typedef int (*tf8)(const volatile funobj, int, int, int, int, int, int, int); typedef int (*tf9)(const volatile funobj, int, int, int, int, int, int, int, int); typedef int (*tf10)(const volatile funobj, int, int, int, int, int, int, int, int, int); -#pragma warning(push) -#pragma warning(disable : 4521) // multiple copy constructors specified struct funobj { // general purpose function object typedef int result_type; @@ -226,7 +224,6 @@ struct funobj { // general purpose function object } int i0; }; -#pragma warning(pop) typedef int (funobj::*mf1)(); typedef int (funobj::*mf2)(int); diff --git a/tests/tr1/tests/functional8/test.cpp b/tests/tr1/tests/functional8/test.cpp index 2219cefc78..2e09fd2494 100644 --- a/tests/tr1/tests/functional8/test.cpp +++ b/tests/tr1/tests/functional8/test.cpp @@ -61,8 +61,6 @@ int f10(int, int, int, int, int, int, int, int, int, int) { return 10; } -#pragma warning(push) -#pragma warning(disable : 4521) // multiple copy constructors specified struct S { S() : di(1), df(2.0), cdd(3.0), vdd(4.0), cvdd(5.0) { // default constructor } @@ -259,7 +257,6 @@ struct S { return 39; } }; -#pragma warning(pop) struct Fn0 { char operator()() const { From f0852aa8c9c18fd09850773b71166ab9d5621335 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 21 May 2024 20:47:32 -0700 Subject: [PATCH 29/29] Work around VSO-2064546 "EDG ICE when deriving from std::num_get". --- tests/std/tests/GH_001277_num_get_bad_grouping/test.cpp | 4 ++++ tests/std/tests/LWG2381_num_get_floating_point/test.cpp | 4 ++++ tests/tr1/tests/locale3/test.cpp | 4 ++++ tests/tr1/tests/locale4/test.cpp | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/tests/std/tests/GH_001277_num_get_bad_grouping/test.cpp b/tests/std/tests/GH_001277_num_get_bad_grouping/test.cpp index 8d5e72294e..d03fe2ab32 100644 --- a/tests/std/tests/GH_001277_num_get_bad_grouping/test.cpp +++ b/tests/std/tests/GH_001277_num_get_bad_grouping/test.cpp @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#ifndef __EDG__ // TRANSITION, VSO-2064546 + #include #include #include @@ -459,3 +461,5 @@ int main() { test_nonending_unlimited_grouping(); test_nonending_unlimited_grouping(); } + +#endif // ^^^ no workaround ^^^ diff --git a/tests/std/tests/LWG2381_num_get_floating_point/test.cpp b/tests/std/tests/LWG2381_num_get_floating_point/test.cpp index 7f0615f97e..44c50f7243 100644 --- a/tests/std/tests/LWG2381_num_get_floating_point/test.cpp +++ b/tests/std/tests/LWG2381_num_get_floating_point/test.cpp @@ -13,6 +13,8 @@ // * std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp // * std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp +#ifndef __EDG__ // TRANSITION, VSO-2064546 + #include #include #include @@ -616,3 +618,5 @@ int main() { test_double_from_char_cases(); #endif // _HAS_CXX17 } + +#endif // ^^^ no workaround ^^^ diff --git a/tests/tr1/tests/locale3/test.cpp b/tests/tr1/tests/locale3/test.cpp index 2c177311fe..89136f897a 100644 --- a/tests/tr1/tests/locale3/test.cpp +++ b/tests/tr1/tests/locale3/test.cpp @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#ifndef __EDG__ // TRANSITION, VSO-2064546 + // test , part 3 #define TEST_NAME ", part 3" @@ -553,3 +555,5 @@ void test_main() { // test basic workings of locale definitions test_time_get(); test_time_put(); } + +#endif // ^^^ no workaround ^^^ diff --git a/tests/tr1/tests/locale4/test.cpp b/tests/tr1/tests/locale4/test.cpp index 8ed6bcb057..16cafe7d49 100644 --- a/tests/tr1/tests/locale4/test.cpp +++ b/tests/tr1/tests/locale4/test.cpp @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#ifndef __EDG__ // TRANSITION, VSO-2064546 + // test , part 4 #define TEST_NAME ", part 4" @@ -521,3 +523,5 @@ void test_main() { // test basic workings of locale definitions test_time_get(); test_time_put(); } + +#endif // ^^^ no workaround ^^^