This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Re: [patch] handle core file names without a pid suffix
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Tue, 07 Jan 2014 10:30:57 +0100
- Subject: Re: [patch] handle core file names without a pid suffix
On Mon, 2014-01-06 at 19:59 +0100, Matthias Klose wrote:
> The following fix is needed when /proc/sys/kernel/core_uses_pid is set
> to 0. try to rename the core file, and if it does still fail, skip the
> test.
That makes sense. Tested with core_uses_pid set to 1 or 0. And it does
the right thing now in both cases. Added a ChangeLog entry and pushed as
attached.
Thanks,
Mark
>From e922ec4e3bcd7c164a9ce424accac4394e7d5afd Mon Sep 17 00:00:00 2001
From: Matthias Klose <doko@ubuntu.com>
Date: Tue, 7 Jan 2014 10:25:29 +0100
Subject: [PATCH] tests: backtrace-subr.sh (check_native_core) should check core file name.
Needed when /proc/sys/kernel/core_uses_pid is set to 0. Try to rename
the core file, and if it does still fail, skip the test.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
tests/ChangeLog | 6 ++++++
tests/backtrace-subr.sh | 5 +++++
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 63b7bed..7e9dcf4 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,9 @@
+2014-01-07 Matthias Klose <doko@ubuntu.com>
+
+ * backtrace-subr.sh (check_native_core): Check to see if core file
+ was created without ".PID" extension, if so mv core to core.PID.
+ Skip test if no core file was created or could be found.
+
2014-01-04 Mark Wielaard <mjw@redhat.com>
* backtrace-data.c (main): Don't assert if raise returns.
diff --git a/tests/backtrace-subr.sh b/tests/backtrace-subr.sh
index e7ece91..62b873c 100644
--- a/tests/backtrace-subr.sh
+++ b/tests/backtrace-subr.sh
@@ -111,6 +111,11 @@ check_native_core()
# Skip the test if we cannot adjust core ulimit.
core="core.`ulimit -c unlimited || exit 77; set +ex; testrun ${abs_builddir}/$child --gencore; true`"
+ # see if /proc/sys/kernel/core_uses_pid is set to 0
+ if [ -f core ]; then
+ mv core "$core"
+ fi
+ if [ ! -f "$core" ]; then exit 77; fi
if [ "x$SAVED_VALGRIND_CMD" != "x" ]; then
VALGRIND_CMD="$SAVED_VALGRIND_CMD"
--
1.7.1