From 48db31c5cf6f347c973f5409b9fa64863170eea0 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Thu, 25 Jun 2020 21:51:17 +0200 Subject: [PATCH] rlc_stress_test: fix random PDU dropping the rand() was sometimes giving NaN so this case needs to be handled and the PDU not dropped to have real zero drop-rate --- lib/test/upper/rlc_stress_test.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/test/upper/rlc_stress_test.cc b/lib/test/upper/rlc_stress_test.cc index e0ccdf715..0262c6839 100644 --- a/lib/test/upper/rlc_stress_test.cc +++ b/lib/test/upper/rlc_stress_test.cc @@ -230,7 +230,8 @@ private: unique_byte_buffer_t& pdu = *it; // Drop - if (((real_dist(mt19937) > args.pdu_drop_rate) || skip_action) && pdu->N_bytes > 0) { + float rnd = real_dist(mt19937); + if (std::isnan(rnd) || (((rnd > args.pdu_drop_rate) || skip_action) && pdu->N_bytes > 0)) { uint32_t pdu_len = pdu->N_bytes; // Cut