[libvirt] [PATCH v2] [TCK] nwfilter: add a test case using concurrency

Eric Blake eblake at redhat.com
Fri Nov 19 19:09:04 UTC 2010


On 11/18/2010 04:49 AM, Stefan Berger wrote:
> V2:
>    - following Eric's suggestions from review of V1
>    - all scripts started by the main script trap on signal 2 and clean up
>    - the main program waits for all child processes to have terminated
>    - the test now requires each child process to do 10 steps:
>       - 1 VM start-destroy cycle is 1 step
>       - 50 filter changes are considered 1 step
>    - the test terminates after 3 minutes (in case the test system is
> very slow / busy) with a bail out message
> 
> Now that the existing scripts are cleaned up and my POSIX compliancy
> shell-scripting skills have temporarily:-)  improved, I am now adding a
> test case that exercises concurrency. The test case creates and destroys
> 2 VMs concurrently as well as changes their referenced filters in a
> tight loop. This kind of test previously uncovered
> 
> - deadlocks in libvirt due to lock-ordering in the nwfilter subsystem
> - libvirt termination bug in libaugeas due to doubly closed file
> descriptors and the side effects
> 
> All of these have been fixed recently.
> 
> The test script is known to run in bash, dash and ksh shells.

They are still Linux-specific (things like date +%s aren't required by
POSIX), but so is the functionality we're testing, so no need to come up
with an alternate timeout method.  I only have a couple of trivial nits:

> +  # Test runs for a maximum of 3 minutes
> +  now=`date +%s`
> +  test_end=$(($now + 3 * 60))
> +
> +  while :;
> +  do
> +    # The logs give us the number of cycles the VMs were created
> +    # and destroyed.
> +    val=$(cat "${logvm1}" 2>/dev/null | tail -n 1)

Useless use of cat.  val=$(tail -n1 "${logvm1}" 2>/dev/null)

> +    val=$(cat "${logvm2}" 2>/dev/null | tail -n 1)

Likewise.

ACK with that fixed.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20101119/72eaeb28/attachment-0001.sig>


More information about the libvir-list mailing list