Fix intermittent ImportDistroInvalidTar test failures (#41490)
* Fix test to be more resilient * Make WSL1 more lenient, make WSL2 exact
David Bennett committed
Sep 3, 2026 at 13:48 UTC
b91e0f629b9329362504bb0f514e83ce37cc493f
1 file changed
+11
-1
test/windows/UnitTests.cpp
+11
-1
@@ -1275,7 +1275,17 @@ class UnitTests
1275
1276
VERIFY_ARE_EQUAL(
1277
out, FormatErrorMessage(L"Importing the distribution failed.", L"Wsl/Service/RegisterDistro/WSL_E_IMPORT_FAILED"));
1278
- VERIFY_ARE_EQUAL(err, L"bsdtar: Error opening archive: Unrecognized archive format\n");
1278
+
1279
+ constexpr auto expectedError = L"bsdtar: Error opening archive: Unrecognized archive format\n";
1280
+ if (LxsstuVmMode())
1281
+ {
1282
+ VERIFY_ARE_EQUAL(err, expectedError);
1283
+ }
1284
+ else
1285
+ {
1286
+ // lxcore.sys can close the stderr pipe before bsdtar has finished writing.
1287
+ VERIFY_IS_TRUE(std::wstring_view{expectedError}.starts_with(err));
1288
+ }
1289
}
1290
1291
TEST_METHOD(AppxDistroDeletion)