]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test: Make screencandy optional for FreeBSD 15444/head
authorWillem Jan Withagen <wjw@digiware.nl>
Sat, 3 Jun 2017 11:09:59 +0000 (13:09 +0200)
committerWillem Jan Withagen <wjw@digiware.nl>
Wed, 14 Jun 2017 10:40:55 +0000 (12:40 +0200)
 - FreeBSD diff does not have a side-by-side with termwidth
   So differentiate for that

Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
qa/workunits/ceph-helpers.sh
src/test/osd/osd-scrub-repair.sh
src/test/osd/osd-scrub-snaps.sh

index 2e9a5d47d1d80d42e94645f14e7b72b0a08c8971..bb681bf440e9752d0c2d31f4571e9098b35ecc5c 100755 (executable)
@@ -29,11 +29,18 @@ else
        echo "Missing xmlstarlet binary!"
        exit 1
 fi
+
 if [ `uname` = FreeBSD ]; then
     SED=gsed
+    DIFFCOLOPTS=""
 else
     SED=sed
-fi 
+    termwidth=$(stty -a | head -1 | sed -e 's/.*columns \([0-9]*\).*/\1/')
+    if [ -n "$termwidth" -a "$termwidth" != "0" ]; then 
+        termwidth="-W ${termwidth}" 
+    fi
+    DIFFCOLOPTS="-y $termwidth"
+fi
 
 #! @file ceph-helpers.sh
 #  @brief Toolbox to manage Ceph cluster dedicated to testing
index eb2bef526e39c5574bba1447809bcccd71219a8d..6594e730eb07394a99af5a846438c0d339dc03f1 100755 (executable)
@@ -21,9 +21,6 @@ source $CEPH_ROOT/qa/workunits/ceph-helpers.sh
 # Set to "yes" in order to ignore diff errors and save results to update test
 getjson="no"
 
-termwidth=$(stty -a | head -1 | sed -e 's/.*columns \([0-9]*\).*/\1/')
-if test -n "$termwidth" -a "$termwidth" != "0"; then termwidth="-W ${termwidth}"; fi
-
 # Ignore the epoch and filter out the attr '_' value because it has date information and won't match
 jqfilter='.inconsistents | (.[].shards[].attrs[] | select(.name == "_") | .value) |= "----Stripped-by-test----"'
 sortkeys='import json; import sys ; JSON=sys.stdin.read() ; ud = json.loads(JSON) ; print json.dumps(ud, sort_keys=True, indent=2)'
@@ -921,7 +918,7 @@ function TEST_corrupt_scrub_replicated() {
 EOF
 
     jq "$jqfilter" $dir/json | python -c "$sortkeys" | sed -e "$sedfilter" > $dir/csjson
-    diff -y $termwidth $dir/checkcsjson $dir/csjson || test $getjson = "yes" || return 1
+    diff ${DIFFCOLOPTS} $dir/checkcsjson $dir/csjson || test $getjson = "yes" || return 1
     if test $getjson = "yes"
     then
         jq '.' $dir/json > save1.json
@@ -1555,7 +1552,7 @@ EOF
 EOF
 
     jq "$jqfilter" $dir/json | python -c "$sortkeys" | sed -e "$sedfilter" > $dir/csjson
-    diff -y $termwidth $dir/checkcsjson $dir/csjson || test $getjson = "yes" || return 1
+    diff ${DIFFCOLOPTS} $dir/checkcsjson $dir/csjson || test $getjson = "yes" || return 1
     if test $getjson = "yes"
     then
         jq '.' $dir/json > save2.json
index 1cd9b562e4c79a20c67cb053e304cf96df3b9bd7..5328e5e009e30db4d37da7676ad1dcae74532750 100755 (executable)
@@ -400,7 +400,7 @@ function TEST_scrub_snaps() {
 EOF
 
     jq "$jqfilter" $dir/json | python -c "$sortkeys" > $dir/csjson
-    diff -y $dir/checkcsjson $dir/csjson || return 1
+    diff ${DIFFCOLOPTS} $dir/checkcsjson $dir/csjson || return 1
 
     if which jsonschema > /dev/null;
     then