Change in osmo-bsc[master]: add bsc_stubs.h to workaround linking hell for utils and tests

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

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Thu May 24 16:59:45 UTC 2018


Neels Hofmeyr has uploaded this change for review. ( https://gerrit.osmocom.org/9279


Change subject: add bsc_stubs.h to workaround linking hell for utils and tests
......................................................................

add bsc_stubs.h to workaround linking hell for utils and tests

libbsc currently depends on functions defined in osmo-bsc/. Until we clean that
up, unify the place to define stubs that allow linking. (Otherwise I would edit
all those separate scopes for each new BSSMAP function.)

For reasons I can't even begin to understand, simply including this header with
trivial stubs suddenly causes the linker to require libosmo-mgcp-client and
libosmo-sigtran in bsc_test and gsm0408_test. Whatever, go ahead then.

Change-Id: I000be689ed071aced1a085284f924a7e77e5656d
---
M include/osmocom/bsc/Makefile.am
A include/osmocom/bsc/bsc_stubs.h
M src/ipaccess/ipaccess-config.c
M src/utils/bs11_config.c
M tests/abis/abis_test.c
M tests/bsc-nat/bsc_nat_test.c
M tests/bsc/Makefile.am
M tests/bsc/bsc_test.c
M tests/channel/channel_test.c
M tests/gsm0408/Makefile.am
M tests/gsm0408/gsm0408_test.c
M tests/handover/handover_test.c
M tests/nanobts_omlattr/nanobts_omlattr_test.c
13 files changed, 48 insertions(+), 36 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/79/9279/1

diff --git a/include/osmocom/bsc/Makefile.am b/include/osmocom/bsc/Makefile.am
index b25dfd8..5a1370c 100644
--- a/include/osmocom/bsc/Makefile.am
+++ b/include/osmocom/bsc/Makefile.am
@@ -52,4 +52,5 @@
 	vty.h \
 	bsc_api.h \
 	penalty_timers.h \
+	bsc_stubs.h \
 	$(NULL)
diff --git a/include/osmocom/bsc/bsc_stubs.h b/include/osmocom/bsc/bsc_stubs.h
new file mode 100644
index 0000000..7b3244e
--- /dev/null
+++ b/include/osmocom/bsc/bsc_stubs.h
@@ -0,0 +1,22 @@
+/* libbsc currently references some BSSMAP functions only implemented within osmo-bsc/. Until that gets
+ * cleaned up properly, various utils and C tests need these stubs to successfully link a complete
+ * binary. This nonsense should disappear as soon as we get time to fix it. */
+
+struct gsm_subscriber_connection;
+struct msgb;
+struct gsm_lchan;
+struct gsm0808_handover_required;
+struct handover;
+
+int osmo_bsc_sigtran_send(struct gsm_subscriber_connection *conn, struct msgb *msg)
+{ OSMO_ASSERT(false); }
+
+int osmo_bsc_sigtran_open_conn(struct gsm_subscriber_connection *conn, struct msgb *msg)
+{ return 0; }
+
+int bsc_send_handover_required(struct gsm_lchan *lchan,
+			       const struct gsm0808_handover_required *params)
+{ OSMO_ASSERT(false); }
+
+int bsc_send_handover_request_ack(struct handover *ho, struct msgb *rr_ho_command)
+{ OSMO_ASSERT(false); }
diff --git a/src/ipaccess/ipaccess-config.c b/src/ipaccess/ipaccess-config.c
index 2236063..f88ca6e 100644
--- a/src/ipaccess/ipaccess-config.c
+++ b/src/ipaccess/ipaccess-config.c
@@ -55,6 +55,8 @@
 #include <osmocom/abis/abis.h>
 #include <osmocom/gsm/protocol/gsm_12_21.h>
 
+#include <osmocom/bsc/bsc_stubs.h>
+
 struct gsm_network *bsc_gsmnet;
 
 static int net_listen_testnr;
@@ -1072,15 +1074,3 @@
 
 	exit(0);
 }
-
-/* Stub */
-int osmo_bsc_sigtran_send(struct gsm_subscriber_connection *conn, struct msgb *msg)
-{
-	return 0;
-}
-
-/* Stub */
-int osmo_bsc_sigtran_open_conn(struct gsm_subscriber_connection *conn, struct msgb *msg)
-{
-	return 0;
-}
diff --git a/src/utils/bs11_config.c b/src/utils/bs11_config.c
index 8d4de01..831c198 100644
--- a/src/utils/bs11_config.c
+++ b/src/utils/bs11_config.c
@@ -45,6 +45,8 @@
 #include <osmocom/abis/abis.h>
 #include <osmocom/abis/e1_input.h>
 
+#include <osmocom/bsc/bsc_stubs.h>
+
 static void *tall_bs11cfg_ctx;
 static struct e1inp_sign_link *oml_link;
 
@@ -969,15 +971,3 @@
 
 	exit(0);
 }
-
-/* Stub */
-int osmo_bsc_sigtran_send(struct gsm_subscriber_connection *conn, struct msgb *msg)
-{
-	return 0;
-}
-
-/* Stub */
-int osmo_bsc_sigtran_open_conn(struct gsm_subscriber_connection *conn, struct msgb *msg)
-{
-	return 0;
-}
diff --git a/tests/abis/abis_test.c b/tests/abis/abis_test.c
index faf9ea5..93f5924 100644
--- a/tests/abis/abis_test.c
+++ b/tests/abis/abis_test.c
@@ -29,6 +29,8 @@
 #include <osmocom/bsc/abis_nm.h>
 #include <osmocom/bsc/debug.h>
 
+#include <osmocom/bsc/bsc_stubs.h>
+
 static const uint8_t load_config[] = {
 	0x42, 0x12, 0x00, 0x08, 0x31, 0x36, 0x38, 0x64,
 	0x34, 0x37, 0x32, 0x00, 0x13, 0x00, 0x0b, 0x76,
diff --git a/tests/bsc-nat/bsc_nat_test.c b/tests/bsc-nat/bsc_nat_test.c
index 7aa39ec..fcc01f2 100644
--- a/tests/bsc-nat/bsc_nat_test.c
+++ b/tests/bsc-nat/bsc_nat_test.c
@@ -29,6 +29,8 @@
 #include <osmocom/bsc/bsc_msg_filter.h>
 #include <osmocom/bsc/nat_rewrite_trie.h>
 
+#include <osmocom/bsc/bsc_stubs.h>
+
 #include <osmocom/core/application.h>
 #include <osmocom/core/backtrace.h>
 #include <osmocom/core/talloc.h>
diff --git a/tests/bsc/Makefile.am b/tests/bsc/Makefile.am
index a436c27..89e897c 100644
--- a/tests/bsc/Makefile.am
+++ b/tests/bsc/Makefile.am
@@ -9,7 +9,7 @@
 	$(LIBOSMOCORE_CFLAGS) \
 	$(LIBOSMOGSM_CFLAGS) \
 	$(LIBOSMOABIS_CFLAGS) \
-	$(LIBOSMOLEGACYMGCP_CFLAGS) \
+	$(LIBOSMOMGCPCLIENT_CFLAGS) \
 	$(LIBOSMOSIGTRAN_CFLAGS) \
 	$(COVERAGE_CFLAGS) \
 	$(NULL)
@@ -37,7 +37,8 @@
 	$(LIBOSMOGSM_LIBS) \
 	$(LIBOSMOVTY_LIBS) \
 	$(LIBOSMOABIS_LIBS) \
-	$(LIBOSMOLEGACYMGCP_LIBS) \
+	$(LIBOSMOMGCPCLIENT_LIBS) \
+	$(LIBOSMOSIGTRAN_LIBS) \
 	$(LIBRARY_GSM) \
 	-lrt \
 	$(NULL)
diff --git a/tests/bsc/bsc_test.c b/tests/bsc/bsc_test.c
index 106b08b..d7b8ccd 100644
--- a/tests/bsc/bsc_test.c
+++ b/tests/bsc/bsc_test.c
@@ -32,6 +32,8 @@
 #include <osmocom/bsc/gsm_04_80.h>
 #include <osmocom/bsc/common_bsc.h>
 
+#include <osmocom/bsc/bsc_stubs.h>
+
 #include <osmocom/core/application.h>
 #include <osmocom/core/backtrace.h>
 #include <osmocom/core/talloc.h>
@@ -239,7 +241,3 @@
 	talloc_free(ctx);
 	return 0;
 }
-
-struct gsm_subscriber_connection *bsc_subscr_con_allocate(struct gsm_network *net) {
-	OSMO_ASSERT(0);
-}
diff --git a/tests/channel/channel_test.c b/tests/channel/channel_test.c
index e8f6cd9..dcffa87 100644
--- a/tests/channel/channel_test.c
+++ b/tests/channel/channel_test.c
@@ -29,6 +29,8 @@
 #include <osmocom/bsc/abis_rsl.h>
 #include <osmocom/bsc/debug.h>
 
+#include <osmocom/bsc/bsc_stubs.h>
+
 void test_bts_debug_print(void)
 {
 	struct gsm_network *network;
diff --git a/tests/gsm0408/Makefile.am b/tests/gsm0408/Makefile.am
index 9a74d44..0c917ad 100644
--- a/tests/gsm0408/Makefile.am
+++ b/tests/gsm0408/Makefile.am
@@ -8,6 +8,8 @@
 	$(LIBOSMOCORE_CFLAGS) \
 	$(LIBOSMOGSM_CFLAGS) \
 	$(LIBOSMOABIS_CFLAGS) \
+	$(LIBOSMOMGCPCLIENT_CFLAGS) \
+	$(LIBOSMOSIGTRAN_CFLAGS) \
 	$(NULL)
 
 noinst_PROGRAMS = \
@@ -27,4 +29,6 @@
 	$(LIBOSMOCORE_LIBS) \
 	$(LIBOSMOGSM_LIBS) \
 	$(LIBOSMOABIS_LIBS) \
+	$(LIBOSMOMGCPCLIENT_LIBS) \
+	$(LIBOSMOSIGTRAN_LIBS) \
 	$(NULL)
diff --git a/tests/gsm0408/gsm0408_test.c b/tests/gsm0408/gsm0408_test.c
index a934806..da02117 100644
--- a/tests/gsm0408/gsm0408_test.c
+++ b/tests/gsm0408/gsm0408_test.c
@@ -31,6 +31,8 @@
 #include <osmocom/bsc/system_information.h>
 #include <osmocom/bsc/abis_rsl.h>
 
+#include <osmocom/bsc/bsc_stubs.h>
+
 #include <osmocom/core/application.h>
 #include <osmocom/core/byteswap.h>
 #include <osmocom/gsm/sysinfo.h>
@@ -844,7 +846,3 @@
 
 	return EXIT_SUCCESS;
 }
-
-struct gsm_subscriber_connection *bsc_subscr_con_allocate(struct gsm_network *net) {
-	OSMO_ASSERT(0);
-}
diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c
index 82afbe5..caa57c1 100644
--- a/tests/handover/handover_test.c
+++ b/tests/handover/handover_test.c
@@ -43,6 +43,8 @@
 #include <osmocom/bsc/osmo_bsc.h>
 #include <osmocom/bsc/bsc_subscr_conn_fsm.h>
 
+#include <osmocom/bsc/bsc_stubs.h>
+
 void *ctx;
 
 struct gsm_network *bsc_gsmnet;
@@ -1695,5 +1697,3 @@
 void trau_mux_map_lchan() {}
 void trau_recv_lchan() {}
 void trau_send_frame() {}
-int osmo_bsc_sigtran_send(struct gsm_subscriber_connection *conn, struct msgb *msg) { return 0; }
-int osmo_bsc_sigtran_open_conn(struct gsm_subscriber_connection *conn, struct msgb *msg) { return 0; }
diff --git a/tests/nanobts_omlattr/nanobts_omlattr_test.c b/tests/nanobts_omlattr/nanobts_omlattr_test.c
index 8e8626d..e15529f 100644
--- a/tests/nanobts_omlattr/nanobts_omlattr_test.c
+++ b/tests/nanobts_omlattr/nanobts_omlattr_test.c
@@ -23,6 +23,8 @@
 #include <osmocom/bsc/gsm_data.h>
 #include <osmocom/bsc/bts_ipaccess_nanobts_omlattr.h>
 
+#include <osmocom/bsc/bsc_stubs.h>
+
 #include <osmocom/core/talloc.h>
 #include <osmocom/core/utils.h>
 #include <osmocom/core/application.h>

-- 
To view, visit https://gerrit.osmocom.org/9279
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I000be689ed071aced1a085284f924a7e77e5656d
Gerrit-Change-Number: 9279
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180524/2306b519/attachment.htm>


More information about the gerrit-log mailing list