2023-06-30 14:41:27 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-07-09 15:06:37 +00:00
|
|
|
# core.COMM.PID-TID
|
|
|
|
sysctl kernel.core_pattern='core.%e.%p-%P'
|
2024-07-10 13:45:17 +00:00
|
|
|
# ASAN doesn't work with suid_dumpable=2
|
|
|
|
sysctl fs.suid_dumpable=1
|
2024-07-09 15:06:37 +00:00
|
|
|
|
2023-06-30 14:41:27 +00:00
|
|
|
function run_with_retry()
|
|
|
|
{
|
2023-07-26 09:53:19 +00:00
|
|
|
if [[ $- =~ e ]]; then
|
|
|
|
set_e=true
|
|
|
|
else
|
|
|
|
set_e=false
|
|
|
|
fi
|
2023-06-30 14:41:27 +00:00
|
|
|
set +e
|
|
|
|
|
|
|
|
local total_retries="$1"
|
|
|
|
shift
|
|
|
|
|
|
|
|
local retry=0
|
|
|
|
|
|
|
|
until [ "$retry" -ge "$total_retries" ]
|
|
|
|
do
|
|
|
|
if "$@"; then
|
2023-07-26 09:53:19 +00:00
|
|
|
if $set_e; then
|
|
|
|
set -e
|
|
|
|
fi
|
2023-06-30 14:41:27 +00:00
|
|
|
return
|
|
|
|
else
|
|
|
|
retry=$((retry + 1))
|
|
|
|
sleep 5
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "Command '$*' failed after $total_retries retries, exiting"
|
|
|
|
exit 1
|
2023-07-02 09:52:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function fn_exists() {
|
|
|
|
declare -F "$1" > /dev/null;
|
2023-07-26 09:53:19 +00:00
|
|
|
}
|
2023-08-18 09:17:32 +00:00
|
|
|
|
2024-07-09 15:06:37 +00:00
|
|
|
function collect_core_dumps()
|
|
|
|
{
|
|
|
|
find . -type f -maxdepth 1 -name 'core.*' | while read -r core; do
|
|
|
|
zstd --threads=0 "$core"
|
|
|
|
mv "$core.zst" /test_output/
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2023-08-18 09:17:32 +00:00
|
|
|
# vi: ft=bash
|