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

This commit is contained in:
Shane Bryldt 2017-03-27 09:11:23 -05:00
parent 778190ffaf
commit f6b8329827
2 changed files with 44 additions and 0 deletions

View File

@ -9,6 +9,11 @@ testpools_SOURCES = testpools.c tap.c
testpools_CFLAGS = $(AM_CFLAGS)
testpools_LDADD = $(TEST_LDADD)
check_PROGRAMS += testmmap
testmmap_SOURCES = testmmap.c tap.c
testmmap_CFLAGS = $(AM_CFLAGS)
testmmap_LDADD = $(TEST_LDADD)
check_PROGRAMS += testacl
testacl_SOURCES = testacl.c tap.c
testacl_CFLAGS = $(AM_CFLAGS)

View File

@ -0,0 +1,39 @@
#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;
}