From a70b4599f63b50c4d654eb9e1b1a099a7c8cdc36 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Fri, 23 Jun 2017 03:18:02 +0200 Subject: 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 --- tests/xua/xua_test.c | 4 +++- tests/xua/xua_test.ok | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) 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(>_out, msgb_data(msg), msgb_length(msg)); printf("OUT:%s\n", osmo_sccp_gt_dump(>_out)); + printf(" %s\n", osmo_hexdump_nospc(>_out, sizeof(struct osmo_sccp_gt))); OSMO_ASSERT(!memcmp(gt_in, >_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 -- cgit v1.2.3