diff mbox

ndctl: fix "skip" reporting when nfit_test modules are missing

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

Commit Message

Dan Williams Sept. 11, 2015, 12:20 a.m. UTC
If the kernel headers report the kernel version is capable of running
the tests, but the nfit_test infrastructure is not found, don't report
"PASS".  Add ndctl_test_skip() as an explicit skip for reasons outside
of incompatible kernel version.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 lib/test-core.c        |    7 +++++++
 lib/test-core.h        |    2 ++
 lib/test-dpa-alloc.c   |    1 +
 lib/test-libndctl.c    |    1 +
 lib/test-parent-uuid.c |    1 +
 5 files changed, 12 insertions(+)

Comments

Ross Zwisler Sept. 11, 2015, 3:25 p.m. UTC | #1
On Thu, Sep 10, 2015 at 08:20:21PM -0400, Dan Williams wrote:
> If the kernel headers report the kernel version is capable of running
> the tests, but the nfit_test infrastructure is not found, don't report
> "PASS".  Add ndctl_test_skip() as an explicit skip for reasons outside
> of incompatible kernel version.
> 
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>

Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
diff mbox

Patch

diff --git a/lib/test-core.c b/lib/test-core.c
index 932c2dd246f5..4733e0fb424e 100644
--- a/lib/test-core.c
+++ b/lib/test-core.c
@@ -62,6 +62,13 @@  int __ndctl_test_attempt(struct ndctl_test *test, unsigned int kver,
 	return 0;
 }
 
+void __ndctl_test_skip(struct ndctl_test *test, const char *caller, int line)
+{
+	test->skip++;
+	test->attempt = test->skip;
+	fprintf(stderr, "%s: explicit skip %s:%d\n", __func__, caller, line);
+}
+
 int ndctl_test_get_attempted(struct ndctl_test *test)
 {
 	return test->attempt;
diff --git a/lib/test-core.h b/lib/test-core.h
index 7f13bc28441b..9129871be43e 100644
--- a/lib/test-core.h
+++ b/lib/test-core.h
@@ -6,3 +6,5 @@  int ndctl_test_get_attempted(struct ndctl_test *test);
 int __ndctl_test_attempt(struct ndctl_test *test, unsigned int kver,
 		const char *caller, int line);
 #define ndctl_test_attempt(t, v) __ndctl_test_attempt(t, v, __func__, __LINE__)
+void __ndctl_test_skip(struct ndctl_test *test, const char *caller, int line);
+#define ndctl_test_skip(t) __ndctl_test_skip(t, __func__, __LINE__)
diff --git a/lib/test-dpa-alloc.c b/lib/test-dpa-alloc.c
index 1eb278dcaf7e..dab3b882757e 100644
--- a/lib/test-dpa-alloc.c
+++ b/lib/test-dpa-alloc.c
@@ -319,6 +319,7 @@  int test_dpa_alloc(int loglevel, struct ndctl_test *test)
 			NULL, NULL, NULL, NULL);
 	if (err < 0) {
 		result = 77;
+		ndctl_test_skip(test);
 		fprintf(stderr, "%s unavailable skipping tests\n",
 				NFIT_TEST_MODULE);
 		goto err_module;
diff --git a/lib/test-libndctl.c b/lib/test-libndctl.c
index 54511994098c..b7c85371ee07 100644
--- a/lib/test-libndctl.c
+++ b/lib/test-libndctl.c
@@ -1583,6 +1583,7 @@  int test_libndctl(int loglevel, struct ndctl_test *test)
 			NULL, NULL, NULL, NULL);
 	if (err < 0) {
 		result = 77;
+		ndctl_test_skip(test);
 		fprintf(stderr, "%s unavailable skipping tests\n",
 				NFIT_TEST_MODULE);
 		goto err_module;
diff --git a/lib/test-parent-uuid.c b/lib/test-parent-uuid.c
index ed0e7f88863b..4f48717ca0f7 100644
--- a/lib/test-parent-uuid.c
+++ b/lib/test-parent-uuid.c
@@ -249,6 +249,7 @@  int test_parent_uuid(int loglevel, struct ndctl_test *test)
 			NULL, NULL, NULL, NULL);
 	if (err < 0) {
 		result = 77;
+		ndctl_test_skip(test);
 		fprintf(stderr, "%s unavailable skipping tests\n",
 				NFIT_TEST_MODULE);
 		goto err_module;