coreutils
[Top][All Lists]
Advanced

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

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


From: Bernhard Voelker
Subject: Re: [PATCH] tests: provide an option to relax the need for gdb
Date: Thu, 21 Jun 2018 08:18:34 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

On 06/21/2018 05:52 AM, Pádraig Brady wrote:
> * 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

Wouldn't it be even more flexible if the we'd set USE_GDB=0 instead
of skip_?

BTW: setting USE_GDB=0 unveils:

  ./tests/rm/r-root.sh: line 222: test: =: unary operator expected

The variable 'fail' should be initialized:

  test $fail = 1 && { cat out; cat err; Exit $fail; }

... *BUT* it seems that we have more cases like that:

  $ grep -F 'unary operator expected' tests/*/*.log | sort -u | wc -l
  15

Maybe we should initialize 'fail' in a central place?

Thanks & have a nice day,
Berny



reply via email to

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