From: Pádraig Brady
Date: Thu, 21 Jun 2018 03:48:36 +0000 (-0700) Subject: tests: provide an option to relax the need for gdb X-Git-Tag: v8.30~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ac7bd90cee0584bae7d4938b1d887361ee7c8ffa;p=thirdparty%2Fcoreutils.git tests: provide an option to relax the need for gdb * tests/rm/r-root.sh: gdb provides extra protection, but is not strictly necessary. So provide an option for maintainers to relax the requirements. --- diff --git a/tests/rm/r-root.sh b/tests/rm/r-root.sh index c8a57afda2..14bd0d93ed 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=$?