mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-12 09:22:05 +00:00
93e10077ba
* Fix attaching gdb in stress tests * Fix * Update run.sh * Try remove run_with_retry * Return run_with_retry * Don't set -e in run_with_retry if it was't set before * Update tests/ci/utils.lib * Fix bash --------- Co-authored-by: Alexander Tokmakov <tavplubix@clickhouse.com>
37 lines
574 B
Bash
37 lines
574 B
Bash
#!/bin/bash
|
|
|
|
function run_with_retry()
|
|
{
|
|
if [[ $- =~ e ]]; then
|
|
set_e=true
|
|
else
|
|
set_e=false
|
|
fi
|
|
set +e
|
|
|
|
local total_retries="$1"
|
|
shift
|
|
|
|
local retry=0
|
|
|
|
until [ "$retry" -ge "$total_retries" ]
|
|
do
|
|
if "$@"; then
|
|
if $set_e; then
|
|
set -e
|
|
fi
|
|
return
|
|
else
|
|
retry=$((retry + 1))
|
|
sleep 5
|
|
fi
|
|
done
|
|
|
|
echo "Command '$*' failed after $total_retries retries, exiting"
|
|
exit 1
|
|
}
|
|
|
|
function fn_exists() {
|
|
declare -F "$1" > /dev/null;
|
|
}
|