[MERGED] osmo-msc[master]: Move IMSI into test parameters

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Feb 8 09:28:52 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: Move IMSI into test parameters
......................................................................


Move IMSI into test parameters

This makes test routines more flexible and allows to easier re-use them
for tests with different IMSIs.

Change-Id: I74d46fdb7e87dc04c6b82a0b6f3ce6bef60bde58
Related: OS#2864
---
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_hlr_reject.c
M tests/msc_vlr/msc_vlr_test_ms_timeout.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_tests.c
M tests/msc_vlr/msc_vlr_tests.h
8 files changed, 32 insertions(+), 52 deletions(-)

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



diff --git a/tests/msc_vlr/msc_vlr_test_gsm_authen.c b/tests/msc_vlr/msc_vlr_test_gsm_authen.c
index 70b7614..2bcdd3c 100644
--- a/tests/msc_vlr/msc_vlr_test_gsm_authen.c
+++ b/tests/msc_vlr/msc_vlr_test_gsm_authen.c
@@ -23,10 +23,9 @@
 
 #include "msc_vlr_tests.h"
 
-void test_gsm_authen()
+void test_gsm_authen(const char *imsi)
 {
 	struct vlr_subscr *vsub;
-	const char *imsi = "901700000004620";
 
 	comment_start();
 
@@ -213,10 +212,9 @@
 	comment_end();
 }
 
-void test_gsm_authen_tmsi()
+void test_gsm_authen_tmsi(const char *imsi)
 {
 	struct vlr_subscr *vsub;
-	const char *imsi = "901700000004620";
 
 	comment_start();
 
@@ -490,10 +488,9 @@
 	comment_end();
 }
 
-void test_gsm_authen_imei()
+void test_gsm_authen_imei(const char *imsi)
 {
 	struct vlr_subscr *vsub;
-	const char *imsi = "901700000004620";
 
 	comment_start();
 
@@ -586,10 +583,9 @@
 	comment_end();
 }
 
-void test_gsm_authen_tmsi_imei()
+void test_gsm_authen_tmsi_imei(const char *imsi)
 {
 	struct vlr_subscr *vsub;
-	const char *imsi = "901700000004620";
 
 	comment_start();
 
diff --git a/tests/msc_vlr/msc_vlr_test_gsm_ciph.c b/tests/msc_vlr/msc_vlr_test_gsm_ciph.c
index 42e620a..38f07bb 100644
--- a/tests/msc_vlr/msc_vlr_test_gsm_ciph.c
+++ b/tests/msc_vlr/msc_vlr_test_gsm_ciph.c
@@ -23,10 +23,9 @@
 
 #include "msc_vlr_tests.h"
 
-void test_ciph()
+void test_ciph(const char *imsi)
 {
 	struct vlr_subscr *vsub;
-	const char *imsi = "901700000004620";
 
 	comment_start();
 
@@ -235,10 +234,9 @@
 	comment_end();
 }
 
-void test_ciph_tmsi()
+void test_ciph_tmsi(const char *imsi)
 {
 	struct vlr_subscr *vsub;
-	const char *imsi = "901700000004620";
 
 	comment_start();
 
@@ -474,10 +472,9 @@
 	comment_end();
 }
 
-void test_ciph_imei()
+void test_ciph_imei(const char *imsi)
 {
 	struct vlr_subscr *vsub;
-	const char *imsi = "901700000004620";
 
 	comment_start();
 
@@ -576,10 +573,9 @@
 	comment_end();
 }
 
-void test_ciph_imeisv()
+void test_ciph_imeisv(const char *imsi)
 {
 	struct vlr_subscr *vsub;
-	const char *imsi = "901700000004620";
 
 	comment_start();
 
@@ -674,10 +670,9 @@
 	comment_end();
 }
 
-void test_ciph_tmsi_imei()
+void test_ciph_tmsi_imei(const char *imsi)
 {
 	struct vlr_subscr *vsub;
-	const char *imsi = "901700000004620";
 
 	comment_start();
 
diff --git a/tests/msc_vlr/msc_vlr_test_hlr_reject.c b/tests/msc_vlr/msc_vlr_test_hlr_reject.c
index 6cf4afc..76cfb47 100644
--- a/tests/msc_vlr/msc_vlr_test_hlr_reject.c
+++ b/tests/msc_vlr/msc_vlr_test_hlr_reject.c
@@ -75,10 +75,9 @@
 	comment_end();
 }
 
-void test_hlr_rej_auth_info_net_fail_no_reuse_tuples()
+void test_hlr_rej_auth_info_net_fail_no_reuse_tuples(const char *imsi)
 {
 	struct vlr_subscr *vsub;
-	const char *imsi = "901700000004620";
 
 	comment_start();
 
@@ -162,10 +161,9 @@
 	comment_end();
 }
 
-void test_hlr_rej_auth_info_unkown_imsi_no_reuse_tuples()
+void test_hlr_rej_auth_info_unkown_imsi_no_reuse_tuples(const char *imsi)
 {
 	struct vlr_subscr *vsub;
-	const char *imsi = "901700000004620";
 
 	comment_start();
 
@@ -282,10 +280,9 @@
 	comment_end();
 }
 
-void test_hlr_rej_auth_info_net_fail_reuse_tuples()
+void test_hlr_rej_auth_info_net_fail_reuse_tuples(const char *imsi)
 {
 	struct vlr_subscr *vsub;
-	const char *imsi = "901700000004620";
 
 	comment_start();
 
diff --git a/tests/msc_vlr/msc_vlr_test_ms_timeout.c b/tests/msc_vlr/msc_vlr_test_ms_timeout.c
index 4cfd035..d5f4bb0 100644
--- a/tests/msc_vlr/msc_vlr_test_ms_timeout.c
+++ b/tests/msc_vlr/msc_vlr_test_ms_timeout.c
@@ -182,10 +182,9 @@
 	comment_end();
 }
 
-void test_ms_timeout_paging()
+void test_ms_timeout_paging(const char *imsi)
 {
 	struct vlr_subscr *vsub;
-	const char *imsi = "901700000004620";
 
 	rx_from_ran = RAN_GERAN_A;
 
diff --git a/tests/msc_vlr/msc_vlr_test_no_authen.c b/tests/msc_vlr/msc_vlr_test_no_authen.c
index 32e0b40..e193f27 100644
--- a/tests/msc_vlr/msc_vlr_test_no_authen.c
+++ b/tests/msc_vlr/msc_vlr_test_no_authen.c
@@ -23,10 +23,9 @@
 
 #include "msc_vlr_tests.h"
 
-void test_no_authen()
+void test_no_authen(const char *imsi)
 {
 	struct vlr_subscr *vsub;
-	const char *imsi = "901700000004620";
 	
 	/* No auth only works on GERAN */
 	rx_from_ran = RAN_GERAN_A;
@@ -162,10 +161,9 @@
 	comment_end();
 }
 
-void test_no_authen_tmsi()
+void test_no_authen_tmsi(const char *imsi)
 {
 	struct vlr_subscr *vsub;
-	const char *imsi = "901700000004620";
 
 	rx_from_ran = RAN_GERAN_A;
 
@@ -382,10 +380,9 @@
 	comment_end();
 }
 
-void test_no_authen_imei()
+void test_no_authen_imei(const char *imsi)
 {
 	struct vlr_subscr *vsub;
-	const char *imsi = "901700000004620";
 
 	rx_from_ran = RAN_GERAN_A;
 
@@ -450,10 +447,9 @@
 	comment_end();
 }
 
-void test_no_authen_tmsi_imei()
+void test_no_authen_tmsi_imei(const char *imsi)
 {
 	struct vlr_subscr *vsub;
-	const char *imsi = "901700000004620";
 
 	rx_from_ran = RAN_GERAN_A;
 
@@ -527,10 +523,9 @@
 	comment_end();
 }
 
-void test_no_authen_imeisv()
+void test_no_authen_imeisv(const char *imsi)
 {
 	struct vlr_subscr *vsub;
-	const char *imsi = "901700000004620";
 	
 	/* No auth only works on GERAN */
 	rx_from_ran = RAN_GERAN_A;
@@ -588,10 +583,9 @@
 	comment_end();
 }
 
-void test_no_authen_imeisv_imei()
+void test_no_authen_imeisv_imei(const char *imsi)
 {
 	struct vlr_subscr *vsub;
-	const char *imsi = "901700000004620";
 
 	rx_from_ran = RAN_GERAN_A;
 
@@ -666,10 +660,9 @@
 	comment_end();
 }
 
-void test_no_authen_imeisv_tmsi()
+void test_no_authen_imeisv_tmsi(const char *imsi)
 {
 	struct vlr_subscr *vsub;
-	const char *imsi = "901700000004620";
 
 	rx_from_ran = RAN_GERAN_A;
 
@@ -804,10 +797,9 @@
 	comment_end();
 }
 
-void test_no_authen_imeisv_tmsi_imei()
+void test_no_authen_imeisv_tmsi_imei(const char *imsi)
 {
 	struct vlr_subscr *vsub;
-	const char *imsi = "901700000004620";
 
 	rx_from_ran = RAN_GERAN_A;
 
diff --git a/tests/msc_vlr/msc_vlr_test_reject_concurrency.c b/tests/msc_vlr/msc_vlr_test_reject_concurrency.c
index 2377c19..d6676cf 100644
--- a/tests/msc_vlr/msc_vlr_test_reject_concurrency.c
+++ b/tests/msc_vlr/msc_vlr_test_reject_concurrency.c
@@ -115,9 +115,8 @@
 	EXPECT_ACCEPTED(true);
 }
 
-void _page()
+void _page(const char *imsi)
 {
-	const char *imsi = "901700000004620";
 	struct vlr_subscr *vsub;
 
 	BTW("an SMS is sent, MS is paged");
@@ -318,12 +317,12 @@
 	comment_end();
 }
 
-void test_reject_paging_resp_during_paging_resp()
+void test_reject_paging_resp_during_paging_resp(const char *imsi)
 {
 	comment_start();
 
 	_normal_lu();
-	_page();
+	_page(imsi);
 	_paging_resp_part1();
 
 	BTW("MS sends another erratic Paging Response which is dropped silently");
@@ -335,12 +334,12 @@
 	comment_end();
 }
 
-void test_reject_lu_during_paging_resp()
+void test_reject_lu_during_paging_resp(const char *imsi)
 {
 	comment_start();
 
 	_normal_lu();
-	_page();
+	_page(imsi);
 	_paging_resp_part1();
 
 	BTW("MS sends erratic LU Request, which is dropped silently");
@@ -355,12 +354,12 @@
 	comment_end();
 }
 
-void test_accept_cm_during_paging_resp()
+void test_accept_cm_during_paging_resp(const char *imsi)
 {
 	comment_start();
 
 	_normal_lu();
-	_page();
+	_page(imsi);
 	_paging_resp_part1();
 
 	BTW("CM Service Request during open connection is accepted");
diff --git a/tests/msc_vlr/msc_vlr_tests.c b/tests/msc_vlr/msc_vlr_tests.c
index 713bb16..82ab8bc 100644
--- a/tests/msc_vlr/msc_vlr_tests.c
+++ b/tests/msc_vlr/msc_vlr_tests.c
@@ -826,6 +826,8 @@
 void run_tests(int nr)
 {
 	int test_nr;
+	const char *imsi = "901700000004620";
+
 	nr--; /* arg's first test is 1, in here it's 0 */
 	for (test_nr = 0; msc_vlr_tests[test_nr]; test_nr++) {
 		if (nr >= 0 && test_nr != nr)
@@ -834,7 +836,7 @@
 		if (cmdline_opts.verbose)
 			fprintf(stderr, "(test nr %d)\n", test_nr + 1);
 
-		msc_vlr_tests[test_nr]();
+		msc_vlr_tests[test_nr](imsi);
 
 		if (cmdline_opts.verbose)
 			fprintf(stderr, "(test nr %d)\n", test_nr + 1);
diff --git a/tests/msc_vlr/msc_vlr_tests.h b/tests/msc_vlr/msc_vlr_tests.h
index ee26ac4..eaec340 100644
--- a/tests/msc_vlr/msc_vlr_tests.h
+++ b/tests/msc_vlr/msc_vlr_tests.h
@@ -122,7 +122,7 @@
 	int run_test_nr;
 };
 
-typedef void (* msc_vlr_test_func_t )(void);
+typedef void (* msc_vlr_test_func_t )(const char *);
 extern msc_vlr_test_func_t msc_vlr_tests[];
 
 struct msgb *msgb_from_hex(const char *label, uint16_t size, const char *hex);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I74d46fdb7e87dc04c6b82a0b6f3ce6bef60bde58
Gerrit-PatchSet: 3
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: daniel <dwillmann at sysmocom.de>


More information about the gerrit-log mailing list