From: Loic Dachary Date: Sun, 31 May 2015 13:13:52 +0000 (+0200) Subject: tests: use get_pg from ceph-helpers.sh X-Git-Tag: v9.0.2~70^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d2cc2b184b56a55e65cd5a8f9991308d87f4e759;p=ceph.git tests: use get_pg from ceph-helpers.sh The semantic and interface of get_pg are the same, that avoids duplication and the ceph-helpers.sh version is tested and documented. Make the ceph-test package dependent on xmlstarlet because it is needed by ceph-helpers.sh. Signed-off-by: Loic Dachary --- diff --git a/ceph.spec.in b/ceph.spec.in index 752311cf0ec3..041e5108787f 100644 --- a/ceph.spec.in +++ b/ceph.spec.in @@ -346,6 +346,7 @@ Summary: Ceph benchmarks and test tools Group: System Environment/Libraries License: LGPL-2.0 Requires: ceph-common +Requires: xmlstarlet %if (0%{?fedora} >= 20 || 0%{?rhel} == 6) BuildRequires: lttng-ust-devel BuildRequires: libbabeltrace-devel diff --git a/debian/control b/debian/control index 30764fd8275d..099f4b708aa3 100644 --- a/debian/control +++ b/debian/control @@ -463,7 +463,7 @@ Description: debugging symbols for rest-bench Package: ceph-test Architecture: linux-any -Depends: ceph-common, curl, xml2, ${misc:Depends}, ${shlibs:Depends} +Depends: ceph-common, curl, xml2, xmlstarlet, ${misc:Depends}, ${shlibs:Depends} Description: Ceph test and benchmarking tools This package contains tools for testing and benchmarking Ceph. diff --git a/qa/workunits/cephtool/test.sh b/qa/workunits/cephtool/test.sh index 1b57375f3f3f..09c11fd513b0 100755 --- a/qa/workunits/cephtool/test.sh +++ b/qa/workunits/cephtool/test.sh @@ -1,5 +1,7 @@ #!/bin/bash -x +source $(dirname $0)/../ceph-helpers.sh + set -e set -o functrace PS4=' ${FUNCNAME[0]}: $LINENO: ' @@ -23,23 +25,6 @@ function wait_no_osd_down() check_no_osd_down } -function get_pg() -{ - local pool obj map_output pg - pool=$1 - obj=$2 - declare -a map_output - map_output=($(ceph osd map $1 $2)) - for (( i=0; i<${#map_output[*]}; i++ )) ; do - if [ "${map_output[$i]}" == "pg" ] ; then - pg=${map_output[((i+2))]} - break - fi - done - pg=$(echo $pg | sed 's/[()]//g') - echo $pg -} - function expect_false() { set -x