]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: implement erasure_code_plugin_exists in ceph-helpers.sh
authorLoic Dachary <ldachary@redhat.com>
Sun, 7 Jun 2015 08:51:07 +0000 (10:51 +0200)
committerLoic Dachary <ldachary@redhat.com>
Sun, 7 Jun 2015 08:51:07 +0000 (10:51 +0200)
Return 0 if the erasure code *plugin* is available, 1 otherwise.

Signed-off-by: Loic Dachary <ldachary@redhat.com>
qa/workunits/ceph-helpers.sh

index ad04abe733a400aa8f1f2e072a159100dafa0ec2..f5a2ee405c81ebb9bfbfb1ae3f61a4e4e597b93b 100755 (executable)
@@ -1098,6 +1098,39 @@ function test_expect_failure() {
 
 #######################################################################
 
+##
+# Return 0 if the erasure code *plugin* is available, 1 otherwise.
+#
+# @param plugin erasure code plugin
+# @return 0 on success, 1 on error
+#
+
+function erasure_code_plugin_exists() {
+    local plugin=$1
+
+    local status
+    if ceph osd erasure-code-profile set TESTPROFILE plugin=$plugin 2>&1 |
+        grep "$plugin.*No such file" ; then
+        status=1
+    else
+        status=0
+        ceph osd erasure-code-profile rm TESTPROFILE
+    fi
+    return $status
+}
+
+function test_erasure_code_plugin_exists() {
+    local dir=$1
+
+    setup $dir || return 1
+    run_mon $dir a || return 1
+    erasure_code_plugin_exists jerasure || return 1
+    ! erasure_code_plugin_exists FAKE || return 1
+    teardown $dir || return 1
+}
+
+#######################################################################
+
 ##
 # Call the **run** function (which must be defined by the caller) with
 # the **dir** argument followed by the caller argument list.
@@ -1167,5 +1200,5 @@ if test "$1" = TESTS ; then
 fi
 
 # Local Variables:
-# compile-command: "cd .. ; make -j4 && test/ceph-helpers.sh TESTS # test_get_config"
+# compile-command: "cd ../../src ; make -j4 && ../qa/workunits/ceph-helpers.sh TESTS # test_get_config"
 # End: