diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gb/gprs_bssgp_test.c | 34 | ||||
-rw-r--r-- | tests/gb/gprs_bssgp_test.ok | 4 |
2 files changed, 38 insertions, 0 deletions
diff --git a/tests/gb/gprs_bssgp_test.c b/tests/gb/gprs_bssgp_test.c index 707b64bf..3de05ddb 100644 --- a/tests/gb/gprs_bssgp_test.c +++ b/tests/gb/gprs_bssgp_test.c @@ -254,6 +254,39 @@ static void test_bssgp_flow_control_bvc(void) printf("----- %s END\n", __func__); } +static void test_bssgp_msgb_copy() +{ + struct msgb *msg, *msg2; + uint16_t bvci_be = htons(2); + uint8_t cause = BSSGP_CAUSE_OML_INTERV; + + printf("----- %s START\n", __func__); + msg = bssgp_msgb_alloc(); + + msg->l3h = msgb_data(msg); + msgb_v_put(msg, BSSGP_PDUT_BVC_RESET); + msgb_tvlv_put(msg, BSSGP_IE_BVCI, sizeof(bvci_be), (uint8_t *)&bvci_be); + msgb_tvlv_put(msg, BSSGP_IE_CAUSE, sizeof(cause), &cause); + + msgb_bvci(msg) = 0xbad; + msgb_nsei(msg) = 0xbee; + + printf("Old msgb: %s\n", msgb_hexdump(msg)); + msg2 = bssgp_msgb_copy(msg, "test"); + printf("New msgb: %s\n", msgb_hexdump(msg2)); + + OSMO_ASSERT(msgb_bvci(msg2) == 0xbad); + OSMO_ASSERT(msgb_nsei(msg2) == 0xbee); + OSMO_ASSERT(msgb_l3(msg2) == msgb_data(msg2)); + OSMO_ASSERT(msgb_bssgph(msg2) == msgb_data(msg2)); + OSMO_ASSERT(msgb_bssgp_len(msg2) == msgb_length(msg2)); + + msgb_free(msg); + msgb_free(msg2); + + printf("----- %s END\n", __func__); +} + static struct log_info info = {}; int main(int argc, char **argv) @@ -278,6 +311,7 @@ int main(int argc, char **argv) test_bssgp_status(); test_bssgp_bad_reset(); test_bssgp_flow_control_bvc(); + test_bssgp_msgb_copy(); printf("===== BSSGP test END\n\n"); exit(EXIT_SUCCESS); diff --git a/tests/gb/gprs_bssgp_test.ok b/tests/gb/gprs_bssgp_test.ok index 83d633bc..c5b3e7d1 100644 --- a/tests/gb/gprs_bssgp_test.ok +++ b/tests/gb/gprs_bssgp_test.ok @@ -13,5 +13,9 @@ BSSGP primitive, SAP 16777221, prim = 11, op = 2, msg = 41 07 81 05 04 82 04 d2 Got message: 26 1e 81 2a 05 82 10 22 03 82 c0 40 01 82 08 11 1c 82 60 20 Got message: 26 1e 81 2a 05 82 10 22 03 82 c0 40 01 82 08 11 1c 82 60 20 3c 81 78 06 82 11 44 ----- test_bssgp_flow_control_bvc END +----- test_bssgp_msgb_copy START +Old msgb: [L3]> 22 04 82 00 02 07 81 08 +New msgb: [L3]> 22 04 82 00 02 07 81 08 +----- test_bssgp_msgb_copy END ===== BSSGP test END |