Skip to content

Make the native UIA test harness robust to cleanup locks and vcvars extension failures - #805

Merged
coneilen merged 1 commit into
mainfrom
coneilen-microsoft-windows-preview-rebuild
Oct 14, 2026
Merged

coneilen merged 1 commit into
mainfrom
coneilen-microsoft-windows-preview-rebuild

Conversation

@coneilen

Copy link
Copy Markdown
Collaborator

Summary

#802 made the windows-shell unit part run AccessibilityProvider.Native.Tests.ps1. That passes on hosted runners, but on developer machines it turned passing runs into failures, for two harness reasons:

  1. Cleanup lock. Push-Location $scratch made the scratch folder the pwsh process's working directory at the native call. Pop-Location doesn't change the process directory back, so the final Remove-Item failed with "being used by another process", and the script exited 1 after its checks had passed. Lane D2 hit this on a full unit run (1201/1201 tests and 55/55 sections passed, yet overall exit 1); I reproduced it locally.
  2. vcvars exit code. vcvars64.bat exits 1 when an optional extension (ext\ConnectionManagerExe.bat, the VC Linux component) is absent, even though the MSVC environment is usable. call vcvars && cl therefore never compiled on such machines.

Changes

Tools/windows/Tests/AccessibilityProvider.Native.Tests.ps1:

  • change directory inside cmd (cd /d), with no Push-Location, so the pwsh process never holds the scratch folder;
  • after vcvars, require a resolvable cl (where cl) instead of trusting vcvars's exit code. A real compile or test failure still fails the run;
  • clean up with a bounded retry (10 attempts, 500 ms apart), then warn, so a transient antivirus lock can't turn a passing run into a failure.

Test plan

RED: pwsh Tools/windows/Tests/AccessibilityProvider.Native.Tests.ps1 on main 13758a7 (local) -> exit 1, Remove-Item could not remove the scratch folder because it is being used by another process; cmd /c call vcvars64.bat -> exit 1 (ConnectionManagerExe init FAILED)
GREEN: pwsh Tools/windows/Tests/AccessibilityProvider.Native.Tests.ps1 on this branch (local) -> exit 0, Native accessibility provider: 176 checks, 0 failures, no scratch folder left; negative: -VcVars pointing to a no-op batch file with MSVC removed from PATH -> exit 1 (Native accessibility provider tests failed: 1), no scratch left
REGRESSION: pwsh Tools/windows/Tests/ValidationRunner.Tests.ps1 -> ValidationRunner.Tests.ps1: PASS; git diff --check -> clean; bash Tools/ci/tests/classify-changes.test.sh -> 59 passed, 0 failed

Exact-head CI shard 0 must still show Native accessibility provider: N checks, 0 failures with N greater than 0. macOS make test and make check were not run, because no Swift changed.

Checklist

  • I have read the Contributing Guidelines
  • I have signed off my commits (git commit -s) per the DCO
  • Tests pass locally (make test)
  • Code follows the existing style (make check)
  • I added the test/contract before the implementation and observed the intended RED failure

…xtension failures

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Signed-off-by: coneilen <coneilen@users.noreply.github.com>
@coneilen
coneilen merged commit b0bb81f into main Oct 14, 2026
24 checks passed
@coneilen coneilen mentioned this pull request Oct 14, 2026
3 of 5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant