Skip to content

Commit 8ad9edc

Browse files
committed
fix(ci): 避免测试重复初始化 MSVC 导致 PATH 超长
复用已确认的 MSVC 14.44/SDK 26100 x64 环境;定向复现先在第二次初始化检测到 PATH 变化,修复后多次初始化保持一致。保留所有云端测试。
1 parent 11493f5 commit 8ad9edc

3 files changed

Lines changed: 32 additions & 0 deletions

File tree

‎.github/workflows/build-windows.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ jobs:
4747
run: ./tools/setup-host.ps1
4848
- name: Build Release x64
4949
run: ./tools/build.ps1 -ToolRoot .local/shader-tools -Configuration Release
50+
- name: Check repeated compiler environment initialization
51+
run: ./tests/run-build-environment-tests.ps1
5052
- name: Run focused tests with WARP
5153
run: ./tools/run-tests.ps1 -Suite all -SoftwareOnly -OutputDirectory tmp/ci-tests
5254
- name: Validate packaging gates
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[CmdletBinding()]
2+
param()
3+
4+
$ErrorActionPreference = 'Stop'
5+
. (Join-Path $PSScriptRoot 'test-support.ps1')
6+
Initialize-TestBuild
7+
$taskNames = @('PATH','INCLUDE','LIB','LIBPATH','VCToolsInstallDir','WindowsSDKVersion')
8+
$taskInitial = @{}
9+
foreach ($taskName in $taskNames) {
10+
$taskInitial[$taskName] = [Environment]::GetEnvironmentVariable($taskName, 'Process')
11+
}
12+
foreach ($taskRun in 1..3) {
13+
Initialize-TestBuild
14+
foreach ($taskName in $taskNames) {
15+
if ([Environment]::GetEnvironmentVariable($taskName, 'Process') -cne $taskInitial[$taskName]) {
16+
throw "Repeated MSVC initialization changed $taskName on call $($taskRun + 1)."
17+
}
18+
}
19+
}
20+
Write-Host 'PASS repeated MSVC/SDK initialization preserves the qualified x64 environment.'

‎tests/test-support.ps1‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
# 仅供本地回归入口使用;不安装插件、不启动游戏。
22
function Initialize-TestBuild {
33
param([string]$VcVars64)
4+
# Child suites share this process. Re-running vcvars without its private
5+
# markers appends the same paths and can exceed cmd.exe's 8191-char limit.
6+
if (-not $VcVars64 -and $env:VCToolsInstallDir -match '[\\/]14\.44\.' -and
7+
([string]$env:WindowsSDKVersion).TrimEnd('\') -eq '10.0.26100.0' -and $env:INCLUDE -and $env:LIB) {
8+
$taskCompiler = Get-Command cl.exe -CommandType Application -ErrorAction SilentlyContinue
9+
$taskExpectedCompiler = Join-Path $env:VCToolsInstallDir 'bin/Hostx64/x64/cl.exe'
10+
if ($taskCompiler -and $taskCompiler.Path.Equals($taskExpectedCompiler, [StringComparison]::OrdinalIgnoreCase)) {
11+
return
12+
}
13+
}
414
if (-not $VcVars64) {
515
$vswhere = Join-Path ${env:ProgramFiles(x86)} 'Microsoft Visual Studio/Installer/vswhere.exe'
616
$installation = & $vswhere -latest -products '*' -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath

0 commit comments

Comments
 (0)