From: Zdenek Kabelac Date: Fri, 14 Jul 2017 18:15:55 -0400 Subject: master - tests: utils.sh looks for more dumps Message-ID: <201707142215.v6EMFtc9010268@lists01.pubmisc.prod.ext.phx2.redhat.com> List-Id: To: lvm-devel@redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=413209f3f8f35963dda8b0fbbbaaa785e44958e2 Commit: 413209f3f8f35963dda8b0fbbbaaa785e44958e2 Parent: 2154f30a996967fa192b33997704d47038b5f077 Author: Zdenek Kabelac AuthorDate: Sat Jul 15 00:12:07 2017 +0200 Committer: Zdenek Kabelac CommitterDate: Sat Jul 15 00:12:07 2017 +0200 tests: utils.sh looks for more dumps Check for core in sysctl kernel.core_pattern (assuming core prefix still) --- test/lib/utils.sh | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/test/lib/utils.sh b/test/lib/utils.sh index 61ccf9b..a0f325c 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