@@ -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);
@@ -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,
@@ -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,
@@ -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;
}
@@ -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);
@@ -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);
@@ -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);
@@ -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__ */
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(-)