[PATCH] libosmo-sccp[master]: fix sanitize make check: xua_test: initialize gt_out.

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/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Fri Jun 23 01:22:27 UTC 2017


Review at  https://gerrit.osmocom.org/3019

fix sanitize make check: xua_test: initialize gt_out.

The sanitize build fails because gt_out is not initialized to zero, but is
later mem-compared to a zero-initialized struct.

Zero-initialize gt_out.

Also print in the test output both byte dumps. It helped to figure out the test
failure and might as well stay.

Change-Id: Ice8ee9c2a6bde4924f3ae6d95aa9268ebef9f070
---
M tests/xua/xua_test.c
M tests/xua/xua_test.ok
2 files changed, 5 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/19/3019/1

diff --git a/tests/xua/xua_test.c b/tests/xua/xua_test.c
index da3ee95..4af0836 100644
--- a/tests/xua/xua_test.c
+++ b/tests/xua/xua_test.c
@@ -151,10 +151,11 @@
 {
 	struct msgb *msg = msgb_alloc(1024, "foo");
 	const struct osmo_sccp_gt *gt_in = &sccp_addr_testcases[0].expected.gt;
-	struct osmo_sccp_gt gt_out;
+	struct osmo_sccp_gt gt_out = {};
 
 	printf("Testing Decoded GT -> SUA encoding\n");
 	printf("IN: %s\n", osmo_sccp_gt_dump(gt_in));
+	printf("    %s\n", osmo_hexdump_nospc(gt_in, sizeof(struct osmo_sccp_gt)));
 
 	/* encode sccp_addr to SUA GT */
 	xua_part_add_gt(msg, gt_in);
@@ -167,6 +168,7 @@
 	/* parse + compare */
 	sua_parse_gt(&gt_out, msgb_data(msg), msgb_length(msg));
 	printf("OUT:%s\n", osmo_sccp_gt_dump(&gt_out));
+	printf("    %s\n", osmo_hexdump_nospc(&gt_out, sizeof(struct osmo_sccp_gt)));
 	OSMO_ASSERT(!memcmp(gt_in, &gt_out, sizeof(gt_out)));
 
 	msgb_free(msg);
diff --git a/tests/xua/xua_test.ok b/tests/xua/xua_test.ok
index 2184902..ca8572a 100644
--- a/tests/xua/xua_test.ok
+++ b/tests/xua/xua_test.ok
@@ -11,7 +11,9 @@
 parsed:   RI=7,SSN=254,GTI=0
 Testing Decoded GT -> SUA encoding
 IN: TT=0,NPL=1,NAI=4,DIG=919969679389
+    0400000001000000040000003931393936393637393338390000000000000000000000000000000000000000
 OUT:TT=0,NPL=1,NAI=4,DIG=919969679389
+    0400000001000000040000003931393936393637393338390000000000000000000000000000000000000000
 
 => BSSMAP-RESET
 SCCP Input: [L2]> 09 00 03 05 07 02 42 fe 02 42 fe 06 00 04 30 04 01 20 

-- 
To view, visit https://gerrit.osmocom.org/3019
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ice8ee9c2a6bde4924f3ae6d95aa9268ebef9f070
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list