diff mbox

[ndctl] ndctl: fix 'make check' for common build environments

Message ID 20160202015915.11424.48222.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State Accepted
Commit 35ddd4ff9e50
Headers show

Commit Message

Dan Williams Feb. 2, 2016, 1:59 a.m. UTC
Given some versions of rpmbuild run 'make check' by default, be sure to
'skip' rather than 'fail' tests that are dependent on root priveleges,
kernel dependencies, or a specific hardware/firmware platform.

Reported-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Tested-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 test/create.sh |   11 +++++++++++
 test/pcommit.c |    2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/test/create.sh b/test/create.sh
index 61ffe5fcc424..b190eccfc243 100755
--- a/test/create.sh
+++ b/test/create.sh
@@ -4,15 +4,26 @@  NDCTL="./ndctl"
 BUS="-b nfit_test.0"
 json2var="s/[{}\",]//g; s/:/=/g"
 SECTOR_SIZE="4096"
+rc=77
 
 set -e
 
+err() {
+	echo "test/create: failed at line $1"
+	exit $rc
+}
+
+set -e
+trap 'err $LINENO' ERR
+
 # setup (reset nfit_test dimms)
 modprobe nfit_test
 $NDCTL disable-region $BUS all
 $NDCTL zero-labels $BUS all
 $NDCTL enable-region $BUS all
 
+rc=1
+
 # create pmem
 dev="x"
 json=$($NDCTL create-namespace $BUS -t pmem -m raw)
diff --git a/test/pcommit.c b/test/pcommit.c
index afe4fde44d22..3ef09a5074a4 100644
--- a/test/pcommit.c
+++ b/test/pcommit.c
@@ -54,7 +54,7 @@  int test_pcommit(void)
         }
 
 	fclose(cpuinfo);
-	return ENOTSUP;
+	return 77;
 }
 
 int __attribute__((weak)) main(int argc, char *argv[])