Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pipelines/build-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ jobs:
displayName: "CMake ${{ parameters.platform }}"
inputs:
workingDirectory: "."
cmakeArgs: . --fresh -A ${{ parameters.platform }} -DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_VERSION=10.0.26100.0 -DPACKAGE_VERSION=$(version.WSL_PACKAGE_VERSION) -DWSL_NUGET_PACKAGE_VERSION=$(version.WSL_NUGET_PACKAGE_VERSION) -DSKIP_PACKAGE_SIGNING=${{ parameters.isRelease }} -DOFFICIAL_BUILD=${{ parameters.isRelease }} -DINCLUDE_PACKAGE_STAGE=${{ or(parameters.isRelease, parameters.isNightly) }} -DPIPELINE_BUILD_ID=$(Build.BuildId) -DVSO_ORG=${{ parameters.vsoOrg }} -DVSO_PROJECT=${{ parameters.vsoProject }} -DWSL_BUILD_WSL_SETTINGS=true -DWSL_INCLUDE_SDK_CSHARP=true $(packageInputDirArg)\${{ parameters.platform }}
cmakeArgs: . --fresh -A ${{ parameters.platform }} -DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_VERSION=10.0.26100.0 -DPACKAGE_VERSION=$(version.WSL_PACKAGE_VERSION) -DWSL_NUGET_PACKAGE_VERSION=$(version.WSL_NUGET_PACKAGE_VERSION) -DSKIP_PACKAGE_SIGNING=${{ parameters.isRelease }} -DOFFICIAL_BUILD=${{ parameters.isRelease }} -DINCLUDE_PACKAGE_STAGE=${{ or(parameters.isRelease, parameters.isNightly) }} -DPIPELINE_BUILD_ID=$(Build.BuildId) -DVSO_ORG=${{ parameters.vsoOrg }} -DVSO_PROJECT=${{ parameters.vsoProject }} -DWSL_BUILD_WSL_SETTINGS=true -DWSL_INCLUDE_SDK_CSHARP=true -DWSL_E2E_UNITY_BUILD=ON $(packageInputDirArg)\${{ parameters.platform }}

# Workaround for WSL Settings NuGet restore authentication issue
- script: _deps\nuget.exe restore -NonInteractive
Expand Down
41 changes: 19 additions & 22 deletions test/windows/WSLCTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,38 +359,35 @@ class WSLCTests
{
auto sessionManager = OpenSessionManager();

// Act: list sessions
{
wil::unique_cotaskmem_array_ptr<WSLCSessionListEntry> sessions;
VERIFY_SUCCEEDED(sessionManager->ListSessions(&sessions, sessions.size_address<ULONG>()));

// Assert
VERIFY_ARE_EQUAL(sessions.size(), 1u);
const auto& info = sessions[0];

// SessionId is implementation detail (starts at 1), so we only assert DisplayName here.
VERIFY_ARE_EQUAL(std::wstring(info.DisplayName), c_testSessionName);
}

// List multiple sessions.
{
auto session2 = CreateSession(GetDefaultSessionSettings(L"wslc-test-list-2"));

auto listDisplayNames = [&]() {
wil::unique_cotaskmem_array_ptr<WSLCSessionListEntry> sessions;
VERIFY_SUCCEEDED(sessionManager->ListSessions(&sessions, sessions.size_address<ULONG>()));

VERIFY_ARE_EQUAL(sessions.size(), 2);

std::vector<std::wstring> displayNames;
for (const auto& e : sessions)
{
displayNames.push_back(e.DisplayName);
}
return displayNames;
};

auto contains = [](const std::vector<std::wstring>& names, std::wstring_view target) {
return std::ranges::find(names, target) != names.end();
};

std::ranges::sort(displayNames);
// Act: list sessions
{
auto displayNames = listDisplayNames();
VERIFY_IS_TRUE(contains(displayNames, c_testSessionName));
}

// List multiple sessions.
{
auto session2 = CreateSession(GetDefaultSessionSettings(L"wslc-test-list-2"));

VERIFY_ARE_EQUAL(displayNames[0], c_testSessionName);
VERIFY_ARE_EQUAL(displayNames[1], L"wslc-test-list-2");
auto displayNames = listDisplayNames();
VERIFY_IS_TRUE(contains(displayNames, c_testSessionName));
VERIFY_IS_TRUE(contains(displayNames, L"wslc-test-list-2"));
}
}

Expand Down
20 changes: 20 additions & 0 deletions test/windows/wslc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,26 @@ set_source_files_properties(${WSLC_TEST_SOURCES}
COMPILE_FLAGS "/Yuprecomp.h"
)

# Opt-in unity build for the e2e tests (~2x faster clean recompile; CI enables it).
option(WSL_E2E_UNITY_BUILD "Unity-batch the wslc e2e test sources" OFF)
set(WSL_E2E_UNITY_BATCH_SIZE 8 CACHE STRING "Unity batch size for wslc e2e tests")

if(WSL_E2E_UNITY_BUILD)
# GROUP mode only batches sources tagged with UNITY_GROUP, so tag e2e sources and leave every other wsltests source untouched.
set_target_properties(wsltests PROPERTIES UNITY_BUILD ON UNITY_BUILD_MODE GROUP)
Comment thread
AmelBawa-msft marked this conversation as resolved.

file(GLOB WSLC_E2E_SOURCES CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/e2e/*.cpp)
set(_e2eIndex 0)
foreach(_e2eSource IN LISTS WSLC_E2E_SOURCES)
math(EXPR _e2eGroup "${_e2eIndex} / ${WSL_E2E_UNITY_BATCH_SIZE}")
set_source_files_properties(${_e2eSource}
TARGET_DIRECTORY wsltests
PROPERTIES UNITY_GROUP "wslc_e2e_${_e2eGroup}"
)
math(EXPR _e2eIndex "${_e2eIndex} + 1")
endforeach()
endif()

# Add include directories needed for WSLC tests.
target_include_directories(wsltests PRIVATE
${CMAKE_SOURCE_DIR}/test
Expand Down
2 changes: 1 addition & 1 deletion test/windows/wslc/e2e/WSLCE2EPushPullTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class WSLCE2EPushPullTests
auto session = OpenDefaultElevatedSession();

{
auto [registryContainer, registryAddress] = StartLocalRegistry(*session, "", "", 15003);
auto [registryContainer, registryAddress] = StartLocalRegistry(*session, "", "", 15004);
auto registryAddressW = string::MultiByteToWide(registryAddress);

// Tag the image for the local registry.
Expand Down