[Libguestfs] [nbdkit PATCH 2/2] tests: Enhance captive test

Richard W.M. Jones rjones at redhat.com
Sat Oct 19 17:33:45 UTC 2019


On Mon, Sep 30, 2019 at 12:15:42PM -0500, Eric Blake wrote:
> Test the just-fixed bug in --run failing to detect an nbdkit assertion
> failure.
> 
> While at it, sleep less when we don't actually need to wait for the
> socket to be opened.
> 
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
>  tests/test-captive.sh | 46 +++++++++++++++++++++++++++++++++++++++----
>  1 file changed, 42 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/test-captive.sh b/tests/test-captive.sh
> index e89c387d..88c0d818 100755
> --- a/tests/test-captive.sh
> +++ b/tests/test-captive.sh
> @@ -1,6 +1,6 @@
>  #!/usr/bin/env bash
>  # nbdkit
> -# Copyright (C) 2014-2018 Red Hat Inc.
> +# Copyright (C) 2014-2019 Red Hat Inc.
>  #
>  # Redistribution and use in source and binary forms, with or without
>  # modification, are permitted provided that the following conditions are
> @@ -36,13 +36,15 @@ set -x
> 
>  # Test nbdkit --run (captive nbdkit) option.
> 
> +fail=0
> +
>  sock=`mktemp -u`
> -files="$sock captive.out"
> +files="$sock captive.out captive.pid"
>  rm -f $files
>  cleanup_fn rm -f $files
> 
>  nbdkit -U $sock example1 --run '
> -    sleep 5; echo nbd=$nbd; echo port=$port; echo socket=$unixsocket
> +    sleep 1; echo nbd=$nbd; echo port=$port; echo socket=$unixsocket
>    ' > captive.out

For some reason this test is now failing much more frequently under
load.  I can pretty easily reproduce the failure on my local 24 core
machine, especially if I use ‘make check-valgrind’, and it happens in
Koji too on the slower builders, eg:

  https://kojipkgs.fedoraproject.org//work/tasks/6571/38396571/build.log

I am planning to revert this single line from the commit for now, but
really I don't understand why it's failing because the sleep ought to
be completely unnecessary (ie. no sleep ought to work just as well).
I can't think right now why I put a sleep there in the first place ...

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v




More information about the Libguestfs mailing list