[Libguestfs] [PATCH nbdkit 2/7] tests/test-debug-flags.sh: Log the error from nbdkit unconditionally.

Eric Blake eblake at redhat.com
Thu Dec 12 17:15:58 UTC 2019


On 12/12/19 6:02 AM, Richard W.M. Jones wrote:
> Useful to print the error displayed by nbdkit in all cases, not
> just when the test fails.
> 
> Also fix the error message if the test does fail (unexpected -> expected).
> ---
>   tests/test-debug-flags.sh | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/test-debug-flags.sh b/tests/test-debug-flags.sh
> index 10e916c..88f5a22 100755
> --- a/tests/test-debug-flags.sh
> +++ b/tests/test-debug-flags.sh
> @@ -49,10 +49,9 @@ expected_failure ()
>   
>   check_error ()
>   {
> +    cat debug-flags.out
>       if ! grep -sq "$1" debug-flags.out; then
> -        echo "unexpected error message containing: $1"
> -        echo "actual output:"
> -        cat debug-flags.out
> +        echo "expected error message containing: $1"

Bike-shedding: my first read was more along the lines of "I've output 
the file, and found the expected error message that contains $1" when 
the point was that the expected error message was not present.

Maybe it reads better as one of:
"expected an error message that contains: $1"
"unexpected error message, expecting: $1"

But the sense change makes sense, as does the unconditional output of 
the file.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




More information about the Libguestfs mailing list