Files
pcre2/maint/RunManifestTest.ps1
Nicholas Wilson 5b3edae9d2 Add CI test to ensure installation manifest is correct (#630)
The new CI job ensures that `make distcheck` passes.

It also bundles up the tarball and includes in the GitHub artifacts, along with a GitHub-provided attestation that the tarball is derived from the given build steps.
2024-12-18 12:02:23 +00:00

37 lines
1.1 KiB
PowerShell

# Script to test a directory listing. We use this to verify that the list of
# files installed by "make install" or "cmake --install" matches what we expect.
param (
[Parameter(Mandatory=$true)]
[string]$inputDir,
[Parameter(Mandatory=$true)]
[string]$manifestName
)
if ((-not $inputDir) -or (-not $manifestName)) {
throw "Usage: .\RunManifestTest.ps1 <dir> <manifest name>"
}
$base = [System.IO.Path]::GetFileName($manifestName)
$installedFiles = Get-ChildItem -Recurse -Force -Path $inputDir |
Sort-Object {[System.BitConverter]::ToString([system.Text.Encoding]::UTF8.GetBytes($_.FullName))} |
ForEach-Object { $_.Mode.Substring(0,5) + " " + ($_.FullName | Resolve-Path -Relative) }
$null = New-Item -Force $base -Value (($installedFiles | Out-String) -replace "`r`n", "`n")
$expectedFiles = Get-Content -Path $manifestName -Raw
$actualFiles = Get-Content -Path $base -Raw
if ($expectedFiles -ne $actualFiles) {
Write-Host "===Actual==="
Write-Host $actualFiles
Write-Host "===End==="
throw "Installed files differ from expected"
}
Write-Host "Installed files match expected"
Remove-Item -Path $base -Force