From 1ca147f9e08202dfbc78692e204adac280f8238b Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Sat, 14 Feb 2015 19:15:43 +0100 Subject: Rearrange testing architecture : just type 'make run_tests' --- src/tests/ktests/region1/test.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/tests/ktests/region1/test.c (limited to 'src/tests/ktests/region1/test.c') diff --git a/src/tests/ktests/region1/test.c b/src/tests/ktests/region1/test.c new file mode 100644 index 0000000..1a42638 --- /dev/null +++ b/src/tests/ktests/region1/test.c @@ -0,0 +1,36 @@ + +void test_region_1() { + BEGIN_TEST("region-test-1"); + + void* p = region_alloc(0x1000, "Test region", 0); + dbg_printf("Allocated one-page region: 0x%p\n", p); + dbg_print_region_info(); + void* q = region_alloc(0x1000, "Test region", 0); + dbg_printf("Allocated one-page region: 0x%p\n", q); + dbg_print_region_info(); + void* r = region_alloc(0x2000, "Test region", 0); + dbg_printf("Allocated two-page region: 0x%p\n", r); + dbg_print_region_info(); + void* s = region_alloc(0x10000, "Test region", 0); + dbg_printf("Allocated 16-page region: 0x%p\n", s); + dbg_print_region_info(); + region_free(p); + dbg_printf("Freed region 0x%p\n", p); + dbg_print_region_info(); + region_free(q); + dbg_printf("Freed region 0x%p\n", q); + dbg_print_region_info(); + region_free(r); + dbg_printf("Freed region 0x%p\n", r); + dbg_print_region_info(); + region_free(s); + dbg_printf("Freed region 0x%p\n", s); + dbg_print_region_info(); + + TEST_OK; +} + +#undef TEST_PLACEHOLDER_AFTER_REGION +#define TEST_PLACEHOLDER_AFTER_REGION { test_region_1(); } + +/* vim: set ts=4 sw=4 tw=0 noet :*/ -- cgit v1.2.3