1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-31 05:47:43 +03:00

tests: better coredump lookup

Some bash version may have problem with contruct:
done < <(

Replace it with array reading.
This commit is contained in:
Zdenek Kabelac 2023-10-04 21:02:53 +02:00
parent e3adccb528
commit 470f1058a8

View File

@ -138,25 +138,29 @@ STACKTRACE() {
# Check for all cores newer then TESTNAME file
# Assume users keep prefix 'core'
# TODO: possibly better integrate with coredumpctl & systemd
while IFS= read -r i; do
local cores=()
local IFS=$IFS_NL
cores=( $(find . "$(dirname "$(sysctl -n kernel.core_pattern)")" \
"/var/lib/systemd/coredump/" -name 'core*' -newer TESTNAME 2>/dev/null || true ) )
for i in "${cores[@]-}"; do
bin=$(gdb -batch -c "$i" 2>&1 | grep "generated by" | \
sed -e "s,.*generated by \`\([^ ']*\).*,\1,") || continue
{
echo bt full
echo l
echo quit
} > gdb_commands.txt || rm -f gdb_commands.txt
cat > gdb_commands.txt <<- EOF || rm -f gdb_commands.txt
bt full
l
quit
EOF
if test ! -s gdb_commands.txt ; then
echo "Out of disk space, can't check coredump $i generated by $bin."
continue
echo "Out of disk space, cannot check coredump \"$i\" generated by \"$bin\"."
break
fi
echo "## Checking coredump: $i generated by $bin."
gdb -batch -c "$i" -x gdb_commands.txt "$(which "$bin")" 2>/dev/null | \
sed -e "s,^,## GDB: ," || continue
done < <(find . "$(dirname "$(sysctl -n kernel.core_pattern)")" \
"/var/lib/systemd/coredump/" -name 'core*' -newer TESTNAME 2>/dev/null || true)
done
fi
test -f SKIP_THIS_TEST && exit 200