summaryrefslogtreecommitdiffstats
path: root/lldb/unittests/Process/gdb-remote
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2016-11-04 11:49:06 +0000
committerPavel Labath <labath@google.com>2016-11-04 11:49:06 +0000
commit2fd9a1e0d9ee0a2a4458d7b6d55494a2a9c60038 (patch)
tree1b30124545a3bfed5400aa7f074316de17c721be /lldb/unittests/Process/gdb-remote
parentbaeb40201476656d2478ae1af284cb8b17d1296c (diff)
downloadbcm5719-llvm-2fd9a1e0d9ee0a2a4458d7b6d55494a2a9c60038.tar.gz
bcm5719-llvm-2fd9a1e0d9ee0a2a4458d7b6d55494a2a9c60038.zip
Fix GDBRemoteCommunicationClientTest.TestPacketSpeedJSON
The mock server was listening for only one packet (I forgot to put a loop around it), which caused the client to stall in debug builds, as the timeout there is 1000 seconds. In case of a release builds the test would just silently succeed as the tested function does not check or report errors (which should be fixed). This fixes the test by adding the server loop. Since the test was taking quite a long time now (8s), I have added a parameter to control the amount of data sent (default 4MB), and call it with a smaller value in the test, to make the test run faster. llvm-svn: 285992
Diffstat (limited to 'lldb/unittests/Process/gdb-remote')
-rw-r--r--lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
index 9db939ed591..84b354d7517 100644
--- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
+++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
@@ -270,21 +270,23 @@ TEST_F(GDBRemoteCommunicationClientTest, TestPacketSpeedJSON) {
return;
std::thread server_thread([&server] {
- StringExtractorGDBRemote request;
- PacketResult result = server.GetPacket(request);
- if (result == PacketResult::ErrorDisconnected)
- return;
- ASSERT_EQ(PacketResult::Success, result);
- StringRef ref = request.GetStringRef();
- ASSERT_TRUE(ref.consume_front("qSpeedTest:response_size:"));
- int size;
- ASSERT_FALSE(ref.consumeInteger(10, size)) << "ref: " << ref;
- std::string response(size, 'X');
- ASSERT_EQ(PacketResult::Success, server.SendPacket(response));
+ for (;;) {
+ StringExtractorGDBRemote request;
+ PacketResult result = server.GetPacket(request);
+ if (result == PacketResult::ErrorDisconnected)
+ return;
+ ASSERT_EQ(PacketResult::Success, result);
+ StringRef ref = request.GetStringRef();
+ ASSERT_TRUE(ref.consume_front("qSpeedTest:response_size:"));
+ int size;
+ ASSERT_FALSE(ref.consumeInteger(10, size)) << "ref: " << ref;
+ std::string response(size, 'X');
+ ASSERT_EQ(PacketResult::Success, server.SendPacket(response));
+ }
});
StreamString ss;
- client.TestPacketSpeed(10, 32, 32, true, ss);
+ client.TestPacketSpeed(10, 32, 32, 4096, true, ss);
client.Disconnect();
server_thread.join();
OpenPOWER on IntegriCloud