1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-03-23 15:22:20 -07:00

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
This commit is contained in:
Gareth Rees 2018-07-23 11:05:31 +01:00
parent 74df9f7f35
commit 5c8e6891bb
7 changed files with 34 additions and 126 deletions

View file

@ -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
*/

View file

@ -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;
}

View file

@ -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;
}

View file

@ -7,7 +7,7 @@ TEST_HEADER
OUTPUT_SPEC
assert = true
assertfile P= poolmvff.c
assertcond = unreachable code
assertcond = res == ResOK
END_HEADER
*/

View file

@ -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);

View file

@ -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<ITERATE; p++) {
die(mps_alloc(&q, pool, PROMISE*1024), "alloc");
q = (mps_addr_t) ((char *) q + MPS_PF_ALIGN);
mps_free(pool, q, PROMISE*1024-MPS_PF_ALIGN);
die(mps_alloc(&q, pool, PROMISE), "alloc");
q = (char *)q + MPS_PF_ALIGN;
mps_free(pool, q, PROMISE - MPS_PF_ALIGN);
report("promise", "%i", p);
}

View file

@ -45,8 +45,7 @@ argerr/39.c
argerr/40.c
argerr/41.c
argerr/42.c
argerr/43.c
argerr/44.c
% 43-44 -- no such test
argerr/45.c
argerr/46.c
argerr/47.c