24 lines
1.0 KiB
PowerShell
24 lines
1.0 KiB
PowerShell
Set-StrictMode -Version Latest
|
|
$ErrorActionPreference = 'Stop'
|
|
$root = Split-Path $PSScriptRoot -Parent
|
|
Import-Module (Join-Path $root 'CBBRefresh.Core.psm1') -Force
|
|
$scratch = Join-Path $root ('build\content-check-exit-' + [guid]::NewGuid().ToString('N'))
|
|
New-Item -ItemType Directory -Path $scratch | Out-Null
|
|
$exe = Join-Path $scratch 'ReuseBlockImporter.exe'
|
|
Add-Type -TypeDefinition @'
|
|
using System;
|
|
public class FakeImporter {
|
|
public static int Main(string[] args) {
|
|
Console.WriteLine("content checking completed successfully");
|
|
return 7;
|
|
}
|
|
}
|
|
'@ -OutputAssembly $exe -OutputType ConsoleApplication
|
|
$library = Join-Path $scratch 'test.lmc'
|
|
[IO.File]::WriteAllText($library, '')
|
|
$result = Invoke-CbbReuseBlockContentCheck -LmcFile $library -BlockName 'CBB' -LibSpec 'test' -DmsLoginConfig 'test' -MentorBin $scratch
|
|
if ($result.result -ne 'fail' -or $result.exitCode -ne 7) {
|
|
throw 'A nonzero native exit must not pass, even when stdout claims success.'
|
|
}
|
|
Write-Output 'Content-check exit-code regression passed (no Mentor data opened).'
|