Skip to content

Commit 5033db2

Browse files
Clarify that the "FATAL" message is expected
The test case "Memory buffer small buffer" emits a message "FATAL: verification of first header failed". In this test case, it's actually expected, but it looks weird to see this message from a passing test. Add a comment that states this explicitly, and modify the test description to indicate that the failure is expected, and change the test function name to be more accurate. Fix #309
1 parent ccde952 commit 5033db2

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

tests/suites/test_suite_memory_buffer_alloc.data

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ memory_buffer_alloc_free_alloc:100:64:100:100:0:0:0:1:200:0
1616
Memory buffer alloc - Out of Memory test
1717
memory_buffer_alloc_oom_test:
1818

19-
Memory buffer small buffer
20-
memory_buffer_small_buffer:
19+
Memory buffer: heap too small (header verification should fail)
20+
memory_buffer_heap_too_small:
2121

2222
Memory buffer underalloc
2323
memory_buffer_underalloc:

tests/suites/test_suite_memory_buffer_alloc.function

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,14 @@ exit:
232232
/* END_CASE */
233233

234234
/* BEGIN_CASE depends_on:MBEDTLS_MEMORY_DEBUG */
235-
void memory_buffer_small_buffer( )
235+
void memory_buffer_heap_too_small( )
236236
{
237237
unsigned char buf[1];
238238

239239
mbedtls_memory_buffer_alloc_init( buf, sizeof( buf ) );
240+
/* With MBEDTLS_MEMORY_DEBUG enabled, this prints a message
241+
* "FATAL: verification of first header failed".
242+
*/
240243
TEST_ASSERT( mbedtls_memory_buffer_alloc_verify() != 0 );
241244
}
242245
/* END_CASE */

0 commit comments

Comments
 (0)