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

Max gerrit-no-reply at lists.osmocom.org
Thu Feb 15 12:02:58 UTC 2018


Hello daniel, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/6296

to look at the new patch set (#6).

Fix VLR 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 adding the parameter.

While at it, also constify conn_exists() parameter.

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, 87 insertions(+), 82 deletions(-)


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

diff --git a/tests/msc_vlr/msc_vlr_test_authen_reuse.c b/tests/msc_vlr/msc_vlr_test_authen_reuse.c
index 039c399..0aff1ef 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);
+	EXPECT_ACCEPTED(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 dea1d96..ca38cfe 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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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 e9eacf0..75f4ca0 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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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 541bac1..eb1ea4c 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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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 b744827..2401d2c 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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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 c7af200..705fbf8 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);
+	EXPECT_ACCEPTED(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 cb5e24f..222bf62 100644
--- a/tests/msc_vlr/msc_vlr_test_rest.c
+++ b/tests/msc_vlr/msc_vlr_test_rest.c
@@ -28,17 +28,17 @@
 	comment_start(nr, imsi);
 
 	btw("NULL conn");
-	EXPECT_ACCEPTED(false);
+	EXPECT_ACCEPTED(false, g_conn);
 
 	btw("freshly allocated conn");
 	g_conn = msc_subscr_con_allocate(net);
-	EXPECT_ACCEPTED(false);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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 9c02682..86d03c2 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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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);
+	EXPECT_ACCEPTED(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 556bf49..ed8cf1f 100644
--- a/tests/msc_vlr/msc_vlr_tests.c
+++ b/tests/msc_vlr/msc_vlr_tests.c
@@ -170,13 +170,18 @@
 		OSMO_ASSERT(gsup_tx_confirmed);
 }
 
-bool conn_exists(struct gsm_subscriber_connection *conn)
+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;
 }
 
@@ -210,7 +215,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 +237,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 d00eb9f..9d7632a 100644
--- a/tests/msc_vlr/msc_vlr_tests.h
+++ b/tests/msc_vlr/msc_vlr_tests.h
@@ -128,7 +128,7 @@
 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);
+bool conn_exists(const struct gsm_subscriber_connection *conn);
 
 void dtap_expect_tx(const char *hex);
 void dtap_expect_tx_ussd(char *ussd_text);
@@ -144,14 +144,14 @@
 
 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); \
+#define EXPECT_ACCEPTED(expect_accepted, x_conn) do {	\
+		if (x_conn) \
+			OSMO_ASSERT(conn_exists(x_conn)); \
+		bool accepted = msc_subscr_conn_is_accepted(x_conn); \
 		fprintf(stderr, "msc_subscr_conn_is_accepted() == %s\n", \
 			accepted ? "true" : "false"); \
 		OSMO_ASSERT(accepted == expect_accepted); \
-	} while (false)
+	} while (0)
 
 #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: newpatchset
Gerrit-Change-Id: I36ae1f9bb395921dc2c5a39e35fbb8040ba47213
Gerrit-PatchSet: 6
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>


More information about the gerrit-log mailing list