From 5c8e6891bbb2c248331abecb64262a20719209f1 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Mon, 23 Jul 2018 11:05:31 +0100 Subject: [PATCH] Update mmqa tests to cope with the removal of mv: * Fix typo in argerr/41.c. * Delete argerr/43.c and argerr/44.c: MVFF doesn't take a maximum size argument so we can't test for erroneous values of this argument. * Fix assertion condition in conerr/59.c. * In function/136.c, need to specify extend-by for second pool, now that it's an MVFF pool. * function/224.c now passes (fragmentation is avoided because MVFF allocations can cross extent boundaries). Copied from Perforce Change: 194712 --- mps/test/argerr/41.c | 2 +- mps/test/argerr/43.c | 48 ---------------------------------------- mps/test/argerr/44.c | 47 --------------------------------------- mps/test/conerr/59.c | 2 +- mps/test/function/136.c | 36 +++++++++++++++++++----------- mps/test/function/224.c | 22 +++++++----------- mps/test/testsets/argerr | 3 +-- 7 files changed, 34 insertions(+), 126 deletions(-) delete mode 100644 mps/test/argerr/43.c delete mode 100644 mps/test/argerr/44.c diff --git a/mps/test/argerr/41.c b/mps/test/argerr/41.c index ccdd814d1f1..fc20f94c621 100644 --- a/mps/test/argerr/41.c +++ b/mps/test/argerr/41.c @@ -6,7 +6,7 @@ TEST_HEADER link = testlib.o OUTPUT_SPEC assert = true - assertfile P= poolmff.c + assertfile P= poolmvff.c assertcond = extendBy > 0 END_HEADER */ diff --git a/mps/test/argerr/43.c b/mps/test/argerr/43.c deleted file mode 100644 index e051d09a6d8..00000000000 --- a/mps/test/argerr/43.c +++ /dev/null @@ -1,48 +0,0 @@ -/* -TEST_HEADER - id = $Id$ - summary = zero maxSize for pool_create (MV) - language = c - link = testlib.o -OUTPUT_SPEC - assert = true - assertfile P= poolmvff.c - assertcond = maxSize > 0 -END_HEADER -*/ - -#include "testlib.h" -#include "mpscmv.h" -#include "arg.h" - -void *stackpointer; - -static void test(void) -{ - mps_arena_t arena; - mps_pool_t pool; - mps_thr_t thread; - - cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena"); - - cdie(mps_thread_reg(&thread, arena), "register thread"); - - cdie( - mps_pool_create( - &pool, arena, mps_class_mv(), - (size_t) 32, (size_t) 32, (size_t) 0), - "create pool"); - - mps_pool_destroy(pool); - mps_thread_dereg(thread); - mps_arena_destroy(arena); -} - -int main(void) -{ - void *m; - stackpointer=&m; /* hack to get stack pointer */ - - easy_tramp(test); - return 0; -} diff --git a/mps/test/argerr/44.c b/mps/test/argerr/44.c deleted file mode 100644 index d9aaffc1acf..00000000000 --- a/mps/test/argerr/44.c +++ /dev/null @@ -1,47 +0,0 @@ -/* -TEST_HEADER - id = $Id$ - summary = extendBy > maxSize for pool_create (MV) - language = c - link = testlib.o -OUTPUT_SPEC - assert = true - assertfile P= poolmvff.c - assertcond = extendBy <= maxSize -END_HEADER -*/ - -#include "testlib.h" -#include "mpscmv.h" -#include "arg.h" - -void *stackpointer; - -static void test(void) -{ - mps_arena_t arena; - mps_pool_t pool; - mps_thr_t thread; - - cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena"); - - cdie(mps_thread_reg(&thread, arena), "register thread"); - - cdie( - mps_pool_create( - &pool, arena, mps_class_mv(), - (size_t) 33, (size_t) 32, (size_t) 32), - "create pool"); - - mps_pool_destroy(pool); - -} - -int main(void) -{ - void *m; - stackpointer=&m; /* hack to get stack pointer */ - - easy_tramp(test); - return 0; -} diff --git a/mps/test/conerr/59.c b/mps/test/conerr/59.c index 9d97943f71a..a8e8d68a523 100644 --- a/mps/test/conerr/59.c +++ b/mps/test/conerr/59.c @@ -7,7 +7,7 @@ TEST_HEADER OUTPUT_SPEC assert = true assertfile P= poolmvff.c - assertcond = unreachable code + assertcond = res == ResOK END_HEADER */ diff --git a/mps/test/function/136.c b/mps/test/function/136.c index f333a206f4d..bd873e899b9 100644 --- a/mps/test/function/136.c +++ b/mps/test/function/136.c @@ -5,6 +5,7 @@ TEST_HEADER language = c link = testlib.o OUTPUT_SPEC + assert = true limit < 160000 END_HEADER */ @@ -31,7 +32,6 @@ END_HEADER #include "testlib.h" #include "mpscmvff.h" -#include "mpscmv.h" #include "mpsavm.h" @@ -73,15 +73,17 @@ static void do_test(size_t extendBy, size_t avgSize, size_t align, "create MVFF pool"); } MPS_ARGS_END(args); - die(mps_pool_create(&pool2, arena, mps_class_mv(), - extendBy, avgSize, /* maxSize */ extendBy), - "create MV pool"); + MPS_ARGS_BEGIN(args) { + MPS_ARGS_ADD(args, MPS_KEY_EXTEND_BY, extendBy); + die(mps_pool_create_k(&pool2, arena, mps_class_mvff(), args), + "create second MVFF pool"); + } MPS_ARGS_END(args); - /* Allocate one small object in pool2 so that its block and span - pools get some initial memory. */ + /* Allocate one small object in pool2 so that its CBS gets some + initial memory. */ res = mps_alloc(&p, pool2, 8); - asserts(res == MPS_RES_OK, - "Couldn't allocate one object of size %lu in second pool", + asserts(res == MPS_RES_OK, + "Couldn't allocate first object of size %lu in second pool", (unsigned long)8); /* First we allocate large objects until we run out of memory. */ @@ -129,6 +131,8 @@ static void do_test(size_t extendBy, size_t avgSize, size_t align, } /* MVFF should be failing over from the CBS to the freelist now. */ + res = mps_alloc(&p, pool2, largeObjectSize); + asserts(res != MPS_RES_OK, "unexpectedly have some memory left"); /* Then we free every other large object */ for(i = 0; i < nLargeObjects; i += 2) { @@ -139,7 +143,7 @@ static void do_test(size_t extendBy, size_t avgSize, size_t align, /* Then we allocate in another pool. */ res = mps_alloc(&p, pool2, largeObjectSize); asserts(res == MPS_RES_OK, - "Couldn't allocate one object of size %lu in second pool", + "Couldn't allocate second object of size %lu in second pool", (unsigned long)largeObjectSize); done: @@ -152,14 +156,20 @@ static void test(void) { mps_thr_t thread; int symm; + size_t grainSize = 4096; size_t comlimit; mps_bool_t slotHigh, arenaHigh, firstFit; - cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t) (1024*1024*50)), - "create arena"); + MPS_ARGS_BEGIN(args) { + MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, 1024*1024*50); + MPS_ARGS_ADD(args, MPS_KEY_ARENA_GRAIN_SIZE, grainSize); + cdie(mps_arena_create_k(&arena, mps_arena_class_vm(), args), + "create arena"); + } MPS_ARGS_END(args); + cdie(mps_thread_reg(&thread, arena), "register thread"); - for (comlimit = 512 * 1024; comlimit >= 148 * 1024; comlimit -= 4*1024) { + for (comlimit = 128 * grainSize; comlimit > 0; comlimit -= grainSize) { mps_arena_commit_limit_set(arena, comlimit); report("limit", "%d", comlimit); symm = ranint(8); @@ -167,7 +177,7 @@ static void test(void) arenaHigh = (symm >> 1) & 1; firstFit = (symm & 1); - do_test(4096, 8, 8, slotHigh, arenaHigh, firstFit); + do_test(grainSize, 8, 8, slotHigh, arenaHigh, firstFit); } mps_thread_dereg(thread); diff --git a/mps/test/function/224.c b/mps/test/function/224.c index 743805f1442..1e52e07c5da 100644 --- a/mps/test/function/224.c +++ b/mps/test/function/224.c @@ -1,21 +1,17 @@ /* TEST_HEADER id = $Id$ - summary = MV allocate large promise, make it small, repeat + summary = MVFF allocate large promise, make it small, repeat language = c link = testlib.o harness = 2.5 - parameters = EXTENDBY=65536 AVGSIZE=32 PROMISE=64 ITERATE=2000 -OUTPUT_SPEC - errtext = alloc: COMMIT_LIMIT + parameters = PROMISE=65536 ITERATE=2000 END_HEADER - -This one is supposed to fail, telling us that MV is badly fragmented. */ -#include "testlib.h" -#include "mpscmv.h" #include "mpsavm.h" +#include "mpscmvff.h" +#include "testlib.h" #define VMSIZE ((size_t) 30*1024*1024) @@ -30,15 +26,13 @@ static void test(void) die(mps_arena_create(&arena, mps_arena_class_vm(), VMSIZE), "create"); die(mps_arena_commit_limit_set(arena, VMSIZE), "commit limit"); - - die(mps_pool_create(&pool, arena, mps_class_mv(), - (size_t)EXTENDBY, (size_t)AVGSIZE, (size_t)EXTENDBY), + die(mps_pool_create_k(&pool, arena, mps_class_mvff(), mps_args_none), "pool create"); for (p=0; p