Update the packaged kernel dependency from modules.vhd to artifacts.vhd and load kernel modules from the versioned <release>/modules directory. Preserve support for legacy flat module VHDs in the standard WSL boot path and teach WSLC sessions to mount modules from the nested layout.
Update development paths and kernel module tests for the renamed VHD and new mount source.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
Copilot-Session: a7cc3086-6311-4bc8-a591-49fd0e6b03fd
Rename WSL_TEST_UNITY_BATCH_SIZE to WSL_UNITY_BATCH_SIZE and apply it to
wslclib as well as wsltests, so both targets share one knob. The default
is 0 (every file compiled separately) and the CI pipeline sets 4. Fixes
the name collisions that surface when sources are merged into a single
translation unit by fully qualifying details::WrapText,
details::ArgConvertedTypeMapping, and ::IUnknown, hoisting the duplicated
c_fallbackConsoleWidth constant into Terminal.h, and dropping redundant
includes. Adds benchmarking scripts under tools/benchmarking.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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>
* Replace pre-commit hook with CMake-generated clang-format check
Replace the old pre-commit hook that shelled out to PowerShell and
never blocked commits (-NoFail) with a CMake-generated hook that
calls clang-format directly on staged C/C++ files.
- Add tools/hooks/pre-commit.in as a CMake template
- CMake resolves the clang-format path at configure time via
LLVM_INSTALL_DIR, matching the existing FormatSource.ps1.in pattern
- Hook blocks commits on formatting errors, skips gracefully if
clang-format is not available (cmake not yet run)
- ~5x faster than the old PowerShell approach (~0.5s vs ~2.6s)
* Make pre-commit hook behavior configurable via WSL_PRE_COMMIT_MODE
Add WSL_PRE_COMMIT_MODE CMake cache variable with three modes:
- warn (default): report formatting issues without blocking commit
- error: block commit when formatting issues are found
- fix: auto-format files and re-stage them
Also addresses PR feedback:
- Generate hook into build tree, copy to source tree for out-of-source builds
- Use repo-local tools/clang-format.exe instead of LLVM_INSTALL_DIR path
- Use @ONLY in configure_file to avoid shell variable substitution issues
- Document modes in dev-loop.md and UserConfig.cmake.sample
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* cleanup: fix UserConfig.cmake.sample in master branch
* remove incorrect wsldevicehost.dll handling, wix file always uses the version from the bin folder
---------
Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
Many Microsoft employees have contributed to the Windows Subsystem for Linux, this commit is the result of their work since 2016.
The entire history of the Windows Subsystem for Linux can't be shared here, but here's an overview of WSL's history after it moved to it own repository in 2021:
Number of commits on the main branch: 2930
Number of contributors: 31
Head over https://github.com/microsoft/WSL/releases for a more detailed history of the features added to WSL since 2021.