[MERGED] osmo-mgw[master]: mgcp_test: add returncode check

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

dexter gerrit-no-reply at lists.osmocom.org
Tue Dec 5 10:19:39 UTC 2017


dexter has submitted this change and it was merged.

Change subject: mgcp_test: add returncode check
......................................................................


mgcp_test: add returncode check

The returncode of get_conn_id_from_response() is unchecked, which
is intentional since some of the test messages will intentionally cause
this function to fail (the response does not inclde a connection
identifier). This means it makes no sense to assert this function
to a fixed value.

In order to spot regressions better print a log message depending
on the return code.

Change-Id: I9bce9ca39b7751b557374b7ab57c6c9005bcdb7d
Fixes: Coverity CID#180534
---
M tests/mgcp/mgcp_test.c
M tests/mgcp/mgcp_test.ok
2 files changed, 33 insertions(+), 3 deletions(-)

Approvals:
  Neels Hofmeyr: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/tests/mgcp/mgcp_test.c b/tests/mgcp/mgcp_test.c
index 1c57347..ee49eef 100644
--- a/tests/mgcp/mgcp_test.c
+++ b/tests/mgcp/mgcp_test.c
@@ -636,6 +636,7 @@
 	int i;
 	struct mgcp_conn_rtp *conn = NULL;
 	char last_conn_id[256];
+	int rc;
 
 	cfg = mgcp_config_alloc();
 
@@ -675,9 +676,14 @@
 			OSMO_ASSERT(false);
 		}
 
-		if (msg)
-			get_conn_id_from_response(msg->data, last_conn_id,
-						  sizeof(last_conn_id));
+		if (msg) {
+			rc = get_conn_id_from_response(msg->data, last_conn_id,
+						       sizeof(last_conn_id));
+			if (rc)
+				printf("(response contains a connection id)\n");
+			else
+				printf("(response does not contain a connection id)\n");
+		}
 
 		msgb_free(msg);
 
diff --git a/tests/mgcp/mgcp_test.ok b/tests/mgcp/mgcp_test.ok
index c764531..23f0658 100644
--- a/tests/mgcp/mgcp_test.ok
+++ b/tests/mgcp/mgcp_test.ok
@@ -22,6 +22,7 @@
 checking response:
 using message as statically defined for comparison
 Response matches our expectations.
+(response contains a connection id)
 
 ================================================
 Testing AUEP2
@@ -33,6 +34,7 @@
 checking response:
 using message as statically defined for comparison
 Response matches our expectations.
+(response contains a connection id)
 
 ================================================
 Testing MDCX1
@@ -44,6 +46,7 @@
 checking response:
 using message as statically defined for comparison
 Response matches our expectations.
+(response contains a connection id)
 
 ================================================
 Testing MDCX2
@@ -55,6 +58,7 @@
 checking response:
 using message as statically defined for comparison
 Response matches our expectations.
+(response contains a connection id)
 
 ================================================
 Testing CRCX
@@ -75,6 +79,7 @@
 checking response:
 using message with patched conn_id for comparison
 Response matches our expectations.
+(response does not contain a connection id)
 Dummy packets: 2
 
 ================================================
@@ -88,6 +93,7 @@
 checking response:
 using message with patched conn_id for comparison
 Response matches our expectations.
+(response does not contain a connection id)
 Dummy packets: 2
 
 ================================================
@@ -111,6 +117,7 @@
 checking response:
 using message with patched conn_id for comparison
 Response matches our expectations.
+(response does not contain a connection id)
 Dummy packets: 2
 
 ================================================
@@ -134,6 +141,7 @@
 checking response:
 using message with patched conn_id for comparison
 Response matches our expectations.
+(response does not contain a connection id)
 Dummy packets: 2
 
 ================================================
@@ -157,6 +165,7 @@
 checking response:
 using message with patched conn_id for comparison
 Response matches our expectations.
+(response does not contain a connection id)
 Dummy packets: 2
 
 ================================================
@@ -180,6 +189,7 @@
 checking response:
 using message with patched conn_id for comparison
 Response matches our expectations.
+(response does not contain a connection id)
 Dummy packets: 2
 
 ================================================
@@ -203,6 +213,7 @@
 checking response:
 using message with patched conn_id for comparison
 Response matches our expectations.
+(response does not contain a connection id)
 
 ================================================
 Testing MDCX4_RO
@@ -217,6 +228,7 @@
 checking response:
 using message with patched conn_id for comparison
 Response matches our expectations.
+(response does not contain a connection id)
 Dummy packets: 2
 
 ================================================
@@ -231,6 +243,7 @@
 checking response:
 using message as statically defined for comparison
 Response matches our expectations.
+(response contains a connection id)
 
 ================================================
 Testing CRCX_ZYN
@@ -243,6 +256,7 @@
 checking response:
 using message with patched conn_id for comparison
 Response matches our expectations.
+(response does not contain a connection id)
 Dummy packets: 2
 
 ================================================
@@ -263,6 +277,7 @@
 checking response:
 using message as statically defined for comparison
 Response matches our expectations.
+(response contains a connection id)
 
 ================================================
 Testing SHORT2
@@ -273,6 +288,7 @@
 checking response:
 using message as statically defined for comparison
 Response matches our expectations.
+(response contains a connection id)
 
 ================================================
 Testing SHORT3
@@ -283,6 +299,7 @@
 checking response:
 using message as statically defined for comparison
 Response matches our expectations.
+(response contains a connection id)
 
 ================================================
 Testing SHORT4
@@ -293,6 +310,7 @@
 checking response:
 using message as statically defined for comparison
 Response matches our expectations.
+(response contains a connection id)
 
 ================================================
 Testing RQNT1
@@ -306,6 +324,7 @@
 checking response:
 using message as statically defined for comparison
 Response matches our expectations.
+(response contains a connection id)
 
 ================================================
 Testing RQNT2
@@ -319,6 +338,7 @@
 checking response:
 using message as statically defined for comparison
 Response matches our expectations.
+(response contains a connection id)
 
 ================================================
 Testing DLCX
@@ -332,6 +352,7 @@
 checking response:
 using message as statically defined for comparison
 Response matches our expectations.
+(response contains a connection id)
 
 ================================================
 Testing CRCX
@@ -352,6 +373,7 @@
 checking response:
 using message with patched conn_id for comparison
 Response matches our expectations.
+(response does not contain a connection id)
 Dummy packets: 2
 
 ================================================
@@ -365,6 +387,7 @@
 checking response:
 using message with patched conn_id for comparison
 Response matches our expectations.
+(response does not contain a connection id)
 Dummy packets: 2
 
 ================================================
@@ -379,6 +402,7 @@
 checking response:
 using message as statically defined for comparison
 Response matches our expectations.
+(response contains a connection id)
 
 ================================================
 Testing CRCX

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9bce9ca39b7751b557374b7ab57c6c9005bcdb7d
Gerrit-PatchSet: 2
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>



More information about the gerrit-log mailing list