mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-18 10:04:20 +03:00
tests: utils.sh arithmetic
expr is antiquated. Consider rewriting this using $((..)), ${} or [[ ]]. $ is unnecessary on arithmetic variables.
This commit is contained in:
parent
00957450eb
commit
4697937af4
@ -97,7 +97,7 @@ mkdtemp() {
|
|||||||
err=$(mkdir -m 0700 "$candidate_dir" 2>&1) && \
|
err=$(mkdir -m 0700 "$candidate_dir" 2>&1) && \
|
||||||
{ echo "$candidate_dir"; return; }
|
{ echo "$candidate_dir"; return; }
|
||||||
test $MAX_TRIES -le $i && break;
|
test $MAX_TRIES -le $i && break;
|
||||||
i=$(expr $i + 1)
|
i=$(( i + 1 ))
|
||||||
done
|
done
|
||||||
die "$err"
|
die "$err"
|
||||||
}
|
}
|
||||||
@ -114,7 +114,7 @@ stacktrace() {
|
|||||||
echo "## - $0:${BASH_LINENO[0]}"
|
echo "## - $0:${BASH_LINENO[0]}"
|
||||||
while FUNC=${FUNCNAME[$i]}; test "$FUNC" != "main"; do
|
while FUNC=${FUNCNAME[$i]}; test "$FUNC" != "main"; do
|
||||||
echo "## $i ${FUNC}() called from ${BASH_SOURCE[$i]}:${BASH_LINENO[$i]}"
|
echo "## $i ${FUNC}() called from ${BASH_SOURCE[$i]}:${BASH_LINENO[$i]}"
|
||||||
i=$(($i + 1))
|
i=$(( i + 1 ))
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ STACKTRACE() {
|
|||||||
test -f "$i" || break # nothing is found (expands to debug.log*)
|
test -f "$i" || break # nothing is found (expands to debug.log*)
|
||||||
name=${i##debug.log_}
|
name=${i##debug.log_}
|
||||||
name=${name%%_*}
|
name=${name%%_*}
|
||||||
test "$name" = "DEBUG" && { name="$name$idx" ; idx=$(($idx + 1)) ; }
|
test "$name" = "DEBUG" && { name="$name$idx" ; idx=$(( idx + 1 )) ; }
|
||||||
echo "<======== Debug log $i ========>"
|
echo "<======== Debug log $i ========>"
|
||||||
sed -e "s,^,## $name: ," "$i"
|
sed -e "s,^,## $name: ," "$i"
|
||||||
done
|
done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user