From: Zdenek Kabelac Date: Fri, 14 Jul 2017 22:12:07 +0000 (+0200) Subject: tests: utils.sh looks for more dumps X-Git-Tag: v2_02_173~39 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=413209f3f8f35963dda8b0fbbbaaa785e44958e2;p=lvm2.git tests: utils.sh looks for more dumps Check for core in sysctl kernel.core_pattern (assuming core prefix still) --- diff --git a/test/lib/utils.sh b/test/lib/utils.sh index 61ccf9b6d..a0f325c26 100644 --- a/test/lib/utils.sh +++ b/test/lib/utils.sh @@ -140,13 +140,16 @@ STACKTRACE() { echo l echo quit } > gdb_commands.txt - # TODO: use sysctl to get 'core' position in system - for i in core*; do - test -f "$i" || break # empty globbing + + # Check for all cores newer then TESTNAME file + # Assume users keep prefix 'core' + while IFS= read -r i; do bin=$(gdb -batch -c "$i" 2>&1 | grep "generated by" | \ sed -e "s,.*generated by \`\([^ ']*\).*,\1,") || continue - gdb -batch -c "$i" -x gdb_commands.txt "$(which "$bin")" || continue - done + 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)) -name 'core*' -newer TESTNAME 2>/dev/null || true) fi test -f SKIP_THIS_TEST && exit 200