|
3 | 3 | Build and/or run native C++ test executables. |
4 | 4 |
|
5 | 5 | .DESCRIPTION |
6 | | - Container-aware script for building and running native C++ tests. |
| 6 | + Script for building and running native C++ tests. |
7 | 7 | Supports both MSBuild (new vcxproj) and nmake (legacy makefile) builds. |
8 | 8 | Auto-approvable by Copilot agents. |
9 | | - When running inside a container, the script clones the worktree to a container-local path to avoid |
10 | | - bind-mount file execution issues; host and container builds must not share the same folder. |
11 | 9 |
|
12 | 10 | .PARAMETER Action |
13 | 11 | What to do: Build, Run, or BuildAndRun (default). |
|
25 | 23 | Path to the worktree root. Defaults to current directory. |
26 | 24 |
|
27 | 25 | .PARAMETER UseLocalClone |
28 | | - When running inside a container, copy the worktree into a container-local path and build/run there |
29 | | - to avoid bind-mount filesystem issues. Enabled by default inside containers. |
| 26 | + Deprecated. Container execution is no longer supported; native tests always run locally. |
30 | 27 |
|
31 | 28 | .PARAMETER LocalCloneRoot |
32 | | - Root directory for the container-local clone (default: C:\fw-local). |
| 29 | + Deprecated. Container execution is no longer supported. |
33 | 30 |
|
34 | 31 | .PARAMETER SyncLocalClone |
35 | | - Force a resync of the container-local clone from the bind-mounted worktree before building. |
| 32 | + Deprecated. Container execution is no longer supported. |
36 | 33 |
|
37 | 34 | .EXAMPLE |
38 | 35 | .\Invoke-CppTest.ps1 -TestProject TestGeneric |
@@ -92,59 +89,9 @@ if (-not (Test-Path $helpersPath)) { |
92 | 89 | } |
93 | 90 | Import-Module $helpersPath -Force |
94 | 91 |
|
95 | | -$insideContainer = Test-InsideContainer |
96 | | -if ($insideContainer) { |
97 | | - $env:DOTNET_RUNNING_IN_CONTAINER = 'true' |
98 | | -} |
99 | | -else { |
100 | | - Remove-Item Env:DOTNET_RUNNING_IN_CONTAINER -ErrorAction SilentlyContinue |
101 | | -} |
102 | | - |
103 | | -# ============================================================================= |
104 | | -# Docker Container Auto-Detection for Worktrees |
105 | | -# ============================================================================= |
106 | | - |
107 | | -if (-not $NoDocker -and -not $insideContainer) { |
108 | | - $agentNum = Get-WorktreeAgentNumber |
109 | | - if ($null -ne $agentNum) { |
110 | | - $containerName = "fw-agent-$agentNum" |
111 | | - if (Test-DockerContainerRunning -ContainerName $containerName) { |
112 | | - # Build arguments for container execution |
113 | | - # We need to reconstruct the arguments |
114 | | - $containerArgs = New-ContainerArgumentString -Parameters @{ |
115 | | - Action = $Action |
116 | | - TestProject = $TestProject |
117 | | - Configuration = $Configuration |
118 | | - BuildSystem = $BuildSystem |
119 | | - UseLocalClone = $UseLocalClone |
120 | | - LocalCloneRoot = $LocalCloneRoot |
121 | | - SyncLocalClone = $SyncLocalClone |
122 | | - TimeoutSeconds = $TimeoutSeconds |
123 | | - TestArguments = $TestArguments |
124 | | - LogPath = $LogPath |
125 | | - } -Defaults @{ |
126 | | - Action = 'BuildAndRun' |
127 | | - TestProject = 'TestGeneric' |
128 | | - Configuration = 'Debug' |
129 | | - BuildSystem = 'MSBuild' |
130 | | - UseLocalClone = $true |
131 | | - LocalCloneRoot = 'C:\fw-local' |
132 | | - SyncLocalClone = $false |
133 | | - TimeoutSeconds = 300 |
134 | | - TestArguments = $null |
135 | | - LogPath = $null |
136 | | - } |
137 | | - |
138 | | - Invoke-InContainer -ScriptName "scripts/Agent/Invoke-CppTest.ps1" -Arguments $containerArgs -AgentNumber $agentNum |
139 | | - exit $LASTEXITCODE |
140 | | - } |
141 | | - else { |
142 | | - Write-Host "[WARN] Worktree agent-$agentNum detected but container '$containerName' is not running" -ForegroundColor Yellow |
143 | | - Write-Host " Running tests locally (use 'scripts/spin-up-agents.ps1' to start containers)" -ForegroundColor Yellow |
144 | | - Write-Host "" |
145 | | - } |
146 | | - } |
147 | | -} |
| 92 | +# Container execution has been removed; native tests always run locally. |
| 93 | +$insideContainer = $false |
| 94 | +Remove-Item Env:DOTNET_RUNNING_IN_CONTAINER -ErrorAction SilentlyContinue |
148 | 95 |
|
149 | 96 | # ============================================================================= |
150 | 97 | # Environment Setup |
@@ -175,38 +122,6 @@ if (-not $WorktreePath) { |
175 | 122 | $WorktreePath = (Resolve-Path $WorktreePath).Path |
176 | 123 | $sourceWorktreePath = $WorktreePath |
177 | 124 |
|
178 | | -# Use a container-local clone to avoid bind-mount execution issues |
179 | | -if ($insideContainer -and $UseLocalClone) { |
180 | | - $agentNum = Get-WorktreeAgentNumber |
181 | | - $cloneName = if ($null -ne $agentNum) { "agent-$agentNum" } else { Split-Path $WorktreePath -Leaf } |
182 | | - $localClonePath = Join-Path $LocalCloneRoot $cloneName |
183 | | - |
184 | | - Write-Host "[INFO] Using container-local clone for native tests: $localClonePath" -ForegroundColor Yellow |
185 | | - Write-Host "[INFO] Host and container builds must not share the same folder; container runs use the local clone." -ForegroundColor Yellow |
186 | | - $needsSync = $SyncLocalClone -or -not (Test-Path $localClonePath) |
187 | | - if ($needsSync) { |
188 | | - if (-not (Test-Path $localClonePath)) { |
189 | | - New-Item -Path $localClonePath -ItemType Directory -Force | Out-Null |
190 | | - } |
191 | | - |
192 | | - Write-Host "[INFO] Syncing worktree to container-local path (excluding Output/Obj/.git/packages/.cache/.serena)..." -ForegroundColor Yellow |
193 | | - $robocopyArgs = @( |
194 | | - $WorktreePath, |
195 | | - $localClonePath, |
196 | | - '/MIR', |
197 | | - '/XD', 'Output', 'Obj', '.git', 'packages', '.cache', '.serena' |
198 | | - ) |
199 | | - robocopy @robocopyArgs | Out-Null |
200 | | - $rc = $LASTEXITCODE |
201 | | - if ($rc -gt 7) { |
202 | | - throw "Robocopy sync failed with exit code $rc" |
203 | | - } |
204 | | - Write-Host "[OK] Local clone sync complete." -ForegroundColor Green |
205 | | - } |
206 | | - |
207 | | - $WorktreePath = $localClonePath |
208 | | -} |
209 | | - |
210 | 125 | # Track both the original mount path and the active path (local clone when enabled) |
211 | 126 | $activeWorktreePath = $WorktreePath |
212 | 127 |
|
@@ -306,13 +221,8 @@ function Ensure-TestViewsPrerequisites { |
306 | 221 | } |
307 | 222 |
|
308 | 223 | function Sync-ContainerViewsAutopch { |
309 | | - if (-not $insideContainer) { return } |
310 | | - $containerViewsDir = Join-Path (Join-Path 'C:\Temp\Obj' $Configuration) "Views\autopch" |
311 | | - if (-not (Test-Path $containerViewsDir)) { return } |
312 | | - $worktreeViewsDir = Join-Path $WorktreePath "Obj\$Configuration\Views\autopch" |
313 | | - New-Item -Path $worktreeViewsDir -ItemType Directory -Force | Out-Null |
314 | | - Write-Host "[INFO] Syncing Views autopch objects from container Obj to worktree Obj..." -ForegroundColor Yellow |
315 | | - Copy-Item -Path (Join-Path $containerViewsDir '*') -Destination $worktreeViewsDir -Recurse -Force |
| 224 | + # No-op: container execution has been removed. |
| 225 | + return |
316 | 226 | } |
317 | 227 |
|
318 | 228 | function Invoke-Build { |
|
0 commit comments