coreutils
[Top][All Lists]
Advanced

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

[PATCH] tests: provide an option to relax the need for gdb


From: Pádraig Brady
Subject: [PATCH] tests: provide an option to relax the need for gdb
Date: Wed, 20 Jun 2018 20:52:27 -0700

* tests/rm/r-root.sh: gdb provides extra protection,
but is not strictly necessary.  So provide an option
for maintainers to relax the requirements.
---
 tests/rm/r-root.sh | 36 ++++++++++++++++++++++++------------
 1 file changed, 24 insertions(+), 12 deletions(-)

diff --git a/tests/rm/r-root.sh b/tests/rm/r-root.sh
index c8a57af..14bd0d9 100755
--- a/tests/rm/r-root.sh
+++ b/tests/rm/r-root.sh
@@ -36,12 +36,18 @@ require_gcc_shared_
 # used later in the unlinkat() wrapper.
 unset CU_TEST_SKIP_EXIT
 
-# Use gdb to provide further protection by limiting calls to unlinkat().
-( timeout 10s gdb --version ) > gdb.out 2>&1
-case $(cat gdb.out) in
+# Set this to 0 if you don't have a working gdb but would
+# still like to run the test
+USE_GDB=1
+
+if test $USE_GDB = 1; then
+  # Use gdb to provide further protection by limiting calls to unlinkat().
+  ( timeout 10s gdb --version ) > gdb.out 2>&1
+  case $(cat gdb.out) in
     *'GNU gdb'*) ;;
     *) skip_ "can't run gdb";;
-esac
+  esac
+fi
 
 # Break on a line rather than a symbol, to cater for inline functions
 break_src="$abs_top_srcdir/src/remove.c"
@@ -131,14 +137,20 @@ exercise_rm_r_root ()
     skip_exit='CU_TEST_SKIP_EXIT=1'
   fi
 
-  gdb -nx --batch-silent -return-child-result                          \
-    --eval-command="set exec-wrapper                                   \
-                     env 'LD_PRELOAD=$LD_PRELOAD:./k.so' $skip_exit"   \
-    --eval-command="break '$break_line'"                               \
-    --eval-command='source bp.py'                                      \
-    --eval-command="run -rv --one-file-system $*"                      \
-    --eval-command='quit'                                              \
-    rm < /dev/null > out 2> err.t
+  if test $USE_GDB = 1; then
+    gdb -nx --batch-silent -return-child-result                                
\
+      --eval-command="set exec-wrapper                                 \
+                       env 'LD_PRELOAD=$LD_PRELOAD:./k.so' $skip_exit" \
+      --eval-command="break '$break_line'"                             \
+      --eval-command='source bp.py'                                    \
+      --eval-command="run -rv --one-file-system $*"                    \
+      --eval-command='quit'                                            \
+      rm < /dev/null > out 2> err.t
+  else
+    touch excise.break
+    env LD_PRELOAD=$LD_PRELOAD:./k.so $skip_exit \
+      rm -rv --one-file-system $* < /dev/null > out 2> err.t
+  fi
 
   ret=$?
 
-- 
2.9.3




reply via email to

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