This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Max gerrit-no-reply at lists.osmocom.orgMax has uploaded this change for review. ( https://gerrit.osmocom.org/12571
Change subject: VLR: use msgb_eq_data_print() for comparison
......................................................................
VLR: use msgb_eq_data_print() for comparison
This simplifies tests refactoring by showing exact byte where mismatch
happened. It also makes code more readable.
Change-Id: If9771c973f2bc55580f4c146bdbeeb1609d56786
---
M tests/msc_vlr/msc_vlr_tests.c
1 file changed, 11 insertions(+), 11 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/71/12571/1
diff --git a/tests/msc_vlr/msc_vlr_tests.c b/tests/msc_vlr/msc_vlr_tests.c
index 44ecc50..f58acae 100644
--- a/tests/msc_vlr/msc_vlr_tests.c
+++ b/tests/msc_vlr/msc_vlr_tests.c
@@ -570,15 +570,20 @@
int __real_osmo_gsup_client_send(struct osmo_gsup_client *gsupc, struct msgb *msg);
int __wrap_osmo_gsup_client_send(struct osmo_gsup_client *gsupc, struct msgb *msg)
{
- const char *is = osmo_hexdump_nospc(msg->data, msg->len);
+ uint8_t buf[OSMO_GSUP_MAX_MSISDN_LEN * OSMO_GSUP_MAX_CALLED_PARTY_BCD_LEN];
+ int len;
+
fprintf(stderr, "GSUP --> HLR: %s: %s\n",
- osmo_gsup_message_type_name(msg->data[0]), is);
+ osmo_gsup_message_type_name(msg->data[0]), osmo_hexdump_nospc(msg->data, msg->len));
OSMO_ASSERT(gsup_tx_expected);
- if (strcmp(gsup_tx_expected, is)) {
- fprintf(stderr, "Mismatch! Expected:\n%s\n", gsup_tx_expected);
+
+ len = osmo_hexparse(gsup_tx_expected, buf, sizeof(buf));
+ if (len < 1)
abort();
- }
+
+ if (!msgb_eq_data_print(msg, buf, len))
+ abort();
talloc_free(msg);
gsup_tx_confirmed = true;
@@ -596,13 +601,8 @@
/* Mask the sequence number out before comparing */
msg->data[1] &= 0x3f;
- if (msg->len != dtap_tx_expected->len
- || memcmp(msg->data, dtap_tx_expected->data, msg->len)) {
- fprintf(stderr, "Mismatch! Expected:\n%s\n",
- osmo_hexdump_nospc(dtap_tx_expected->data,
- dtap_tx_expected->len));
+ if (!msgb_eq_data_print(msg, dtap_tx_expected->data, dtap_tx_expected->len))
abort();
- }
btw("DTAP matches expected message");
--
To view, visit https://gerrit.osmocom.org/12571
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: If9771c973f2bc55580f4c146bdbeeb1609d56786
Gerrit-Change-Number: 12571
Gerrit-PatchSet: 1
Gerrit-Owner: Max <msuraev at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190115/aeb7d020/attachment.htm>