summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-06-23 03:18:02 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-06-23 03:21:24 +0200
commita70b4599f63b50c4d654eb9e1b1a099a7c8cdc36 (patch)
treea7c5da61f5d8d6777e8f56fc5ad4692e7a30d518
parent42488383275a01e288961f6aebf74fb2eb13817d (diff)
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
-rw-r--r--tests/xua/xua_test.c4
-rw-r--r--tests/xua/xua_test.ok2
2 files changed, 5 insertions, 1 deletions
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 @@ static void test_helpers(void)
{
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 @@ static void test_helpers(void)
/* 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 @@ expected: RI=7,SSN=254,GTI=0
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