diff options
author | Alex Auvolat <alex.auvolat@ens.fr> | 2015-02-14 19:15:43 +0100 |
---|---|---|
committer | Alex Auvolat <alex.auvolat@ens.fr> | 2015-02-14 19:15:43 +0100 |
commit | 1ca147f9e08202dfbc78692e204adac280f8238b (patch) | |
tree | 70cf40c14aae874bae814a9dcddbfdf5aba52079 /src/tests/ktests/region1/test.c | |
parent | 74ea640f40285220dfa93492a143a35426b867d1 (diff) | |
download | kogata-1ca147f9e08202dfbc78692e204adac280f8238b.tar.gz kogata-1ca147f9e08202dfbc78692e204adac280f8238b.zip |
Rearrange testing architecture : just type 'make run_tests'
Diffstat (limited to 'src/tests/ktests/region1/test.c')
-rw-r--r-- | src/tests/ktests/region1/test.c | 36 |
1 files changed, 36 insertions, 0 deletions
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 :*/ |