diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2018-06-07 02:45:50 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2018-06-07 17:05:41 +0000 |
commit | 5cb01655c5103d3b916c119cada1a3a6a10956cc (patch) | |
tree | a2ab1fc9e55bd198642566efe81ef84b5a0fa25e /tests | |
parent | 39a1d10c11b17eec9b8a2708f1d3b91890dec650 (diff) |
tests: remove bssap_test
Rationale:
- All it does is compose four Paging Requests and feed it into the osmo-bsc
bssap_udt, and expects the cell identifier to be decoded properly.
- To do so it employs a comparatively huge linking effort. This linking effort
is becoming annoying in my ongoing work and is just not worth it.
- We have comprehensive cell identifier tests in ttcn3, verifying that the
proper cells are paged, and that actually for *all* cell identifier types.
Change-Id: I07cf23b66de36cfa1142a11b9f85e9c0190ee314
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 1 | ||||
-rw-r--r-- | tests/bssap/Makefile.am | 49 | ||||
-rw-r--r-- | tests/bssap/bssap_test.c | 162 | ||||
-rw-r--r-- | tests/bssap/bssap_test.err | 27 | ||||
-rw-r--r-- | tests/bssap/bssap_test.ok | 0 | ||||
-rw-r--r-- | tests/testsuite.at | 7 |
6 files changed, 0 insertions, 246 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 20368ee2f..7bbef9980 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -5,7 +5,6 @@ SUBDIRS = \ abis \ subscr \ nanobts_omlattr \ - bssap \ handover \ $(NULL) diff --git a/tests/bssap/Makefile.am b/tests/bssap/Makefile.am deleted file mode 100644 index 30a9246c8..000000000 --- a/tests/bssap/Makefile.am +++ /dev/null @@ -1,49 +0,0 @@ -AM_CPPFLAGS = \ - $(all_includes) \ - -I$(top_srcdir)/include \ - $(NULL) - -AM_CFLAGS = \ - -Wall \ - -ggdb3 \ - $(LIBOSMOCORE_CFLAGS) \ - $(LIBOSMOGSM_CFLAGS) \ - $(LIBOSMOABIS_CFLAGS) \ - $(LIBOSMOSIGTRAN_CFLAGS) \ - $(COVERAGE_CFLAGS) \ - $(LIBOSMOMGCPCLIENT_CFLAGS) \ - $(NULL) - -EXTRA_DIST = \ - bssap_test.ok \ - bssap_test.err \ - $(NULL) - -noinst_PROGRAMS = \ - bssap_test \ - $(NULL) - -bssap_test_SOURCES = \ - bssap_test.c \ - $(top_srcdir)/src/osmo-bsc/osmo_bsc_bssap.c \ - $(top_srcdir)/src/osmo-bsc/osmo_bsc_sigtran.c \ - $(top_srcdir)/src/osmo-bsc/osmo_bsc_filter.c \ - $(top_srcdir)/src/osmo-bsc/osmo_bsc_grace.c \ - $(NULL) - -bssap_test_LDADD = \ - $(top_builddir)/src/libbsc/libbsc.a \ - $(LIBOSMOCORE_LIBS) \ - $(LIBOSMOGSM_LIBS) \ - $(LIBOSMOABIS_LIBS) \ - $(LIBOSMOSIGTRAN_LIBS) \ - $(LIBOSMOMGCPCLIENT_LIBS) \ - $(NULL) - -bssap_test_LDFLAGS = \ - -Wl,--wrap=bsc_grace_paging_request \ - $(NULL) - -.PHONY: update_exp -update_exp: - $(builddir)/bssap_test >$(srcdir)/bssap_test.ok 2>$(srcdir)/bssap_test.err diff --git a/tests/bssap/bssap_test.c b/tests/bssap/bssap_test.c deleted file mode 100644 index c9e7075e2..000000000 --- a/tests/bssap/bssap_test.c +++ /dev/null @@ -1,162 +0,0 @@ -/* - * (C) 2017 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de> - * All Rights Reserved - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -#include <osmocom/core/application.h> - -#include <osmocom/bsc/debug.h> -#include <osmocom/bsc/osmo_bsc.h> -#include <osmocom/bsc/signal.h> -#include <osmocom/bsc/bsc_subscriber.h> -#include <osmocom/bsc/bsc_msc_data.h> -#include <osmocom/bsc/common_bsc.h> -#include <osmocom/bsc/osmo_bsc_rf.h> - -struct msgb *msgb_from_hex(const char *label, uint16_t size, const char *hex) -{ - struct msgb *msg = msgb_alloc(size, label); - unsigned char *rc; - msg->l2h = msg->l3h = msg->head; - rc = msgb_put(msg, osmo_hexparse(hex, msg->head, msgb_tailroom(msg))); - OSMO_ASSERT(rc == msg->l2h); - return msg; -} - -uint16_t gl_expect_lac = 0; - -/* override, requires '-Wl,--wrap=bsc_grace_paging_request' */ -int __real_bsc_grace_paging_request(enum signal_rf rf_policy, struct bsc_subscr *subscr, int chan_needed, - struct bsc_msc_data *msc, struct gsm_bts *bts); -int __wrap_bsc_grace_paging_request(enum signal_rf rf_policy, struct bsc_subscr *subscr, int chan_needed, - struct bsc_msc_data *msc, struct gsm_bts *bts) -{ - if (subscr->lac == GSM_LAC_RESERVED_ALL_BTS) - fprintf(stderr, "BSC paging started on entire BSS (%u)\n", subscr->lac); - else - fprintf(stderr, "BSC paging started with LAC %u\n", subscr->lac); - OSMO_ASSERT(gl_expect_lac == subscr->lac); - return 1; /* pretend one BTS was paged */ -} - -struct { - const char *msg; - uint16_t expect_lac; - int expect_rc; -} cell_identifier_tests[] = { - { - "001652080859512069000743940904010844601a03050065", - /* ^^^^^^ Cell Identifier List: LAC */ - 0x65, 0 - }, - { - "001452080859512069000743940904010844601a0106", - /* ^^ Cell Identifier List: BSS */ - GSM_LAC_RESERVED_ALL_BTS, 0 - }, - { - "001952080859512069000743940904010844601a060415f5490065", - /* ^^^^^^^^^^^^ Cell Identifier List: LAI */ - GSM_LAC_RESERVED_ALL_BTS, 0 - }, - { - "001952080859512069000743940904010844601a060400f1100065", - /* ^^^^^^^^^^^^ Cell Identifier List: LAI */ - 0x65, 0 - }, -}; - -struct gsm_network *bsc_gsmnet; - -void test_cell_identifier() -{ - int i; - int rc; - struct bsc_msc_data *msc; - struct gsm_bts *bts; - - bsc_gsmnet = bsc_network_init(NULL); - bsc_gsmnet->bsc_data->rf_ctrl = talloc_zero(NULL, struct osmo_bsc_rf); - bsc_gsmnet->bsc_data->rf_ctrl->policy = S_RF_ON; - - msc = talloc_zero(bsc_gsmnet, struct bsc_msc_data); - msc->network = bsc_gsmnet; - - bts = gsm_bts_alloc_register(bsc_gsmnet, GSM_BTS_TYPE_UNKNOWN, 0); - if (bts == NULL) { - fprintf(stderr, "gsm_bts_alloc_register() returned NULL\n"); - return; - } - - log_set_log_level(osmo_stderr_target, LOGL_DEBUG); - - for (i = 0; i < ARRAY_SIZE(cell_identifier_tests); i++) { - struct msgb *msg; - fprintf(stderr, "\n%d:\n", i); - msg = msgb_from_hex("test_cell_identifier", 1024, cell_identifier_tests[i].msg); - - gl_expect_lac = cell_identifier_tests[i].expect_lac; - bts->location_area_code = (gl_expect_lac == GSM_LAC_RESERVED_ALL_BTS ? 0 : gl_expect_lac); - rc = bsc_handle_udt(msc, msg, msgb_l2len(msg)); - - fprintf(stderr, "bsc_handle_udt() returned %d\n", rc); - OSMO_ASSERT(rc == cell_identifier_tests[i].expect_rc); - - msgb_free(msg); - } -} - -static const struct log_info_cat log_categories[] = { - [DMSC] = { - .name = "DMSC", - .description = "Mobile Switching Center", - .enabled = 1, .loglevel = LOGL_NOTICE, - }, - [DREF] = { - .name = "DREF", - .description = "Reference Counting", - .enabled = 0, .loglevel = LOGL_DEBUG, - }, -}; - -static const struct log_info log_info = { - .cat = log_categories, - .num_cat = ARRAY_SIZE(log_categories), -}; - -int main(int argc, char **argv) -{ - void *tall_ctx = talloc_named_const(NULL, 1, "bssap_test"); - msgb_talloc_ctx_init(tall_ctx, 0); - osmo_init_logging2(tall_ctx, &log_info); - log_set_use_color(osmo_stderr_target, 0); - log_set_print_timestamp(osmo_stderr_target, 0); - log_set_print_filename(osmo_stderr_target, 0); - log_set_print_category(osmo_stderr_target, 1); - - test_cell_identifier(); - - return 0; -} - -struct gsm_subscriber_connection *bsc_subscr_con_allocate(struct gsm_network *net) { - OSMO_ASSERT(0); -} - -int bsc_sccplite_rx_ctrl(struct osmo_ss7_asp *asp, struct msgb *msg) { - OSMO_ASSERT(0); -} diff --git a/tests/bssap/bssap_test.err b/tests/bssap/bssap_test.err deleted file mode 100644 index 8ae3b2286..000000000 --- a/tests/bssap/bssap_test.err +++ /dev/null @@ -1,27 +0,0 @@ - -0: -DMSC Rx MSC UDT: 00 16 52 08 08 59 51 20 69 00 07 43 94 09 04 01 08 44 60 1a 03 05 00 65 -DMSC Rx MSC UDT BSSMAP PAGING -DMSC Paging request from MSC BTS: 0 IMSI: '515029600703449' TMSI: '0x1084460/17319008' LAC: 0x65 -BSC paging started with LAC 101 -bsc_handle_udt() returned 0 - -1: -DMSC Rx MSC UDT: 00 14 52 08 08 59 51 20 69 00 07 43 94 09 04 01 08 44 60 1a 01 06 -DMSC Rx MSC UDT BSSMAP PAGING -DMSC Paging request from MSC BTS: 0 IMSI: '515029600703449' TMSI: '0x1084460/17319008' LAC: 0xfffe -BSC paging started on entire BSS (65534) -bsc_handle_udt() returned 0 - -2: -DMSC Rx MSC UDT: 00 19 52 08 08 59 51 20 69 00 07 43 94 09 04 01 08 44 60 1a 06 04 15 f5 49 00 65 -DMSC Rx MSC UDT BSSMAP PAGING -DMSC Paging IMSI 515029600703449: MCC-MNC in Cell Identifier List (515-94) do not match our network (001-01) -bsc_handle_udt() returned 0 - -3: -DMSC Rx MSC UDT: 00 19 52 08 08 59 51 20 69 00 07 43 94 09 04 01 08 44 60 1a 06 04 00 f1 10 00 65 -DMSC Rx MSC UDT BSSMAP PAGING -DMSC Paging request from MSC BTS: 0 IMSI: '515029600703449' TMSI: '0x1084460/17319008' LAC: 0x65 -BSC paging started with LAC 101 -bsc_handle_udt() returned 0 diff --git a/tests/bssap/bssap_test.ok b/tests/bssap/bssap_test.ok deleted file mode 100644 index e69de29bb..000000000 --- a/tests/bssap/bssap_test.ok +++ /dev/null diff --git a/tests/testsuite.at b/tests/testsuite.at index 07bd85f8a..974af895d 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -38,13 +38,6 @@ cat $abs_srcdir/nanobts_omlattr/nanobts_omlattr_test.ok > expout AT_CHECK([$abs_top_builddir/tests/nanobts_omlattr/nanobts_omlattr_test], [], [expout], [ignore]) AT_CLEANUP -AT_SETUP([bssap]) -AT_KEYWORDS([bssap]) -cat $abs_srcdir/bssap/bssap_test.ok > expout -cat $abs_srcdir/bssap/bssap_test.err > experr -AT_CHECK([$abs_top_builddir/tests/bssap/bssap_test], [], [expout], [experr]) -AT_CLEANUP - AT_SETUP([handover test 0]) AT_KEYWORDS([handover]) cat $abs_srcdir/handover/handover_test.ok > expout |