]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test: switch to GNU sed 26318/head
authorWillem Jan Withagen <wjw@digiware.nl>
Thu, 7 Feb 2019 14:20:24 +0000 (15:20 +0100)
committerWillem Jan Withagen <wjw@digiware.nl>
Thu, 7 Feb 2019 14:20:24 +0000 (15:20 +0100)
BSD sed and GNU sed have migrated too far apart in RE evaluation
So switch for this test also to gsed.

Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
src/test/crush/crush_weights.sh

index b089c728bb919c7a3e1995d4c3873ce79cc6a4bf..bf2bf8b0baffdf1c0fdebbd8888013ff4787d3b8 100755 (executable)
@@ -2,6 +2,12 @@
 
 source $(dirname $0)/../detect-build-env-vars.sh
 
+if [ `uname` = FreeBSD ]; then
+    SED=gsed
+else
+    SED=sed
+fi
+
 read -r -d '' cm <<'EOF'
 # devices
 device 0 device0
@@ -39,7 +45,7 @@ EOF
 
 three=($(echo "$cm" | crushtool -c /dev/fd/0 --test --show-utilization \
                               --min-x 1 --max-x 1000000 --num-rep 3 | \
-  grep "device \(0\|4\)" | sed -e 's/^.*stored : \([0-9]\+\).*$/\1/'))
+  grep "device \(0\|4\)" | $SED -e 's/^.*stored : \([0-9]\+\).*$/\1/'))
 
 if test $(echo "scale=5; (10 - ${three[0]}/${three[1]}) < .75" | bc) = 1; then
     echo 3 replicas weights better distributed than they should be. 1>&2
@@ -48,7 +54,7 @@ fi
 
 one=($(echo "$cm" | crushtool -c /dev/fd/0 --test --show-utilization \
                               --min-x 1 --max-x 1000000 --num-rep 1 | \
-  grep "device \(0\|4\)" | sed -e 's/^.*stored : \([0-9]\+\).*$/\1/'))
+  grep "device \(0\|4\)" | $SED -e 's/^.*stored : \([0-9]\+\).*$/\1/'))
 
 if test $(echo "scale=5; (10 - ${one[0]}/${one[1]}) > .1 || (10 - ${one[0]}/${one[1]}) < -.1" | bc) = 1; then
     echo 1 replica not distributed as they should be. 1>&2