diff mbox

[ndctl,2/3] ndctl: disable nfit_test regions after test

Message ID 20160311004521.27582.16889.stgit@dwillia2-desk3.jf.intel.com (mailing list archive)
State Accepted
Commit 9562fce6c46f
Headers show

Commit Message

Dan Williams March 11, 2016, 12:45 a.m. UTC
Ensure that all nfit_test regions are disabled after a successful test
so the module can be removed.  Otherwise test/libndctl will not run
back-to-back runs in the case of "make TESTS=test/libndctl check".

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 test/libndctl.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/test/libndctl.c b/test/libndctl.c
index 2601117333a4..ca1d7515d406 100644
--- a/test/libndctl.c
+++ b/test/libndctl.c
@@ -482,11 +482,11 @@  static int check_btts(struct ndctl_region *region, struct btt **btts);
 static int check_regions(struct ndctl_bus *bus, struct region *regions, int n,
 		enum ns_mode mode)
 {
+	struct ndctl_region *region;
 	int i, rc = 0;
 
 	for (i = 0; i < n; i++) {
 		struct ndctl_interleave_set *iset;
-		struct ndctl_region *region;
 		char devname[50];
 
 		if (strcmp(regions[i].type, "pmem") == 0)
@@ -566,6 +566,10 @@  static int check_regions(struct ndctl_bus *bus, struct region *regions, int n,
 			break;
 	}
 
+	if (rc == 0)
+		ndctl_region_foreach(bus, region)
+			ndctl_region_disable_invalidate(region);
+
 	return rc;
 }