Commit 74fd479d authored by Adam Štěpánek's avatar Adam Štěpánek
Browse files

Fix the compare script

parent b71b46f4
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -4,25 +4,30 @@ param(
    [Parameter(Position=1, Mandatory=$true)]
    [string] $source)

$reference = (Get-Item $reference)
$source = (Get-Item $source)
Write-Host $reference $source
$kinds = Get-ChildItem -Directory $reference

$ui = (Get-Host).UI.RawUI
foreach ($kind in $kinds) {
    $ui.ForegroundColor = 'White'
    Write-Host "Checking ${kind.Name}:"
    Write-Host "Checking $($kind.Name):"
    $tests = Get-ChildItem -File $kind
    foreach ($test in $tests) {
        $other = "$source\${kind.Name}\${other.Name}"
        $other = Get-Item (Join-Path $source $kind.Name $test.Name)
        $hashRef = (Get-FileHash -Path $test -Algorithm SHA256).Hash
        $hashSrc = (Get-FileHash -Path $other -Algorithm SHA256).Hash
        if ($hashRef -eq $hashSrc) {
            $ui.ForegroundColor = 'Green'
            Write-Host "     OK $test == $other"
            $name = $test.Name
            Write-Host "     OK $name"
        }
        else {
            $ui.ForegroundColor = 'Red'
            Write-Host "    NOK $test != $other"
            Write-Host "        $hashRef != $hashSrc"
            $name = $test.Name
            Write-Host "    NOK $name"
        }
    }
}
$ui.ForegroundColor = 'White'