[libvirt] PATCH: 2/4: Generic test script infrastructure

Daniel Veillard veillard at redhat.com
Wed May 28 13:40:00 UTC 2008


On Thu, May 22, 2008 at 06:28:25PM +0100, Daniel P. Berrange wrote:
> This patch adds more helper functions to the  tests/testutils.c file which
> make it trivial to verify OOM handling in our test suites.
> 
> It provides a virtTestMain() function which is the main driver. This is
> given the original argc, argv and a function callback representing the
> test suite to run.  Next, instead of a test suite defining a 'main()' 
> function itself, it calls it something else like 'mymain()', and then
> declared  VIRT_TEST_MAIN(mymain).  This will cause the test suite to be
> run via the generic helper.
> 
> In normal use the virtTestMain() function simply calls mymain() directly
> and everything runs as it does now.
> 
> If you set the VIR_TEST_OOM environment variable to a positive integer
> it'll perform OOM testing.  The value of the variable is the number of
> consequtive allocations to fails. eg VIR_TEST_OOM=1 will only fail a
> single allocation each time, while VIR_TEST_OOM=5 will fail batches 
> of 5 allocations.
> 
> As described in the previous patch, the way it works is
> 
>   -  Run  mymain()  and get a count  of allocations
> 
>   -  Foreach n in count
>         - Schedule the n'th alocation to fail
>         - Run mymain() and validate that it returns EXIT_FAILURE
> 
> So, now you can do
> 
>     VIR_TEST_OOM=1  make check
> 
> And it'll perform OOM checking on any test suite leveraging this testutils
> infrastructure. You can also do it directly on individual testsuites
> 
>     VIR_TEST_OOM=1  ./qparamstest

  okay, sounds cool. The problem is to make realistic testing while
systematic one would explodes time-wise. I guess the 1 setting is probably
sufficient


  Patch looks fine to me, +1

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard at redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/




More information about the libvir-list mailing list