[PATCH] osmo-msc[master]: VLR tests: move network init into function

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
Wed Feb 7 15:30:03 UTC 2018


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

VLR tests: move network init into function

That's a preparation step for properly splitting main function of
different tests in follow-up function.

Change-Id: I68a2e94cf79fcb83286eef981a8d88bdbe10ef69
Related: OS#2864
---
M tests/msc_vlr/msc_vlr_tests.c
1 file changed, 25 insertions(+), 15 deletions(-)


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

diff --git a/tests/msc_vlr/msc_vlr_tests.c b/tests/msc_vlr/msc_vlr_tests.c
index ba49180..556bf49 100644
--- a/tests/msc_vlr/msc_vlr_tests.c
+++ b/tests/msc_vlr/msc_vlr_tests.c
@@ -844,6 +844,29 @@
 	}
 }
 
+struct gsm_network *test_net(void *ctx)
+{
+	struct gsm_network *net = gsm_network_init(ctx, 1, 1, mncc_recv);
+
+	net->gsup_server_addr_str = talloc_strdup(net, "no_gsup_server");
+	net->gsup_server_port = 0;
+
+	OSMO_ASSERT(msc_vlr_alloc(net) == 0);
+	OSMO_ASSERT(msc_vlr_start(net) == 0);
+	OSMO_ASSERT(net->vlr);
+	OSMO_ASSERT(net->vlr->gsup_client);
+
+	net->vlr->ops.tx_lu_acc = fake_vlr_tx_lu_acc;
+	net->vlr->ops.tx_lu_rej = fake_vlr_tx_lu_rej;
+	net->vlr->ops.tx_cm_serv_acc = fake_vlr_tx_cm_serv_acc;
+	net->vlr->ops.tx_cm_serv_rej = fake_vlr_tx_cm_serv_rej;
+	net->vlr->ops.tx_auth_req = fake_vlr_tx_auth_req;
+	net->vlr->ops.tx_auth_rej = fake_vlr_tx_auth_rej;
+	net->vlr->ops.set_ciph_mode = fake_vlr_tx_ciph_mode_cmd;
+
+	return net;
+}
+
 int main(int argc, char **argv)
 {
 	handle_options(argc, argv);
@@ -863,24 +886,11 @@
 	if (cmdline_opts.verbose)
 		log_set_category_filter(osmo_stderr_target, DLSMS, 1, LOGL_DEBUG);
 
-	net = gsm_network_init(tall_bsc_ctx, 1, 1, mncc_recv);
-	net->gsup_server_addr_str = talloc_strdup(net, "no_gsup_server");
-	net->gsup_server_port = 0;
+	net = test_net(tall_bsc_ctx);
 
 	osmo_fsm_log_addr(false);
-	OSMO_ASSERT(msc_vlr_alloc(net) == 0);
-	OSMO_ASSERT(msc_vlr_start(net) == 0);
-	OSMO_ASSERT(net->vlr);
-	OSMO_ASSERT(net->vlr->gsup_client);
-	msc_subscr_conn_init();
 
-	net->vlr->ops.tx_lu_acc = fake_vlr_tx_lu_acc;
-	net->vlr->ops.tx_lu_rej = fake_vlr_tx_lu_rej;
-	net->vlr->ops.tx_cm_serv_acc = fake_vlr_tx_cm_serv_acc;
-	net->vlr->ops.tx_cm_serv_rej = fake_vlr_tx_cm_serv_rej;
-	net->vlr->ops.tx_auth_req = fake_vlr_tx_auth_req;
-	net->vlr->ops.tx_auth_rej = fake_vlr_tx_auth_rej;
-	net->vlr->ops.set_ciph_mode = fake_vlr_tx_ciph_mode_cmd;
+	msc_subscr_conn_init();
 
 	clear_vlr();
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I68a2e94cf79fcb83286eef981a8d88bdbe10ef69
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