From 468a01bd6227140b3f3b37b863daac07b3487392 Mon Sep 17 00:00:00 2001 From: Willem Jan Withagen Date: Thu, 7 Feb 2019 15:20:24 +0100 Subject: [PATCH] test: switch to GNU sed 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 --- src/test/crush/crush_weights.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/test/crush/crush_weights.sh b/src/test/crush/crush_weights.sh index b089c728bb91..bf2bf8b0baff 100755 --- a/src/test/crush/crush_weights.sh +++ b/src/test/crush/crush_weights.sh @@ -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 -- 2.47.3