aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-03-17 12:22:40 +0100
committerHarald Welte <laforge@gnumonks.org>2018-03-17 13:40:03 +0100
commitd8cd756da48bcff9f9caf9e64fc0af047a165b60 (patch)
tree136d09901ae8420803500d92646944376ae21f59 /tests
parent7c4a22dbc48f51eb199766bf1b29e061bf765cbd (diff)
Get rid of 'struct gsm_bts_role_bts'
gsm_bts_role_bts was introduced at a time when we still shared gsm_data_shared.[ch] between BSC and BTS, and where we then subsequently needed a BTS-private structure. Since that sharing was abandoned quite some time ago, we can merge gsm_bts_role_bts into gsm_bts and do away with the bts/btsb dualism in a lot of the code. Change-Id: I4fdd601ea873d9697f89a748cc77bcf7c978fa3e
Diffstat (limited to 'tests')
-rw-r--r--tests/agch/agch_test.c26
-rw-r--r--tests/cipher/cipher_test.c32
-rw-r--r--tests/handover/handover_test.c5
-rw-r--r--tests/paging/paging_test.c24
-rw-r--r--tests/power/power_test.c5
-rw-r--r--tests/sysmobts/sysmobts_test.c11
6 files changed, 44 insertions, 59 deletions
diff --git a/tests/agch/agch_test.c b/tests/agch/agch_test.c
index 89f113ab..6efbc248 100644
--- a/tests/agch/agch_test.c
+++ b/tests/agch/agch_test.c
@@ -29,7 +29,6 @@
#include <unistd.h>
static struct gsm_bts *bts;
-static struct gsm_bts_role_bts *btsb;
static int count_imm_ass_rej_refs(struct gsm48_imm_ass_rej *rej)
{
@@ -116,11 +115,11 @@ static void test_agch_queue(void)
g_time.t3 = 6;
printf("Testing AGCH messages queue handling.\n");
- btsb->agch_queue.max_length = 32;
+ bts->agch_queue.max_length = 32;
- btsb->agch_queue.low_level = 30;
- btsb->agch_queue.high_level = 30;
- btsb->agch_queue.thresh_level = 60;
+ bts->agch_queue.low_level = 30;
+ bts->agch_queue.high_level = 30;
+ bts->agch_queue.thresh_level = 60;
for (round = 1; round <= num_rounds; round++) {
for (idx = 0; idx < num_ima_per_round; idx++) {
@@ -143,10 +142,10 @@ static void test_agch_queue(void)
"dropped %"PRIu64", merged %"PRIu64", rejected %"PRIu64", "
"ag-res %"PRIu64", non-res %"PRIu64"\n",
count, imm_ass_count, imm_ass_rej_count, imm_ass_rej_ref_count,
- btsb->agch_queue.max_length, btsb->agch_queue.length,
- btsb->agch_queue.dropped_msgs, btsb->agch_queue.merged_msgs,
- btsb->agch_queue.rejected_msgs, btsb->agch_queue.agch_msgs,
- btsb->agch_queue.pch_msgs);
+ bts->agch_queue.max_length, bts->agch_queue.length,
+ bts->agch_queue.dropped_msgs, bts->agch_queue.merged_msgs,
+ bts->agch_queue.rejected_msgs, bts->agch_queue.agch_msgs,
+ bts->agch_queue.pch_msgs);
imm_ass_count = 0;
imm_ass_rej_count = 0;
@@ -182,10 +181,10 @@ static void test_agch_queue(void)
"dropped %"PRIu64", merged %"PRIu64", rejected %"PRIu64", "
"ag-res %"PRIu64", non-res %"PRIu64"\n",
multiframes, imm_ass_count, imm_ass_rej_count, imm_ass_rej_ref_count,
- btsb->agch_queue.max_length, btsb->agch_queue.length,
- btsb->agch_queue.dropped_msgs, btsb->agch_queue.merged_msgs,
- btsb->agch_queue.rejected_msgs, btsb->agch_queue.agch_msgs,
- btsb->agch_queue.pch_msgs);
+ bts->agch_queue.max_length, bts->agch_queue.length,
+ bts->agch_queue.dropped_msgs, bts->agch_queue.merged_msgs,
+ bts->agch_queue.rejected_msgs, bts->agch_queue.agch_msgs,
+ bts->agch_queue.pch_msgs);
}
static void test_agch_queue_length_computation(void)
@@ -231,7 +230,6 @@ int main(int argc, char **argv)
exit(1);
}
- btsb = bts_role_bts(bts);
test_agch_queue_length_computation();
test_agch_queue();
printf("Success\n");
diff --git a/tests/cipher/cipher_test.c b/tests/cipher/cipher_test.c
index 07d9fdee..5e2bdc02 100644
--- a/tests/cipher/cipher_test.c
+++ b/tests/cipher/cipher_test.c
@@ -28,7 +28,6 @@
#include <unistd.h>
static struct gsm_bts *bts;
-static struct gsm_bts_role_bts *btsb;
#define ASSERT_TRUE(rc) \
if (!(rc)) { \
@@ -41,27 +40,27 @@ static void test_cipher_parsing(void)
{
int i;
- btsb->support.ciphers = 0;
+ bts->support.ciphers = 0;
/* always support A5/0 */
- ASSERT_TRUE(bts_supports_cipher(btsb, 0x0) == -ENOTSUP);
- ASSERT_TRUE(bts_supports_cipher(btsb, 0x1) == 1); /* A5/0 */
+ ASSERT_TRUE(bts_supports_cipher(bts, 0x0) == -ENOTSUP);
+ ASSERT_TRUE(bts_supports_cipher(bts, 0x1) == 1); /* A5/0 */
for (i = 2; i <= 8; ++i) {
- ASSERT_TRUE(bts_supports_cipher(btsb, i) == 0);
+ ASSERT_TRUE(bts_supports_cipher(bts, i) == 0);
}
/* checking default A5/1 to A5/3 support */
- btsb->support.ciphers = CIPHER_A5(1) | CIPHER_A5(2) | CIPHER_A5(3);
- ASSERT_TRUE(bts_supports_cipher(btsb, 0x0) == -ENOTSUP);
- ASSERT_TRUE(bts_supports_cipher(btsb, 0x1) == 1); /* A5/0 */
- ASSERT_TRUE(bts_supports_cipher(btsb, 0x2) == 1); /* A5/1 */
- ASSERT_TRUE(bts_supports_cipher(btsb, 0x3) == 1); /* A5/2 */
- ASSERT_TRUE(bts_supports_cipher(btsb, 0x4) == 1); /* A5/3 */
- ASSERT_TRUE(bts_supports_cipher(btsb, 0x5) == 0); /* A5/4 */
- ASSERT_TRUE(bts_supports_cipher(btsb, 0x6) == 0); /* A5/5 */
- ASSERT_TRUE(bts_supports_cipher(btsb, 0x7) == 0); /* A5/6 */
- ASSERT_TRUE(bts_supports_cipher(btsb, 0x8) == 0); /* A5/7 */
- ASSERT_TRUE(bts_supports_cipher(btsb, 0x9) == -ENOTSUP);
+ bts->support.ciphers = CIPHER_A5(1) | CIPHER_A5(2) | CIPHER_A5(3);
+ ASSERT_TRUE(bts_supports_cipher(bts, 0x0) == -ENOTSUP);
+ ASSERT_TRUE(bts_supports_cipher(bts, 0x1) == 1); /* A5/0 */
+ ASSERT_TRUE(bts_supports_cipher(bts, 0x2) == 1); /* A5/1 */
+ ASSERT_TRUE(bts_supports_cipher(bts, 0x3) == 1); /* A5/2 */
+ ASSERT_TRUE(bts_supports_cipher(bts, 0x4) == 1); /* A5/3 */
+ ASSERT_TRUE(bts_supports_cipher(bts, 0x5) == 0); /* A5/4 */
+ ASSERT_TRUE(bts_supports_cipher(bts, 0x6) == 0); /* A5/5 */
+ ASSERT_TRUE(bts_supports_cipher(bts, 0x7) == 0); /* A5/6 */
+ ASSERT_TRUE(bts_supports_cipher(bts, 0x8) == 0); /* A5/7 */
+ ASSERT_TRUE(bts_supports_cipher(bts, 0x9) == -ENOTSUP);
}
int main(int argc, char **argv)
@@ -77,7 +76,6 @@ int main(int argc, char **argv)
exit(1);
}
- btsb = bts_role_bts(bts);
test_cipher_parsing();
printf("Success\n");
diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c
index adc4d65b..1c0a4da7 100644
--- a/tests/handover/handover_test.c
+++ b/tests/handover/handover_test.c
@@ -56,7 +56,6 @@ static void expect_phys_info(struct lapdm_entity *le)
int main(int argc, char **argv)
{
- struct gsm_bts_role_bts *btsb;
void *tall_bts_ctx;
struct e1inp_line *line;
struct gsm_lchan *lchan;
@@ -87,8 +86,6 @@ int main(int argc, char **argv)
exit(1);
}
- btsb = bts_role_bts(bts);
-
libosmo_abis_init(NULL);
line = e1inp_line_create(0, "ipa");
@@ -170,7 +167,7 @@ int main(int argc, char **argv)
OSMO_ASSERT(rslh->c.msg_type == RSL_MT_HANDO_DET);
OSMO_ASSERT(!msgb_dequeue(&trx->rsl_link->tx_list));
- for (i = 0; i < btsb->ny1 - 1; i++) {
+ for (i = 0; i < bts->ny1 - 1; i++) {
/* expect T3105 running */
OSMO_ASSERT(osmo_timer_pending(&trx->ts[2].lchan[0].ho.t3105))
diff --git a/tests/paging/paging_test.c b/tests/paging/paging_test.c
index 2573b3fb..f4f0934e 100644
--- a/tests/paging/paging_test.c
+++ b/tests/paging/paging_test.c
@@ -28,7 +28,6 @@
#include <unistd.h>
static struct gsm_bts *bts;
-static struct gsm_bts_role_bts *btsb;
static const uint8_t static_ilv[] = {
0x08, 0x59, 0x51, 0x30, 0x99, 0x00, 0x00, 0x00, 0x19
@@ -50,28 +49,28 @@ static void test_paging_smoke(void)
printf("Testing that paging messages expire.\n");
/* add paging entry */
- rc = paging_add_identity(btsb->paging_state, 0, static_ilv, 0);
+ rc = paging_add_identity(bts->paging_state, 0, static_ilv, 0);
ASSERT_TRUE(rc == 0);
- ASSERT_TRUE(paging_queue_length(btsb->paging_state) == 1);
+ ASSERT_TRUE(paging_queue_length(bts->paging_state) == 1);
/* generate messages */
g_time.fn = 0;
g_time.t1 = 0;
g_time.t2 = 0;
g_time.t3 = 6;
- rc = paging_gen_msg(btsb->paging_state, out_buf, &g_time, &is_empty);
+ rc = paging_gen_msg(bts->paging_state, out_buf, &g_time, &is_empty);
ASSERT_TRUE(rc == 13);
ASSERT_TRUE(is_empty == 0);
- ASSERT_TRUE(paging_group_queue_empty(btsb->paging_state, 0));
- ASSERT_TRUE(paging_queue_length(btsb->paging_state) == 0);
+ ASSERT_TRUE(paging_group_queue_empty(bts->paging_state, 0));
+ ASSERT_TRUE(paging_queue_length(bts->paging_state) == 0);
/* now test the empty queue */
g_time.fn = 0;
g_time.t1 = 0;
g_time.t2 = 0;
g_time.t3 = 6;
- rc = paging_gen_msg(btsb->paging_state, out_buf, &g_time, &is_empty);
+ rc = paging_gen_msg(bts->paging_state, out_buf, &g_time, &is_empty);
ASSERT_TRUE(rc == 6);
ASSERT_TRUE(is_empty == 1);
@@ -90,9 +89,9 @@ static void test_paging_sleep(void)
printf("Testing that paging messages expire with sleep.\n");
/* add paging entry */
- rc = paging_add_identity(btsb->paging_state, 0, static_ilv, 0);
+ rc = paging_add_identity(bts->paging_state, 0, static_ilv, 0);
ASSERT_TRUE(rc == 0);
- ASSERT_TRUE(paging_queue_length(btsb->paging_state) == 1);
+ ASSERT_TRUE(paging_queue_length(bts->paging_state) == 1);
/* sleep */
sleep(1);
@@ -102,12 +101,12 @@ static void test_paging_sleep(void)
g_time.t1 = 0;
g_time.t2 = 0;
g_time.t3 = 6;
- rc = paging_gen_msg(btsb->paging_state, out_buf, &g_time, &is_empty);
+ rc = paging_gen_msg(bts->paging_state, out_buf, &g_time, &is_empty);
ASSERT_TRUE(rc == 13);
ASSERT_TRUE(is_empty == 0);
- ASSERT_TRUE(paging_group_queue_empty(btsb->paging_state, 0));
- ASSERT_TRUE(paging_queue_length(btsb->paging_state) == 0);
+ ASSERT_TRUE(paging_group_queue_empty(bts->paging_state, 0));
+ ASSERT_TRUE(paging_queue_length(bts->paging_state) == 0);
}
int main(int argc, char **argv)
@@ -123,7 +122,6 @@ int main(int argc, char **argv)
exit(1);
}
- btsb = bts_role_bts(bts);
test_paging_smoke();
test_paging_sleep();
printf("Success\n");
diff --git a/tests/power/power_test.c b/tests/power/power_test.c
index 295f6380..a46a430c 100644
--- a/tests/power/power_test.c
+++ b/tests/power/power_test.c
@@ -35,13 +35,11 @@ static inline void apply_power_test(struct gsm_lchan *lchan, int rxlev, int exp_
static void test_power_loop(void)
{
struct gsm_bts bts;
- struct gsm_bts_role_bts btsb;
struct gsm_bts_trx trx;
struct gsm_bts_trx_ts ts;
struct gsm_lchan *lchan;
memset(&bts, 0, sizeof(bts));
- memset(&btsb, 0, sizeof(btsb));
memset(&trx, 0, sizeof(trx));
memset(&ts, 0, sizeof(ts));
@@ -49,10 +47,9 @@ static void test_power_loop(void)
lchan->ts = &ts;
ts.trx = &trx;
trx.bts = &bts;
- bts.role = &btsb;
bts.band = GSM_BAND_1800;
trx.ms_power_control = 1;
- btsb.ul_power_target = -75;
+ bts.ul_power_target = -75;
lchan->state = LCHAN_S_NONE;
lchan->ms_power_ctrl.current = ms_pwr_ctl_lvl(GSM_BAND_1800, 0);
diff --git a/tests/sysmobts/sysmobts_test.c b/tests/sysmobts/sysmobts_test.c
index 32d6e958..02490bef 100644
--- a/tests/sysmobts/sysmobts_test.c
+++ b/tests/sysmobts/sysmobts_test.c
@@ -51,16 +51,13 @@ static int pcs_to_pcs[][3] = {
static void test_sysmobts_auto_band(void)
{
struct gsm_bts bts;
- struct gsm_bts_role_bts btsb;
struct gsm_bts_trx trx;
struct femtol1_hdl hdl;
int i;
memset(&bts, 0, sizeof(bts));
- memset(&btsb, 0, sizeof(btsb));
memset(&trx, 0, sizeof(trx));
memset(&hdl, 0, sizeof(hdl));
- bts.role = &btsb;
trx.bts = &bts;
trx.role_bts.l1h = &hdl;
@@ -74,7 +71,7 @@ static void test_sysmobts_auto_band(void)
uint16_t arfcn;
int res;
- btsb.auto_band = 0;
+ bts.auto_band = 0;
bts.band = direct_map[i][0];
arfcn = direct_map[i][2];
res = sysmobts_select_femto_band(&trx, arfcn);
@@ -89,7 +86,7 @@ static void test_sysmobts_auto_band(void)
uint16_t arfcn;
int res;
- btsb.auto_band = 1;
+ bts.auto_band = 1;
bts.band = direct_map[i][0];
arfcn = direct_map[i][2];
res = sysmobts_select_femto_band(&trx, arfcn);
@@ -104,7 +101,7 @@ static void test_sysmobts_auto_band(void)
uint16_t arfcn;
int res;
- btsb.auto_band = 1;
+ bts.auto_band = 1;
bts.band = dcs_to_dcs[i][0];
arfcn = dcs_to_dcs[i][2];
res = sysmobts_select_femto_band(&trx, arfcn);
@@ -119,7 +116,7 @@ static void test_sysmobts_auto_band(void)
uint16_t arfcn;
int res;
- btsb.auto_band = 1;
+ bts.auto_band = 1;
bts.band = pcs_to_pcs[i][0];
arfcn = pcs_to_pcs[i][2];
res = sysmobts_select_femto_band(&trx, arfcn);