summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTimur Alperovich <timuralp@swiftstack.com>2016-03-07 15:02:53 -0800
committerTimur Alperovich <timuralp@swiftstack.com>2016-03-08 22:06:19 -0800
commitc7a94df0724af30b26e3856f9c14344fc9b73a09 (patch)
tree62d1f0b4d5de236303a9c7f659eb48f916ed0f50 /test
parent1785a5894151a8422020516797655be4024dc12b (diff)
downloadliberasurecode-c7a94df0724af30b26e3856f9c14344fc9b73a09.tar.gz
Add a method to check if a backend is present.
Uses dlopen to check if a backend is present. This may be used by consumers who need to check which backends are present on a system. Issue #23
Diffstat (limited to 'test')
-rw-r--r--test/liberasurecode_test.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/liberasurecode_test.c b/test/liberasurecode_test.c
index e8b3179..8ee84c4 100644
--- a/test/liberasurecode_test.c
+++ b/test/liberasurecode_test.c
@@ -471,6 +471,16 @@ static void test_create_and_destroy_backend(
assert(0 == liberasurecode_instance_destroy(desc));
}
+static void test_backend_available(ec_backend_id_t be_id) {
+ assert(1 == liberasurecode_backend_available(be_id));
+}
+
+static void test_backend_available_invalid_args(ec_backend_id_t be_id)
+{
+ int ret = liberasurecode_backend_available(EC_BACKENDS_MAX);
+ assert(ret < 0);
+}
+
static void test_create_backend_invalid_args()
{
int desc = liberasurecode_instance_create(-1, &null_args);
@@ -1522,6 +1532,14 @@ static void test_verify_stripe_metadata_frag_idx_invalid(
//static void test_verify_str
struct testcase testcases[] = {
+ {"test_backend_available_invalid_args",
+ test_backend_available_invalid_args,
+ EC_BACKENDS_MAX, 0,
+ .skip = false},
+ {"test_backend_available",
+ test_backend_available,
+ EC_BACKEND_NULL, 0,
+ .skip = false},
{"test_create_backend_invalid_args",
test_create_backend_invalid_args,
EC_BACKENDS_MAX, CHKSUM_TYPES_MAX,