diff --git a/install.ps1 b/install.ps1 index f26ec54..fbd23b1 100644 --- a/install.ps1 +++ b/install.ps1 @@ -379,12 +379,14 @@ function Install-Prebuilt { Verify-ArchiveChecksum $url $zip Expand-Archive -Force -Path $zip -DestinationPath $extract Verify-ArchiveVersion $extract $url - foreach ($bin in @("dosh-client.exe", "dosh-bench.exe")) { - $found = Get-ChildItem -Path $extract -Recurse -File -Filter $bin | Select-Object -First 1 - if (-not $found) { - throw "prebuilt archive missing $bin" - } - Install-Binary $found.FullName (Join-Path $bindir $bin) + $client = Get-ChildItem -Path $extract -Recurse -File -Filter "dosh-client.exe" | Select-Object -First 1 + if (-not $client) { + throw "prebuilt archive missing dosh-client.exe" + } + Install-Binary $client.FullName (Join-Path $bindir "dosh-client.exe") + $bench = Get-ChildItem -Path $extract -Recurse -File -Filter "dosh-bench.exe" | Select-Object -First 1 + if ($bench) { + Install-Binary $bench.FullName (Join-Path $bindir "dosh-bench.exe") } Install-Binary (Join-Path $bindir "dosh-client.exe") (Join-Path $bindir "dosh.exe") return $true diff --git a/tests/release_scripts.rs b/tests/release_scripts.rs index 188b919..76173df 100644 --- a/tests/release_scripts.rs +++ b/tests/release_scripts.rs @@ -230,6 +230,21 @@ fn windows_source_fallback_builds_client_only_like_unix() { assert!(ps1.contains("if (Test-Path \"target\\release\\dosh-bench.exe\")")); } +#[test] +fn windows_prebuilt_install_requires_client_but_not_bench() { + let install = include_str!("../install.sh"); + let ps1 = include_str!("../install.ps1"); + assert!(install.contains("install_extracted_binary \"$tmpdir/extract\" dosh-client")); + assert!(install.contains("if found_bench=\"$(find_extracted_binary")); + assert!(ps1.contains("throw \"prebuilt archive missing dosh-client.exe\"")); + assert!(ps1.contains("-Filter \"dosh-bench.exe\"")); + assert!(ps1.contains("if ($bench)")); + assert!( + !ps1.contains("throw \"prebuilt archive missing dosh-bench.exe\""), + "Windows prebuilt install should not fall back to source just because dosh-bench is absent" + ); +} + #[test] fn windows_installer_adds_user_path_idempotently() { let ps1 = include_str!("../install.ps1");