summaryrefslogtreecommitdiffstats
path: root/src/tests/emalloc_test.c
diff options
context:
space:
mode:
authorMichael Brown2007-01-12 04:27:05 +0100
committerMichael Brown2007-01-12 04:27:05 +0100
commit132a8fe49d2a8e5a909b32fcb1b2f211df5af070 (patch)
tree79724d61e10933abe7a3fcb50ceaf90643be67d4 /src/tests/emalloc_test.c
parentFirst version of an external memory allocator (not tested) (diff)
downloadipxe-132a8fe49d2a8e5a909b32fcb1b2f211df5af070.tar.gz
ipxe-132a8fe49d2a8e5a909b32fcb1b2f211df5af070.tar.xz
ipxe-132a8fe49d2a8e5a909b32fcb1b2f211df5af070.zip
Quick and dirty test for emalloc()
Diffstat (limited to 'src/tests/emalloc_test.c')
-rw-r--r--src/tests/emalloc_test.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/tests/emalloc_test.c b/src/tests/emalloc_test.c
new file mode 100644
index 00000000..e8428f5d
--- /dev/null
+++ b/src/tests/emalloc_test.c
@@ -0,0 +1,26 @@
+#include <vsprintf.h>
+#include <gpxe/uaccess.h>
+#include <gpxe/emalloc.h>
+#include <gpxe/memmap.h>
+
+void emalloc_test ( void ) {
+ struct memory_map memmap;
+ userptr_t bob;
+ userptr_t fred;
+
+ printf ( "Before allocation:\n" );
+ get_memmap ( &memmap );
+
+ bob = emalloc ( 1234 );
+ bob = erealloc ( bob, 12345 );
+ fred = emalloc ( 999 );
+
+ printf ( "After allocation:\n" );
+ get_memmap ( &memmap );
+
+ efree ( bob );
+ efree ( fred );
+
+ printf ( "After freeing:\n" );
+ get_memmap ( &memmap );
+}