Fix various arm64 test failures (#41444)

* Fix various arm64 test failures * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Fix LF * Format * Cleanup diff --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Blue committed Aug 26, 2026 at 18:57 UTC d884208ee0432b735d0d5216d01d90d9212a3d54
1 file changed +119 -34
test/windows/UnitTests.cpp
+119 -34
@@ -2341,8 +2341,15 @@ Usage:
2341 // Verify experimental.swiotlb parsing and validation.
2342 //
2343 // With wsl2.virtio enabled (the default), a valid swiotlb value is accepted silently.
2344 +
2345 validateWarnings(L"[experimental]\nswiotlb=64M", L"");
2345 - validateWarnings(L"[experimental]\nswiotlb=4096K", L"");
2346 +
2347 + constexpr auto expectedWarning =
2348 + wsl::shared::Arm64 ? L"wsl: The running kernel is missing a patch that significantly improves virtio device "
2349 + L"performance. Update to a more recent WSL kernel to enable this optimization.\r\n"
2350 + : L"";
2351 +
2352 + validateWarnings(L"[experimental]\nswiotlb=4096K", expectedWarning);
2353
2354 // Malformed values are rejected by the parser; only the parser warning is reported.
2355 validateWarnings(
@@ -2439,7 +2446,7 @@ Usage:
2446 return wsl::shared::retry::RetryWithTimeout<std::string>(
2447 [&]() {
2448 auto content = readDmesgLog(offset);
2442 - THROW_HR_IF(E_FAIL, content.find(expectedLine) == std::string::npos);
2449 + THROW_HR_IF_MSG(E_FAIL, content.find(expectedLine) == std::string::npos, "%hs", content.c_str());
2450
2451 return content;
2452 },
@@ -2449,10 +2456,13 @@ Usage:
2456
2457 // 'Linux version' is printed during early boot. 'brd: module loaded' is printed after transitioning to the virtio console.
2458 {
2452 - auto dmesg = expectInDmesg(true, "brd: module loaded");
2459 + // N.B. brd is only loaded on X64.
2460 + auto dmesg = expectInDmesg(true, wsl::shared::Arm64 ? "Linux version" : "brd: module loaded");
2461 VERIFY_ARE_NOT_EQUAL(dmesg.find("Linux version"), std::string::npos);
2462 }
2463
2464 + // N.B. Early boot logging is always enabled on ARM64.
2465 + if constexpr (!wsl::shared::Arm64)
2466 {
2467 auto dmesg = expectInDmesg(false, "brd: module loaded");
2468 VERIFY_ARE_EQUAL(dmesg.find("Linux version"), std::string::npos);
@@ -5588,8 +5598,12 @@ VERSION_ID="Invalid|Format"
5598 "FriendlyName": "DebianFriendlyName",
5599 "Default": true,
5600 "Amd64Url": {{
5591 - "Url": "{}",
5592 - "Sha256": "{}"
5601 + "Url": "{0}",
5602 + "Sha256": "{1}"
5603 + }},
5604 + "Arm64Url": {{
5605 + "Url": "{0}",
5606 + "Sha256": "{1}"
5607 }}
5608 }}
5609 ]
@@ -5655,6 +5669,10 @@ VERSION_ID="Invalid|Format"
5669 "Amd64Url": {{
5670 "Url": "",
5671 "Sha256": ""
5672 + }},
5673 + "Arm64Url": {{
5674 + "Url": "",
5675 + "Sha256": ""
5676 }}
5677 }},
5678 {{
@@ -5662,8 +5680,12 @@ VERSION_ID="Invalid|Format"
5680 "FriendlyName": "DebianFriendlyName",
5681 "Default": true,
5682 "Amd64Url": {{
5665 - "Url": "{}",
5666 - "Sha256": "{}"
5683 + "Url": "{0}",
5684 + "Sha256": "{1}"
5685 + }},
5686 + "Arm64Url": {{
5687 + "Url": "{0}",
5688 + "Sha256": "{1}"
5689 }}
5690 }}
5691 ],
@@ -5675,6 +5697,10 @@ VERSION_ID="Invalid|Format"
5697 "Amd64Url": {{
5698 "Url": "",
5699 "Sha256": ""
5700 + }},
5701 + "Arm64Url": {{
5702 + "Url": "",
5703 + "Sha256": ""
5704 }}
5705 }},
5706 {{
@@ -5682,8 +5708,12 @@ VERSION_ID="Invalid|Format"
5708 "FriendlyName": "UbuntuFriendlyName",
5709 "Default": true,
5710 "Amd64Url": {{
5685 - "Url": "{}",
5686 - "Sha256": "{}"
5711 + "Url": "{2}",
5712 + "Sha256": "{3}"
5713 + }},
5714 + "Arm64Url": {{
5715 + "Url": "{2}",
5716 + "Sha256": "{3}"
5717 }}
5718 }}
5719 ]
@@ -5739,6 +5769,10 @@ Distribution successfully installed. It can be launched via 'wsl.exe -d ubuntu-d
5769 "Amd64Url": {{
5770 "Url": "",
5771 "Sha256": ""
5772 + }},
5773 + "Arm64Url": {{
5774 + "Url": "",
5775 + "Sha256": ""
5776 }}
5777 }}
5778 ]
@@ -5750,7 +5784,8 @@ Distribution successfully installed. It can be launched via 'wsl.exe -d ubuntu-d
5784 "PackageFamilyName": "Dummy",
5785 "Amd64": true,
5786 "Arm64": true,
5753 - "Amd64PackageUrl": "http://127.0.0.1:12/dummyUrl" }}]
5787 + "Amd64PackageUrl": "http://127.0.0.1:12/dummyUrl",
5788 + "Arm64PackageUrl": "http://127.0.0.1:12/dummyUrl" }}]
5789 }})",
5790 tarPath);
5791
@@ -5782,8 +5817,12 @@ Distribution successfully installed. It can be launched via 'wsl.exe -d ubuntu-d
5817 "Name": "debian-12",
5818 "FriendlyName": "DebianFriendlyName",
5819 "Amd64Url": {{
5785 - "Url": "{}",
5786 - "Sha256": "{}"
5820 + "Url": "{0}",
5821 + "Sha256": "{1}"
5822 + }},
5823 + "Arm64Url": {{
5824 + "Url": "{0}",
5825 + "Sha256": "{1}"
5826 }}
5827 }}
5828 ]
@@ -5795,7 +5834,8 @@ Distribution successfully installed. It can be launched via 'wsl.exe -d ubuntu-d
5834 "PackageFamilyName": "Dummy",
5835 "Amd64": true,
5836 "Arm64": true,
5798 - "Amd64PackageUrl": "http://127.0.0.1:12/dummyUrl" }}]
5837 + "Amd64PackageUrl": "http://127.0.0.1:12/dummyUrl",
5838 + "Arm64PackageUrl": "http://127.0.0.1:12/dummyUrl" }}]
5839 }})",
5840 tarPath,
5841 tarHash);
@@ -5826,8 +5866,12 @@ Distribution successfully installed. It can be launched via 'wsl.exe -d ubuntu-d
5866 "Name": "debian-12",
5867 "FriendlyName": "DebianFriendlyName",
5868 "Amd64Url": {{
5829 - "Url": "{}",
5830 - "Sha256": "{}"
5869 + "Url": "{0}",
5870 + "Sha256": "{1}"
5871 + }},
5872 + "Arm64Url": {{
5873 + "Url": "{0}",
5874 + "Sha256": "{1}"
5875 }}
5876 }},
5877 {{
@@ -5835,7 +5879,11 @@ Distribution successfully installed. It can be launched via 'wsl.exe -d ubuntu-d
5879 "FriendlyName": "DebianFriendlyName",
5880 "Default": true,
5881 "Amd64Url": {{
5838 - "Url": "{}",
5882 + "Url": "{2}",
5883 + "Sha256": ""
5884 + }},
5885 + "Arm64Url": {{
5886 + "Url": "{2}",
5887 "Sha256": ""
5888 }}
5889 }}
@@ -5855,8 +5903,12 @@ Distribution successfully installed. It can be launched via 'wsl.exe -d ubuntu-d
5903 "Name": "debian-12",
5904 "FriendlyName": "DebianFriendlyNameOverridden",
5905 "Amd64Url": {{
5858 - "Url": "{}",
5859 - "Sha256": "{}"
5906 + "Url": "{0}",
5907 + "Sha256": "{1}"
5908 + }},
5909 + "Arm64Url": {{
5910 + "Url": "{0}",
5911 + "Sha256": "{1}"
5912 }}
5913 }}
5914 ]
@@ -5889,8 +5941,12 @@ Distribution successfully installed. It can be launched via 'wsl.exe -d ubuntu-d
5941 "Name": "test-default-manifest-name",
5942 "FriendlyName": "DebianFriendlyName",
5943 "Amd64Url": {{
5892 - "Url": "{}",
5893 - "Sha256": "{}"
5944 + "Url": "{0}",
5945 + "Sha256": "{1}"
5946 + }},
5947 + "Arm64Url": {{
5948 + "Url": "{0}",
5949 + "Sha256": "{1}"
5950 }}
5951 }}
5952 ]
@@ -5917,7 +5973,11 @@ Distribution successfully installed. It can be launched via 'wsl.exe -d ubuntu-d
5973 "Name": "debian-12",
5974 "FriendlyName": "DebianFriendlyName",
5975 "Amd64Url": {{
5920 - "Url": "{}",
5976 + "Url": "{0}",
5977 + "Sha256": "0x12"
5978 + }},
5979 + "Arm64Url": {{
5980 + "Url": "{0}",
5981 "Sha256": "0x12"
5982 }}
5983 }}
@@ -5947,7 +6007,11 @@ Distribution successfully installed. It can be launched via 'wsl.exe -d ubuntu-d
6007 "Name": "debian-12",
6008 "FriendlyName": "DebianFriendlyName",
6009 "Amd64Url": {{
5950 - "Url": "{}",
6010 + "Url": "{0}",
6011 + "Sha256": "wrongformat"
6012 + }},
6013 + "Arm64Url": {{
6014 + "Url": "{0}",
6015 "Sha256": "wrongformat"
6016 }}
6017 }}
@@ -5976,7 +6040,8 @@ Distribution successfully installed. It can be launched via 'wsl.exe -d ubuntu-d
6040 "PackageFamilyName": "Dummy",
6041 "Amd64": true,
6042 "Arm64": true,
5979 - "Amd64PackageUrl": "" }]
6043 + "Amd64PackageUrl": "",
6044 + "Arm64PackageUrl": "" }]
6045 })";
6046
6047 auto restore = SetManifest(manifest);
@@ -6010,11 +6075,15 @@ Distribution successfully installed. It can be launched via 'wsl.exe -d ubuntu-d
6075 "ModernDistributions": {{
6076 "debian": [
6077 {{
6013 - "Name": "{}",
6078 + "Name": "{0}",
6079 "FriendlyName": "DebianFriendlyName",
6080 "Amd64Url": {{
6081 "Url": "file://nonexistent",
6082 "Sha256": ""
6083 + }},
6084 + "Arm64Url": {{
6085 + "Url": "file://nonexistent",
6086 + "Sha256": ""
6087 }}
6088 }},
6089 {{
@@ -6023,6 +6092,10 @@ Distribution successfully installed. It can be launched via 'wsl.exe -d ubuntu-d
6092 "Amd64Url": {{
6093 "Url": "file://nonexistent",
6094 "Sha256": ""
6095 + }},
6096 + "Arm64Url": {{
6097 + "Url": "file://nonexistent",
6098 + "Sha256": ""
6099 }}
6100 }}
6101 ]
@@ -6067,6 +6140,10 @@ Distribution successfully installed. It can be launched via 'wsl.exe -d ubuntu-d
6140 "Amd64Url": {
6141 "Url": "",
6142 "Sha256": ""
6143 + },
6144 + "Arm64Url": {
6145 + "Url": "",
6146 + "Sha256": ""
6147 }
6148 }
6149 ]
@@ -6113,8 +6190,12 @@ Distribution successfully installed. It can be launched via 'wsl.exe -d ubuntu-d
6190 "FriendlyName": "FriendlyName",
6191 "Default": true,
6192 "Amd64Url": {{
6116 - "Url": "{}/distro.tar?foo=bar&key=value",
6117 - "Sha256": "{}"
6193 + "Url": "{0}/distro.tar?foo=bar&key=value",
6194 + "Sha256": "{1}"
6195 + }},
6196 + "Arm64Url": {{
6197 + "Url": "{0}/distro.tar?foo=bar&key=value",
6198 + "Sha256": "{1}"
6199 }}
6200 }}
6201 ]
@@ -6239,8 +6320,12 @@ Distribution successfully installed. It can be launched via 'wsl.exe -d ubuntu-d
6320 \"FriendlyName\": \"FriendlyName\",
6321 \"Default\": true,
6322 \"Amd64Url\": {{
6242 - \"Url\": \"{}/distro.tar\",
6243 - \"Sha256\": \"{}\"
6323 + \"Url\": \"{0}/distro.tar\",
6324 + \"Sha256\": \"{1}\"
6325 + }},
6326 + \"Arm64Url\": {{
6327 + \"Url\": \"{0}/distro.tar\",
6328 + \"Sha256\": \"{1}\"
6329 }}
6330 }}
6331 ]
@@ -6794,9 +6879,9 @@ Distribution successfully installed. It can be launched via 'wsl.exe -d ubuntu-d
6879 auto [version, asset] = wsl::windows::common::wslutil::GetLatestGitHubRelease(false, json);
6880
6881 VERIFY_ARE_EQUAL(version, L"2.4.12");
6797 - VERIFY_ARE_EQUAL(asset.id, 2);
6798 - VERIFY_ARE_EQUAL(asset.url, L"http://x64-url");
6799 - VERIFY_ARE_EQUAL(asset.name, L"wsl.2.4.12.0.x64.msi");
6882 + VERIFY_ARE_EQUAL(asset.id, wsl::shared::Arm64 ? 1 : 2);
6883 + VERIFY_ARE_EQUAL(asset.url, wsl::shared::Arm64 ? L"http://arm-url" : L"http://x64-url");
6884 + VERIFY_ARE_EQUAL(asset.name, wsl::shared::Arm64 ? L"wsl.2.4.12.0.arm64.msi" : L"wsl.2.4.12.0.x64.msi");
6885 }
6886
6887 // Test wsl --update --pre-release
@@ -6828,9 +6913,9 @@ Distribution successfully installed. It can be launched via 'wsl.exe -d ubuntu-d
6913 auto [version, asset] = wsl::windows::common::wslutil::GetLatestGitHubRelease(true, json);
6914
6915 VERIFY_ARE_EQUAL(version, L"2.5.1");
6831 - VERIFY_ARE_EQUAL(asset.id, 2);
6832 - VERIFY_ARE_EQUAL(asset.url, L"http://x64-url");
6833 - VERIFY_ARE_EQUAL(asset.name, L"wsl.2.5.1.0.x64.msi");
6916 + VERIFY_ARE_EQUAL(asset.id, wsl::shared::Arm64 ? 1 : 2);
6917 + VERIFY_ARE_EQUAL(asset.url, wsl::shared::Arm64 ? L"http://arm-url" : L"http://x64-url");
6918 + VERIFY_ARE_EQUAL(asset.name, wsl::shared::Arm64 ? L"wsl.2.5.1.0.arm64.msi" : L"wsl.2.5.1.0.x64.msi");
6919 }
6920 }
6921