aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-05-27 01:26:31 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2018-06-07 19:09:06 +0200
commit958f259f9592e3729a2ebf4084d8f37bdba6bf3c (patch)
tree3ca9a7de640b28ef6f40578df4c036440f8a4cb1 /tests
parent8f2aaf47c910a984de370774e6910ea5d453983e (diff)
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to allow linking from utils/* and ipaccess/* without pulling in unccessary dependencies. Some utilities use gsm_network and gsm_bts structs, which already include data structures for fairly advanced uses. Move initialization that only osmo-bsc needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so that the leaner tools can use the old gsm_* versions without the need to link everything (e.g. handover and lchan alloc code). In some instances, there need to be stubs if to cut off linking "just before the RSL level" and prevent dependencies from creeping in. - abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is osmo-bsc, the utils are merely concerned with OML, if at all. - paging_flush_bts(): ip.access nanobts models call this when the RSL link is dropped. Only osmo-bsc actually needs to do anything there. - on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related to OML, while this action to take on init would pull in RSL dependencies. utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests implement stubs inline where required. From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/. In order for this to work, the osmo-bsc subdir must be built before the other source trees. (An alternative would be to include the .c files as sources, but that would re-compile them in every source tree. Not a large burden really, but unless linking .o files gives problems, let's have the quicker build.) Minor obvious cleanups creep in with this patch, I will not bother to name them individually now unless code review asks me to. Rationale: 1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc is distracting. 2) Recently, ridiculous linking requirements have made adding new functions cumbersome, because libbsc has started depending on osmo-bsc/*.c implementations: on gscon FSM and bssap functions. For example, neither bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP message composition. It makes no sense to link the entire osmo-bsc to it, nor do we want to keep adding stubs to each linking realm. Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
Diffstat (limited to 'tests')
-rw-r--r--tests/abis/Makefile.am4
-rw-r--r--tests/abis/abis_test.c2
-rw-r--r--tests/bsc/Makefile.am21
-rw-r--r--tests/bsc/bsc_test.c3
-rw-r--r--tests/gsm0408/Makefile.am6
-rw-r--r--tests/gsm0408/gsm0408_test.c8
-rw-r--r--tests/handover/Makefile.am30
-rw-r--r--tests/handover/handover_test.c8
-rw-r--r--tests/nanobts_omlattr/Makefile.am4
-rw-r--r--tests/nanobts_omlattr/nanobts_omlattr_test.c3
-rw-r--r--tests/subscr/Makefile.am2
11 files changed, 75 insertions, 16 deletions
diff --git a/tests/abis/Makefile.am b/tests/abis/Makefile.am
index 8dc829fc3..60054d94d 100644
--- a/tests/abis/Makefile.am
+++ b/tests/abis/Makefile.am
@@ -25,7 +25,9 @@ abis_test_SOURCES = \
$(NULL)
abis_test_LDADD = \
- $(top_builddir)/src/libbsc/libbsc.a \
+ $(top_builddir)/src/osmo-bsc/abis_nm.o \
+ $(top_builddir)/src/osmo-bsc/gsm_data.o \
+ $(top_builddir)/src/osmo-bsc/net_init.o \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOABIS_LIBS) \
$(LIBOSMOGSM_LIBS) \
diff --git a/tests/abis/abis_test.c b/tests/abis/abis_test.c
index faf9ea533..c6f29f577 100644
--- a/tests/abis/abis_test.c
+++ b/tests/abis/abis_test.c
@@ -186,3 +186,5 @@ int main(int argc, char **argv)
struct gsm_subscriber_connection *bsc_subscr_con_allocate(struct gsm_network *net) {
OSMO_ASSERT(0);
}
+
+bool on_gsm_ts_init(struct gsm_bts_trx_ts *ts) { return true; }
diff --git a/tests/bsc/Makefile.am b/tests/bsc/Makefile.am
index a436c27f0..a930629fa 100644
--- a/tests/bsc/Makefile.am
+++ b/tests/bsc/Makefile.am
@@ -28,11 +28,28 @@ noinst_PROGRAMS = \
bsc_test_SOURCES = \
bsc_test.c \
- $(top_srcdir)/src/osmo-bsc/osmo_bsc_filter.c \
$(NULL)
bsc_test_LDADD = \
- $(top_builddir)/src/libbsc/libbsc.a \
+ $(top_builddir)/src/osmo-bsc/abis_nm.o \
+ $(top_builddir)/src/osmo-bsc/abis_rsl.o \
+ $(top_builddir)/src/osmo-bsc/arfcn_range_encode.o \
+ $(top_builddir)/src/osmo-bsc/bsc_api.o \
+ $(top_builddir)/src/osmo-bsc/bsc_dyn_ts.o \
+ $(top_builddir)/src/osmo-bsc/osmo_bsc_filter.o \
+ $(top_builddir)/src/osmo-bsc/bsc_rll.o \
+ $(top_builddir)/src/osmo-bsc/bsc_subscriber.o \
+ $(top_builddir)/src/osmo-bsc/chan_alloc.o \
+ $(top_builddir)/src/osmo-bsc/gsm_04_08_utils.o \
+ $(top_builddir)/src/osmo-bsc/gsm_04_80_utils.o \
+ $(top_builddir)/src/osmo-bsc/gsm_data.o \
+ $(top_builddir)/src/osmo-bsc/handover_cfg.o \
+ $(top_builddir)/src/osmo-bsc/handover_logic.o \
+ $(top_builddir)/src/osmo-bsc/net_init.o \
+ $(top_builddir)/src/osmo-bsc/paging.o \
+ $(top_builddir)/src/osmo-bsc/pcu_sock.o \
+ $(top_builddir)/src/osmo-bsc/rest_octets.o \
+ $(top_builddir)/src/osmo-bsc/system_information.o \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOVTY_LIBS) \
diff --git a/tests/bsc/bsc_test.c b/tests/bsc/bsc_test.c
index 08d376016..3a9946790 100644
--- a/tests/bsc/bsc_test.c
+++ b/tests/bsc/bsc_test.c
@@ -30,7 +30,6 @@
#include <osmocom/bsc/osmo_bsc.h>
#include <osmocom/bsc/bsc_msc_data.h>
#include <osmocom/bsc/gsm_04_80.h>
-#include <osmocom/bsc/common_bsc.h>
#include <osmocom/core/application.h>
#include <osmocom/core/backtrace.h>
@@ -123,7 +122,7 @@ static void test_scan(void)
{
int i;
- struct gsm_network *net = bsc_network_init(ctx);
+ struct gsm_network *net = gsm_network_init(ctx);
struct gsm_bts *bts = gsm_bts_alloc(net, 0);
struct bsc_msc_data *msc;
struct gsm_subscriber_connection *conn;
diff --git a/tests/gsm0408/Makefile.am b/tests/gsm0408/Makefile.am
index 9a74d449a..6d10b9fd9 100644
--- a/tests/gsm0408/Makefile.am
+++ b/tests/gsm0408/Makefile.am
@@ -23,7 +23,11 @@ gsm0408_test_SOURCES = \
$(NULL)
gsm0408_test_LDADD = \
- $(top_builddir)/src/libbsc/libbsc.a \
+ $(top_builddir)/src/osmo-bsc/arfcn_range_encode.o \
+ $(top_builddir)/src/osmo-bsc/gsm_data.o \
+ $(top_builddir)/src/osmo-bsc/net_init.o \
+ $(top_builddir)/src/osmo-bsc/rest_octets.o \
+ $(top_builddir)/src/osmo-bsc/system_information.o \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOABIS_LIBS) \
diff --git a/tests/gsm0408/gsm0408_test.c b/tests/gsm0408/gsm0408_test.c
index a934806b5..9552fb11d 100644
--- a/tests/gsm0408/gsm0408_test.c
+++ b/tests/gsm0408/gsm0408_test.c
@@ -24,7 +24,6 @@
#include <stdbool.h>
#include <arpa/inet.h>
-#include <osmocom/bsc/common_bsc.h>
#include <osmocom/bsc/gsm_data.h>
#include <osmocom/bsc/debug.h>
#include <osmocom/bsc/arfcn_range_encode.h>
@@ -817,7 +816,7 @@ int main(int argc, char **argv)
osmo_init_logging2(tall_bsc_ctx, &log_info);
log_set_log_level(osmo_stderr_target, LOGL_INFO);
- net = bsc_network_init(tall_bsc_ctx);
+ net = gsm_network_init(tall_bsc_ctx);
if (!net) {
printf("Network init failure.\n");
return EXIT_FAILURE;
@@ -848,3 +847,8 @@ int main(int argc, char **argv)
struct gsm_subscriber_connection *bsc_subscr_con_allocate(struct gsm_network *net) {
OSMO_ASSERT(0);
}
+
+bool on_gsm_ts_init(struct gsm_bts_trx_ts *ts)
+{
+ return true;
+}
diff --git a/tests/handover/Makefile.am b/tests/handover/Makefile.am
index 957bbeeb9..07491d57f 100644
--- a/tests/handover/Makefile.am
+++ b/tests/handover/Makefile.am
@@ -34,7 +34,35 @@ handover_test_LDFLAGS =\
$(NULL)
handover_test_LDADD = \
- $(top_builddir)/src/libbsc/libbsc.a \
+ $(top_builddir)/src/osmo-bsc/a_reset.o \
+ $(top_builddir)/src/osmo-bsc/abis_nm.o \
+ $(top_builddir)/src/osmo-bsc/abis_rsl.o \
+ $(top_builddir)/src/osmo-bsc/arfcn_range_encode.o \
+ $(top_builddir)/src/osmo-bsc/bsc_api.o \
+ $(top_builddir)/src/osmo-bsc/bsc_dyn_ts.o \
+ $(top_builddir)/src/osmo-bsc/bsc_init.o \
+ $(top_builddir)/src/osmo-bsc/bsc_rll.o \
+ $(top_builddir)/src/osmo-bsc/bsc_subscr_conn_fsm.o \
+ $(top_builddir)/src/osmo-bsc/bsc_subscriber.o \
+ $(top_builddir)/src/osmo-bsc/bts_ipaccess_nanobts.o \
+ $(top_builddir)/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.o \
+ $(top_builddir)/src/osmo-bsc/bts_sysmobts.o \
+ $(top_builddir)/src/osmo-bsc/chan_alloc.o \
+ $(top_builddir)/src/osmo-bsc/gsm_04_08_utils.o \
+ $(top_builddir)/src/osmo-bsc/gsm_04_80_utils.o \
+ $(top_builddir)/src/osmo-bsc/gsm_data.o \
+ $(top_builddir)/src/osmo-bsc/handover_cfg.o \
+ $(top_builddir)/src/osmo-bsc/handover_decision.o \
+ $(top_builddir)/src/osmo-bsc/handover_decision_2.o \
+ $(top_builddir)/src/osmo-bsc/handover_logic.o \
+ $(top_builddir)/src/osmo-bsc/meas_rep.o \
+ $(top_builddir)/src/osmo-bsc/osmo_bsc_lcls.o \
+ $(top_builddir)/src/osmo-bsc/net_init.o \
+ $(top_builddir)/src/osmo-bsc/paging.o \
+ $(top_builddir)/src/osmo-bsc/pcu_sock.o \
+ $(top_builddir)/src/osmo-bsc/penalty_timers.o \
+ $(top_builddir)/src/osmo-bsc/rest_octets.o \
+ $(top_builddir)/src/osmo-bsc/system_information.o \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOABIS_LIBS) \
diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c
index 82afbe5ce..26074a2fd 100644
--- a/tests/handover/handover_test.c
+++ b/tests/handover/handover_test.c
@@ -37,7 +37,6 @@
#include <osmocom/bsc/system_information.h>
#include <osmocom/bsc/handover_cfg.h>
#include <osmocom/bsc/handover_decision_2.h>
-#include <osmocom/bsc/common_bsc.h>
#include <osmocom/bsc/bss.h>
#include <osmocom/bsc/bsc_api.h>
#include <osmocom/bsc/osmo_bsc.h>
@@ -202,7 +201,7 @@ static struct gsm_bts *create_bts(int arfcn)
struct e1inp_sign_link *rsl_link;
int i;
- bts = gsm_bts_alloc_register(bsc_gsmnet, GSM_BTS_TYPE_OSMOBTS, 0x3f);
+ bts = bsc_bts_alloc_register(bsc_gsmnet, GSM_BTS_TYPE_OSMOBTS, 0x3f);
if (!bts) {
printf("No resource for bts1\n");
return NULL;
@@ -1347,8 +1346,8 @@ int main(int argc, char **argv)
struct gsm_lchan *lchan[256];
int lchan_num = 0;
int i;
- int algorithm;
struct bsc_api bsc_api = {};
+ int algorithm;
int test_case_i;
int last_test_i;
@@ -1373,8 +1372,7 @@ int main(int argc, char **argv)
log_set_print_category_hex(osmo_stderr_target, 0);
log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_BASENAME);
- /* Create a dummy network */
- bsc_gsmnet = bsc_network_init(ctx);
+ bsc_network_alloc();
if (!bsc_gsmnet)
exit(1);
diff --git a/tests/nanobts_omlattr/Makefile.am b/tests/nanobts_omlattr/Makefile.am
index c2b2c3b7a..aa7045e49 100644
--- a/tests/nanobts_omlattr/Makefile.am
+++ b/tests/nanobts_omlattr/Makefile.am
@@ -23,7 +23,9 @@ nanobts_omlattr_test_SOURCES = \
$(NULL)
nanobts_omlattr_test_LDADD = \
- $(top_builddir)/src/libbsc/libbsc.a \
+ $(top_builddir)/src/osmo-bsc/abis_nm.o \
+ $(top_builddir)/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.o \
+ $(top_builddir)/src/osmo-bsc/gsm_data.o \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOABIS_LIBS) \
diff --git a/tests/nanobts_omlattr/nanobts_omlattr_test.c b/tests/nanobts_omlattr/nanobts_omlattr_test.c
index 8e8626d13..72dabe542 100644
--- a/tests/nanobts_omlattr/nanobts_omlattr_test.c
+++ b/tests/nanobts_omlattr/nanobts_omlattr_test.c
@@ -305,3 +305,6 @@ int bssgp_prim_cb(struct osmo_prim_hdr *oph, void *ctx)
struct gsm_subscriber_connection *bsc_subscr_con_allocate(struct gsm_network *net) {
OSMO_ASSERT(0);
}
+
+bool on_gsm_ts_init(struct gsm_bts_trx_ts *ts)
+{ return true; }
diff --git a/tests/subscr/Makefile.am b/tests/subscr/Makefile.am
index 8d14ebf9d..e56d142bc 100644
--- a/tests/subscr/Makefile.am
+++ b/tests/subscr/Makefile.am
@@ -31,7 +31,7 @@ bsc_subscr_test_SOURCES = \
$(NULL)
bsc_subscr_test_LDADD = \
- $(top_builddir)/src/libbsc/libbsc.a \
+ $(top_builddir)/src/osmo-bsc/bsc_subscriber.o \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOABIS_LIBS) \
$(LIBOSMOGSM_LIBS) \