From e07c431eb31faf03c689c181301a86e865b4709c Mon Sep 17 00:00:00 2001
From: Paul Bakker
Date: Wed, 3 Jul 2013 14:00:49 +0200
Subject: [PATCH] Test suite automatically uses buffer-based memory allocator
if present
Eat your own dog-food..
---
tests/scripts/generate_code.pl | 10 ++++++++++
tests/suites/helpers.function | 4 ++++
2 files changed, 14 insertions(+)
diff --git a/tests/scripts/generate_code.pl b/tests/scripts/generate_code.pl
index 75d741da8..4565c617a 100755
--- a/tests/scripts/generate_code.pl
+++ b/tests/scripts/generate_code.pl
@@ -59,6 +59,12 @@ FCT_BGN()
{
$suite_pre_code
+#if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C)
+ unsigned char buf[1000000];
+ memory_buffer_alloc_init( buf, sizeof(buf) );
+#endif
+
+
FCT_SUITE_BGN($suite_name)
{
END
@@ -141,6 +147,10 @@ print TEST_FILE << "END";
}
FCT_SUITE_END();
+#if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C) && defined(POLARSSL_MEMORY_DEBUG)
+ memory_buffer_alloc_status();
+#endif
+
$suite_post_code
}
FCT_END();
diff --git a/tests/suites/helpers.function b/tests/suites/helpers.function
index b23d3ff17..66af8af27 100644
--- a/tests/suites/helpers.function
+++ b/tests/suites/helpers.function
@@ -1,3 +1,7 @@
+#if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C)
+#include "polarssl/memory.h"
+#endif
+
#ifdef _MSC_VER
#include
typedef UINT32 uint32_t;