Move IMSI into test parameters

This makes test routines more flexible and allows to easier re-use them
for tests with different IMSIs.

Change-Id: I74d46fdb7e87dc04c6b82a0b6f3ce6bef60bde58
Related: OS#2864
This commit is contained in:
Max 2018-02-07 12:06:03 +01:00
parent d83b17b3c7
commit 093300d141
8 changed files with 32 additions and 52 deletions

View File

@ -23,10 +23,9 @@
#include "msc_vlr_tests.h"
void test_gsm_authen()
void test_gsm_authen(const char *imsi)
{
struct vlr_subscr *vsub;
const char *imsi = "901700000004620";
comment_start();
@ -213,10 +212,9 @@ void test_gsm_authen()
comment_end();
}
void test_gsm_authen_tmsi()
void test_gsm_authen_tmsi(const char *imsi)
{
struct vlr_subscr *vsub;
const char *imsi = "901700000004620";
comment_start();
@ -490,10 +488,9 @@ void test_gsm_authen_tmsi()
comment_end();
}
void test_gsm_authen_imei()
void test_gsm_authen_imei(const char *imsi)
{
struct vlr_subscr *vsub;
const char *imsi = "901700000004620";
comment_start();
@ -586,10 +583,9 @@ void test_gsm_authen_imei()
comment_end();
}
void test_gsm_authen_tmsi_imei()
void test_gsm_authen_tmsi_imei(const char *imsi)
{
struct vlr_subscr *vsub;
const char *imsi = "901700000004620";
comment_start();

View File

@ -23,10 +23,9 @@
#include "msc_vlr_tests.h"
void test_ciph()
void test_ciph(const char *imsi)
{
struct vlr_subscr *vsub;
const char *imsi = "901700000004620";
comment_start();
@ -235,10 +234,9 @@ void test_ciph()
comment_end();
}
void test_ciph_tmsi()
void test_ciph_tmsi(const char *imsi)
{
struct vlr_subscr *vsub;
const char *imsi = "901700000004620";
comment_start();
@ -474,10 +472,9 @@ void test_ciph_tmsi()
comment_end();
}
void test_ciph_imei()
void test_ciph_imei(const char *imsi)
{
struct vlr_subscr *vsub;
const char *imsi = "901700000004620";
comment_start();
@ -576,10 +573,9 @@ void test_ciph_imei()
comment_end();
}
void test_ciph_imeisv()
void test_ciph_imeisv(const char *imsi)
{
struct vlr_subscr *vsub;
const char *imsi = "901700000004620";
comment_start();
@ -674,10 +670,9 @@ void test_ciph_imeisv()
comment_end();
}
void test_ciph_tmsi_imei()
void test_ciph_tmsi_imei(const char *imsi)
{
struct vlr_subscr *vsub;
const char *imsi = "901700000004620";
comment_start();

View File

@ -75,10 +75,9 @@ void test_hlr_rej_auth_info_net_fail()
comment_end();
}
void test_hlr_rej_auth_info_net_fail_no_reuse_tuples()
void test_hlr_rej_auth_info_net_fail_no_reuse_tuples(const char *imsi)
{
struct vlr_subscr *vsub;
const char *imsi = "901700000004620";
comment_start();
@ -162,10 +161,9 @@ void test_hlr_rej_auth_info_net_fail_no_reuse_tuples()
comment_end();
}
void test_hlr_rej_auth_info_unkown_imsi_no_reuse_tuples()
void test_hlr_rej_auth_info_unkown_imsi_no_reuse_tuples(const char *imsi)
{
struct vlr_subscr *vsub;
const char *imsi = "901700000004620";
comment_start();
@ -282,10 +280,9 @@ void test_hlr_acc_but_no_auth_tuples()
comment_end();
}
void test_hlr_rej_auth_info_net_fail_reuse_tuples()
void test_hlr_rej_auth_info_net_fail_reuse_tuples(const char *imsi)
{
struct vlr_subscr *vsub;
const char *imsi = "901700000004620";
comment_start();

View File

@ -182,10 +182,9 @@ void test_ms_timeout_cm_auth_resp()
comment_end();
}
void test_ms_timeout_paging()
void test_ms_timeout_paging(const char *imsi)
{
struct vlr_subscr *vsub;
const char *imsi = "901700000004620";
rx_from_ran = RAN_GERAN_A;

View File

@ -23,10 +23,9 @@
#include "msc_vlr_tests.h"
void test_no_authen()
void test_no_authen(const char *imsi)
{
struct vlr_subscr *vsub;
const char *imsi = "901700000004620";
/* No auth only works on GERAN */
rx_from_ran = RAN_GERAN_A;
@ -162,10 +161,9 @@ void test_no_authen()
comment_end();
}
void test_no_authen_tmsi()
void test_no_authen_tmsi(const char *imsi)
{
struct vlr_subscr *vsub;
const char *imsi = "901700000004620";
rx_from_ran = RAN_GERAN_A;
@ -382,10 +380,9 @@ void test_no_authen_tmsi()
comment_end();
}
void test_no_authen_imei()
void test_no_authen_imei(const char *imsi)
{
struct vlr_subscr *vsub;
const char *imsi = "901700000004620";
rx_from_ran = RAN_GERAN_A;
@ -450,10 +447,9 @@ void test_no_authen_imei()
comment_end();
}
void test_no_authen_tmsi_imei()
void test_no_authen_tmsi_imei(const char *imsi)
{
struct vlr_subscr *vsub;
const char *imsi = "901700000004620";
rx_from_ran = RAN_GERAN_A;
@ -527,10 +523,9 @@ void test_no_authen_tmsi_imei()
comment_end();
}
void test_no_authen_imeisv()
void test_no_authen_imeisv(const char *imsi)
{
struct vlr_subscr *vsub;
const char *imsi = "901700000004620";
/* No auth only works on GERAN */
rx_from_ran = RAN_GERAN_A;
@ -588,10 +583,9 @@ void test_no_authen_imeisv()
comment_end();
}
void test_no_authen_imeisv_imei()
void test_no_authen_imeisv_imei(const char *imsi)
{
struct vlr_subscr *vsub;
const char *imsi = "901700000004620";
rx_from_ran = RAN_GERAN_A;
@ -666,10 +660,9 @@ void test_no_authen_imeisv_imei()
comment_end();
}
void test_no_authen_imeisv_tmsi()
void test_no_authen_imeisv_tmsi(const char *imsi)
{
struct vlr_subscr *vsub;
const char *imsi = "901700000004620";
rx_from_ran = RAN_GERAN_A;
@ -804,10 +797,9 @@ void test_no_authen_imeisv_tmsi()
comment_end();
}
void test_no_authen_imeisv_tmsi_imei()
void test_no_authen_imeisv_tmsi_imei(const char *imsi)
{
struct vlr_subscr *vsub;
const char *imsi = "901700000004620";
rx_from_ran = RAN_GERAN_A;

View File

@ -115,9 +115,8 @@ void _normal_cm_service_req()
EXPECT_ACCEPTED(true);
}
void _page()
void _page(const char *imsi)
{
const char *imsi = "901700000004620";
struct vlr_subscr *vsub;
BTW("an SMS is sent, MS is paged");
@ -318,12 +317,12 @@ void test_reject_paging_resp_during_cm()
comment_end();
}
void test_reject_paging_resp_during_paging_resp()
void test_reject_paging_resp_during_paging_resp(const char *imsi)
{
comment_start();
_normal_lu();
_page();
_page(imsi);
_paging_resp_part1();
BTW("MS sends another erratic Paging Response which is dropped silently");
@ -335,12 +334,12 @@ void test_reject_paging_resp_during_paging_resp()
comment_end();
}
void test_reject_lu_during_paging_resp()
void test_reject_lu_during_paging_resp(const char *imsi)
{
comment_start();
_normal_lu();
_page();
_page(imsi);
_paging_resp_part1();
BTW("MS sends erratic LU Request, which is dropped silently");
@ -355,12 +354,12 @@ void test_reject_lu_during_paging_resp()
comment_end();
}
void test_accept_cm_during_paging_resp()
void test_accept_cm_during_paging_resp(const char *imsi)
{
comment_start();
_normal_lu();
_page();
_page(imsi);
_paging_resp_part1();
BTW("CM Service Request during open connection is accepted");

View File

@ -826,6 +826,8 @@ void *msgb_ctx = NULL;
void run_tests(int nr)
{
int test_nr;
const char *imsi = "901700000004620";
nr--; /* arg's first test is 1, in here it's 0 */
for (test_nr = 0; msc_vlr_tests[test_nr]; test_nr++) {
if (nr >= 0 && test_nr != nr)
@ -834,7 +836,7 @@ void run_tests(int nr)
if (cmdline_opts.verbose)
fprintf(stderr, "(test nr %d)\n", test_nr + 1);
msc_vlr_tests[test_nr]();
msc_vlr_tests[test_nr](imsi);
if (cmdline_opts.verbose)
fprintf(stderr, "(test nr %d)\n", test_nr + 1);

View File

@ -122,7 +122,7 @@ struct msc_vlr_test_cmdline_opts {
int run_test_nr;
};
typedef void (* msc_vlr_test_func_t )(void);
typedef void (* msc_vlr_test_func_t )(const char *);
extern msc_vlr_test_func_t msc_vlr_tests[];
struct msgb *msgb_from_hex(const char *label, uint16_t size, const char *hex);