3 Commits
Author SHA1 Message Date
ggarzia-MSFTandCopilot 4ebaffce6f Enable unity builds for wsltests (#41247)
wsltests is a single large target whose compile time dominates local test
iteration. Enabling CMake unity builds batches test sources into shared
translation units, cutting wall-clock build time significantly.

Batch size is controlled by the new WSL_TEST_UNITY_BATCH_SIZE cache variable
(default 2). Setting it to 0 disables unity builds and compiles every file
separately, which is useful for isolating a build break to a single source
file. The value is validated at configure time and documented in
UserConfig.cmake.sample.

Concatenating sources into one translation unit surfaced latent collisions
that file scope had previously hidden:

- g_pipelineBuildId was defined as a separate file-static in both Common.cpp
  and InstallerTests.cpp. Common.cpp now owns the definition and
  InstallerTests.cpp declares it extern.
- ProcessOutput was declared at namespace scope in both WslcSdkTests.cpp and
  WslcSdkWinRTTests.cpp. The latter is renamed to CapturedProcessOutput.
- Broad `using namespace wsl::windows::common;` directives in
  WindowsUpdateTests.cpp, WSLCE2EHelpers.cpp, WSLCE2ETlsRegistryTests.cpp and
  WSLCExecutor.cpp leaked into neighboring sources and created ambiguous
  lookups. They are replaced with targeted using-declarations and namespace
  aliases.

Unity builds also change test execution order, which broke assertions that
implicitly depended on running before anything else had created a session.
WSLCTests::ListSessions and WSLCTests::SessionManagement now share a
ListTestSessionNames() helper that filters out the persistent sessions the
wslc CLI creates for itself, so the assertions no longer depend on what else
has run on the machine.

SessionManagement is the only test that creates persistent sessions, which
outlive the COM reference that created them. It now records the ones it
creates and terminates them from a scope_exit handler, so a failure partway
through cannot leak a session into subsequent runs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-06 17:53:15 -07:00
JohnMcPMS b25c0820a9 WSLC SDK install API update (#40949)
Updates the WSLC SDK install API to allow more flexibility in the calling pattern, specifically enabling caller-initiated updates/reinstalls to WSL even when WSLC is already present.
2026-07-28 09:12:15 -07:00
+8 358ab87d40 Add WSLC (WSL Containers) feature (#40366)
WSLC is a container runtime built on the Windows Subsystem for Linux, enabling Windows applications to create and manage Linux containers through a native Windows API surface.

Key components:
- wslc.exe: CLI for managing containers, images, volumes, and networks
  (build, run, stop, inspect, push/pull from registries)
- wslcsession.exe: Per-user Windows service hosting container lifecycle,
  storage management, and networking
- WSLC SDK: C++ and C# client libraries with NuGet packaging for
  programmatic container management
- Container networking: port forwarding, DNS tunneling, virtio
  networking, and HCN integration
- Storage: VHD-backed volumes, virtiofs file sharing, overlayfs layers
- GPU passthrough and device host proxy support

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
Co-authored-by: 1wizkid <richard.fricks@hotmail.com>
Co-authored-by: AmirMS <104940545+AmelBawa-msft@users.noreply.github.com>
Co-authored-by: beena352 <beenachauhan@microsoft.com>
Co-authored-by: Blue <OneBlue@users.noreply.github.com>
Co-authored-by: Craig Loewen <crloewen@microsoft.com>
Co-authored-by: Darshak Bhatti <47045043+dabhattimsft@users.noreply.github.com>
Co-authored-by: David Bennett <dbenne@microsoft.com>
Co-authored-by: Feng Wang <wang6922@outlook.com>
Co-authored-by: Flor Chacon <14323496+florelis@users.noreply.github.com>
Co-authored-by: John Stephens <johnstep@microsoft.com>
Co-authored-by: JohnMcPMS <johnmcp@microsoft.com>
Co-authored-by: Kevin Vega <40717198+kvega005@users.noreply.github.com>
Co-authored-by: Pooja Trivedi <poojatrivedi@gmail.com>
Co-authored-by: ramesh-ramn <raman.ramesh@gmail.com>
Co-authored-by: Richard Fricks <richfr@microsoft.com>
Co-authored-by: yao-msft <50888816+yao-msft@users.noreply.github.com>
2026-04-30 13:34:43 -07:00