Merge pull request #11925 from rajkan01/feature-gt-bare-metal-minimal-printf

Fixed greentea minimal-printf test for microlib
pull/11932/merge
Martin Kojtal 2019-11-22 22:23:55 +01:00 committed by GitHub
commit 9ca69cfced
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -856,11 +856,16 @@ static control_t test_snprintf_buffer_overflow_generic(const char *fmt, T data)
char buffer_minimal[buf_size];
int result_baseline;
int result_minimal;
#if !defined(__MICROLIB)
// Microlib snprintf always returns zero if the size
// to copy from the buffer is zero.
// See reported microlib bug SDCOMP-54710
/* empty buffer test */
result_minimal = mbed_snprintf(buffer_minimal, 0, fmt, data);
result_baseline = snprintf(buffer_baseline, 0, fmt, data);
TEST_ASSERT_EQUAL_INT(result_baseline, result_minimal);
#endif
/* buffer isn't large enough, output needs to be truncated */
result_minimal = mbed_snprintf(buffer_minimal, buf_size - 2, fmt, data);