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

pespin gerrit-no-reply at lists.osmocom.org
Mon Jun 3 17:41:25 UTC 2019


pespin has uploaded this change for review. ( 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 verify only the sign of the returned value.

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



  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/57/14357/1

diff --git a/tests/db_sms/db_sms_test.c b/tests/db_sms/db_sms_test.c
index a97f7c7..a204ab1 100644
--- a/tests/db_sms/db_sms_test.c
+++ b/tests/db_sms/db_sms_test.c
@@ -358,7 +358,7 @@
                     sizeof(sms->user_data));
 	if (rc) {
 		LOGPC(DDB, LOGL_ERROR, "TP-User-Data mismatch (diff=%d/%zu)\n",
-		      rc, sizeof(sms->user_data));
+		      rc > 0 ? 1 : -1, sizeof(sms->user_data));
 		return -EINVAL;
 	}
 
@@ -366,7 +366,7 @@
 	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));
+		      rc > 0 ? 1 : -1, sizeof(sms->text));
 		return -EINVAL;
 	}
 
diff --git a/tests/db_sms/db_sms_test.ok b/tests/db_sms/db_sms_test.ok
index e0a329d..4722a92 100644
--- a/tests/db_sms/db_sms_test.ok
+++ b/tests/db_sms/db_sms_test.ok
@@ -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 (diff=-1/256)
 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 (diff=-1/256)
 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 (diff=-1/256)
 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 (diff=-1/256)
 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 (diff=-1/256)
 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 (diff=-1/256)
 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 (diff=-1/256)
 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 (diff=-1/256)
 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 (diff=-1/256)
 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: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190603/ed30cee0/attachment.html>


More information about the gerrit-log mailing list