diff options
| author | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2014-01-28 10:53:59 +0100 | 
|---|---|---|
| committer | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2014-03-04 13:34:38 +0100 | 
| commit | c893c2233ad167585b4aa7e4246c2255e32c9734 (patch) | |
| tree | 9c5dc817345e759fd48c966264065bd3d2bf0b81 | |
| parent | 2462cf6ee12452362f24510d26a4c0ff19599342 (diff) | |
lapd/test: Extend test case to test msgs having data before l2h
Since e.g. the IPA input driver leaves it's specific header in front
of msg->l2h, so that msg->l2h != msg->data. The lapdm code does not expect this at least in
rslms_rx_rll_est_req().
This patch modifies the test program to add a dummy L1 header to
generated messages (unless the test would abort when doing so).
Note that the ok file reflects the current state which is not
correct.
Sponsored-by: On-Waves ehf
| -rw-r--r-- | tests/lapd/lapd_test.c | 12 | ||||
| -rw-r--r-- | tests/lapd/lapd_test.ok | 8 | 
2 files changed, 16 insertions, 4 deletions
diff --git a/tests/lapd/lapd_test.c b/tests/lapd/lapd_test.c index 1842ab7e..e3d4e80e 100644 --- a/tests/lapd/lapd_test.c +++ b/tests/lapd/lapd_test.c @@ -36,6 +36,7 @@  	}  static struct log_info info = {}; +static int dummy_l1_header_len = 0;  struct lapdm_polling_state {  	struct lapdm_channel *bts; @@ -94,6 +95,7 @@ static struct msgb *create_cm_serv_req(void)  	msg = msgb_from_array(cm, sizeof(cm));  	rsl_rll_push_l3(msg, RSL_MT_EST_REQ, 0, 0, 1); +	msgb_push(msg, dummy_l1_header_len);  	return msg;  } @@ -106,6 +108,7 @@ static struct msgb *create_mm_id_req(void)  	OSMO_ASSERT(msgb_l2len(msg) == 12);  	msg->l3h = msg->l2h + 6;  	OSMO_ASSERT(msgb_l3len(msg) == 6); +	msgb_push(msg, dummy_l1_header_len);  	return msg;  } @@ -117,6 +120,7 @@ static struct msgb *create_empty_msg(void)  	msg = msgb_from_array(NULL, 0);  	OSMO_ASSERT(msgb_l3len(msg) == 0);  	rsl_rll_push_l3(msg, RSL_MT_DATA_REQ, 0, 0, 1); +	msgb_push(msg, dummy_l1_header_len);  	return msg;  } @@ -126,6 +130,7 @@ static struct msgb *create_dummy_data_req(void)  	msg = msgb_from_array(dummy1, sizeof(dummy1));  	rsl_rll_push_l3(msg, RSL_MT_DATA_REQ, 0, 0, 1); +	msgb_push(msg, dummy_l1_header_len);  	return msg;  } @@ -135,6 +140,7 @@ static struct msgb *create_rel_req(void)  	msg = msgb_from_array(rel_req, sizeof(rel_req));  	msg->l2h = msg->data; +	msgb_push(msg, dummy_l1_header_len);  	msg->l3h = msg->l2h + sizeof(struct abis_rsl_rll_hdr);  	return msg;  } @@ -145,6 +151,7 @@ static struct msgb *create_est_req(const uint8_t *est_req, size_t est_req_size)  	msg = msgb_from_array(est_req, est_req_size);  	msg->l2h = msg->data; +	msgb_push(msg, dummy_l1_header_len);  	msg->l3h = msg->l2h + sizeof(struct abis_rsl_rll_hdr);  	return msg;  } @@ -550,10 +557,15 @@ int main(int argc, char **argv)  {  	osmo_init_logging(&info); +	/* Prevent the test from segfaulting */ +	dummy_l1_header_len = 0;  	test_lapdm_polling(); + +	dummy_l1_header_len = 3;  	test_lapdm_early_release();  	test_lapdm_contention_resolution();  	test_lapdm_establishment(); +  	printf("Success.\n");  	return 0; diff --git a/tests/lapd/lapd_test.ok b/tests/lapd/lapd_test.ok index 9fb58e0c..7d266bdd 100644 --- a/tests/lapd/lapd_test.ok +++ b/tests/lapd/lapd_test.ok @@ -33,9 +33,9 @@ Took message from DCCH queue: L2 header size 3, L3 size 20, SAP 0x1000000, 0/0,  Message: [L2]> 01 73 41 [L3]> 05 24 31 03 50 18 93 08 29 47 80 00 00 00 00 80 2b 2b 2b 2b   I test RF channel establishment.  Testing SAPI3/SDCCH -Took message from DCCH queue: L2 header size 3, L3 size 20, SAP 0x1000000, 0/0, Link 0x03 -Message: [L2]> 0f 3f 01 [L3]> 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b  +Took message from DCCH queue: L2 header size 6, L3 size 17, SAP 0x1000000, 0/0, Link 0x03 +Message: [L2]> 0f 3f 0d 20 02 03 [L3]> 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b   Testing SAPI3/SACCH -Took message from ACCH queue: L2 header size 5, L3 size 18, SAP 0x1000000, 0/0, Link 0x43 -Message: [L2]> 00 00 0f 3f 01 [L3]> 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b  +Took message from ACCH queue: L2 header size 8, L3 size 15, SAP 0x1000000, 0/0, Link 0x43 +Message: [L2]> 00 00 0f 3f 0d 0b 02 43 [L3]> 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b   Success.  | 
