diff mbox

[1/2] ndctl: add TEST_SKIP constant

Message ID 1442944034-2148-1-git-send-email-ross.zwisler@linux.intel.com (mailing list archive)
State Superseded
Headers show

Commit Message

Ross Zwisler Sept. 22, 2015, 5:47 p.m. UTC
To help with readability, since "77" isn't very informative.

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
---
 builtin-test.c         | 6 +++---
 lib/blk_namespaces.c   | 2 +-
 lib/pmem_namespaces.c  | 2 +-
 lib/test-core.c        | 4 ++--
 lib/test-dpa-alloc.c   | 4 ++--
 lib/test-libndctl.c    | 4 ++--
 lib/test-parent-uuid.c | 4 ++--
 test.h                 | 4 ++++
 8 files changed, 17 insertions(+), 13 deletions(-)
diff mbox

Patch

diff --git a/builtin-test.c b/builtin-test.c
index 9c3b7a8..854984b 100644
--- a/builtin-test.c
+++ b/builtin-test.c
@@ -6,7 +6,7 @@ 
 
 static char *result(int rc)
 {
-	if (rc == 77)
+	if (rc == TEST_SKIP)
 		return "SKIP";
 	else if (rc)
 		return "FAIL";
@@ -46,12 +46,12 @@  int cmd_test(int argc, const char **argv)
 
 	rc = test_libndctl(loglevel, test);
 	fprintf(stderr, "test-libndctl: %s\n", result(rc));
-	if (rc && rc != 77)
+	if (rc && rc != TEST_SKIP)
 		return rc;
 
 	rc = test_dpa_alloc(loglevel, test);
 	fprintf(stderr, "test-dpa-alloc: %s\n", result(rc));
-	if (rc && rc != 77)
+	if (rc && rc != TEST_SKIP)
 		return rc;
 
 	rc = test_parent_uuid(loglevel, test);
diff --git a/lib/blk_namespaces.c b/lib/blk_namespaces.c
index 968af27..9a07000 100644
--- a/lib/blk_namespaces.c
+++ b/lib/blk_namespaces.c
@@ -227,7 +227,7 @@  int test_blk_namespaces(int log_level)
 	bus = ndctl_bus_get_by_provider(ctx, provider);
 	if (!bus) {
 		fprintf(stderr, "%s: failed to find NFIT-provider\n", comm);
-		rc = 77;
+		rc = TEST_SKIP;
 		goto err_nobus;
 	} else
 		fprintf(stderr, "%s: found provider: %s\n", comm,
diff --git a/lib/pmem_namespaces.c b/lib/pmem_namespaces.c
index 17c3019..2fd6e50 100644
--- a/lib/pmem_namespaces.c
+++ b/lib/pmem_namespaces.c
@@ -187,7 +187,7 @@  int test_pmem_namespaces(int log_level)
 	bus = ndctl_bus_get_by_provider(ctx, provider);
 	if (!bus) {
 		fprintf(stderr, "%s: failed to find NFIT-provider\n", comm);
-		rc = 77;
+		rc = TEST_SKIP;
 		goto err;
 	} else
 		fprintf(stderr, "%s: found provider: %s\n", comm,
diff --git a/lib/test-core.c b/lib/test-core.c
index 93d02d8..ddf059b 100644
--- a/lib/test-core.c
+++ b/lib/test-core.c
@@ -32,10 +32,10 @@  int ndctl_test_result(struct ndctl_test *test, int rc)
 		fprintf(stderr, "attempted: %d skipped: %d\n",
 				ndctl_test_get_attempted(test),
 				ndctl_test_get_skipped(test));
-	if (rc && rc != 77)
+	if (rc && rc != TEST_SKIP)
 		return rc;
 	if (ndctl_test_get_skipped(test) >= ndctl_test_get_attempted(test))
-		return 77;
+		return TEST_SKIP;
 	/* return success if no failures and at least one test not skipped */
 	return 0;
 }
diff --git a/lib/test-dpa-alloc.c b/lib/test-dpa-alloc.c
index 6fa88cc..a2ecf94 100644
--- a/lib/test-dpa-alloc.c
+++ b/lib/test-dpa-alloc.c
@@ -298,7 +298,7 @@  int test_dpa_alloc(int loglevel, struct ndctl_test *test)
 	int err, result = EXIT_FAILURE;
 
 	if (!ndctl_test_attempt(test, KERNEL_VERSION(4, 2, 0)))
-		return 77;
+		return TEST_SKIP;
 
 	err = ndctl_new(&ctx);
 	if (err < 0)
@@ -317,7 +317,7 @@  int test_dpa_alloc(int loglevel, struct ndctl_test *test)
 	err = kmod_module_probe_insert_module(mod, KMOD_PROBE_APPLY_BLACKLIST,
 			NULL, NULL, NULL, NULL);
 	if (err < 0) {
-		result = 77;
+		result = TEST_SKIP;
 		ndctl_test_skip(test);
 		fprintf(stderr, "%s unavailable skipping tests\n",
 				NFIT_TEST_MODULE);
diff --git a/lib/test-libndctl.c b/lib/test-libndctl.c
index 616b0be..88e63e0 100644
--- a/lib/test-libndctl.c
+++ b/lib/test-libndctl.c
@@ -1561,7 +1561,7 @@  int test_libndctl(int loglevel, struct ndctl_test *test)
 	int err, result = EXIT_FAILURE;
 
 	if (!ndctl_test_attempt(test, KERNEL_VERSION(4, 2, 0)))
-		return 77;
+		return TEST_SKIP;
 
 	err = ndctl_new(&ctx);
 	if (err < 0)
@@ -1581,7 +1581,7 @@  int test_libndctl(int loglevel, struct ndctl_test *test)
 	err = kmod_module_probe_insert_module(mod, KMOD_PROBE_APPLY_BLACKLIST,
 			NULL, NULL, NULL, NULL);
 	if (err < 0) {
-		result = 77;
+		result = TEST_SKIP;
 		ndctl_test_skip(test);
 		fprintf(stderr, "%s unavailable skipping tests\n",
 				NFIT_TEST_MODULE);
diff --git a/lib/test-parent-uuid.c b/lib/test-parent-uuid.c
index 042ea6b..4fd7e1f 100644
--- a/lib/test-parent-uuid.c
+++ b/lib/test-parent-uuid.c
@@ -228,7 +228,7 @@  int test_parent_uuid(int loglevel, struct ndctl_test *test)
 	int err, result = EXIT_FAILURE;
 
 	if (!ndctl_test_attempt(test, KERNEL_VERSION(4, 3, 0)))
-		return 77;
+		return TEST_SKIP;
 
 	err = ndctl_new(&ctx);
 	if (err < 0)
@@ -247,7 +247,7 @@  int test_parent_uuid(int loglevel, struct ndctl_test *test)
 	err = kmod_module_probe_insert_module(mod, KMOD_PROBE_APPLY_BLACKLIST,
 			NULL, NULL, NULL, NULL);
 	if (err < 0) {
-		result = 77;
+		result = TEST_SKIP;
 		ndctl_test_skip(test);
 		fprintf(stderr, "%s unavailable skipping tests\n",
 				NFIT_TEST_MODULE);
diff --git a/test.h b/test.h
index d58dc88..33598bb 100644
--- a/test.h
+++ b/test.h
@@ -1,5 +1,8 @@ 
 #ifndef __TEST_H__
 #define __TEST_H__
+
+#define TEST_SKIP 77
+
 struct ndctl_test;
 struct ndctl_test;
 struct ndctl_test *ndctl_test_new(unsigned int kver);
@@ -19,4 +22,5 @@  int test_libndctl(int loglevel, struct ndctl_test *test);
 int test_blk_namespaces(int loglevel);
 int test_pmem_namespaces(int loglevel);
 int test_pcommit(void);
+
 #endif /* __TEST_H__ */