diff options
author | Michael Brown | 2007-01-12 04:27:05 +0100 |
---|---|---|
committer | Michael Brown | 2007-01-12 04:27:05 +0100 |
commit | 132a8fe49d2a8e5a909b32fcb1b2f211df5af070 (patch) | |
tree | 79724d61e10933abe7a3fcb50ceaf90643be67d4 /src/tests/emalloc_test.c | |
parent | First version of an external memory allocator (not tested) (diff) | |
download | ipxe-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.c | 26 |
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 ); +} |