Skip to contentSkip to conversation

test: correctly adjust rc for skip/fail

PATCH New Vishal Verma 1 participant 1 message Oct 30, 2017 libnvdimm: non-volatile memory device

lore
Share & tools
lore

Vishal Verma

author maintainer
#0 lore raw

PATCH 1/1 test: correctly adjust rc for skip/fail

The exit code for daxdev-errors and multi-dax wasn't being set correctly to distinguish a skipped test from a failure. Fix it by setting rc to 77 prior to probing for nfit_test, and to 1 after it.

---
 test/daxdev-errors.sh | 3 ++-
 test/multi-dax.sh     | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
test/daxdev-errors.sh +2 -1
index e9d9d57..d15bd82 100755
@@ -37,7 +37,6 @@ check_min_kver "4.12" || { echo "kernel $KVER lacks dax dev error handling"; exi
 
 set -e
 trap 'err $LINENO' ERR
-rc=1
 
 # setup (reset nfit_test dimms)
 modprobe nfit_test
@@ -45,6 +44,8 @@ $NDCTL disable-region $BUS all
 $NDCTL zero-labels $BUS all
 $NDCTL enable-region $BUS all
 
+rc=1
+
 query=". | sort_by(.available_size) | reverse | .[0].dev"
 region=$($NDCTL list $BUS -t pmem -Ri | jq -r "$query")
 
test/multi-dax.sh +2 -1
index 751f16f..d70ce69 100755
@@ -20,7 +20,6 @@ json2var="s/[{}\",]//g; s/:/=/g"
 rc=77
 
 err() {
-	rc=1
 	echo "test/multi-dax: failed at line $1"
 	exit $rc
 }
@@ -45,6 +44,8 @@ $NDCTL disable-region $BUS all
 $NDCTL zero-labels $BUS all
 $NDCTL enable-region $BUS all
 
+rc=1
+
 query=". | sort_by(.available_size) | reverse | .[0].dev"
 region=$($NDCTL list $BUS -t pmem -Ri | jq -r "$query")
 
Signature · 6 lines
2.9.5

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm