Skip to content

Commit 0cbc83e

Browse files
committed
Improve diagnostics-only flow and smoke test robustness
1 parent 51afd6e commit 0cbc83e

File tree

2 files changed

+40
-9
lines changed

2 files changed

+40
-9
lines changed

dev/_installers/build_installer.ps1

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ param(
88
[switch]$NoClean,
99
[switch]$SkipPyInstaller,
1010
[switch]$SkipInno,
11-
[switch]$SmokeTest
11+
[switch]$SmokeTest,
12+
[switch]$DiagnosticsOnly
1213
)
1314

1415
Set-StrictMode -Version Latest
@@ -74,6 +75,12 @@ try {
7475
Write-Host "DiagDir = $DiagDir"
7576
Write-Host "PSVersion = $($PSVersionTable.PSVersion)"
7677

78+
if ($DiagnosticsOnly) {
79+
$SkipPyInstaller = $true
80+
$SkipInno = $true
81+
Write-Host "DiagnosticsOnly enabled -> forcing -SkipPyInstaller and -SkipInno"
82+
}
83+
7784
$VenvPy = Ensure-Venv -RepoRootPath $RepoRoot
7885

7986
Write-Section "Python / pip sanity"
@@ -173,24 +180,42 @@ try {
173180

174181
if ($SmokeTest) {
175182
Write-Section "Smoke test (IBEIS-console.exe with IBEIS_DLL_DEBUG=1) -> smoke_test.txt"
176-
$SmokeOut = Join-Path $DiagDir "smoke_test.txt"
183+
$SmokeOut = Join-Path $DiagDir "smoke_test_stdout.txt"
184+
$SmokeErr = Join-Path $DiagDir "smoke_test_stderr.txt"
185+
$SmokeMerged = Join-Path $DiagDir "smoke_test.txt"
177186
$exe = Join-Path $AppDir "IBEIS-console.exe"
178187

179188
$env:IBEIS_DLL_DEBUG = "1"
180-
$p = Start-Process -FilePath $exe -WorkingDirectory $AppDir -NoNewWindow -PassThru `
181-
-RedirectStandardOutput $SmokeOut -RedirectStandardError $SmokeOut
182-
183189
try {
190+
$p = Start-Process -FilePath $exe -WorkingDirectory $AppDir -NoNewWindow -PassThru `
191+
-RedirectStandardOutput $SmokeOut -RedirectStandardError $SmokeErr
192+
184193
Wait-Process -Id $p.Id -Timeout 20 -ErrorAction SilentlyContinue | Out-Null
185194
if (-not $p.HasExited) {
186195
Write-Warning "Smoke test timed out; stopping process."
187196
Stop-Process -Id $p.Id -Force -ErrorAction SilentlyContinue
188197
}
198+
} catch {
199+
Write-Warning "Smoke test failed to start: $($_.Exception.Message)"
189200
} finally {
190201
Remove-Item Env:\IBEIS_DLL_DEBUG -ErrorAction SilentlyContinue
191202
}
192203

193-
Write-Host "Wrote: $SmokeOut"
204+
$parts = @()
205+
if (Test-Path $SmokeOut) {
206+
$parts += "===== STDOUT ====="
207+
$parts += (Get-Content $SmokeOut)
208+
}
209+
if (Test-Path $SmokeErr) {
210+
$parts += "===== STDERR ====="
211+
$parts += (Get-Content $SmokeErr)
212+
}
213+
if ($parts.Count -gt 0) {
214+
$parts | Set-Content -Path $SmokeMerged
215+
Write-Host "Wrote: $SmokeMerged"
216+
} else {
217+
Write-Warning "Smoke test produced no output files."
218+
}
194219
}
195220

196221
if (-not $SkipInno) {

dev/_installers/ibeis_pyi_helper.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ def _collect_msvc_runtime_binaries() -> List[BinaryTuple]:
131131
return out
132132

133133

134+
135+
136+
def _exclude_test_modules(mods: List[str]) -> List[str]:
137+
return [m for m in mods if ".tests" not in m and not m.endswith(".test") and ".testing" not in m]
138+
139+
134140
def collect_everything():
135141
datas: List[DataTuple] = []
136142
binaries: List[BinaryTuple] = []
@@ -144,12 +150,12 @@ def collect_everything():
144150
)
145151

146152
# Dynamic imports in ibeis
147-
hiddenimports += _all_py_modules_in_package("ibeis")
153+
hiddenimports += _exclude_test_modules(_all_py_modules_in_package("ibeis"))
148154

149155
# Custom binary packages
150156
for pkg in ["pyhesaff", "pyflann_ibeis", "vtool_ibeis_ext"]:
151157
binaries += _collect_pkg_binaries(pkg)
152-
hiddenimports += _all_py_modules_in_package(pkg)
158+
hiddenimports += _exclude_test_modules(_all_py_modules_in_package(pkg))
153159

154160
# Wheel binary bundles
155161
for pkg in ["numpy", "scipy", "pandas", "shapely", "sklearn"]:
@@ -168,7 +174,7 @@ def collect_everything():
168174
if win32_dir is not None:
169175
datas += _collect_dir_as_datas(win32_dir, "win32ctypes")
170176
binaries += _collect_dir_as_binaries(win32_dir, "win32ctypes")
171-
hiddenimports += _all_py_modules_in_package("win32ctypes")
177+
hiddenimports += _exclude_test_modules(_all_py_modules_in_package("win32ctypes"))
172178
else:
173179
hiddenimports += [
174180
"win32ctypes.core",

0 commit comments

Comments
 (0)