From: Loic Dachary Date: Sun, 7 Jun 2015 08:51:07 +0000 (+0200) Subject: tests: implement erasure_code_plugin_exists in ceph-helpers.sh X-Git-Tag: v9.0.2~31^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=deb651b61c9e9fa88eef63829a7a95a82c66555e;p=ceph.git tests: implement erasure_code_plugin_exists in ceph-helpers.sh Return 0 if the erasure code *plugin* is available, 1 otherwise. Signed-off-by: Loic Dachary --- diff --git a/qa/workunits/ceph-helpers.sh b/qa/workunits/ceph-helpers.sh index ad04abe733a..f5a2ee405c8 100755 --- a/qa/workunits/ceph-helpers.sh +++ b/qa/workunits/ceph-helpers.sh @@ -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: