Evan's Blog
EvanZhu0721 / 公开仓库

SBMS

镜像已同步

SBMS complete the calculation rules for the default logical desktop topology relationship and the physical dimensions of the displays in the Windows multi-screen collaboration system.

上游 GitHub
READ-ONLY MIRROR

README、源码与 Release 已保存到本站;源码视图固定到 commit bd87fa1e。

main/ root / installer/tests
bd87fa1e· 固定源码快照
installer/tests/build-installer-contract.Tests.ps13.0 KB
1$ErrorActionPreference = 'Stop'
2Set-StrictMode -Version Latest
3
4$buildScript = [IO.Path]::GetFullPath(
5 (Join-Path $PSScriptRoot '..\..\build-installer.ps1')
6)
7
8Describe 'Installer build entry point contract' {
9 BeforeAll {
10 $script:command = Get-Command -Name $buildScript
11 $script:source = [IO.File]::ReadAllText(
12 $buildScript,
13 [Text.Encoding]::UTF8
14 )
15 $tokens = $null
16 $parseErrors = $null
17 $ast = [Management.Automation.Language.Parser]::ParseFile(
18 $buildScript,
19 [ref]$tokens,
20 [ref]$parseErrors
21 )
22 @($parseErrors).Count | Should Be 0
23 $hashFunction = $ast.Find(
24 {
25 param($node)
26 $node -is [Management.Automation.Language.FunctionDefinitionAst] -and
27 $node.Name -eq 'Get-Sha256Hex'
28 },
29 $true
30 )
31 $hashFunction | Should Not BeNullOrEmpty
32 $script:hashFunctionSource = $hashFunction.Extent.Text
33 }
34
35 It 'requires a certificate in the default signed release path' {
36 $signed = @($script:command.ParameterSets |
37 Where-Object Name -eq 'Signed')
38
39 $signed.Count | Should Be 1
40 ($signed[0].Parameters |
41 Where-Object Name -eq 'SigningCertificateThumbprint').IsMandatory |
42 Should Be $true
43 @($signed[0].Parameters |
44 Where-Object Name -eq 'Unsigned').Count | Should Be 0
45 }
46
47 It 'keeps unsigned packaging explicit and on the full build path' {
48 $unsigned = @($script:command.ParameterSets |
49 Where-Object Name -eq 'Unsigned')
50
51 $unsigned.Count | Should Be 1
52 ($unsigned[0].Parameters |
53 Where-Object Name -eq 'Unsigned').IsMandatory | Should Be $true
54 }
55
56 It 'rejects a false unsigned switch instead of weakening release signing' {
57 $failure = $null
58 try {
59 & $buildScript -Unsigned:$false
60 }
61 catch {
62 $failure = $_
63 }
64
65 $failure | Should Not BeNullOrEmpty
66 $failure.Exception.Message | Should Match (
67 'Unsigned packaging must be explicitly enabled'
68 )
69 }
70
71 It 'computes SHA256 without depending on PowerShell module discovery' {
72 . ([scriptblock]::Create($script:hashFunctionSource))
73 $inputFile = Join-Path $TestDrive 'sha256-input.txt'
74 [IO.File]::WriteAllText(
75 $inputFile,
76 'abc',
77 [Text.UTF8Encoding]::new($false)
78 )
79
80 Get-Sha256Hex -LiteralPath $inputFile | Should Be (
81 'BA7816BF8F01CFEA414140DE5DAE2223' +
82 'B00361A396177A9CB410FF61F20015AD'
83 )
84 }
85
86 It 'locks Rust and always runs the real driver build' {
87 $script:source | Should Match (
88 '(?m)cargo\.exe\s+build\s+--release\s+--bins\s+--locked'
89 )
90 $script:source | Should Match (
91 "(?m)&\s+\(Join-Path\s+\`$repository\s+'build-driver\.ps1'\)"
92 )
93 }
94}
95