diff mbox series

[ndctl,1/4] test/dax.sh: Fix failure reporting / handling

Message ID 157150318391.3940762.7285126205451065448.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State New, archived
Headers show
Series test/dax.sh: Add huge page fault validation | expand

Commit Message

Dan Williams Oct. 19, 2019, 4:39 p.m. UTC
Instrument the cleanup() function rather than the err() function to
handle run_test() failures. This ensures umount runs and reports the
line number of the test rather than the line number internal to
run_test().

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 test/dax.sh |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/test/dax.sh b/test/dax.sh
index 3bb44ac0a26c..b8eb4ce54e10 100755
--- a/test/dax.sh
+++ b/test/dax.sh
@@ -33,7 +33,7 @@  run_test() {
 	if ! ./dax-pmd $MNT/$FILE; then
 		rc=$?
 		if [ $rc -ne 77 -a $rc -ne 0 ]; then
-			err
+			cleanup $1
 		fi
 	fi
 }
@@ -50,7 +50,7 @@  rc=1
 mkfs.ext4 -b 4096 /dev/$blockdev
 mount /dev/$blockdev $MNT -o dax
 fallocate -l 1GiB $MNT/$FILE
-run_test
+run_test $LINENO
 umount $MNT
 
 # convert pmem to put the memmap on the device
@@ -62,7 +62,7 @@  eval $(json2var <<< "$json")
 mkfs.ext4 -b 4096 /dev/$blockdev
 mount /dev/$blockdev $MNT -o dax
 fallocate -l 1GiB $MNT/$FILE
-run_test
+run_test $LINENO
 umount $MNT
 
 json=$($NDCTL create-namespace -m raw -f -e $dev)
@@ -72,7 +72,7 @@  eval $(json2var <<< "$json")
 mkfs.xfs -f /dev/$blockdev -m reflink=0
 mount /dev/$blockdev $MNT -o dax
 fallocate -l 1GiB $MNT/$FILE
-run_test
+run_test $LINENO
 umount $MNT
 
 # convert pmem to put the memmap on the device
@@ -83,7 +83,7 @@  eval $(json2var <<< "$json")
 mkfs.xfs -f /dev/$blockdev -m reflink=0
 mount /dev/$blockdev $MNT -o dax
 fallocate -l 1GiB $MNT/$FILE
-run_test
+run_test $LINENO
 umount $MNT
 
 # revert namespace to raw mode