提交 f6b83298 authored 作者: Shane Bryldt's avatar Shane Bryldt

FS-10167: Added testmmap to isolate page allocation issues under windows, vs project coming soon

上级 778190ff
...@@ -9,6 +9,11 @@ testpools_SOURCES = testpools.c tap.c ...@@ -9,6 +9,11 @@ testpools_SOURCES = testpools.c tap.c
testpools_CFLAGS = $(AM_CFLAGS) testpools_CFLAGS = $(AM_CFLAGS)
testpools_LDADD = $(TEST_LDADD) testpools_LDADD = $(TEST_LDADD)
check_PROGRAMS += testmmap
testmmap_SOURCES = testmmap.c tap.c
testmmap_CFLAGS = $(AM_CFLAGS)
testmmap_LDADD = $(TEST_LDADD)
check_PROGRAMS += testacl check_PROGRAMS += testacl
testacl_SOURCES = testacl.c tap.c testacl_SOURCES = testacl.c tap.c
testacl_CFLAGS = $(AM_CFLAGS) testacl_CFLAGS = $(AM_CFLAGS)
......
#include "ks.h"
#include "tap.h"
static ks_pool_t *pool = NULL;
#define LOOP_COUNT 1000000
ks_status_t test1()
{
int i;
void *mem, *last_mem = NULL;
for (i = 0; i < LOOP_COUNT; i++) {
if (last_mem) {
ks_pool_free(pool, &last_mem);
}
mem = ks_pool_alloc(pool, 1024);
last_mem = mem;
}
return KS_STATUS_SUCCESS;
}
int main(int argc, char **argv)
{
ks_init();
ok(ks_pool_open(&pool) == KS_STATUS_SUCCESS);
ok(test1() == KS_STATUS_SUCCESS);
ok(ks_pool_close(&pool) == KS_STATUS_SUCCESS);
ks_shutdown();
done_testing();
return 0;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论