Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 33 additions & 2 deletions tools/ci/Resolve-CiEnvironment.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,16 @@ that is running when a job starts belongs to an earlier one. When vipm gives
up on an operation, VIPM Desktop can carry on with it, or wait at a dialog,
long afterwards, and then never answers the next job ("wait for VIPM startup
timed out"). The vipm command line starts VIPM Desktop again when needed, and
LabVIEW CLI starts LabVIEW. The check after the package install does not pass
-CleanStart, so it keeps what the install just started.
LabVIEW CLI starts LabVIEW. It also closes the LabVIEW chosen for the tests
and the build if it is still running, and deletes that LabVIEW version's
compiled object cache (Documents\LabVIEW Data\VIObjCache\<version>). The
repository's VIs are saved source-only, so their compiled code lives in that
cache, keyed by file path. Jobs of different pull requests use the same
workspace path, and a VI that is identical on both branches keeps its cache
entry, compiled against the previous job's typedefs: the next build then looks
for that job's files ("The following source VIs or Libraries are missing").
The check after the package install does not pass -CleanStart, so it keeps
what the install just started.

The requested values come from the environment variables
REQUESTED_LABVIEW_PATH, REQUESTED_LABVIEW_PORT, REQUESTED_COMPARE_PATH and
Expand Down Expand Up @@ -149,6 +157,29 @@ if ($For -in 'Test', 'All' -and $installs.Count -gt 0) {
}
}

if ($Fix -and $CleanStart -and $test) {
# The previous job's VIs may still be loaded from the same workspace path.
$running = Get-LabVIEWProcess $test.Path
if ($running) {
$runningId = $running.Id
Stop-Process -Id $runningId -Force -ErrorAction SilentlyContinue
Wait-Process -Id $runningId -Timeout 60 -ErrorAction SilentlyContinue
$notes.Add("Closed LabVIEW $($test.Year) $($test.Bitness)-bit (process $runningId) left running by an earlier job.")
}
# Compiled code of source-only VIs from an earlier job's checkout at the
# same path; LabVIEW rebuilds the cache from this checkout's files.
$cacheRoot = Join-Path ([Environment]::GetFolderPath('MyDocuments')) 'LabVIEW Data\VIObjCache'
$cacheDirs = @(Get-ChildItem -LiteralPath $cacheRoot -Directory -Filter "$($test.Year - 2000).0*" -ErrorAction SilentlyContinue)
foreach ($dir in $cacheDirs) {
try {
Remove-Item -LiteralPath $dir.FullName -Recurse -Force -ErrorAction Stop
$notes.Add("Deleted the compiled object cache $($dir.FullName), so no VI is loaded with code compiled against an earlier job's files.")
} catch {
$notes.Add("Could not delete the compiled object cache $($dir.FullName): $($_.Exception.Message)")
}
}
}

$compare = $null
if ($For -in 'Compare', 'All' -and $installs.Count -gt 0) {
$compare = Select-Requested $env:REQUESTED_COMPARE_PATH 'LABVIEW_COMPARE_PATH' $installs
Expand Down
Loading