[MERGED] osmo-pcu[master]: tests: edge, tbf: assert return values

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Feb 10 12:21:18 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: tests: edge, tbf: assert return values
......................................................................


tests: edge, tbf: assert return values

Numerous calls assign a return value without asserting its value. Add
assertions and thus also eliminate compiler warnings about unused values.

Change-Id: I7f14198cfd747dae68b8aaa3b8d6ff7fc49ab824
---
M tests/edge/EdgeTest.cpp
M tests/tbf/TbfTest.cpp
2 files changed, 16 insertions(+), 1 deletion(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/tests/edge/EdgeTest.cpp b/tests/edge/EdgeTest.cpp
index 86c08f5..16a39e9 100644
--- a/tests/edge/EdgeTest.cpp
+++ b/tests/edge/EdgeTest.cpp
@@ -1226,6 +1226,7 @@
 	egprs2->pi = 0;
 	data[4] = 0x20;                /* Setting E field */
 	rc = Decoding::rlc_parse_ul_data_header(&rlc, data, cs);
+	OSMO_ASSERT(rc == 487);
 	offs = rlc.data_offs_bits[0] / 8;
 	OSMO_ASSERT(offs == 4);
 	OSMO_ASSERT(rlc.tfi == 1);
@@ -1250,6 +1251,7 @@
 	egprs2->pi = 0;
 	data[10] = 0x20;                /* Setting E field */
 	rc = Decoding::rlc_parse_ul_data_header(&rlc, data, cs);
+	OSMO_ASSERT(rc == 679);
 	offs = rlc.data_offs_bits[0] / 8;
 	OSMO_ASSERT(offs == 10);
 	OSMO_ASSERT(rlc.num_data_blocks == 1);
@@ -1271,6 +1273,7 @@
 	egprs2->pi = 0;
 	data[10] = 0x20;		/* Setting E field */
 	rc = Decoding::rlc_parse_ul_data_header(&rlc, data, cs);
+	OSMO_ASSERT(rc == 679);
 	offs = rlc.data_offs_bits[0] / 8;
 	OSMO_ASSERT(offs == 10);
 	OSMO_ASSERT(rlc.tfi == 1);
@@ -1330,6 +1333,7 @@
 	data[5] = 0xc0;
 	data[5 + 57] = 1;
 	rc = Decoding::rlc_parse_ul_data_header(&rlc, data, cs);
+	OSMO_ASSERT(rc == 946);
 	OSMO_ASSERT(rlc.num_data_blocks == 2);
 	OSMO_ASSERT(rlc.block_info[0].e == 1);
 	OSMO_ASSERT(rlc.block_info[0].ti == 1);
@@ -1357,6 +1361,7 @@
 	data[5] = 0xc0;
 	data[5 + 69] = 1;
 	rc = Decoding::rlc_parse_ul_data_header(&rlc, data, cs);
+	OSMO_ASSERT(rc == 1138);
 	OSMO_ASSERT(rlc.num_data_blocks == 2);
 	OSMO_ASSERT(rlc.block_info[0].e == 1);
 	OSMO_ASSERT(rlc.block_info[0].ti == 1);
@@ -1384,6 +1389,7 @@
 	data[5] = 0xc0;
 	data[5 + 75] = 1;
 	rc = Decoding::rlc_parse_ul_data_header(&rlc, data, cs);
+	OSMO_ASSERT(rc == 1234);
 	OSMO_ASSERT(rlc.num_data_blocks == 2);
 	OSMO_ASSERT(rlc.block_info[0].e == 1);
 	OSMO_ASSERT(rlc.block_info[0].ti == 1);
diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp
index 79e49ec..7d786b4 100644
--- a/tests/tbf/TbfTest.cpp
+++ b/tests/tbf/TbfTest.cpp
@@ -2985,7 +2985,7 @@
 		fn = fn_add_blocks(fn, 1);
 		/* Send 2 RLC data block */
 		msg = dl_tbf->create_dl_acked_block(fn, dl_tbf->control_ts);
-
+		OSMO_ASSERT(msg);
 		OSMO_ASSERT(dl_tbf->m_window.m_v_b.is_unacked(0));
 		OSMO_ASSERT(dl_tbf->m_window.m_v_b.is_unacked(1));
 		OSMO_ASSERT(dl_tbf->m_rlc.block(0)->cs_current_trans.to_num()
@@ -3006,6 +3006,7 @@
 		fn = fn_add_blocks(fn, 1);
 		/* Retransmit the first RLC data block with demanded_mcs */
 		msg = dl_tbf->create_dl_acked_block(fn, dl_tbf->control_ts);
+		OSMO_ASSERT(msg);
 		OSMO_ASSERT(dl_tbf->m_window.m_v_b.is_unacked(0));
 		OSMO_ASSERT(dl_tbf->m_window.m_v_b.is_nacked(1));
 		OSMO_ASSERT(dl_tbf->m_rlc.block(0)->cs_current_trans.to_num()
@@ -3014,6 +3015,7 @@
 		fn = fn_add_blocks(fn, 1);
 		/* Retransmit the second RLC data block with demanded_mcs */
 		msg = dl_tbf->create_dl_acked_block(fn, dl_tbf->control_ts);
+		OSMO_ASSERT(msg);
 		OSMO_ASSERT(dl_tbf->m_window.m_v_b.is_unacked(0));
 		OSMO_ASSERT(dl_tbf->m_window.m_v_b.is_unacked(1));
 		OSMO_ASSERT(dl_tbf->m_rlc.block(1)->cs_current_trans.to_num()
@@ -3023,6 +3025,7 @@
 		fn = fn_add_blocks(fn, 1);
 		/* Send first RLC data block BSN 0 */
 		msg = dl_tbf->create_dl_acked_block(fn, dl_tbf->control_ts);
+		OSMO_ASSERT(msg);
 		OSMO_ASSERT(dl_tbf->m_window.m_v_b.is_unacked(0));
 		OSMO_ASSERT(dl_tbf->m_rlc.block(0)->cs_current_trans.to_num()
 				== mcs);
@@ -3030,6 +3033,7 @@
 		fn = fn_add_blocks(fn, 1);
 		/* Send second RLC data block BSN 1 */
 		msg = dl_tbf->create_dl_acked_block(fn, dl_tbf->control_ts);
+		OSMO_ASSERT(msg);
 		OSMO_ASSERT(dl_tbf->m_window.m_v_b.is_unacked(1));
 		OSMO_ASSERT(dl_tbf->m_rlc.block(1)->cs_current_trans.to_num()
 				== mcs);
@@ -3046,6 +3050,7 @@
 		fn = fn_add_blocks(fn, 1);
 		/* Send first, second RLC data blocks with demanded_mcs */
 		msg = dl_tbf->create_dl_acked_block(fn, dl_tbf->control_ts);
+		OSMO_ASSERT(msg);
 		OSMO_ASSERT(dl_tbf->m_window.m_v_b.is_unacked(0));
 		OSMO_ASSERT(dl_tbf->m_window.m_v_b.is_unacked(1));
 		OSMO_ASSERT(dl_tbf->m_rlc.block(0)->cs_current_trans.to_num()
@@ -3057,6 +3062,7 @@
 		fn = fn_add_blocks(fn, 1);
 		/* Send first,second RLC data blocks */
 		msg = dl_tbf->create_dl_acked_block(fn, dl_tbf->control_ts);
+		OSMO_ASSERT(msg);
 		OSMO_ASSERT(dl_tbf->m_window.m_v_b.is_unacked(0));
 		OSMO_ASSERT(dl_tbf->m_window.m_v_b.is_unacked(1));
 		OSMO_ASSERT(dl_tbf->m_rlc.block(0)->cs_current_trans.to_num()
@@ -3072,6 +3078,7 @@
 		fn = fn_add_blocks(fn, 1);
 		/* Send first,second RLC data blocks with demanded_mcs*/
 		msg = dl_tbf->create_dl_acked_block(fn, dl_tbf->control_ts);
+		OSMO_ASSERT(msg);
 		OSMO_ASSERT(dl_tbf->m_window.m_v_b.is_unacked(0));
 		OSMO_ASSERT(dl_tbf->m_window.m_v_b.is_unacked(1));
 		OSMO_ASSERT(dl_tbf->m_rlc.block(0)->cs_current_trans.to_num()
@@ -3084,6 +3091,7 @@
 		fn = fn_add_blocks(fn, 1);
 		/* Send first RLC data block */
 		msg = dl_tbf->create_dl_acked_block(fn, dl_tbf->control_ts);
+		OSMO_ASSERT(msg);
 		OSMO_ASSERT(dl_tbf->m_window.m_v_b.is_unacked(0));
 		OSMO_ASSERT(dl_tbf->m_rlc.block(0)->cs_current_trans.to_num()
 				== mcs);
@@ -3094,6 +3102,7 @@
 		fn = fn_add_blocks(fn, 1);
 		/* Send first RLC data block with demanded_mcs */
 		msg = dl_tbf->create_dl_acked_block(fn, dl_tbf->control_ts);
+		OSMO_ASSERT(msg);
 		OSMO_ASSERT(dl_tbf->m_window.m_v_b.is_unacked(0));
 		OSMO_ASSERT(dl_tbf->m_rlc.block(0)->cs_current_trans.to_num()
 				== mcs);

-- 
To view, visit https://gerrit.osmocom.org/1772
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7f14198cfd747dae68b8aaa3b8d6ff7fc49ab824
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder


More information about the gerrit-log mailing list