Re: [PATCH 4/4] t/zbd: make the test script easier to terminate

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

 



On 2020/05/26 6:33, Dmitry Fomichev wrote:
> Very often, it takes more than one ^C to terminate test-zbd-support
> script. Just a single ^C does end the test that is currently being
> executed, but then the script proceeds to the next test. This commit
> adds a simple signal handler to exit the test loop after receiving
> a Ctrl-C.
> 
> Signed-off-by: Dmitry Fomichev <dmitry.fomichev@xxxxxxx>
> ---
>  t/zbd/test-zbd-support | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/t/zbd/test-zbd-support b/t/zbd/test-zbd-support
> index 51b05dfd..4001be3b 100755
> --- a/t/zbd/test-zbd-support
> +++ b/t/zbd/test-zbd-support
> @@ -940,6 +940,9 @@ else
>  fi
>  rc=0
>  
> +intr=0
> +trap 'intr=1' SIGINT
> +
>  for test_number in "${tests[@]}"; do
>      rm -f "${logfile}.${test_number}"
>      echo -n "Running test $(printf "%02d" $test_number) ... "
> @@ -955,6 +958,7 @@ for test_number in "${tests[@]}"; do
>      fi
>      echo -e "$cc_status"
>      echo "$status" >> "${logfile}.${test_number}"
> +    [ $intr -ne 0 ] && exit 1
>  done
>  
>  echo "$passed tests passed"
> 

Looks good to me.

Reviewed-by: Damien Le Moal <damien.lemoal@xxxxxxx>

-- 
Damien Le Moal
Western Digital Research




[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux