* Initial support for image tag command
* Init test
* Init e2e test
* Adde E2E tests
* Added more tests
* Added more tests
* Resolve copilot comment
* Clang format
* Clang format
* Fix build
* Update parser
* Update loc
* Fix test
* Added more tests
* Clang format
* Loc
* Addressed comments
Replace runtime WSL2_TEST_ONLY()/WSL1_TEST_ONLY() skip macros with
TAEF metadata-based test selection. Tests that don't apply to the
current WSL version are now excluded by /select: queries at selection
time rather than skipped at runtime, eliminating hundreds of 'skipped'
results from test output.
Changes:
- Add WSL2_TEST_METHOD, WSL1_TEST_METHOD, WSLC_TEST_METHOD macros
in Common.h that tag tests with WSLVersion metadata property
- Convert ~430 test methods across 26 files to use new macros
- Update run-tests.ps1 to auto-add /select: version filter
- Update CloudTest XML configs with version selection queries
- Remove WSL2_TEST_ONLY() from composite macros in NetworkTests.cpp
- Update test README with new macro documentation
Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* [WSLC] Add 'wslc version' subcommand
Adds a 'version' subcommand to the WSLC CLI as an alternative to the
existing '--version' flag, following the subcommand pattern used by
other WSLC commands. Includes unit tests for command structure and
command-line parsing.
Co-authored-by: Pooja Trivedi <trivedipooja@microsoft.com>
Co-Authored-By: Claude Sonnet 4.6
* [WSLC] Fix E2E help/invalid-command tests after version subcommand addition
Update expected help output in WSLCE2EGlobalTests to include the newly
added 'version' subcommand, fixing WSLCE2E_HelpCommand and
WSLCE2E_InvalidCommand_DisplaysErrorMessage test failures.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [WSLC] Add E2E version command test and strengthen unit test
- Add WSLCE2E_VersionCommand E2E test in WSLCE2EGlobalTests verifying
stdout, empty stderr, and exit code for 'wslc version'
- Add assertion to VersionCommand_HasNoArguments unit test to verify
only the auto-added --help argument is present
Authored-By: Pooja Trivedi <trivedipooja@microsoft.com>
Co-Authored-By: Claude Sonnet 4.6
* Mark 'context' as UNREFERENCED_PARAMETER in
VersionCommand::ExecuteInternal to avoid build issues
* Address PR feedback on wslc version command
- Use Localization::WSLCCLI_VersionDesc/LongDesc instead of hard-coded strings; add entries to en-US Resources.resw
- Centralize version printing in VersionCommand::PrintVersion(); reuse from RootCommand --version flag
- Drop 'v' prefix from version output per OneBlue's feedback
- Add 'version' entry to E2E GetAvailableCommands() to fix WSLCE2E_HelpCommand and WSLCE2E_InvalidCommand_DisplaysErrorMessage
Co-Authored-By: Pooja Trivedi
* Fix build: add missing using namespace wsl::shared
Localization::WSLCCLI_VersionDesc() and WSLCCLI_VersionLongDesc() live in
wsl::shared::Localization. Without this using directive the compiler cannot
resolve the unqualified Localization:: references in VersionCommand.cpp.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Pooja Trivedi <trivedipooja@microsoft.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* wslc: implement dns tunneling for virtio proxy networking mode
This change implements dnstunneling for the virtio proxy networking mode. For now, this implementation uses the same socket-based approach, but in the fututure this will be moved over to the built-in dns support that is part of the wsldevicehost dll.
* wslc: enable DNS tunneling by default for virtio proxy
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Remove unused DNS test helpers
VerifyDnsResolutionDig and VerifyDnsResolutionRecordTypes are dead
code — VerifyDnsQueries is the superset that covers all record types
and TCP/UDP modes.
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>
* Save state
* Save state
* Save state
* Cleanup
* Prepare for PR
* Cleanup
* Validate flags
* Apply PR suggestions
* Add comment
* Remove include
* Cleanup diff
* Format
* Format
* Restore session flags
* [WSLC] Add --workdir / -w option to 'wslc exec'
Adds a --workdir (-w) argument to the exec command that sets the working
directory inside the container for the executed process. Wires the value
through ContainerOptions into WSLAProcessLauncher::SetWorkingDirectory.
Co-authored-by: Pooja Trivedi <trivedipooja@microsoft.com>
Co-Authored-By: Claude Sonnet 4.6
* Update test/windows/wslc/CommandLineTestCases.h
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update test/windows/wslc/CommandLineTestCases.h
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Fix clang formatting issues
* Update test/windows/wslc/WSLCCLIExecutionUnitTests.cpp
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Add E2E tests for wslc container exec, including --workdir option
- Port existing exec E2E tests from feature branch
- Add WSLCE2E_Container_Exec_WorkDir and WSLCE2E_Container_Exec_WorkDir_ShortAlias tests
- Update help message in GetAvailableOptions to include -w,--workdir
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Fix clang formatting in WSLCE2EContainerExecTests.cpp
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Validate --workdir is non-empty; add unit and parse test cases
- Reject empty or whitespace-only --workdir in Argument::Validate
- Add ExecCommand_ParseWorkDirEmptyValue_ThrowsArgumentException unit test
- Add empty-workdir failing case to CommandLineTestCases.h
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Fix clang formatting in CommandLineTestCases.h
Co-Authored-By: Claude Sonnet 4.6
* Trim exec E2E tests to --workdir coverage only
Remove tests that duplicate existing coverage in WSLCE2EContainerCreateTests.cpp.
Keep only the help message test (validates --workdir appears in output) and the
two workdir-specific E2E tests.
Co-Authored-By: Claude Sonnet 4.6
* Missed change from merge conflict resolution
* Fix --workdir whitespace validation to use std::iswspace for full Unicode coverage
Agent-Logs-Url: https://github.com/microsoft/WSL/sessions/b21d1a57-bb3f-4a12-84cf-8e414a453890
Co-authored-by: ptrivedi <1638019+ptrivedi@users.noreply.github.com>
* Use lambda with wint_t cast in iswspace call to avoid potential UB
Agent-Logs-Url: https://github.com/microsoft/WSL/sessions/b21d1a57-bb3f-4a12-84cf-8e414a453890
Co-authored-by: ptrivedi <1638019+ptrivedi@users.noreply.github.com>
* Missed change from merge conflict resolution
* Address Copilot PR feedback
- Revert Version ArgType alias from NO_ALIAS back to L"v" to preserve existing -v short option
- Restore WSLCE2EContainerExecTests.cpp lost in merge conflict resolution
Co-Authored-By: Pooja Trivedi
* Update src/windows/wslc/services/ContainerService.cpp
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Fix ParserTest_StateMachine_PositionalForward: replace -v with -h in flag parse tests
The -v short alias was removed from --verbose (changed to NO_ALIAS) to
resolve a triple alias conflict with --version and --volume. The parser
test cases in the Run argument set still used -v expecting it to resolve
to --verbose, but since neither Version nor Volume are in the Run set,
-v became unresolvable and caused unexpected parse failures.
Replace -v with -h (help flag) in the flag parse test cases to preserve
the same combined-flag parsing coverage with a valid short alias.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix E2E exec help test: add --user option after base branch merge
After merging feature/wsl-for-apps, the --user argument is now active
in ContainerExecCommand (from PR #40101). Update the expected exec help
output to include -u,--user.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Pooja Trivedi <trivedipooja@microsoft.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ptrivedi <1638019+ptrivedi@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Validate container path is absolute in VolumeMount::Parse
Add validation that non-empty container paths must start with '/' since
they are Linux paths inside the container. This catches cases where
Windows drive letter colons (e.g. C:\path) get misinterpreted as the
host:container separator, producing invalid container paths like
'\hostPath' instead of '/containerPath'.
Previously, 'C:\hostPath:ro' would silently parse as host='C',
container='\hostPath', mode=ro ΓÇö now it throws a clear error.
Updated tests to reflect the new validation and moved previously
'valid' but semantically incorrect cases to the invalid test set.
* Also validate host path is absolute, add format hint to error, cover forward-slash cases
- Reject non-absolute host paths (catches C:/hostPath where host='C')
- Add 'Expected format:' hint to container path error message for consistency
- Add forward-slash drive letter cases to invalid test set
- Move '::' case to invalid (host=':' is not absolute)
* Remove host path is_absolute check to allow future named volumes
Per review feedback: named volumes (e.g. 'test_vol:/path') would fail
an is_absolute() check on the host path. Keep only the container path
validation (must start with '/') which doesn't conflict with named
volume identifiers.
---------
Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
* Localize all user-facing wslc.exe CLI strings
Add localization entries for all hardcoded user-facing strings in the
WSLC CLI tool:
- 38 command description strings (Short + Long for all commands)
- 30 argument description strings in ArgumentDefinitions.h
- Settings reset confirmation string
- All entries added to en-US/Resources.resw with {Locked=...} comments
for CLI flags, product names, and technical terms
E2E tests updated to use Localization:: calls and dynamic column
formatting instead of hardcoded string copies, so they won't go
stale when descriptions change.
* formatting
---------
Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
* Release COM DLLs before installer test MSI operations
Add PrepareForMsiOperation() that calls CoFreeUnusedLibrariesEx(0)
before each msiexec invocation. This releases in-process COM DLLs
like wslserviceproxystub.dll loaded by prior test classes, preventing
the Restart Manager from detecting the test process as holding file
locks and failing the install on older Server SKUs like ni_release.
* fix CoFreeUnusedLibrariesEx
---------
Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
* Prototype
* Save state
* Save state
* Save state
* Save state
* Save state
* Save state
* Remove zeroing
* Apply PR feedback
* Add test coverage
* Format
* Add test coverage for null handles
Implements `WslcCanRun` using existing primitives. Updates the component flag names to help better describe their meaning and adds comments to further do so.
Also changes the error returned when we cannot create a `WSLASessionManager` and WSL is installed at a version below the minimum for WSLC support.
* Save state
* Add test coverage
* Rename method
* Require input handle in the service
* Apply PR feedback
* Format
* Apply PR feedback + update tests
* Format
* Validate empty host path in VolumeMount::Parse
When parsing volume mount specs without a mode suffix (e.g. ':container'),
the host path validation was skipped, producing a VolumeMount with an empty
host path. This would propagate to MountWindowsFolder('') and produce a
confusing error.
Add validation after computing m_hostPath to reject empty host paths with
a clear error message in all cases.
* add test coverage
---------
Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
WaitForMultipleObjects has a 64-handle limit. The accept thread uses
1 handle for the exit event, leaving room for 63 port mappings.
Reject new port mappings with ERROR_TOO_MANY_OPEN_FILES when the limit
is reached, rather than crashing the relay thread. Existing mappings
continue to work.
Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
Allow clients to continue reading stdout/stderr and querying state from containers after they've been deleted, by caching the read-only data in the com wrapper.