Skip to content

Commit

Permalink
Merge pull request twitter#74 from TomekIdczak97/mmap
Browse files Browse the repository at this point in the history
mmap address change
  • Loading branch information
michalbiesek authored Sep 16, 2019
2 parents 6777c82 + de7194e commit fecb51f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion test/storage/slab_pmem/check_slab_pmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
slab_options_st options = { SLAB_OPTION(OPTION_INIT) };
slab_metrics_st metrics = { SLAB_METRIC(METRIC_INIT) };

static uint32_t pagesize;

extern delta_time_i max_ttl;

/*
Expand Down Expand Up @@ -71,7 +73,6 @@ static void
test_reset_addr_change(int un)
{
void *pmem_addr = test_get_pmem_mapping_addr();
uint32_t pagesize = (uint32_t)sysconf(_SC_PAGESIZE);

test_teardown(un);

Expand Down Expand Up @@ -950,8 +951,13 @@ START_TEST(test_evict_lru_basic)
ck_assert_msg(item_get(&key[2]) != NULL,
"item 2 not found");

void *pmem_addr = test_get_pmem_mapping_addr();
test_teardown(0);
void *rearrange_pool_mapping_addr = mmap(pmem_addr, pagesize, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
ck_assert_msg(rearrange_pool_mapping_addr == pmem_addr,
"Address mapped is not in range of previous pmem datapool mapping");
slab_setup(&options, &metrics);
munmap(rearrange_pool_mapping_addr, pagesize);

ck_assert_msg(item_get(&key[0]) == NULL,
"item 0 found afer restart, expected to be evicted");
Expand Down Expand Up @@ -1042,8 +1048,13 @@ START_TEST(test_evict_refcount)

item_insert(it, &key); /* clears slab refcount, can be evicted */

void *pmem_addr = test_get_pmem_mapping_addr();
test_teardown(0);
void *rearrange_pool_mapping_addr = mmap(pmem_addr, pagesize, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
ck_assert_msg(rearrange_pool_mapping_addr == pmem_addr,
"Address mapped is not in range of previous pmem datapool mapping");
slab_setup(&options, &metrics);
munmap(rearrange_pool_mapping_addr, pagesize);

status = item_reserve(&nit, &key, &val, val.len, 0, INT32_MAX);
ck_assert_msg(status == ITEM_OK, "item_reserve not OK - return status %d", status);
Expand Down Expand Up @@ -1497,6 +1508,7 @@ static Suite *
slab_suite(void)
{
Suite *s = suite_create(SUITE_NAME);
pagesize = (uint32_t)sysconf(_SC_PAGESIZE);

/* basic item */
TCase *tc_item = tcase_create("item api");
Expand Down

0 comments on commit fecb51f

Please sign in to comment.