diff options
author | David Zafman <dzafman@redhat.com> | 2018-06-29 01:59:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-29 01:59:21 +0200 |
commit | 663d96e934293da5da9301bf4a358e289e1f64d3 (patch) | |
tree | e8963e2a7d6b3846f80bb5c73ca8f4e3048438d2 /qa/standalone | |
parent | Merge pull request #22763 from dzafman/wip-remove-sudo (diff) | |
parent | test: When possible show side-by-side diff in addition to regular diff (diff) | |
download | ceph-663d96e934293da5da9301bf4a358e289e1f64d3.tar.xz ceph-663d96e934293da5da9301bf4a358e289e1f64d3.zip |
Merge pull request #22727 from dzafman/wip-21664
qa/standalone/scrub: When possible show side-by-side diff in addition to regular diff
Reviewed-by: Kefu Chai <kchai@redhat.com>
Diffstat (limited to 'qa/standalone')
-rwxr-xr-x | qa/standalone/ceph-helpers.sh | 15 | ||||
-rwxr-xr-x | qa/standalone/scrub/osd-scrub-repair.sh | 10 | ||||
-rwxr-xr-x | qa/standalone/scrub/osd-scrub-snaps.sh | 6 |
3 files changed, 23 insertions, 8 deletions
diff --git a/qa/standalone/ceph-helpers.sh b/qa/standalone/ceph-helpers.sh index 8dce056adc7..b22b9490109 100755 --- a/qa/standalone/ceph-helpers.sh +++ b/qa/standalone/ceph-helpers.sh @@ -34,9 +34,15 @@ fi if [ `uname` = FreeBSD ]; then SED=gsed + DIFFCOLOPTS="" KERNCORE="kern.corefile" else SED=sed + 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" KERNCORE="kernel.core_pattern" fi @@ -2075,6 +2081,15 @@ function inject_eio() { done } +function multidiff() { + if ! diff $@ ; then + if [ "$DIFFCOLOPTS" = "" ]; then + return 1 + fi + diff $DIFFCOLOPTS $@ + fi +} + # Local Variables: # compile-command: "cd ../../src ; make -j4 && ../qa/standalone/ceph-helpers.sh TESTS # test_get_config" # End: diff --git a/qa/standalone/scrub/osd-scrub-repair.sh b/qa/standalone/scrub/osd-scrub-repair.sh index 51f15f6df4c..db835a2899e 100755 --- a/qa/standalone/scrub/osd-scrub-repair.sh +++ b/qa/standalone/scrub/osd-scrub-repair.sh @@ -1334,7 +1334,7 @@ function TEST_corrupt_scrub_replicated() { EOF jq "$jqfilter" $dir/json | jq '.inconsistents' | python -c "$sortkeys" > $dir/csjson - diff ${DIFFCOLOPTS} $dir/checkcsjson $dir/csjson || test $getjson = "yes" || return 1 + multidiff $dir/checkcsjson $dir/csjson || test $getjson = "yes" || return 1 if test $getjson = "yes" then jq '.' $dir/json > save1.json @@ -2562,7 +2562,7 @@ EOF EOF jq "$jqfilter" $dir/json | jq '.inconsistents' | python -c "$sortkeys" > $dir/csjson - diff ${DIFFCOLOPTS} $dir/checkcsjson $dir/csjson || test $getjson = "yes" || return 1 + multidiff $dir/checkcsjson $dir/csjson || test $getjson = "yes" || return 1 if test $getjson = "yes" then jq '.' $dir/json > save2.json @@ -3302,7 +3302,7 @@ function corrupt_scrub_erasure() { EOF jq "$jqfilter" $dir/json | jq '.inconsistents' | python -c "$sortkeys" > $dir/csjson - diff ${DIFFCOLOPTS} $dir/checkcsjson $dir/csjson || test $getjson = "yes" || return 1 + multidiff $dir/checkcsjson $dir/csjson || test $getjson = "yes" || return 1 if test $getjson = "yes" then jq '.' $dir/json > save3.json @@ -4716,7 +4716,7 @@ EOF fi jq "$jqfilter" $dir/json | jq '.inconsistents' | python -c "$sortkeys" > $dir/csjson - diff ${DIFFCOLOPTS} $dir/checkcsjson $dir/csjson || test $getjson = "yes" || return 1 + multidiff $dir/checkcsjson $dir/csjson || test $getjson = "yes" || return 1 if test $getjson = "yes" then if [ "$allow_overwrites" = "true" ] @@ -5082,7 +5082,7 @@ function TEST_corrupt_snapset_scrub_rep() { EOF jq "$jqfilter" $dir/json | jq '.inconsistents' | python -c "$sortkeys" > $dir/csjson - diff ${DIFFCOLOPTS} $dir/checkcsjson $dir/csjson || test $getjson = "yes" || return 1 + multidiff $dir/checkcsjson $dir/csjson || test $getjson = "yes" || return 1 if test $getjson = "yes" then jq '.' $dir/json > save6.json diff --git a/qa/standalone/scrub/osd-scrub-snaps.sh b/qa/standalone/scrub/osd-scrub-snaps.sh index fe2268103b4..b0f44fd7993 100755 --- a/qa/standalone/scrub/osd-scrub-snaps.sh +++ b/qa/standalone/scrub/osd-scrub-snaps.sh @@ -207,7 +207,7 @@ function TEST_scrub_snaps() { EOF jq "$jqfilter" $dir/json | python -c "$sortkeys" > $dir/csjson - diff ${DIFFCOLOPTS} $dir/checkcsjson $dir/csjson || test $getjson = "yes" || return 1 + multidiff $dir/checkcsjson $dir/csjson || test $getjson = "yes" || return 1 rados list-inconsistent-snapset $pgid > $dir/json || return 1 @@ -652,7 +652,7 @@ EOF EOF jq "$jqfilter" $dir/json | python -c "$sortkeys" > $dir/csjson - diff ${DIFFCOLOPTS} $dir/checkcsjson $dir/csjson || test $getjson = "yes" || return 1 + multidiff $dir/checkcsjson $dir/csjson || test $getjson = "yes" || return 1 if test $getjson = "yes" then jq '.' $dir/json > save1.json @@ -1100,7 +1100,7 @@ EOF fi jq "$jqfilter" $dir/json | python -c "$sortkeys" > $dir/csjson - diff ${DIFFCOLOPTS} $dir/checkcsjson $dir/csjson || test $getjson = "yes" || return 1 + multidiff $dir/checkcsjson $dir/csjson || test $getjson = "yes" || return 1 if test $getjson = "yes" then jq '.' $dir/json > save1.json |