Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: minor make check cleanup #12146

Merged
4 commits merged into from
Nov 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 23 additions & 15 deletions qa/workunits/ceph-helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1082,17 +1082,19 @@ function test_is_clean() {
# @return a list of sleep delays
#
function get_timeout_delays() {
local -i timeout=$1
local -i first_step=1
local timeout=$1
local first_step=${2:-1}

local -i i
local -i total=0
for (( i = $first_step ; $total + $i <= $timeout ; i *= 2 )) ; do
local i
local total="0"
i=$first_step
while test "$(echo $total + $i \<= $timeout | bc -l)" = "1"; do
echo -n "$i "
total+=$i
total=$(echo $total + $i | bc -l)
i=$(echo $i \* 2 | bc -l)
done
if (( $total < $timeout )) ; then
echo -n $(( $timeout - $total ))
if test "$(echo $total \< $timeout | bc -l)" = "1"; then
echo -n $(echo $timeout - $total | bc -l)
fi
}

Expand All @@ -1102,6 +1104,12 @@ function test_get_timeout_delays() {
test "$(get_timeout_delays 6)" = "1 2 3" || return 1
test "$(get_timeout_delays 7)" = "1 2 4 " || return 1
test "$(get_timeout_delays 8)" = "1 2 4 1" || return 1
test "$(get_timeout_delays 1 .1)" = ".1 .2 .4 .3" || return 1
test "$(get_timeout_delays 1.5 .1)" = ".1 .2 .4 .8 " || return 1
test "$(get_timeout_delays 5 .1)" = ".1 .2 .4 .8 1.6 1.9" || return 1
test "$(get_timeout_delays 6 .1)" = ".1 .2 .4 .8 1.6 2.9" || return 1
test "$(get_timeout_delays 6.3 .1)" = ".1 .2 .4 .8 1.6 3.2 " || return 1
test "$(get_timeout_delays 20 .1)" = ".1 .2 .4 .8 1.6 3.2 6.4 7.3" || return 1
}

#######################################################################
Expand All @@ -1117,8 +1125,8 @@ function test_get_timeout_delays() {
function wait_for_clean() {
local num_active_clean=-1
local cur_active_clean
local -a delays=($(get_timeout_delays $TIMEOUT))
local -i timer=0
local -a delays=($(get_timeout_delays $TIMEOUT .1))
local -i loop=0
local num_pgs=$(get_num_pgs)
test $num_pgs != 0 || return 1

Expand All @@ -1129,16 +1137,16 @@ function wait_for_clean() {
cur_active_clean=$(get_num_active_clean)
test $cur_active_clean = $num_pgs && break
if test $cur_active_clean != $num_active_clean ; then
timer=0
loop=0
num_active_clean=$cur_active_clean
elif get_is_making_recovery_progress ; then
timer=0
elif (( $timer >= ${#delays[*]} )) ; then
loop=0
elif (( $loop >= ${#delays[*]} )) ; then
ceph report
return 1
fi
sleep ${delays[$timer]}
timer+=1
sleep ${delays[$loop]}
loop+=1
done
return 0
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/osd/osd-scrub-repair.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ source $CEPH_ROOT/qa/workunits/ceph-helpers.sh
getjson="no"

termwidth=$(stty -a | head -1 | sed -e 's/.*columns \([0-9]*\).*/\1/')
if test -n "$termwidth" ; then termwidth="-W ${termwidth}"; fi
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----"'
Expand Down