From 56523bea3a211c2afe00ac8413ee9f13fc5b8031 Mon Sep 17 00:00:00 2001 From: Willem Jan Withagen Date: Sat, 3 Jun 2017 13:09:59 +0200 Subject: [PATCH] test: Make screencandy optional for FreeBSD - FreeBSD diff does not have a side-by-side with termwidth So differentiate for that Signed-off-by: Willem Jan Withagen --- qa/workunits/ceph-helpers.sh | 9 ++++++++- src/test/osd/osd-scrub-repair.sh | 7 ++----- src/test/osd/osd-scrub-snaps.sh | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/qa/workunits/ceph-helpers.sh b/qa/workunits/ceph-helpers.sh index 2e9a5d47d1d80..bb681bf440e97 100755 --- a/qa/workunits/ceph-helpers.sh +++ b/qa/workunits/ceph-helpers.sh @@ -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 diff --git a/src/test/osd/osd-scrub-repair.sh b/src/test/osd/osd-scrub-repair.sh index eb2bef526e39c..6594e730eb073 100755 --- a/src/test/osd/osd-scrub-repair.sh +++ b/src/test/osd/osd-scrub-repair.sh @@ -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 diff --git a/src/test/osd/osd-scrub-snaps.sh b/src/test/osd/osd-scrub-snaps.sh index 1cd9b562e4c79..5328e5e009e30 100755 --- a/src/test/osd/osd-scrub-snaps.sh +++ b/src/test/osd/osd-scrub-snaps.sh @@ -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 -- 2.39.5