summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-02-01 12:49:39 +0100
committerHarald Welte <laforge@gnumonks.org>2018-02-08 09:41:36 +0000
commit6de34ee46b1d256e98d0048c5407f0eec929288b (patch)
treefdd227ab8570f9820f15d5946d3577387b379d0a
parent41911d03804c3bb82657a73bfd3dd73b70d13915 (diff)
tests: utils_test: Fix test failure when compiling with -O0
It seems with default flags in_buf was being memzeroed by the compiler. When compiling with -O0, that's not the case anymore and printf prints after first 16 bytes, printing extra garbage which doesn't match the expected output. Change-Id: I736c1e4d625f647d3bb794fa717256e9dbf36e87
-rw-r--r--tests/utils/utils_test.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/utils/utils_test.c b/tests/utils/utils_test.c
index b4f7cd3d..f358e9a5 100644
--- a/tests/utils/utils_test.c
+++ b/tests/utils/utils_test.c
@@ -334,6 +334,7 @@ static void str_escape_test(void)
printf("\nTesting string escaping\n");
printf("- all chars from 0 to 255 in batches of 16:\n");
+ in_buf[16] = '\0';
for (j = 0; j < 16; j++) {
for (i = 0; i < 16; i++)
in_buf[i] = (j << 4) | i;