fix(release): stabilize Windows recovery self-test

This commit is contained in:
程序员阿江(Relakkes) 2026-07-18 20:20:34 +08:00
parent 34a3fcb22e
commit f8cccb096f
2 changed files with 21 additions and 4 deletions

View File

@ -782,13 +782,27 @@ function Run-SelfTest {
}
Assert-SelfTest -Condition $volumeAliasFailed -Message 'extended volume alias did not fail closed'
$shortAliasFailed = $false
$possibleShortAliasFailed = $false
try {
Resolve-CanonicalPath -Path (Join-Path ([IO.Path]::GetPathRoot($testRoot)) 'PROGRA~1') | Out-Null
Resolve-CanonicalPath -Path (Join-Path $testRoot 'MISSIN~1') | Out-Null
} catch {
$shortAliasFailed = $_.Exception.Message.Contains('8.3 path alias')
$possibleShortAliasFailed = $_.Exception.Message.Contains('8.3 path alias')
}
Assert-SelfTest -Condition $possibleShortAliasFailed -Message 'possible 8.3 alias did not fail closed'
$existingShortAlias = Join-Path ([IO.Path]::GetPathRoot($testRoot)) 'PROGRA~1'
if ([IO.Directory]::Exists($existingShortAlias) -or [IO.File]::Exists($existingShortAlias)) {
$existingShortAliasFailed = $false
try {
Resolve-CanonicalPath -Path $existingShortAlias | Out-Null
} catch {
$existingShortAliasFailed = (
$_.Exception.Message.Contains('Alternate path alias') -or
$_.Exception.Message.Contains('8.3 path alias')
)
}
Assert-SelfTest -Condition $existingShortAliasFailed -Message 'existing 8.3 alias did not fail closed'
}
Assert-SelfTest -Condition $shortAliasFailed -Message 'possible 8.3 alias did not fail closed'
$legalTildePath = Join-Path $testRoot 'project~notes'
New-Item -ItemType Directory -Path $legalTildePath | Out-Null

View File

@ -22,6 +22,9 @@ describe('Windows installer recovery prerequisites', () => {
expect(recoveryHelper).toContain('Get-ChildItem -LiteralPath $current -Force')
expect(recoveryHelper).toContain("([string]$_.Name).Equals($segment")
expect(recoveryHelper).toContain("Join-Path $testRoot 'project~notes'")
expect(recoveryHelper).toContain("Join-Path $testRoot 'MISSIN~1'")
expect(recoveryHelper).toContain('possible 8.3 alias did not fail closed')
expect(recoveryHelper).toContain('existing 8.3 alias did not fail closed')
expect(recoveryHelper).toContain('legal long directory name containing a tilde')
expect(recoveryHelper).toContain('extended volume alias did not fail closed')
expect(recoveryHelper).toContain('SUBST alias did not fail closed')