Change in ...osmo-msc[master]: db_sms_test: Do not print exact memcmp result

Harald Welte gerrit-no-reply at lists.osmocom.org
Tue Jun 4 09:51:33 UTC 2019


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmo-msc/+/14357 )

Change subject: db_sms_test: Do not print exact memcmp result
......................................................................

db_sms_test: Do not print exact memcmp result

man memcp doesn't define exact values for returned integer, it only
specifices a meaning for the sign of it.
So it happens that different versions/implementations actually return
different values when this test is run, making it fail.
Let's simply drop that info from logs since anyways it's not useful.

Change-Id: I771fb8f4fc56f337b16561d005ff1803a386d1c6
---
M tests/db_sms/db_sms_test.c
M tests/db_sms/db_sms_test.err
2 files changed, 11 insertions(+), 13 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, approved
  Harald Welte: Looks good to me, approved



diff --git a/tests/db_sms/db_sms_test.c b/tests/db_sms/db_sms_test.c
index a97f7c7..24c86e5 100644
--- a/tests/db_sms/db_sms_test.c
+++ b/tests/db_sms/db_sms_test.c
@@ -357,16 +357,14 @@
 	rc = memcmp(sms->user_data, test->sms.user_data,
                     sizeof(sms->user_data));
 	if (rc) {
-		LOGPC(DDB, LOGL_ERROR, "TP-User-Data mismatch (diff=%d/%zu)\n",
-		      rc, sizeof(sms->user_data));
+		LOGPC(DDB, LOGL_ERROR, "TP-User-Data mismatch\n");
 		return -EINVAL;
 	}
 
 	/* Compare decoded text */
 	rc = strncmp(sms->text, test->sms.text, sizeof(sms->text));
 	if (rc) {
-		LOGPC(DDB, LOGL_ERROR, "TP-User-Data (text) mismatch (diff=%d/%zu)\n",
-		      rc, sizeof(sms->text));
+		LOGPC(DDB, LOGL_ERROR, "TP-User-Data (text) mismatch\n");
 		return -EINVAL;
 	}
 
diff --git a/tests/db_sms/db_sms_test.err b/tests/db_sms/db_sms_test.err
index e0a329d..c61b1f4 100644
--- a/tests/db_sms/db_sms_test.err
+++ b/tests/db_sms/db_sms_test.err
@@ -18,15 +18,15 @@
 DDB NOTICE test_db_sms_get('Regular MT SMS'): success, as expected
 DDB NOTICE verify_sms('Regular MT SMS'): match
 DDB NOTICE test_db_sms_get('Complete TP-UD (160 septets, 7-bit encoding)'): success, as expected
-DDB NOTICE verify_sms('Complete TP-UD (160 septets, 7-bit encoding)'): TP-User-Data mismatch (diff=-65/256)
+DDB NOTICE verify_sms('Complete TP-UD (160 septets, 7-bit encoding)'): TP-User-Data mismatch
 DDB NOTICE test_db_sms_get('Complete TP-UD (140 octets, 8-bit encoding)'): success, as expected
-DDB NOTICE verify_sms('Complete TP-UD (140 octets, 8-bit encoding)'): TP-User-Data mismatch (diff=-66/256)
+DDB NOTICE verify_sms('Complete TP-UD (140 octets, 8-bit encoding)'): TP-User-Data mismatch
 DDB NOTICE test_db_sms_get('TP-UD buffer overflow (UDH-Length > UD-Length)'): success, as expected
 DDB NOTICE verify_sms('TP-UD buffer overflow (UDH-Length > UD-Length)'): match
 DDB NOTICE test_db_sms_get('Truncated TP-UD (200 septets, 7-bit encoding)'): success, as expected
-DDB NOTICE verify_sms('Truncated TP-UD (200 septets, 7-bit encoding)'): TP-User-Data mismatch (diff=-65/256)
+DDB NOTICE verify_sms('Truncated TP-UD (200 septets, 7-bit encoding)'): TP-User-Data mismatch
 DDB NOTICE test_db_sms_get('Truncated TP-UD (255 octets, 8-bit encoding)'): success, as expected
-DDB NOTICE verify_sms('Truncated TP-UD (255 octets, 8-bit encoding)'): TP-User-Data mismatch (diff=-16896/256)
+DDB NOTICE verify_sms('Truncated TP-UD (255 octets, 8-bit encoding)'): TP-User-Data mismatch
 DDB NOTICE test_db_sms_get('Same MSISDN #1'): success, as expected
 DDB NOTICE verify_sms('Same MSISDN #1'): match
 DDB NOTICE test_db_sms_get('Same MSISDN #2'): success, as expected
@@ -43,7 +43,7 @@
 DDB DEBUG Marking #1 as delivered: rc=0
 DDB DEBUG Marking #2 as delivered: rc=0
 DDB NOTICE db_sms_get_next_unsent(starting from #1): found
-DDB NOTICE verify_sms('Complete TP-UD (160 septets, 7-bit encoding)'): TP-User-Data mismatch (diff=-65/256)
+DDB NOTICE verify_sms('Complete TP-UD (160 septets, 7-bit encoding)'): TP-User-Data mismatch
 DDB INFO Testing db_sms_delete_sent_message_by_id()...
 DDB NOTICE db_sms_delete_sent_message_by_id(#1, sent): rc=0
 DDB NOTICE db_sms_delete_sent_message_by_id(#3, not sent): rc=0
@@ -57,15 +57,15 @@
 DDB NOTICE test_db_sms_get('Regular MT SMS'): success, as expected
 DDB NOTICE verify_sms('Regular MT SMS'): match
 DDB NOTICE test_db_sms_get('Complete TP-UD (160 septets, 7-bit encoding)'): success, as expected
-DDB NOTICE verify_sms('Complete TP-UD (160 septets, 7-bit encoding)'): TP-User-Data mismatch (diff=-65/256)
+DDB NOTICE verify_sms('Complete TP-UD (160 septets, 7-bit encoding)'): TP-User-Data mismatch
 DDB NOTICE test_db_sms_get('Complete TP-UD (140 octets, 8-bit encoding)'): success, as expected
-DDB NOTICE verify_sms('Complete TP-UD (140 octets, 8-bit encoding)'): TP-User-Data mismatch (diff=-66/256)
+DDB NOTICE verify_sms('Complete TP-UD (140 octets, 8-bit encoding)'): TP-User-Data mismatch
 DDB NOTICE test_db_sms_get('TP-UD buffer overflow (UDH-Length > UD-Length)'): success, as expected
 DDB NOTICE verify_sms('TP-UD buffer overflow (UDH-Length > UD-Length)'): match
 DDB NOTICE test_db_sms_get('Truncated TP-UD (200 septets, 7-bit encoding)'): success, as expected
-DDB NOTICE verify_sms('Truncated TP-UD (200 septets, 7-bit encoding)'): TP-User-Data mismatch (diff=-65/256)
+DDB NOTICE verify_sms('Truncated TP-UD (200 septets, 7-bit encoding)'): TP-User-Data mismatch
 DDB NOTICE test_db_sms_get('Truncated TP-UD (255 octets, 8-bit encoding)'): success, as expected
-DDB NOTICE verify_sms('Truncated TP-UD (255 octets, 8-bit encoding)'): TP-User-Data mismatch (diff=-16896/256)
+DDB NOTICE verify_sms('Truncated TP-UD (255 octets, 8-bit encoding)'): TP-User-Data mismatch
 DDB NOTICE test_db_sms_get('Same MSISDN #1'): failure, as expected
 DDB NOTICE test_db_sms_get('Same MSISDN #2'): failure, as expected
 DDB NOTICE test_db_sms_get('Expired SMS'): unexpected result

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/14357
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I771fb8f4fc56f337b16561d005ff1803a386d1c6
Gerrit-Change-Number: 14357
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190604/a6ce64ba/attachment.html>


More information about the gerrit-log mailing list