-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CI test to ensure installation manifest is correct
Fixes #617
- Loading branch information
Showing
11 changed files
with
2,016 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#/bin/sh | ||
|
||
# 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. | ||
|
||
LANG=C # Ensure stable ordering of `ls` output | ||
export LANG | ||
|
||
if [ "$1" = "" -o "$2" = "" ] ; then | ||
echo "Usage: $0 <dir> <manifest name>" >&2 | ||
exit 1 | ||
fi | ||
|
||
input_dir="$1" | ||
expected_manifest="$2" | ||
|
||
base=`basename $expected_manifest` | ||
|
||
sed=sed | ||
grep=grep | ||
# Helpers for Solaris | ||
if [ -f /usr/bin/gsed ] ; then | ||
sed=/usr/bin/gsed | ||
fi | ||
if [ -f /usr/bin/ggrep ] ; then | ||
grep=/usr/bin/ggrep | ||
fi | ||
|
||
ls -R -l -n -A "$input_dir" | \ | ||
$grep -v '^total' | \ | ||
$sed -E -e 's/ {2,}/ /g' | \ | ||
cut -d' ' -f '1,9-' \ | ||
> "$base" | ||
|
||
if ! diff -u "$expected_manifest" "$base"; then | ||
echo "Installed files differ from expected" >&2 | ||
|
||
echo "===Actual===" | ||
cat "$base" | ||
echo "===End===" | ||
|
||
exit 1 | ||
fi | ||
|
||
echo "Installed files match expected" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#/bin/sh | ||
|
||
# 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) | ||
|
||
$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" |
Oops, something went wrong.