Explorar el Código

Quick and dirty test for emalloc()

tags/v0.9.3
Michael Brown hace 18 años
padre
commit
132a8fe49d
Se han modificado 1 ficheros con 26 adiciones y 0 borrados
  1. 26
    0
      src/tests/emalloc_test.c

+ 26
- 0
src/tests/emalloc_test.c Ver fichero

@@ -0,0 +1,26 @@
1
+#include <vsprintf.h>
2
+#include <gpxe/uaccess.h>
3
+#include <gpxe/emalloc.h>
4
+#include <gpxe/memmap.h>
5
+
6
+void emalloc_test ( void ) {
7
+	struct memory_map memmap;
8
+	userptr_t bob;
9
+	userptr_t fred;
10
+
11
+	printf ( "Before allocation:\n" );
12
+	get_memmap ( &memmap );
13
+
14
+	bob = emalloc ( 1234 );
15
+	bob = erealloc ( bob, 12345 );
16
+	fred = emalloc ( 999 );
17
+
18
+	printf ( "After allocation:\n" );
19
+	get_memmap ( &memmap );
20
+
21
+	efree ( bob );
22
+	efree ( fred );
23
+
24
+	printf ( "After freeing:\n" );
25
+	get_memmap ( &memmap );
26
+}

Loading…
Cancelar
Guardar