Skip to content

Commit

Permalink
test: disable PMEM_FS_DIR_FORCE_PMEM on PMEM fs
Browse files Browse the repository at this point in the history
If PMEM_FS_DIR_FORCE_PMEM is set to 1 the pmem_is_pmem will not check
if the mapping has been created with MAP_SYNC. This patch reports an
error if this variable is set to 1 AND the PMEM_FS_DIR supports
MAP_SYNC.
  • Loading branch information
plebioda committed Feb 8, 2018
1 parent f63453b commit 292238b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
12 changes: 12 additions & 0 deletions src/test/RUNTESTS
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,18 @@ verbose_tests=
[ -n "$KEEP_GOING" ] && keep_going=$KEEP_GOING
[ -n "$VERBOSE_TESTS" ] && verbose_tests="$VERBOSE_TESTS"


PMEMDETECT="tools/pmemdetect/pmemdetect.static-nondebug"

if [ "$PMEM_FS_DIR_FORCE_PMEM" = "1" ]; then
if $PMEMDETECT -s $PMEM_FS_DIR; then
echo "error: PMEM_FS_DIR_FORCE_PMEM variable is set but PMEM_FS_DIR [" $PMEM_FS_DIR "] supports MAP_SYNC"
echo "Setting this flag prevents from testing an integration between pmem_map_file and pmem_is_pmem."
echo "If you want to ignore this error, please set PMEM_FS_DIR_FORCE_PMEM=2."
exit 1
fi
fi

#
# command-line argument processing...
#
Expand Down
12 changes: 9 additions & 3 deletions src/test/testconfig.sh.example
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,15 @@
NON_PMEM_FS_DIR=/tmp

#
# If you don't have real PMEM or PMEM emulation set up, but still want to test
# PMEM codepaths uncomment this line. It will set PMEM_IS_PMEM_FORCE to 1 for
# tests that require pmem.
# If you don't have real PMEM or PMEM emulation set up and/or the filesystem
# does not support MAP_SYNC flag, but still want to test PMEM codepaths
# uncomment this line. It will set PMEM_IS_PMEM_FORCE to 1 for tests that
# require pmem.
#
# Setting this flag to 1, if the PMEM_FS_DIR filesystem supports MAP_SYNC will
# cause an error. This flag cannot be used with filesystems which support
# MAP_SYNC because it would prevent from testing the target PMEM codepaths.
# If you want to ignore this error set the value to 2.
#
#PMEM_FS_DIR_FORCE_PMEM=1

Expand Down
6 changes: 3 additions & 3 deletions src/test/unittest/unittest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ else
in
pmem)
DIR=$PMEM_FS_DIR/$DIRSUFFIX/$curtestdir$UNITTEST_NUM$SUFFIX
if [ "$PMEM_FS_DIR_FORCE_PMEM" = "1" ]; then
if [ "$PMEM_FS_DIR_FORCE_PMEM" = "1" ] || [ "$PMEM_FS_DIR_FORCE_PMEM" = "2" ]; then
export PMEM_IS_PMEM_FORCE=1
fi
;;
Expand All @@ -205,7 +205,7 @@ else
if [ "$PMEM_FS_DIR" != "" ]; then
DIR=$PMEM_FS_DIR/$DIRSUFFIX/$curtestdir$UNITTEST_NUM$SUFFIX
REAL_FS=pmem
if [ "$PMEM_FS_DIR_FORCE_PMEM" = "1" ]; then
if [ "$PMEM_FS_DIR_FORCE_PMEM" = "1" ] || [ "$PMEM_FS_DIR_FORCE_PMEM" = "2" ]; then
export PMEM_IS_PMEM_FORCE=1
fi
elif [ "$NON_PMEM_FS_DIR" != "" ]; then
Expand All @@ -226,7 +226,7 @@ else
fi

if [ -d "$PMEM_FS_DIR" ]; then
if [ "$PMEM_FS_DIR_FORCE_PMEM" = "1" ]; then
if [ "$PMEM_FS_DIR_FORCE_PMEM" = "1" ] || [ "$PMEM_FS_DIR_FORCE_PMEM" = "2" ]; then
PMEM_IS_PMEM=0
else
$PMEMDETECT "$PMEM_FS_DIR" && true
Expand Down

0 comments on commit 292238b

Please sign in to comment.