[lldb][test] Skip ReadAfterClose JSON Transport tests on Windows
These were failing on our Windows on Arm bot, or more precisely, not even completing. This is because Microsoft's C runtime does extra parameter validation. So when we called _read with an invalid fd, it called an invalid parameter handler instead of returning an error. https://learn.microsoft.com/en-us/%20cpp/c-runtime-library/reference/read?view=msvc-170 https://learn.microsoft.com/en-us/%20cpp/c-runtime-library/parameter-validation?view=msvc-170 (lldb) run Process 8440 launched: 'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\unittests\Host\HostTests.exe' (aarch64) Process 8440 stopped * thread #1, stop reason = Exception 0xc0000409 encountered at address 0x7ffb7453564c frame #0: 0x00007ffb7453564c ucrtbase.dll`_get_thread_local_invalid_parameter_handler + 652 ucrtbase.dll`_get_thread_local_invalid_parameter_handler: -> 0x7ffb7453564c <+652>: brk #0xf003 ucrtbase.dll`_invalid_parameter_noinfo: 0x7ffb74535650 <+0>: b 0x7ffb745354d8 ; _get_thread_local_invalid_parameter_handler + 280 0x7ffb74535654 <+4>: nop 0x7ffb74535658 <+8>: nop You can override this handler but I'm assuming that this reading after close isn't a crucial feature, so disabling the tests seems like the way to go. If it is crucial, we can check the fd before we use it. Tests added by https://github.com/llvm/llvm-project/pull/143946.
This commit is contained in:
@@ -84,12 +84,6 @@ TEST_F(HTTPDelimitedJSONTransportTest, ReadWithEOF) {
|
||||
Failed<TransportEOFError>());
|
||||
}
|
||||
|
||||
TEST_F(HTTPDelimitedJSONTransportTest, ReadAfterClosed) {
|
||||
input.CloseReadFileDescriptor();
|
||||
ASSERT_THAT_EXPECTED(
|
||||
transport->Read<JSONTestType>(std::chrono::milliseconds(1)),
|
||||
llvm::Failed());
|
||||
}
|
||||
|
||||
TEST_F(HTTPDelimitedJSONTransportTest, InvalidTransport) {
|
||||
transport = std::make_unique<HTTPDelimitedJSONTransport>(nullptr, nullptr);
|
||||
@@ -136,13 +130,6 @@ TEST_F(JSONRPCTransportTest, ReadWithEOF) {
|
||||
Failed<TransportEOFError>());
|
||||
}
|
||||
|
||||
TEST_F(JSONRPCTransportTest, ReadAfterClosed) {
|
||||
input.CloseReadFileDescriptor();
|
||||
ASSERT_THAT_EXPECTED(
|
||||
transport->Read<JSONTestType>(std::chrono::milliseconds(1)),
|
||||
llvm::Failed());
|
||||
}
|
||||
|
||||
TEST_F(JSONRPCTransportTest, Write) {
|
||||
ASSERT_THAT_ERROR(transport->Write(JSONTestType{"foo"}), Succeeded());
|
||||
output.CloseWriteFileDescriptor();
|
||||
@@ -173,4 +160,22 @@ TEST_F(JSONRPCTransportTest, ReadWithTimeout) {
|
||||
transport->Read<JSONTestType>(std::chrono::milliseconds(1)),
|
||||
Failed<TransportTimeoutError>());
|
||||
}
|
||||
|
||||
// Windows CRT _read checks that the file descriptor is valid and calls a
|
||||
// handler if not. This handler is normally a breakpoint, which looks like a
|
||||
// crash when not handled by a debugger.
|
||||
// https://learn.microsoft.com/en-us/%20cpp/c-runtime-library/reference/read?view=msvc-170
|
||||
TEST_F(HTTPDelimitedJSONTransportTest, ReadAfterClosed) {
|
||||
input.CloseReadFileDescriptor();
|
||||
ASSERT_THAT_EXPECTED(
|
||||
transport->Read<JSONTestType>(std::chrono::milliseconds(1)),
|
||||
llvm::Failed());
|
||||
}
|
||||
|
||||
TEST_F(JSONRPCTransportTest, ReadAfterClosed) {
|
||||
input.CloseReadFileDescriptor();
|
||||
ASSERT_THAT_EXPECTED(
|
||||
transport->Read<JSONTestType>(std::chrono::milliseconds(1)),
|
||||
llvm::Failed());
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user