From: Loic Dachary Date: Wed, 17 Dec 2014 06:57:34 +0000 (+0100) Subject: tests: ignore xmlstarlet extra empty lines X-Git-Tag: v0.91~51^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=023a8aca8cf66a194a59625a0e4d6f7ce2a8a601;p=ceph.git tests: ignore xmlstarlet extra empty lines With xmlstarlet 1.3.0 (which is on Ubuntu precise) xmlstarlet sel -t -m '//pg_stat/state[(contains(.,'\''active'\'') and contains(.,'\''clean'\'') and not(contains(.,'\''stale'\'')))]' -v . -n will output an extra empty line which does not show on xmlstarlet 1.5.0 (which is on Ubuntu trusty and Fedora 20). Signed-off-by: Loic Dachary --- diff --git a/src/test/ceph-helpers.sh b/src/test/ceph-helpers.sh index 70b71ec2f0cc..fc0f7cf4f824 100755 --- a/src/test/ceph-helpers.sh +++ b/src/test/ceph-helpers.sh @@ -735,8 +735,12 @@ function get_num_active_clean() { expression+="contains(.,'clean') and " expression+="not(contains(.,'stale'))" expression+=")" + # xmlstarlet 1.3.0 (which is on Ubuntu precise) + # add extra new lines that must be ignored with + # grep -v '^$' ceph --format xml pg dump pgs 2>/dev/null | \ - xmlstarlet sel -t -m "//pg_stat/state[$expression]" -v . -n | wc -l + xmlstarlet sel -t -m "//pg_stat/state[$expression]" -v . -n | \ + grep -v '^$' | wc -l } function test_get_num_active_clean() {