Skip to content

Commit

Permalink
test: fix pmem_is_pmem test
Browse files Browse the repository at this point in the history
The pmem_is_pmem function works properly only if the mapping has been
created using pmem_map_file.
  • Loading branch information
plebioda committed Jan 31, 2018
1 parent d652a22 commit 9c80075
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/test/pmem_is_pmem/pmem_is_pmem.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2017, Intel Corporation
* Copyright 2014-2018, Intel Corporation
* Copyright (c) 2016, Microsoft Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -66,16 +66,8 @@ main(int argc, char *argv[])
if (argc == 3)
UT_ASSERTeq(os_setenv("PMEM_IS_PMEM_FORCE", argv[2], 1), 0);

int fd = OPEN(argv[1], O_RDWR);

os_stat_t stbuf;
FSTAT(fd, &stbuf);

Size = stbuf.st_size;
Addr = MMAP(NULL, stbuf.st_size, PROT_READ|PROT_WRITE, MAP_SHARED, fd,
0);

CLOSE(fd);
Addr = pmem_map_file(argv[1], 0, 0, 0, &Size, NULL);
UT_ASSERTne(Addr, NULL);

os_thread_t threads[NTHREAD];
int ret[NTHREAD];
Expand Down

0 comments on commit 9c80075

Please sign in to comment.