Skip to content
Merged
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
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -266,15 +266,16 @@ else()
endif()

# Determine the Visual Studio installation directory which contains LLVM tools
# N.B. The version is set to VS2022 to ensure local runs match pipeline behavior
execute_process(
COMMAND "${VSWHERE_SOURCE_DIR}/vswhere.exe" -latest -products * -property installationPath
COMMAND "${VSWHERE_SOURCE_DIR}/vswhere.exe" -version "[17.0,18.0)" -products * -property installationPath
OUTPUT_VARIABLE VS_INSTALL_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY
)

if (NOT VS_INSTALL_DIR)
message(FATAL_ERROR "Could not determine Visual Studio installation directory.")
message(FATAL_ERROR "Could not determine Visual Studio 2022 installation directory.")
endif()

if("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "AMD64")
Expand Down
2 changes: 1 addition & 1 deletion test/windows/DrvFsTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ class DrvFsTests
} Data;
} Reparse{};

constexpr ULONG ReparseBufferSize = REPARSE_DATA_BUFFER_HEADER_SIZE + sizeof(ULONG);
const ULONG ReparseBufferSize = REPARSE_DATA_BUFFER_HEADER_SIZE + sizeof(ULONG);

//
// The data length is the buffer size excluding the header.
Expand Down
28 changes: 14 additions & 14 deletions test/windows/UnitTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2797,7 +2797,7 @@ Error code: Wsl/InstallDistro/WSL_E_DISTRO_NOT_FOUND

VERIFY_ARE_EQUAL(LxsstuLaunchWsl(std::format(L"--import {} . \"{}\" --version 2", name, g_testDistroPath)), 0L);

auto cleanupName = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, []() {
auto cleanupName = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, [name]() {
LxsstuLaunchWsl(std::format(L"--unregister {}", name));
std::filesystem::remove_all(testFolder);
});
Expand Down Expand Up @@ -2873,9 +2873,9 @@ Error code: Wsl/InstallDistro/WSL_E_DISTRO_NOT_FOUND
WslShutdown();

auto cleanupName =
wil::scope_exit_log(WI_DIAGNOSTICS_INFO, []() { LxsstuLaunchWsl(std::format(L"--unregister {}", name)); });
wil::scope_exit_log(WI_DIAGNOSTICS_INFO, [name]() { LxsstuLaunchWsl(std::format(L"--unregister {}", name)); });

auto validateDistro = [](LPCWSTR size, LPCWSTR expectedSize, LPCWSTR expectedError = nullptr) {
auto validateDistro = [name](LPCWSTR size, LPCWSTR expectedSize, LPCWSTR expectedError = nullptr) {
auto [out, _] = LxsstuLaunchWslAndCaptureOutput(std::format(L"--manage {} --resize {}", name, size), expectedError ? -1 : 0);
if (expectedError)
{
Expand Down Expand Up @@ -3578,8 +3578,8 @@ localhostForwarding=true

constexpr auto TestUser = L"testuser";

auto cleanup =
wil::scope_exit_log(WI_DIAGNOSTICS_INFO, []() { LxsstuLaunchWsl(std::format(L"-u root userdel -f {}", TestUser)); });
auto cleanup = wil::scope_exit_log(
WI_DIAGNOSTICS_INFO, [TestUser]() { LxsstuLaunchWsl(std::format(L"-u root userdel -f {}", TestUser)); });

ULONG Uid{};
ULONG Gid{};
Expand Down Expand Up @@ -3719,7 +3719,7 @@ localhostForwarding=true
constexpr auto testTar = L"exported-distro.tar";
constexpr auto tmpDistroName = L"tmpdistro";

auto cleanup = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, []() {
auto cleanup = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, [tmpDistroName]() {
DeleteFile(testTar);
LxsstuLaunchWsl(std::format(L"--unregister {}", tmpDistroName));
});
Expand Down Expand Up @@ -3950,7 +3950,7 @@ VERSION_ID="Invalid|Format"
constexpr auto testDistroName = L"test-oobe-import";

std::filesystem::create_directory(testDir);
auto cleanup = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, [this]() {
auto cleanup = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, [this, testDistroName]() {
LxsstuLaunchWsl(std::format(L"--unregister {}", testDistroName));
std::error_code error;
std::filesystem::remove_all(testDir, error);
Expand Down Expand Up @@ -4511,7 +4511,7 @@ Error code: Wsl/Service/RegisterDistro/E_INVALIDARG\r\n";
constexpr auto distroName = L"custom-terminal-profile";
constexpr auto tarName = L"custom-terminal-profile.tar";

auto cleanup = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, []() {
auto cleanup = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, [distroName]() {
DeleteFile(tarName);
LxsstuLaunchWsl(std::format(L"--unregister {}", distroName));
});
Expand Down Expand Up @@ -4553,7 +4553,7 @@ Error code: Wsl/Service/RegisterDistro/E_INVALIDARG\r\n";
constexpr auto distroName = L"custom-terminal-profile-bad-json";
constexpr auto tarName = L"custom-terminal-profile-bad-json.tar";

auto cleanup = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, []() {
auto cleanup = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, [distroName]() {
DeleteFile(tarName);
LxsstuLaunchWsl(std::format(L"--unregister {}", distroName));
});
Expand Down Expand Up @@ -4581,7 +4581,7 @@ Error code: Wsl/Service/RegisterDistro/E_INVALIDARG\r\n";
constexpr auto distroName = L"custom-terminal-profile-hide";
constexpr auto tarName = L"custom-terminal-profile-hide.tar";

auto cleanup = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, []() {
auto cleanup = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, [distroName]() {
DeleteFile(tarName);
LxsstuLaunchWsl(std::format(L"--unregister {}", distroName));
});
Expand Down Expand Up @@ -4625,7 +4625,7 @@ Error code: Wsl/Service/RegisterDistro/E_INVALIDARG\r\n";
constexpr auto distroName = L"no-terminal-profile";
constexpr auto tarName = L"no-terminal-profile.tar";

auto cleanup = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, []() {
auto cleanup = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, [distroName]() {
DeleteFile(tarName);
LxsstuLaunchWsl(std::format(L"--unregister {}", distroName));
});
Expand All @@ -4647,7 +4647,7 @@ Error code: Wsl/Service/RegisterDistro/E_INVALIDARG\r\n";
constexpr auto distroName = L"no-shortcut";
constexpr auto tarName = L"no-shortcut.tar";

auto cleanup = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, []() {
auto cleanup = wil::scope_exit_log(WI_DIAGNOSTICS_INFO, [distroName]() {
DeleteFile(tarName);
LxsstuLaunchWsl(std::format(L"--unregister {}", distroName));
});
Expand Down Expand Up @@ -6146,8 +6146,8 @@ Error code: Wsl/InstallDistro/WSL_E_INVALID_JSON\r\n",
TEST_METHOD(ImportExportStdout)
{
constexpr auto test_distro = L"import-test-distro";
auto cleanup =
wil::scope_exit_log(WI_DIAGNOSTICS_INFO, []() { LxsstuLaunchWsl(std::format(L"--unregister {}", test_distro)); });
auto cleanup = wil::scope_exit_log(
WI_DIAGNOSTICS_INFO, [test_distro]() { LxsstuLaunchWsl(std::format(L"--unregister {}", test_distro)); });

// The below logline makes it easier to find the bsdtar output when debugging this test case.
fprintf(stderr, "Starting ImportExportStdout test case\n");
Expand Down