mirror of
https://github.com/microsoft/WSL.git
synced 2026-06-01 01:49:36 -05:00
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>
51 lines
1.6 KiB
C++
51 lines
1.6 KiB
C++
/*++
|
|
|
|
Copyright (c) Microsoft. All rights reserved.
|
|
|
|
Module Name:
|
|
|
|
WSLCCLITmpfsParserUnitTests.cpp
|
|
|
|
Abstract:
|
|
|
|
This file contains unit tests for WSLC CLI tmpfs parsing and validation.
|
|
--*/
|
|
|
|
#include "precomp.h"
|
|
#include "windows/Common.h"
|
|
#include "WSLCCLITestHelpers.h"
|
|
#include "ContainerModel.h"
|
|
|
|
using namespace wsl::windows::wslc;
|
|
|
|
namespace WSLCCLITmpfsParserUnitTests {
|
|
|
|
class WSLCCLITmpfsParserUnitTests
|
|
{
|
|
WSLC_TEST_CLASS(WSLCCLITmpfsParserUnitTests)
|
|
|
|
TEST_METHOD(WSLCCLITmpfsMount_Parse)
|
|
{
|
|
std::vector<std::tuple<std::string, std::string, std::string>> validTmpfsSpecs = {
|
|
{"", "", ""},
|
|
{"/tmp", "/tmp", ""},
|
|
{"/tmp:size=50m", "/tmp", "size=50m"},
|
|
{"/var/tmp:size=1g", "/var/tmp", "size=1g"},
|
|
{"/tmp:size=50m,mode=1777", "/tmp", "size=50m,mode=1777"},
|
|
{"/cache:uid=1000,gid=1000", "/cache", "uid=1000,gid=1000"},
|
|
{"/mnt/ramdisk:size=256k,nr_inodes=1k", "/mnt/ramdisk", "size=256k,nr_inodes=1k"},
|
|
{"/securetmp:mode=0700", "/securetmp", "mode=0700"},
|
|
{"/scratch:nosuid,nodev,noexec", "/scratch", "nosuid,nodev,noexec"},
|
|
{"/wsl/tmp:size=2g,uid=0,gid=0,mode=1777", "/wsl/tmp", "size=2g,uid=0,gid=0,mode=1777"},
|
|
};
|
|
|
|
for (const auto& [input, expectedContainerPath, expectedOptions] : validTmpfsSpecs)
|
|
{
|
|
auto result = models::TmpfsMount::Parse(input);
|
|
VERIFY_ARE_EQUAL(expectedContainerPath, result.ContainerPath());
|
|
VERIFY_ARE_EQUAL(expectedOptions, result.Options());
|
|
}
|
|
}
|
|
};
|
|
|
|
} // namespace WSLCCLITmpfsParserUnitTests
|