[PATCH] osmo-msc[master]: Fix MSC test macro

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/.

Max gerrit-no-reply at lists.osmocom.org
Tue Feb 6 16:17:08 UTC 2018


Review at  https://gerrit.osmocom.org/6296

Fix MSC test macro

Previously EXPECT_ACCEPTED used parameter which wasn't explicitly passed
to it. This is potential source of bugs and makes code harder to read
and maintain. Fix this by converting it to function.

Also don't use assert to fail but print additional error log which
allows the test to continue collecting all related errors in one
run.

In addition, this allow us to make conn_exists() static.

Change-Id: I36ae1f9bb395921dc2c5a39e35fbb8040ba47213
Related: OS#2864
---
M tests/msc_vlr/msc_vlr_test_authen_reuse.c
M tests/msc_vlr/msc_vlr_test_call.c
M tests/msc_vlr/msc_vlr_test_gsm_authen.c
M tests/msc_vlr/msc_vlr_test_gsm_ciph.c
M tests/msc_vlr/msc_vlr_test_no_authen.c
M tests/msc_vlr/msc_vlr_test_reject_concurrency.c
M tests/msc_vlr/msc_vlr_test_rest.c
M tests/msc_vlr/msc_vlr_test_umts_authen.c
M tests/msc_vlr/msc_vlr_tests.c
M tests/msc_vlr/msc_vlr_tests.h
10 files changed, 97 insertions(+), 87 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/96/6296/1

diff --git a/tests/msc_vlr/msc_vlr_test_authen_reuse.c b/tests/msc_vlr/msc_vlr_test_authen_reuse.c
index 103c904..7734440 100644
--- a/tests/msc_vlr/msc_vlr_test_authen_reuse.c
+++ b/tests/msc_vlr/msc_vlr_test_authen_reuse.c
@@ -129,7 +129,7 @@
 
 	btw("a LU Accept with a new TMSI was sent, waiting for TMSI Realloc Compl");
 	EXPECT_CONN_COUNT(1);
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("even though the TMSI is not acked, we can already find the subscr with it");
diff --git a/tests/msc_vlr/msc_vlr_test_call.c b/tests/msc_vlr/msc_vlr_test_call.c
index cc120c8..c35a0ec 100644
--- a/tests/msc_vlr/msc_vlr_test_call.c
+++ b/tests/msc_vlr/msc_vlr_test_call.c
@@ -133,7 +133,7 @@
 
 	btw("a LU Accept with a new TMSI was sent, waiting for TMSI Realloc Compl");
 	EXPECT_CONN_COUNT(1);
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 
 	btw("MS sends TMSI Realloc Complete");
 	iu_release_expected = true;
@@ -178,7 +178,7 @@
 	VERBOSE_ASSERT(auth_request_sent, == true, "%d");
 
 	btw("needs auth, not yet accepted");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 
 	/* On UTRAN */
 	btw("MS sends Authen Response, VLR accepts and sends SecurityModeControl");
diff --git a/tests/msc_vlr/msc_vlr_test_gsm_authen.c b/tests/msc_vlr/msc_vlr_test_gsm_authen.c
index 2bcdd3c..fc4fb78 100644
--- a/tests/msc_vlr/msc_vlr_test_gsm_authen.c
+++ b/tests/msc_vlr/msc_vlr_test_gsm_authen.c
@@ -65,7 +65,7 @@
 
 	btw("If the HLR were to send a GSUP _UPDATE_LOCATION_RESULT we'd still reject");
 	gsup_rx("06010809710000004026f0", NULL);
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 
 	thwart_rx_non_initial_requests();
 
@@ -102,7 +102,7 @@
 	VERBOSE_ASSERT(auth_request_sent, == true, "%d");
 
 	btw("needs auth, not yet accepted");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("MS sends Authen Response, VLR accepts with a CM Service Accept");
@@ -150,7 +150,7 @@
 	VERBOSE_ASSERT(auth_request_sent, == true, "%d");
 
 	btw("needs auth, not yet accepted");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("MS sends Authen Response, VLR accepts and sends pending SMS");
@@ -255,7 +255,7 @@
 
 	btw("If the HLR were to send a GSUP _UPDATE_LOCATION_RESULT we'd still reject");
 	gsup_rx("06010809710000004026f0", NULL);
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 
 	thwart_rx_non_initial_requests();
 
@@ -277,7 +277,7 @@
 	btw("a LU Accept with a new TMSI was sent, waiting for TMSI Realloc Compl");
 	EXPECT_CONN_COUNT(1);
 	VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("even though the TMSI is not acked, we can already find the subscr with it");
@@ -316,7 +316,7 @@
 	VERBOSE_ASSERT(auth_request_sent, == true, "%d");
 
 	btw("needs auth, not yet accepted");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("MS sends Authen Response, VLR accepts with a CM Service Accept");
@@ -364,7 +364,7 @@
 	VERBOSE_ASSERT(auth_request_sent, == true, "%d");
 
 	btw("needs auth, not yet accepted");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("MS sends Authen Response, VLR accepts and sends pending SMS");
@@ -451,7 +451,7 @@
 	btw("a LU Accept with a new TMSI was sent, waiting for TMSI Realloc Compl");
 	EXPECT_CONN_COUNT(1);
 	VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("even though the TMSI is not acked, we can already find the subscr with it");
@@ -531,7 +531,7 @@
 
 	btw("If the HLR were to send a GSUP _UPDATE_LOCATION_RESULT we'd still reject");
 	gsup_rx("06010809710000004026f0", NULL);
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -555,7 +555,7 @@
 	OSMO_ASSERT(vsub);
 	VERBOSE_ASSERT(vsub->imei[0], == 0, "%d");
 	vlr_subscr_put(vsub);
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("MS replies with an Identity Response");
@@ -627,7 +627,7 @@
 
 	btw("If the HLR were to send a GSUP _UPDATE_LOCATION_RESULT we'd still reject");
 	gsup_rx("06010809710000004026f0", NULL);
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 
 	thwart_rx_non_initial_requests();
 
@@ -653,7 +653,7 @@
 	OSMO_ASSERT(vsub);
 	VERBOSE_ASSERT(vsub->imei[0], == 0, "%d");
 	vlr_subscr_put(vsub);
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("MS replies with an Identity Response");
@@ -662,7 +662,7 @@
 	btw("a LU Accept with a new TMSI was sent, waiting for TMSI Realloc Compl");
 	EXPECT_CONN_COUNT(1);
 	VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("even though the TMSI is not acked, we can already find the subscr with it");
@@ -796,7 +796,7 @@
 	VERBOSE_ASSERT(auth_request_sent, == true, "%d");
 
 	btw("needs auth, not yet accepted");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("MS sends Authen Response, VLR accepts with a CM Service Accept");
@@ -847,7 +847,7 @@
 	VERBOSE_ASSERT(auth_request_sent, == true, "%d");
 
 	btw("needs auth, not yet accepted");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("MS sends Authen Response, VLR accepts and sends pending SMS");
diff --git a/tests/msc_vlr/msc_vlr_test_gsm_ciph.c b/tests/msc_vlr/msc_vlr_test_gsm_ciph.c
index 38f07bb..696de49 100644
--- a/tests/msc_vlr/msc_vlr_test_gsm_ciph.c
+++ b/tests/msc_vlr/msc_vlr_test_gsm_ciph.c
@@ -71,7 +71,7 @@
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
 	btw("needs ciph, not yet accepted");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -106,7 +106,7 @@
 	VERBOSE_ASSERT(cm_service_result_sent, == RES_NONE, "%d");
 
 	btw("needs auth, not yet accepted");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("MS sends Authen Response, VLR accepts and requests Ciphering");
@@ -116,7 +116,7 @@
 	VERBOSE_ASSERT(cipher_mode_cmd_sent, == true, "%d");
 
 	btw("needs ciph, not yet accepted");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("MS sends Ciphering Mode Complete, VLR accepts; above Ciphering is an implicit CM Service Accept");
@@ -163,7 +163,7 @@
 	VERBOSE_ASSERT(auth_request_sent, == true, "%d");
 
 	btw("needs auth, not yet accepted");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("MS sends Authen Response, VLR accepts and requests Ciphering");
@@ -172,7 +172,7 @@
 	VERBOSE_ASSERT(cipher_mode_cmd_sent, == true, "%d");
 
 	btw("needs ciph, not yet accepted");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("MS sends Ciphering Mode Complete, VLR accepts and sends pending SMS");
@@ -284,7 +284,7 @@
 	VERBOSE_ASSERT(auth_request_sent, == true, "%d");
 
 	btw("needs ciph, not yet accepted");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -304,7 +304,7 @@
 	btw("a LU Accept with a new TMSI was sent, waiting for TMSI Realloc Compl");
 	EXPECT_CONN_COUNT(1);
 	VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("even though the TMSI is not acked, we can already find the subscr with it");
@@ -344,7 +344,7 @@
 	VERBOSE_ASSERT(cm_service_result_sent, == RES_NONE, "%d");
 
 	btw("needs auth, not yet accepted");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("MS sends Authen Response, VLR accepts and requests Ciphering");
@@ -354,7 +354,7 @@
 	VERBOSE_ASSERT(cipher_mode_cmd_sent, == true, "%d");
 
 	btw("needs ciph, not yet accepted");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("MS sends Ciphering Mode Complete, VLR accepts; above Ciphering is an implicit CM Service Accept");
@@ -401,7 +401,7 @@
 	VERBOSE_ASSERT(auth_request_sent, == true, "%d");
 
 	btw("needs auth, not yet accepted");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("MS sends Authen Response, VLR accepts and requests Ciphering");
@@ -410,7 +410,7 @@
 	VERBOSE_ASSERT(cipher_mode_cmd_sent, == true, "%d");
 
 	btw("needs ciph, not yet accepted");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("MS sends Ciphering Mode Complete, VLR accepts and sends pending SMS");
@@ -521,7 +521,7 @@
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
 	btw("needs ciph, not yet accepted");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -545,7 +545,7 @@
 	OSMO_ASSERT(vsub);
 	VERBOSE_ASSERT(vsub->imei[0], == 0, "%d");
 	vlr_subscr_put(vsub);
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("MS replies with an Identity Response");
@@ -623,7 +623,7 @@
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
 	btw("needs ciph, not yet accepted");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -643,7 +643,7 @@
 	VERBOSE_ASSERT(strcmp(vsub->imeisv, "4234234234234275"), == 0, "%d");
 	vlr_subscr_put(vsub);
 
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("HLR sends _INSERT_DATA_REQUEST, VLR responds with _INSERT_DATA_RESULT");
@@ -720,7 +720,7 @@
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
 	btw("needs ciph, not yet accepted");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -744,7 +744,7 @@
 	OSMO_ASSERT(vsub);
 	VERBOSE_ASSERT(vsub->imei[0], == 0, "%d");
 	vlr_subscr_put(vsub);
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("MS replies with an Identity Response");
@@ -753,7 +753,7 @@
 	btw("a LU Accept with a new TMSI was sent, waiting for TMSI Realloc Compl");
 	EXPECT_CONN_COUNT(1);
 	VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("even though the TMSI is not acked, we can already find the subscr with it");
@@ -799,7 +799,7 @@
 	ms_sends_msg("050802008168000130" "05f4" "23422342");
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("MS tells us the IMSI, causes a GSUP LU request to HLR");
@@ -814,7 +814,7 @@
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
 	btw("having received subscriber data does not mean acceptance");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
diff --git a/tests/msc_vlr/msc_vlr_test_no_authen.c b/tests/msc_vlr/msc_vlr_test_no_authen.c
index e193f27..2e2c133 100644
--- a/tests/msc_vlr/msc_vlr_test_no_authen.c
+++ b/tests/msc_vlr/msc_vlr_test_no_authen.c
@@ -45,7 +45,7 @@
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
 	btw("having received subscriber data does not mean acceptance");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 
 	thwart_rx_non_initial_requests();
 
@@ -67,7 +67,7 @@
 	OSMO_ASSERT(g_conn->conn_fsm);
 	OSMO_ASSERT(g_conn->vsub);
 	VERBOSE_ASSERT(cm_service_result_sent, == RES_ACCEPT, "%d");
-	EXPECT_ACCEPTED(true);
+	exp_accept_con(true, g_conn);
 
 	btw("a USSD request is serviced");
 	dtap_expect_tx_ussd("Your extension is 46071\r");
@@ -184,7 +184,7 @@
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
 	btw("having received subscriber data does not mean acceptance");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -194,7 +194,7 @@
 	btw("a LU Accept with a new TMSI was sent, waiting for TMSI Realloc Compl");
 	EXPECT_CONN_COUNT(1);
 	VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("even though the TMSI is not acked, we can already find the subscr with it");
@@ -228,7 +228,7 @@
 	OSMO_ASSERT(g_conn->conn_fsm);
 	OSMO_ASSERT(g_conn->vsub);
 	VERBOSE_ASSERT(cm_service_result_sent, == RES_ACCEPT, "%d");
-	EXPECT_ACCEPTED(true);
+	exp_accept_con(true, g_conn);
 
 	btw("a USSD request is serviced");
 	dtap_expect_tx_ussd("Your extension is 46071\r");
@@ -333,7 +333,7 @@
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
 	btw("having received subscriber data does not mean acceptance");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -343,7 +343,7 @@
 	btw("a LU Accept with a new TMSI was sent, waiting for TMSI Realloc Compl");
 	EXPECT_CONN_COUNT(1);
 	VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("even though the TMSI is not acked, we can already find the subscr with it");
@@ -403,7 +403,7 @@
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
 	btw("having received subscriber data does not mean acceptance");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -417,7 +417,7 @@
 	OSMO_ASSERT(vsub);
 	VERBOSE_ASSERT(vsub->imei[0], == 0, "%d");
 	vlr_subscr_put(vsub);
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("MS replies with an Identity Response");
@@ -471,7 +471,7 @@
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
 	btw("having received subscriber data does not mean acceptance");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -485,7 +485,7 @@
 	OSMO_ASSERT(vsub);
 	VERBOSE_ASSERT(vsub->imei[0], == 0, "%d");
 	vlr_subscr_put(vsub);
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("MS replies with an Identity Response");
@@ -494,7 +494,7 @@
 	btw("a LU Accept with a new TMSI was sent, waiting for TMSI Realloc Compl");
 	EXPECT_CONN_COUNT(1);
 	VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("MS sends TMSI Realloc Complete");
@@ -558,7 +558,7 @@
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
 	btw("having received subscriber data does not mean acceptance");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 
 	thwart_rx_non_initial_requests();
 
@@ -618,7 +618,7 @@
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
 	btw("having received subscriber data does not mean acceptance");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -632,7 +632,7 @@
 	OSMO_ASSERT(vsub);
 	VERBOSE_ASSERT(vsub->imei[0], == 0, "%d");
 	vlr_subscr_put(vsub);
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("MS replies with an Identity Response");
@@ -695,7 +695,7 @@
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
 	btw("having received subscriber data does not mean acceptance");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -705,7 +705,7 @@
 	btw("a LU Accept with a new TMSI was sent, waiting for TMSI Realloc Compl");
 	EXPECT_CONN_COUNT(1);
 	VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("even though the TMSI is not acked, we can already find the subscr with it");
@@ -750,7 +750,7 @@
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
 	btw("having received subscriber data does not mean acceptance");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -760,7 +760,7 @@
 	btw("a LU Accept with a new TMSI was sent, waiting for TMSI Realloc Compl");
 	EXPECT_CONN_COUNT(1);
 	VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("even though the TMSI is not acked, we can already find the subscr with it");
@@ -833,7 +833,7 @@
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
 	btw("having received subscriber data does not mean acceptance");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -847,7 +847,7 @@
 	OSMO_ASSERT(vsub);
 	VERBOSE_ASSERT(vsub->imei[0], == 0, "%d");
 	vlr_subscr_put(vsub);
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("MS replies with an Identity Response");
@@ -856,7 +856,7 @@
 	btw("a LU Accept with a new TMSI was sent, waiting for TMSI Realloc Compl");
 	EXPECT_CONN_COUNT(1);
 	VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("MS sends TMSI Realloc Complete");
diff --git a/tests/msc_vlr/msc_vlr_test_reject_concurrency.c b/tests/msc_vlr/msc_vlr_test_reject_concurrency.c
index d6676cf..68806ec 100644
--- a/tests/msc_vlr/msc_vlr_test_reject_concurrency.c
+++ b/tests/msc_vlr/msc_vlr_test_reject_concurrency.c
@@ -112,7 +112,7 @@
 	OSMO_ASSERT(g_conn->conn_fsm);
 	OSMO_ASSERT(g_conn->vsub);
 	VERBOSE_ASSERT(cm_service_result_sent, == RES_ACCEPT, "%d");
-	EXPECT_ACCEPTED(true);
+	exp_accept_con(true, g_conn);
 }
 
 void _page(const char *imsi)
diff --git a/tests/msc_vlr/msc_vlr_test_rest.c b/tests/msc_vlr/msc_vlr_test_rest.c
index c19c4c6..029e0e7 100644
--- a/tests/msc_vlr/msc_vlr_test_rest.c
+++ b/tests/msc_vlr/msc_vlr_test_rest.c
@@ -23,22 +23,22 @@
 
 #include "msc_vlr_tests.h"
 
-void test_early_stage()
+void test_early_stage(const char *imsi)
 {
 	comment_start();
 
 	btw("NULL conn");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 
 	btw("freshly allocated conn");
 	g_conn = msc_subscr_con_allocate(net);
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 
 	btw("conn_fsm present, in state NEW");
 	OSMO_ASSERT(msc_create_conn_fsm(g_conn, "test") == 0);
 	OSMO_ASSERT(g_conn->conn_fsm);
 	OSMO_ASSERT(g_conn->conn_fsm->state == SUBSCR_CONN_S_NEW);
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 
 	thwart_rx_non_initial_requests();
 
@@ -50,7 +50,7 @@
 	g_conn->silent_call = 1;
 	osmo_fsm_inst_state_chg(g_conn->conn_fsm, SUBSCR_CONN_S_ACCEPTED, 0, 0);
 	EXPECT_CONN_COUNT(1);
-	EXPECT_ACCEPTED(true);
+	exp_accept_con(true, g_conn);
 
 	btw("CLOSE event marks conn_fsm as released and frees the conn");
 	expect_bssap_clear();
@@ -95,7 +95,7 @@
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
 	btw("having received subscriber data does not mean acceptance");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 
 	thwart_rx_non_initial_requests();
 
@@ -125,7 +125,7 @@
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
 	btw("having received subscriber data does not mean acceptance");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 
 	thwart_rx_non_initial_requests();
 
@@ -160,7 +160,7 @@
 	ms_sends_msg("050802008168000130" "05f4" "23422342");
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("MS tells us the IMSI, causes a GSUP LU request to HLR");
@@ -175,7 +175,7 @@
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
 	btw("having received subscriber data does not mean acceptance");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
diff --git a/tests/msc_vlr/msc_vlr_test_umts_authen.c b/tests/msc_vlr/msc_vlr_test_umts_authen.c
index 1175bf8..0b2e46f 100644
--- a/tests/msc_vlr/msc_vlr_test_umts_authen.c
+++ b/tests/msc_vlr/msc_vlr_test_umts_authen.c
@@ -168,7 +168,7 @@
 
 	btw("a LU Accept with a new TMSI was sent, waiting for TMSI Realloc Compl");
 	EXPECT_CONN_COUNT(1);
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("even though the TMSI is not acked, we can already find the subscr with it");
@@ -202,7 +202,7 @@
 	VERBOSE_ASSERT(auth_request_sent, == true, "%d");
 
 	btw("needs auth, not yet accepted");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	if (via_ran == RAN_GERAN_A) {
@@ -266,7 +266,7 @@
 	VERBOSE_ASSERT(auth_request_sent, == true, "%d");
 
 	btw("needs auth, not yet accepted");
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	if (via_ran == RAN_GERAN_A) {
@@ -536,7 +536,7 @@
 
 	btw("a LU Accept with a new TMSI was sent, waiting for TMSI Realloc Compl");
 	EXPECT_CONN_COUNT(1);
-	EXPECT_ACCEPTED(false);
+	exp_accept_con(false, g_conn);
 	thwart_rx_non_initial_requests();
 
 	btw("even though the TMSI is not acked, we can already find the subscr with it");
diff --git a/tests/msc_vlr/msc_vlr_tests.c b/tests/msc_vlr/msc_vlr_tests.c
index c75d950..8f6d4b2 100644
--- a/tests/msc_vlr/msc_vlr_tests.c
+++ b/tests/msc_vlr/msc_vlr_tests.c
@@ -170,14 +170,32 @@
 		OSMO_ASSERT(gsup_tx_confirmed);
 }
 
-bool conn_exists(struct gsm_subscriber_connection *conn)
+static inline bool conn_exists(const struct gsm_subscriber_connection *conn)
 {
 	struct gsm_subscriber_connection *c;
+
+	if (!conn)
+		return false;
+
 	llist_for_each_entry(c, &net->subscr_conns, entry) {
 		if (c == conn)
 			return true;
 	}
+
 	return false;
+}
+
+void exp_accept_con(bool exp, const struct gsm_subscriber_connection *conn)
+{
+	bool accepted;
+	if (conn)
+		if (!conn_exists(conn))
+			fprintf(stderr, "ERROR: expecting %s on unknown connection\n",
+				exp ? "true" : "false");
+
+	accepted = msc_subscr_conn_is_accepted(conn);
+	fprintf(stderr, "msc_subscr_conn_is_accepted() == %s%s\n",
+		accepted ? "true" : "false", accepted != exp ? " EXP. FAILED!" : "");
 }
 
 enum ran_type rx_from_ran = RAN_GERAN_A;
@@ -210,7 +228,7 @@
 	    ran_type_name(rx_from_ran),
 	    gh_type_name(gh));
 
-	if (g_conn && !conn_exists(g_conn))
+	if (!conn_exists(g_conn))
 		g_conn = NULL;
 
 	if (!g_conn) {
@@ -232,7 +250,7 @@
 			msc_dtap(g_conn, 23, msg);
 	}
 
-	if (g_conn && !conn_exists(g_conn))
+	if (!conn_exists(g_conn))
 		g_conn = NULL;
 }
 
diff --git a/tests/msc_vlr/msc_vlr_tests.h b/tests/msc_vlr/msc_vlr_tests.h
index 2ea3f29..0d48e00 100644
--- a/tests/msc_vlr/msc_vlr_tests.h
+++ b/tests/msc_vlr/msc_vlr_tests.h
@@ -128,7 +128,8 @@
 struct msgb *msgb_from_hex(const char *label, uint16_t size, const char *hex);
 
 void clear_vlr();
-bool conn_exists(struct gsm_subscriber_connection *conn);
+
+void exp_accept_con(bool exp, const struct gsm_subscriber_connection *conn);
 
 void dtap_expect_tx(const char *hex);
 void dtap_expect_tx_ussd(char *ussd_text);
@@ -143,15 +144,6 @@
 	      char *str);
 
 void thwart_rx_non_initial_requests();
-
-#define EXPECT_ACCEPTED(expect_accepted) do { \
-		if (g_conn) \
-			OSMO_ASSERT(conn_exists(g_conn)); \
-		bool accepted = msc_subscr_conn_is_accepted(g_conn); \
-		fprintf(stderr, "msc_subscr_conn_is_accepted() == %s\n", \
-			accepted ? "true" : "false"); \
-		OSMO_ASSERT(accepted == expect_accepted); \
-	} while (false)
 
 #define VERBOSE_ASSERT(val, expect_op, fmt) \
 	do { \

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I36ae1f9bb395921dc2c5a39e35fbb8040ba47213
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list