Commit Graph

14 Commits

Author SHA1 Message Date
Eric Blake
20986e58aa tests: simplify common setup
A few of the tests were missing basic sanity checks, while most
of them were doing copy-and-paste initialization (in fact, some
of them pasted the argc > 1 check more than once!).  It's much
nicer to do things in one common place, and minimizes the size of
the next patch that fixes getcwd usage.

* tests/testutils.h (EXIT_AM_HARDFAIL): New define.
(progname, abs_srcdir): Define for all tests.
(VIRT_TEST_MAIN): Change callback signature.
* tests/testutils.c (virtTestMain): Do more common init.
* tests/commandtest.c (mymain): Simplify.
* tests/cputest.c (mymain): Likewise.
* tests/esxutilstest.c (mymain): Likewise.
* tests/eventtest.c (mymain): Likewise.
* tests/hashtest.c (mymain): Likewise.
* tests/networkxml2xmltest.c (mymain): Likewise.
* tests/nodedevxml2xmltest.c (myname): Likewise.
* tests/nodeinfotest.c (mymain): Likewise.
* tests/nwfilterxml2xmltest.c (mymain): Likewise.
* tests/qemuargv2xmltest.c (mymain): Likewise.
* tests/qemuhelptest.c (mymain): Likewise.
* tests/qemuxml2argvtest.c (mymain): Likewise.
* tests/qemuxml2xmltest.c (mymain): Likewise.
* tests/qparamtest.c (mymain): Likewise.
* tests/sexpr2xmltest.c (mymain): Likewise.
* tests/sockettest.c (mymain): Likewise.
* tests/statstest.c (mymain): Likewise.
* tests/storagepoolxml2xmltest.c (mymain): Likewise.
* tests/storagevolxml2xmltest.c (mymain): Likewise.
* tests/virbuftest.c (mymain): Likewise.
* tests/virshtest.c (mymain): Likewise.
* tests/vmx2xmltest.c (mymain): Likewise.
* tests/xencapstest.c (mymain): Likewise.
* tests/xmconfigtest.c (mymain): Likewise.
* tests/xml2sexprtest.c (mymain): Likewise.
* tests/xml2vmxtest.c (mymain): Likewise.
2011-04-29 10:21:20 -06:00
Daniel P. Berrange
ba5c9afffa Fix statstest when driver modules are enabled
The statstest is xen specific. Instead of filling the code with
a huge number of #ifdef WITH_XEN, just make its entire compilation
conditional in the Makefile.am. Also ensure it links to the Xen
driver so that it builds when driver modules are enabled

* tests/Makefile.am: Make statstest xen conditional. Link to
  xen driver
* tests/Makefile.am: Remove all conditionals
2010-10-19 17:31:30 +01:00
Eric Blake
36d8e7d8d7 build: consistently indent preprocessor directives
* global: patch created by running:
for f in $(git ls-files '*.[ch]') ; do
    cppi $f > $f.t && mv $f.t $f
done
2010-03-09 19:22:28 +01:00
Daniel P. Berrange
e8ac4a79f1 Make test suite output less verbose
Only print out '.' for each test case, full test output can be
re-enabled with VIR_TEST_VERBOSE=1, or VIR_TEST_DEBUG=XXXX

Sample output now looks like

  TEST: statstest
        ........................................ 40
        ...................................      75  OK
  PASS: statstest
  TEST: qparamtest
        ................................         32  OK
  PASS: qparamtest
  TEST:
        ............                             12  OK
2010-01-15 16:28:05 +00:00
Cole Robinson
9710856b33 tests: Centralize VIR_TEST_DEBUG lookup, and document it
Provide a simple interface for other tests to lookup the testDebug variable.
Also remove a redundant error message in interface tests.

If anyone feels inclined to change this env variable to match the existing
LIBVIRT_* format, it should now be easier to do so.
2009-10-20 14:17:34 -04:00
Daniel P. Berrange
f7a107f73e Move xen driver code into src/xen/ directory
* src/Makefile.am, src/proxy_internal.c, src/proxy_internal.h
  src/sexpr.c, src/sexpr.h, src/xen_unified.c, src/xen_unified.h,
  src/xen_internal.c, src/xen_internal.h, src/xen_inotify.c,
  src/xen_inotify.h, src/xend_internal.c, src/xend_internal.h,
  src/xm_internal.c, src/xm_internal.h, src/xs_internal.c,
  src/xs_internal.h: Move to src/xen/ directory
* proxy/Makefile.am, proxy/libvirt_proxy.c, src/Makefile.am,
  src/libvirt.c, tests/sexpr2xmltest.c, tests/statstest.c,
  tests/xencapstest.c, tests/xmconfigtest.c, tests/xml2sexprtest.c:
  Adapt to changed xen location
* src/stats_linux.h, src/stats_linux.c: Remove xen specific block
  stats APIs
* src/qemu_driver.c, src/uml_driver.c: Add missing sys/un.h include
  uncovered after change to stats_linux.h
* src/xen/block_stats.h, src/xen/block_stats.c: Add xen specific
  block stats APIs
2009-09-21 14:41:42 +01:00
Chris Lalancette
8c30002862 Recently upstream Xen added support for having xvd devices > 16. For the most
part, this doesn't really concern libvirt, since for things like attach and
detach we just pass it through and let xend worry about whether it is supported
or not.  The one place this breaks down is in the stats collecting code, where
we need to figure out the device number so we can go digging in /sys for the
statistics.

To remedy this, I've re-written xenLinuxDomainDeviceID() to use regular
expressions to figure out the device number from the name.  The major advantage
is that now xenLinuxDomainDeviceID() looks fairly identical to
tools/python/xen/util/blkif.py (in the Xen sources), so that adding additional
devices in the future should be much easier.  It also reduces the size of the
code, and, in my opinion, the code complexity.

With this patch in place, I was able to get block statistics both on older style
devices (/dev/xvda) and on the new, expanded devices (/dev/xvdaa).

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2008-08-05 16:38:49 +00:00
Daniel P. Berrange
4b23495509 Convert test suites over to new test infrastructure 2008-05-29 15:31:49 +00:00
Daniel P. Berrange
94353ef660 Re-factor and pretty print differences 2008-04-18 15:28:33 +00:00
Jim Meyering
dc42a9d2de remove Vim and Emacs variable settings from C source files
Done with these commands:
git grep -l Local.variab|xargs \
  perl -0x3b -pi -e 's,\n+/\*\n \* vim:(.|\n)*,\n,'

git grep -l Local.variab|xargs \
  perl -0x3b -pi -e 's,\n+/\*\n \* Local variables:\n(.|\n)*,\n,'
2008-04-10 16:53:29 +00:00
Jim Meyering
bdbce64bab With --without-xen, avoid warning about unused function.
* tests/statstest.c (testQuietError) [!WITH_XEN]: Don't define.
2008-02-22 12:33:47 +00:00
Jim Meyering
b5433aaa6f Avoid compilation failure when building --without-xen.
* tests/statstest.c (testDevice) [!WITH_XEN]: #ifdef-out.
(main) [!WITH_XEN]: #ifdef-out the body.

Committer: Jim Meyering <meyering@redhat.com>
Author: Guido Guenther  <agx@sigxcpu.org>
2008-01-31 21:49:47 +00:00
Jim Meyering
51dd1d9e38 Arrange for "make syntax-check" to pass.
* .x-sc_avoid_if_before_free: Exempt ChangeLog.
* tests/statstest.c: Include <config.h>, not "config.h".
2008-01-30 06:55:56 +00:00
Daniel P. Berrange
21416a4746 Fix device name -> number conversion for block stats 2008-01-29 18:36:00 +00:00