mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-04-01 03:33:28 -07:00
New unit
new test Copied from Perforce Change: 17397 ServerID: perforce.ravenbrook.com
This commit is contained in:
parent
92debd10d1
commit
fbde5ede41
4 changed files with 174 additions and 0 deletions
57
mps/qa/function/19.c
Normal file
57
mps/qa/function/19.c
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
/* test create lots of aps at once (and cause to run out of memory)
|
||||
language c
|
||||
link testlib.o newfmt.o
|
||||
*/
|
||||
|
||||
#include "testlib.h"
|
||||
#include "mpscamc.h"
|
||||
#include "mpscmv.h"
|
||||
#include "newfmt.h"
|
||||
|
||||
void *stackpointer;
|
||||
|
||||
static void test(void) {
|
||||
mps_space_t space;
|
||||
mps_pool_t pool;
|
||||
mps_thr_t thread;
|
||||
mps_fmt_t format;
|
||||
mps_root_t root;
|
||||
mps_ap_t ap;
|
||||
mps_addr_t q;
|
||||
|
||||
int p;
|
||||
|
||||
die(mps_space_create(&space), "create");
|
||||
die(mps_thread_reg(&thread, space), "register thread");
|
||||
die(mps_root_create_reg(&root, space, MPS_RANK_AMBIG, 0, thread,
|
||||
mps_stack_scan_ambig, stackpointer, 0), "create root");
|
||||
die(mps_fmt_create_A(&format, space, &fmtA), "create format");
|
||||
|
||||
die(mps_pool_create(&pool, space, mps_class_mv(),
|
||||
1024*32, 1024*16, 1024*256), "pool");
|
||||
|
||||
while (mps_alloc(&q, pool, 64*1024)==MPS_RES_OK);
|
||||
p=0;
|
||||
|
||||
die(mps_pool_create(&pool, space, mps_class_amc(), format),
|
||||
"create pool");
|
||||
|
||||
while (1) {
|
||||
p++;
|
||||
die(mps_ap_create(&ap, pool, MPS_RANK_EXACT),
|
||||
"create ap");
|
||||
report("ap", "%i", p);
|
||||
}
|
||||
|
||||
asserts(1, "Unreachable!");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
void *m;
|
||||
stackpointer=&m; /* hack to get stack pointer */
|
||||
|
||||
easy_tramp(test);
|
||||
pass();
|
||||
return 0;
|
||||
}
|
||||
51
mps/qa/function/20.c
Normal file
51
mps/qa/function/20.c
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
/* test create lots of formats at once (and cause to run out of memory)
|
||||
language c
|
||||
link testlib.o newfmt.o
|
||||
*/
|
||||
|
||||
#include "testlib.h"
|
||||
#include "mpscamc.h"
|
||||
#include "mpscmv.h"
|
||||
#include "newfmt.h"
|
||||
|
||||
void *stackpointer;
|
||||
|
||||
static void test(void) {
|
||||
mps_space_t space;
|
||||
mps_pool_t pool;
|
||||
mps_thr_t thread;
|
||||
mps_fmt_t format;
|
||||
mps_root_t root;
|
||||
mps_addr_t q;
|
||||
|
||||
int p;
|
||||
|
||||
die(mps_space_create(&space), "create");
|
||||
die(mps_thread_reg(&thread, space), "register thread");
|
||||
die(mps_root_create_reg(&root, space, MPS_RANK_AMBIG, 0, thread,
|
||||
mps_stack_scan_ambig, stackpointer, 0), "create root");
|
||||
|
||||
die(mps_pool_create(&pool, space, mps_class_mv(),
|
||||
1024*32, 1024*16, 1024*256), "pool");
|
||||
|
||||
while (mps_alloc(&q, pool, 64*1024)==MPS_RES_OK);
|
||||
p=0;
|
||||
|
||||
while (1) {
|
||||
p++;
|
||||
die(mps_fmt_create_A(&format, space, &fmtA), "create format");
|
||||
report("format", "%i", p);
|
||||
}
|
||||
|
||||
asserts(1, "Unreachable!");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
void *m;
|
||||
stackpointer=&m; /* hack to get stack pointer */
|
||||
|
||||
easy_tramp(test);
|
||||
pass();
|
||||
return 0;
|
||||
}
|
||||
32
mps/qa/function/21.c
Normal file
32
mps/qa/function/21.c
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/* test allocate large promise, make it small, repeat
|
||||
language c
|
||||
link testlib.o
|
||||
*/
|
||||
|
||||
#include "testlib.h"
|
||||
#include "mpscmv.h"
|
||||
|
||||
static void test(void) {
|
||||
mps_space_t space;
|
||||
mps_pool_t pool;
|
||||
mps_addr_t q;
|
||||
int p;
|
||||
|
||||
die(mps_space_create(&space), "create");
|
||||
|
||||
die(mps_pool_create(&pool, space, mps_class_mv(),
|
||||
1024*32, 1024*16, 1024*256), "pool");
|
||||
|
||||
for (p=0; p<2000; p++) {
|
||||
die(mps_alloc(&q, pool, 1024*1024), "alloc");
|
||||
q = (mps_addr_t) ((char *) q + 8);
|
||||
mps_free(pool, q, 256*1024-8);
|
||||
report("promise", "%i", p);
|
||||
}
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
easy_tramp(test);
|
||||
pass();
|
||||
return 0;
|
||||
}
|
||||
34
mps/qa/function/22.c
Normal file
34
mps/qa/function/22.c
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/* test allocate large promise, make it small, repeat interleaved
|
||||
language c
|
||||
link testlib.o
|
||||
*/
|
||||
|
||||
#include "testlib.h"
|
||||
#include "mpscmv.h"
|
||||
|
||||
static void test(void) {
|
||||
mps_space_t space;
|
||||
mps_pool_t pool;
|
||||
mps_addr_t q, r;
|
||||
int p;
|
||||
|
||||
die(mps_space_create(&space), "create");
|
||||
|
||||
die(mps_pool_create(&pool, space, mps_class_mv(),
|
||||
1024*32, 1024*16, 1024*256), "pool");
|
||||
|
||||
die(mps_alloc(&q, pool, 1024*1024), "alloc");
|
||||
|
||||
for (p=0; p<2000; p++) {
|
||||
report("promise", "%i", p);
|
||||
die(mps_alloc(&r, pool, 1024*1024), "alloc");
|
||||
mps_free(pool, q, 256*1024-8);
|
||||
q = (mps_addr_t) ((char *) r + 8);
|
||||
}
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
easy_tramp(test);
|
||||
pass();
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue