From 6de34ee46b1d256e98d0048c5407f0eec929288b Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Thu, 1 Feb 2018 12:49:39 +0100 Subject: 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 --- tests/utils/utils_test.c | 1 + 1 file changed, 1 insertion(+) (limited to 'tests') 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; -- cgit v1.2.3