summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
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/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
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/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index da629089a6c..49733a5ba75 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -2148,8 +2148,9 @@ std::chrono::duration<float> calculate_standard_deviation(
void GDBRemoteCommunicationClient::TestPacketSpeed(const uint32_t num_packets,
uint32_t max_send,
- uint32_t max_recv, bool json,
- Stream &strm) {
+ uint32_t max_recv,
+ uint64_t recv_amount,
+ bool json, Stream &strm) {
using namespace std::chrono;
uint32_t i;
@@ -2215,13 +2216,11 @@ void GDBRemoteCommunicationClient::TestPacketSpeed(const uint32_t num_packets,
}
}
- const uint64_t k_recv_amount = 4 * 1024 * 1024; // Receive amount in bytes
-
- const float k_recv_amount_mb = (float)k_recv_amount / (1024.0f * 1024.0f);
+ const float k_recv_amount_mb = (float)recv_amount / (1024.0f * 1024.0f);
if (json)
strm.Printf("\n ]\n },\n \"download_speed\" : {\n \"byte_size\" "
": %" PRIu64 ",\n \"results\" : [",
- k_recv_amount);
+ recv_amount);
else
strm.Printf("Testing receiving %2.1fMB of data using varying receive "
"packet sizes:\n",
@@ -2238,7 +2237,7 @@ void GDBRemoteCommunicationClient::TestPacketSpeed(const uint32_t num_packets,
const auto start_time = steady_clock::now();
uint32_t bytes_read = 0;
uint32_t packet_count = 0;
- while (bytes_read < k_recv_amount) {
+ while (bytes_read < recv_amount) {
StringExtractorGDBRemote response;
SendPacketAndWaitForResponse(packet.GetString(), response, false);
bytes_read += recv_size;
@@ -2246,7 +2245,7 @@ void GDBRemoteCommunicationClient::TestPacketSpeed(const uint32_t num_packets,
}
const auto end_time = steady_clock::now();
const auto total_time = end_time - start_time;
- float mb_second = ((float)k_recv_amount) /
+ float mb_second = ((float)recv_amount) /
duration<float>(total_time).count() /
(1024.0 * 1024.0);
float packets_per_second =
OpenPOWER on IntegriCloud