Make test-checks.sh helpful and cargo-for-all-lock-files.sh useful (#10906)

This commit is contained in:
Ryo Onodera
2020-07-03 18:08:12 +09:00
committed by GitHub
parent 8d951776ab
commit d8106ab552
2 changed files with 19 additions and 7 deletions

View File

@ -8,6 +8,9 @@ while [[ -n $1 ]]; do
escape_marker=found
shift
break
elif [[ $1 = "--ignore-exit-code" ]]; then
ignore=1
shift
else
shifted_args+=("$1")
shift
@ -33,9 +36,17 @@ for lock_file in $files; do
if [[ -n $CI ]]; then
echo "--- [$lock_file]: cargo " "${shifted_args[@]}" "$@"
fi
(
set -x
cd "$(dirname "$lock_file")"
cargo "${shifted_args[@]}" "$@"
)
if (set -x && cd "$(dirname "$lock_file")" && cargo "${shifted_args[@]}" "$@"); then
# noop
true
else
failed_exit_code=$?
if [[ -n $ignore ]]; then
echo "$0: WARN: ignoring last cargo command failed exit code as requested:" $failed_exit_code
true
else
exit $failed_exit_code
fi
fi
done