coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] tests: fix false failure due to gdb inline function handling


From: Pádraig Brady
Subject: [PATCH] tests: fix false failure due to gdb inline function handling
Date: Sun, 8 Dec 2013 21:59:28 +0000

Inline functions are awkward to breakpoint as mentioned at:
https://sourceware.org/bugzilla/show_bug.cgi?id=10738
The normal case here was for the breakpoint on the inline function
to fail, resulting in a 10s delay before skipping the test.
However on GCC 4.7.2 on ppc64 at least it was seen that
the test failed erroneously due to the breakpoint being successfully
set on an "out of line" function, but an inline function was
actually being called.

* tests/tail-2/inotify-race.sh: Switch to a line based breakpoint,
rather than a symbol base one, which avoids issues with breakpoints
on inline functions.  Also skip_ on the initial breakpoint check
in case the breakpoint is not traversed which would be the case
on remote file systems for example.
---
 tests/tail-2/inotify-race.sh |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/tests/tail-2/inotify-race.sh b/tests/tail-2/inotify-race.sh
index cc0f61b..53c7a7c 100755
--- a/tests/tail-2/inotify-race.sh
+++ b/tests/tail-2/inotify-race.sh
@@ -37,13 +37,17 @@ case $(cat gdb.out) in
     *) skip_ "can't run gdb";;
 esac
 
+break_src="$abs_top_builddir/src/tail.c"
+break_line=$(grep -n ^tail_forever_inotify "$break_src") || framework_failure_
+break_line=$(echo "$break_line" | cut -d: -f1) || framework_failure_
+
 # See if gdb works and
-# tail_forever_inotify is compiled and not inlined
+# tail_forever_inotify is compiled and run
 timeout 10s gdb -nx --batch-silent                 \
-    --eval-command='break tail_forever_inotify'    \
+    --eval-command="break $break_line"             \
     --eval-command='run -f file'                   \
     --eval-command='quit'                          \
-    tail < /dev/null > gdb.out 2>&1
+    tail < /dev/null > gdb.out 2>&1 || skip_ 'breakpoint not hit'
 
 # FIXME: The above is seen to _intermittently_ fail with:
 # warning: .dynamic section for "/lib/libc.so.6" is not at the expected address
@@ -54,9 +58,9 @@ test -s gdb.out && { cat gdb.out; skip_ "can't set 
breakpoints in tail"; }
 # inotify initialization, and then continue.  Before the fix,
 # that just-appended line would never be output.
 timeout 10s gdb -nx --batch-silent                 \
-    --eval-command='break tail_forever_inotify'    \
+    --eval-command="break $break_line"             \
     --eval-command='run -f file >> tail.out'       \
-    --eval-command="shell echo never-seen-with-tail-7.5 >> file" \
+    --eval-command='shell echo never-seen-with-tail-7.5 >> file' \
     --eval-command='continue'                      \
     --eval-command='quit'                          \
     tail < /dev/null > /dev/null 2>&1 &
-- 
1.7.7.6




reply via email to

[Prev in Thread] Current Thread [Next in Thread]