[ndctl,4/4] test/dax.sh: Split into ext4 and xfs tests
diff mbox series

Message ID 157150319928.3940762.16493495662939393302.stgit@dwillia2-desk3.amr.corp.intel.com
State New
Headers show
Series
  • test/dax.sh: Add huge page fault validation
Related show

Commit Message

Dan Williams Oct. 19, 2019, 4:39 p.m. UTC
Given the test can fail based on the fs make it a passed in parameter
and split the tests.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 test/Makefile.am |    3 +-
 test/dax-ext4.sh |    1 +
 test/dax-xfs.sh  |    1 +
 test/dax.sh      |  101 +++++++++++++++++++++++++++++++-----------------------
 4 files changed, 62 insertions(+), 44 deletions(-)
 create mode 120000 test/dax-ext4.sh
 create mode 120000 test/dax-xfs.sh

Patch
diff mbox series

diff --git a/test/Makefile.am b/test/Makefile.am
index ffbe8a3d7e34..3612e58d46b6 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -48,7 +48,8 @@  TESTS +=\
 	pmem-ns \
 	sub-section.sh \
 	dax-dev \
-	dax.sh \
+	dax-ext4.sh \
+	dax-xfs.sh \
 	device-dax \
 	device-dax-fio.sh \
 	daxctl-devices.sh \
diff --git a/test/dax-ext4.sh b/test/dax-ext4.sh
new file mode 120000
index 000000000000..da4ec437a92a
--- /dev/null
+++ b/test/dax-ext4.sh
@@ -0,0 +1 @@ 
+dax.sh
\ No newline at end of file
diff --git a/test/dax-xfs.sh b/test/dax-xfs.sh
new file mode 120000
index 000000000000..da4ec437a92a
--- /dev/null
+++ b/test/dax-xfs.sh
@@ -0,0 +1 @@ 
+dax.sh
\ No newline at end of file
diff --git a/test/dax.sh b/test/dax.sh
index e5945fc3e335..ed1738d58bb7 100755
--- a/test/dax.sh
+++ b/test/dax.sh
@@ -58,6 +58,56 @@  run_test() {
 	fi
 }
 
+run_ext4() {
+	mkfs.ext4 -b 4096 /dev/$blockdev
+	mount /dev/$blockdev $MNT -o dax
+	fallocate -l 1GiB $MNT/$FILE
+	run_test $LINENO
+	umount $MNT
+
+	# convert pmem to put the memmap on the device
+	json=$($NDCTL create-namespace -m fsdax -M dev -f -e $dev)
+	eval $(json2var <<< "$json")
+	[ $mode != "fsdax" ] && echo "fail: $LINENO" &&  exit 1
+	#note the blockdev returned from ndctl create-namespace lacks the /dev prefix
+
+	mkfs.ext4 -b 4096 /dev/$blockdev
+	mount /dev/$blockdev $MNT -o dax
+	fallocate -l 1GiB $MNT/$FILE
+	run_test $LINENO
+	umount $MNT
+	json=$($NDCTL create-namespace -m raw -f -e $dev)
+
+	eval $(json2var <<< "$json")
+	[ $mode != "fsdax" ] && echo "fail: $LINENO" &&  exit 1
+	true
+}
+
+run_xfs() {
+	mkfs.xfs -f -d su=2m,sw=1,agcount=2 -m reflink=0 /dev/$blockdev
+	mount /dev/$blockdev $MNT -o dax
+	fallocate -l 1GiB $MNT/$FILE
+	run_test $LINENO
+	umount $MNT
+
+	# convert pmem to put the memmap on the device
+	json=$($NDCTL create-namespace -m fsdax -M dev -f -e $dev)
+	eval $(json2var <<< "$json")
+	[ $mode != "fsdax" ] && echo "fail: $LINENO" &&  exit 1
+	mkfs.xfs -f -d su=2m,sw=1,agcount=2 -m reflink=0 /dev/$blockdev
+
+	mount /dev/$blockdev $MNT -o dax
+	fallocate -l 1GiB $MNT/$FILE
+	run_test $LINENO
+	umount $MNT
+	# revert namespace to raw mode
+
+	json=$($NDCTL create-namespace -m raw -f -e $dev)
+	eval $(json2var <<< "$json")
+	[ $mode != "fsdax" ] && echo "fail: $LINENO" &&  exit 1
+	true
+}
+
 set -e
 mkdir -p $MNT
 trap 'err $LINENO cleanup' ERR
@@ -67,48 +117,13 @@  json=$($NDCTL list -N -n $dev)
 eval $(json2var <<< "$json")
 rc=1
 
-mkfs.ext4 -b 4096 /dev/$blockdev
-mount /dev/$blockdev $MNT -o dax
-fallocate -l 1GiB $MNT/$FILE
-run_test $LINENO
-umount $MNT
-
-# convert pmem to put the memmap on the device
-json=$($NDCTL create-namespace -m fsdax -M dev -f -e $dev)
-eval $(json2var <<< "$json")
-[ $mode != "fsdax" ] && echo "fail: $LINENO" &&  exit 1
-
-#note the blockdev returned from ndctl create-namespace lacks the /dev prefix
-mkfs.ext4 -b 4096 /dev/$blockdev
-mount /dev/$blockdev $MNT -o dax
-fallocate -l 1GiB $MNT/$FILE
-run_test $LINENO
-umount $MNT
-
-json=$($NDCTL create-namespace -m raw -f -e $dev)
-eval $(json2var <<< "$json")
-[ $mode != "fsdax" ] && echo "fail: $LINENO" &&  exit 1
-
-mkfs.xfs -f -d su=2m,sw=1,agcount=2 -m reflink=0 /dev/$blockdev
-mount /dev/$blockdev $MNT -o dax
-fallocate -l 1GiB $MNT/$FILE
-run_test $LINENO
-umount $MNT
-
-# convert pmem to put the memmap on the device
-json=$($NDCTL create-namespace -m fsdax -M dev -f -e $dev)
-eval $(json2var <<< "$json")
-[ $mode != "fsdax" ] && echo "fail: $LINENO" &&  exit 1
-
-mkfs.xfs -f -d su=2m,sw=1,agcount=2 -m reflink=0 /dev/$blockdev
-mount /dev/$blockdev $MNT -o dax
-fallocate -l 1GiB $MNT/$FILE
-run_test $LINENO
-umount $MNT
-
-# revert namespace to raw mode
-json=$($NDCTL create-namespace -m raw -f -e $dev)
-eval $(json2var <<< "$json")
-[ $mode != "fsdax" ] && echo "fail: $LINENO" &&  exit 1
+if [ $(basename $0) = "dax-ext4.sh" ]; then
+	run_ext4
+elif [ $(basename $0) = "dax-xfs.sh" ]; then
+	run_xfs
+else
+	run_ext4
+	run_xfs
+fi
 
 exit 0