mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-03-24 07:41:54 -07:00
Check that traces with no condemned objects can be started and finished without error in each automatic pool class. regression test for job004086.
Copied from Perforce Change: 194475
This commit is contained in:
parent
bcc01c1fd8
commit
cd9e76a6de
2 changed files with 80 additions and 0 deletions
79
mps/test/function/234.c
Normal file
79
mps/test/function/234.c
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
TEST_HEADER
|
||||
id = $Id$
|
||||
summary = empty traces (regression test for job004086)
|
||||
language = c
|
||||
link = testlib.o rankfmt.o
|
||||
END_HEADER
|
||||
*/
|
||||
|
||||
#include "mpsavm.h"
|
||||
#include "mpscamc.h"
|
||||
#include "mpscams.h"
|
||||
#include "mpscawl.h"
|
||||
#include "mpsclo.h"
|
||||
#include "rankfmt.h"
|
||||
#include "testlib.h"
|
||||
|
||||
static void *stackpointer;
|
||||
|
||||
static void test_pool(mps_pool_class_t pool_class)
|
||||
{
|
||||
mps_arena_t arena;
|
||||
mps_pool_t pool;
|
||||
mps_thr_t thread;
|
||||
mps_root_t root;
|
||||
mps_fmt_t format;
|
||||
mps_ap_t ap;
|
||||
void *addr;
|
||||
|
||||
cdie(mps_arena_create_k(&arena, mps_arena_class_vm(), mps_args_none),
|
||||
"create arena");
|
||||
cdie(mps_thread_reg(&thread, arena), "register thread");
|
||||
cdie(mps_root_create_thread(&root, arena, thread, stackpointer),
|
||||
"create thread");
|
||||
cdie(mps_fmt_create_A(&format, arena, &fmtA), "create format");
|
||||
MPS_ARGS_BEGIN(args) {
|
||||
MPS_ARGS_ADD(args, MPS_KEY_FORMAT, format);
|
||||
cdie(mps_pool_create_k(&pool, arena, pool_class, args), "create pool");
|
||||
} MPS_ARGS_END(args);
|
||||
cdie(mps_ap_create_k(&ap, pool, mps_args_none), "create ap");
|
||||
|
||||
/* First reserve on the allocation point causes the pool to create a
|
||||
buffered segment but with no objects yet. */
|
||||
cdie(mps_reserve(&addr, ap, MPS_PF_ALIGN), "reserve");
|
||||
|
||||
/* Create a trace and condemn the world, but discover that no
|
||||
objects were condemned, so abort the trace. */
|
||||
mps_arena_collect(arena);
|
||||
|
||||
/* Collect again to ensure that aborting the trace after condemning
|
||||
didn't violate the trace invariants. */
|
||||
mps_arena_collect(arena);
|
||||
|
||||
asserts(mps_commit(ap, &addr, MPS_PF_ALIGN), "commit");
|
||||
|
||||
mps_ap_destroy(ap);
|
||||
mps_pool_destroy(pool);
|
||||
mps_fmt_destroy(format);
|
||||
mps_root_destroy(root);
|
||||
mps_thread_dereg(thread);
|
||||
mps_arena_destroy(arena);
|
||||
}
|
||||
|
||||
static void test(void)
|
||||
{
|
||||
test_pool(mps_class_amc());
|
||||
test_pool(mps_class_ams());
|
||||
test_pool(mps_class_awl());
|
||||
test_pool(mps_class_lo());
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
void *m;
|
||||
stackpointer = &m; /* hack to get stack pointer */
|
||||
easy_tramp(test);
|
||||
pass();
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -173,3 +173,4 @@ function/229.c
|
|||
function/231.c
|
||||
function/232.c
|
||||
function/233.c
|
||||
function/234.c
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue