Skip the 'TestAttachFailsWithoutWsl2Distro' test case if a WSL2 distro is installed (#40456)
Blue committed
May 13, 2026 at 16:14 UTC
2cace933f2768def2b446762c596b792a0197ffe
1 file changed
+8
-1
test/windows/MountTests.cpp
+8
-1
@@ -872,6 +872,13 @@ class MountTests
872
SKIP_UNSUPPORTED_ARM64_MOUNT_TEST();
873
// Attempt to mount a disk with only a WSL1 distro
874
wsl::windows::common::SvcComm service;
875
+
876
+ if (std::ranges::any_of(service.EnumerateDistributions(), [](const auto& e) { return e.Version != 1; }))
877
+ {
878
+ LogSkipped("Skipping test because a WSL2 distro is present");
879
+ return;
880
+ }
881
+
882
VERIFY_ARE_EQUAL(service.AttachDisk(L"Dummy", LXSS_ATTACH_MOUNT_FLAGS_PASS_THROUGH), WSL_E_WSL2_NEEDED);
883
}
884
@@ -1483,4 +1490,4 @@ class MountTests
1490
}
1491
}
1492
};
1486
-} // namespace MountTests
\ No newline at end of file
1493
+} // namespace MountTests