Skip to content

Commit cb6bfef

Browse files
authored
Patch version fix (#785)
* add test to verify version match * bump to p2 in version.h
1 parent efa17c8 commit cb6bfef

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

regress/pesterTests/Setup.Tests.ps1

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ Describe "Setup Tests" -Tags "Setup" {
165165
@{
166166
Name = 'sshd.exe'
167167
},
168+
@{
169+
Name = 'sshd-session.exe'
170+
},
168171
@{
169172
Name = 'ssh.exe'
170173
},
@@ -253,6 +256,37 @@ Describe "Setup Tests" -Tags "Setup" {
253256
}
254257
}
255258

259+
Context "$tC - Validate OpenSSH version" {
260+
BeforeAll {
261+
$tI = 1
262+
$sshExePath = Join-Path $binPath "ssh.exe"
263+
if (-not (Test-Path -Path $sshExePath)) {
264+
Throw "ssh.exe not found at $sshExePath"
265+
}
266+
}
267+
AfterAll { $tC++ }
268+
AfterEach { $tI++ }
269+
270+
It "$tC.$tI - Validate ssh -V output matches ssh.exe properties" {
271+
$pattern = "\d+\.\dp\d" # i.e. 9.2p2
272+
273+
$sshVersionOutput = & $sshExePath -V 2>&1 | Select-String -Pattern "OpenSSH"
274+
$match = $sshVersionOutput.Line -match $pattern
275+
if (-not $match) {
276+
throw "No matching version pattern found from ssh -V output"
277+
}
278+
$versionNumber = $Matches[0]
279+
280+
$fileVersionInfo = Get-Item $sshExePath | Select-Object -ExpandProperty VersionInfo
281+
$fileVersion = $fileVersionInfo.ProductVersion
282+
$match = $fileVersion -match $pattern
283+
if (-not $match) {
284+
throw "No matching version pattern found from ssh.exe properties"
285+
}
286+
$versionNumber | Should Match $Matches[0]
287+
}
288+
}
289+
256290
Context "$tC - Validate Openssh registry entries" {
257291
BeforeAll {
258292
$tI=1

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
#define SSH_WINDOWS_BANNER " Win32-OpenSSH-GitHub"
55
#define SSH_VERSION SSH_WINDOWS_VERSION SSH_WINDOWS_BANNER
66

7-
#define SSH_PORTABLE "p1"
7+
#define SSH_PORTABLE "p2"
88
#define SSH_RELEASE SSH_WINDOWS_VERSION SSH_PORTABLE SSH_WINDOWS_BANNER

0 commit comments

Comments
 (0)