From 42e2f1007b17ef5b5ba39ddfdf8617257ead69f3 Mon Sep 17 00:00:00 2001 From: Pekka Pirinen Date: Fri, 21 Jul 2000 14:53:16 +0100 Subject: [PATCH] Make it test the right thing Copied from Perforce Change: 21365 ServerID: perforce.ravenbrook.com --- mps/qa/function/121.c | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/mps/qa/function/121.c b/mps/qa/function/121.c index 577bd99209d..e1710aec083 100644 --- a/mps/qa/function/121.c +++ b/mps/qa/function/121.c @@ -1,6 +1,6 @@ /* TEST_HEADER - id = $HopeName$ + id = $HopeName: MMQA_test_function!121.c(trunk.2) $ summary = very small arenas language = c link = testlib.o @@ -13,6 +13,7 @@ END_HEADER #include "mpsavm.h" #include "mpscmv.h" + void *stackpointer; mps_arena_t arena; @@ -20,19 +21,35 @@ mps_thr_t thread; mps_pool_t pool; mps_pool_t pools[100]; -static void test(void) { - int i; - for (i=64; i>0; i--) { - comment("Trying arena of %dKB.", i); - cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*i)), - "create arena"); - cdie(mps_thread_reg(&thread, arena), "register thread"); - mps_thread_dereg(thread); - mps_arena_destroy(arena); - } +static void test(void) +{ + int i; + for (i = 64; i >= 0; i--) { + mps_res_t res; + + comment("Trying arena of %d kB.", i); + res = mps_arena_create(&arena, mps_arena_class_vm(), (size_t)(1024*i)); + if (res == MPS_RES_OK) { + res = mps_thread_reg(&thread, arena); + if (res == MPS_RES_OK) { + mps_thread_dereg(thread); + } else { + if (res != MPS_RES_MEMORY) { + error("Wrong error code, %d, for mps_thread_reg.", res); + } + } + mps_arena_destroy(arena); + } else { + report_res("arena_create", res); + if (res != MPS_RES_MEMORY) { + error("Wrong error code."); + } + } + } } + int main(void) { void *m;