1. 22 3月, 2013 1 次提交
    • M
      viralloc: Export virAllocTest* · 70bc623b
      Michal Privoznik 提交于
      If users build with --enable-test-oom configure option,
      they get this error saying, virAllocTest* functions are
      not defined within tests/testutils.c.
      70bc623b
  2. 26 2月, 2013 1 次提交
    • E
      tests: uniformly report test failures · dce95297
      Eric Blake 提交于
      testutils.c likes to print summaries after a test completes,
      including if it failed.  But if the test outright exit()s,
      this summary is skipped.  Enforce that we return instead of exit.
      
      * cfg.mk (sc_prohibit_exit_in_tests): New syntax check.
      * tests/commandhelper.c (main): Fix offenders.
      * tests/qemumonitorjsontest.c (mymain): Likewise.
      * tests/seclabeltest.c (main): Likewise.
      * tests/securityselinuxlabeltest.c (mymain): Likewise.
      * tests/securityselinuxtest.c (mymain): Likewise.
      * tests/testutils.h (VIRT_TEST_MAIN_PRELOAD): Likewise.
      * tests/testutils.c (virtTestMain): Likewise.
      (virtTestCaptureProgramOutput): Use symbolic name.
      dce95297
  3. 16 2月, 2013 1 次提交
    • E
      regex: gnulib guarantees that we have regex support · ec8a2d03
      Eric Blake 提交于
      No need to use HAVE_REGEX_H - our use of gnulib guarantees that
      the header exists and works, regardless of platform.  Similarly,
      we can unconditionally assume a compiling <sys/wait.h> (although
      the mingw version of this header is not full-featured).
      
      * src/storage/storage_backend.c: Drop useless conditional.
      * tests/testutils.c: Likewise.
      ec8a2d03
  4. 21 12月, 2012 7 次提交
  5. 15 11月, 2012 1 次提交
  6. 02 11月, 2012 1 次提交
  7. 28 9月, 2012 5 次提交
  8. 27 9月, 2012 1 次提交
  9. 26 9月, 2012 2 次提交
  10. 22 9月, 2012 1 次提交
    • M
      Drop unused return value of virLogOutputFunc · fca338a0
      Miloslav Trmač 提交于
      Nothing uses the return value, and creating it requries otherwise
      unnecessary strlen () calls.
      
      This cleanup is conceptually independent from the rest of the series
      (although the later patches won't apply without it).  This just seems
      a good opportunity to clean this up, instead of entrenching the unnecessary
      return value in the virLogOutputFunc instance that will be added in this
      series.
      Signed-off-by: NMiloslav Trmač <mitr@redhat.com>
      fca338a0
  11. 21 9月, 2012 1 次提交
  12. 06 8月, 2012 1 次提交
    • E
      virrandom: make virRandomInitialize an automatic one-shot · 87de27b7
      Eric Blake 提交于
      All callers used the same initialization seed (well, the new
      viratomictest forgot to look at getpid()); so we might as well
      make this value automatic.  And while it may feel like we are
      giving up functionality, I documented how to get it back in the
      unlikely case that you actually need to debug with a fixed
      pseudo-random sequence.  I left that crippled by default, so
      that a stray environment variable doesn't cause a lack of
      randomness to become a security issue.
      
      * src/util/virrandom.c (virRandomInitialize): Rename...
      (virRandomOnceInit): ...and make static, with one-shot call.
      Document how to do fixed-seed debugging.
      * src/util/virrandom.h (virRandomInitialize): Drop prototype.
      * src/libvirt_private.syms (virrandom.h): Don't export it.
      * src/libvirt.c (virInitialize): Adjust caller.
      * src/lxc/lxc_controller.c (main): Likewise.
      * src/security/virt-aa-helper.c (main): Likewise.
      * src/util/iohelper.c (main): Likewise.
      * tests/seclabeltest.c (main): Likewise.
      * tests/testutils.c (virtTestMain): Likewise.
      * tests/viratomictest.c (mymain): Likewise.
      87de27b7
  13. 27 7月, 2012 1 次提交
    • O
      maint: Use consistent copyright. · a4bcefbc
      Osier Yang 提交于
      This is a follow up patch of commit f9ce7dad, it modifies all
      the files which declare the copyright like "See COPYING.LIB for
      the License of this software" to use the detailed/consistent one.
      
      And deserts the outdated comments like:
      
       * libvirt-qemu.h:
       * Summary: qemu specific interfaces
       * Description: Provides the interfaces of the libvirt library to handle
       *              qemu specific methods
       *
       * Copy:  Copyright (C) 2010, 2012 Red Hat, Inc.
      
      Uses the more compact style like:
      
       * libvirt-qemu.h: Interfaces specific for QEMU/KVM driver
       *
       * Copyright (C) 2010, 2012 Red Hat, Inc.
      a4bcefbc
  14. 25 5月, 2012 1 次提交
    • E
      tests: back to short test names · ee407255
      Eric Blake 提交于
      With the switch to modules by default, I was getting super long
      test output:
      
      TEST: /home/remote/eblake/libvirt/tests/.libs/lt-interfacexml2xmltest
      
      compared to the former:
      
      TEST: interfacexml2xmltest
      
      * tests/testutils.c (virtTestMain): Trim off libtool goop.
      ee407255
  15. 16 5月, 2012 1 次提交
    • D
      Allow stack traces to be included with log messages · 54856395
      Daniel P. Berrange 提交于
      Sometimes it is useful to see the callpath for log messages.
      This change enhances the log filter syntax so that stack traces
      can be show by setting '1:+NAME' instead of '1:NAME'.
      
      This results in output like:
      
      2012-05-09 14:18:45.136+0000: 13314: debug : virInitialize:414 : register drivers
      /home/berrange/src/virt/libvirt/src/.libs/libvirt.so.0(virInitialize+0xd6)[0x7f89188ebe86]
      /home/berrange/src/virt/libvirt/tools/.libs/lt-virsh[0x431921]
      /lib64/libc.so.6(__libc_start_main+0xf5)[0x3a21e21735]
      /home/berrange/src/virt/libvirt/tools/.libs/lt-virsh[0x40a279]
      
      2012-05-09 14:18:45.136+0000: 13314: debug : virRegisterDriver:775 : driver=0x7f8918d02760 name=Test
      /home/berrange/src/virt/libvirt/src/.libs/libvirt.so.0(virRegisterDriver+0x6b)[0x7f89188ec717]
      /home/berrange/src/virt/libvirt/src/.libs/libvirt.so.0(+0x11b3ad)[0x7f891891e3ad]
      /home/berrange/src/virt/libvirt/src/.libs/libvirt.so.0(virInitialize+0xf3)[0x7f89188ebea3]
      /home/berrange/src/virt/libvirt/tools/.libs/lt-virsh[0x431921]
      /lib64/libc.so.6(__libc_start_main+0xf5)[0x3a21e21735]
      /home/berrange/src/virt/libvirt/tools/.libs/lt-virsh[0x40a279]
      
      * docs/logging.html.in: Document new syntax
      * configure.ac: Check for execinfo.h
      * src/util/logging.c, src/util/logging.h: Add support for
        stack traces
      * tests/testutils.c: Adapt to API change
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      54856395
  16. 09 5月, 2012 1 次提交
  17. 04 4月, 2012 1 次提交
    • D
      Fix format specifiers in test cases on Win32 · f48de0f1
      Daniel P. Berrange 提交于
      Some of the test suites use fprintf with format specifiers
      that are not supported on Win32 and are not fixed by gnulib.
      
      The mingw32 compiler also has trouble detecting ssize_t
      correctly, complaining that 'ssize_t' does not match
      'signed size_t' (which it expects for %zd). Force the
      cast to size_t to avoid this problem
      
      * tests/testutils.c, tests/testutils.h: Fix printf
        annotation on virTestResult. Use virVasprintf
        instead of vfprintf
      * tests/virhashtest.c: Use VIR_WARN instead of fprintf(stderr).
        Cast to size_t to avoid mingw32 compiler bug
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      f48de0f1
  18. 02 3月, 2012 1 次提交
    • E
      build: use correct type for pid and similar types · 3e2c3d8f
      Eric Blake 提交于
      No thanks to 64-bit windows, with 64-bit pid_t, we have to avoid
      constructs like 'int pid'.  Our API in libvirt-qemu cannot be
      changed without breaking ABI; but then again, libvirt-qemu can
      only be used on systems that support UNIX sockets, which rules
      out Windows (even if qemu could be compiled there) - so for all
      points on the call chain that interact with this API decision,
      we require a different variable name to make it clear that we
      audited the use for safety.
      
      Adding a syntax-check rule only solves half the battle; anywhere
      that uses printf on a pid_t still needs to be converted, but that
      will be a separate patch.
      
      * cfg.mk (sc_correct_id_types): New syntax check.
      * src/libvirt-qemu.c (virDomainQemuAttach): Document why we didn't
      use pid_t for pid, and validate for overflow.
      * include/libvirt/libvirt-qemu.h (virDomainQemuAttach): Tweak name
      for syntax check.
      * src/vmware/vmware_conf.c (vmwareExtractPid): Likewise.
      * src/driver.h (virDrvDomainQemuAttach): Likewise.
      * tools/virsh.c (cmdQemuAttach): Likewise.
      * src/remote/qemu_protocol.x (qemu_domain_attach_args): Likewise.
      * src/qemu_protocol-structs (qemu_domain_attach_args): Likewise.
      * src/util/cgroup.c (virCgroupPidCode, virCgroupKillInternal):
      Likewise.
      * src/qemu/qemu_command.c(qemuParseProcFileStrings): Likewise.
      (qemuParseCommandLinePid): Use pid_t for pid.
      * daemon/libvirtd.c (daemonForkIntoBackground): Likewise.
      * src/conf/domain_conf.h (_virDomainObj): Likewise.
      * src/probes.d (rpc_socket_new): Likewise.
      * src/qemu/qemu_command.h (qemuParseCommandLinePid): Likewise.
      * src/qemu/qemu_driver.c (qemudGetProcessInfo, qemuDomainAttach):
      Likewise.
      * src/qemu/qemu_process.c (qemuProcessAttach): Likewise.
      * src/qemu/qemu_process.h (qemuProcessAttach): Likewise.
      * src/uml/uml_driver.c (umlGetProcessInfo): Likewise.
      * src/util/virnetdev.h (virNetDevSetNamespace): Likewise.
      * src/util/virnetdev.c (virNetDevSetNamespace): Likewise.
      * tests/testutils.c (virtTestCaptureProgramOutput): Likewise.
      * src/conf/storage_conf.h (_virStoragePerms): Use mode_t, uid_t,
      and gid_t rather than int.
      * src/security/security_dac.c (virSecurityDACSetOwnership): Likewise.
      * src/conf/storage_conf.c (virStorageDefParsePerms): Avoid
      compiler warning.
      3e2c3d8f
  19. 04 2月, 2012 1 次提交
    • E
      build: expand rule to cover testsuite · 8fe454ce
      Eric Blake 提交于
      The bulk of this patch was done with:
      
      sed -i 's/\(\bfree *(/VIR_FREE(/g' tests/*.c
      
      followed by fixing the few compile errors that resulted.
      
      * cfg.mk (exclude_file_name_regexp--sc_prohibit_raw_allocation):
      Remove tests from exemption.
      * tests/testutils.h: Add common header.
      * tests/commandhelper.c: Fix offenders.
      * tests/cputest.c: Likewise.
      * tests/domainsnapshotxml2xmltest.c: Likewise.
      * tests/interfacexml2xmltest.c: Likewise.
      * tests/networkxml2argvtest.c: Likewise.
      * tests/networkxml2xmltest.c: Likewise.
      * tests/nodedevxml2xmltest.c: Likewise.
      * tests/nodeinfotest.c: Likewise.
      * tests/nwfilterxml2xmltest.c: Likewise.
      * tests/qemuargv2xmltest.c: Likewise.
      * tests/qemuxml2argvtest.c: Likewise.
      * tests/qemuxml2xmltest.c: Likewise.
      * tests/qemuxmlnstest.c: Likewise.
      * tests/qparamtest.c: Likewise.
      * tests/sexpr2xmltest.c: Likewise.
      * tests/storagepoolxml2xmltest.c: Likewise.
      * tests/storagevolxml2xmltest.c: Likewise.
      * tests/testutils.c: Likewise.
      * tests/virshtest.c: Likewise.
      * tests/xencapstest.c: Likewise.
      * tests/xmconfigtest.c: Likewise.
      * tests/xml2sexprtest.c: Likewise.
      8fe454ce
  20. 26 1月, 2012 1 次提交
    • D
      Introduce new API for generating random numbers · e95ef67b
      Daniel P. Berrange 提交于
      The old virRandom() API was not generating good random numbers.
      Replace it with a new API virRandomBits which instead of being
      told the upper limit, gets told the number of bits of randomness
      required.
      
      * src/util/virrandom.c, src/util/virrandom.h: Add virRandomBits,
        and move virRandomInitialize
      * src/util/util.h, src/util/util.c: Delete virRandom and
        virRandomInitialize
      * src/libvirt.c, src/security/security_selinux.c,
        src/test/test_driver.c, src/util/iohelper.c: Update for
        changes from virRandom to virRandomBits
      * src/storage/storage_backend_iscsi.c: Remove bogus call
        to virRandomInitialize & convert to virRandomBits
      e95ef67b
  21. 25 10月, 2011 1 次提交
    • E
      waitpid: improve safety · 69d044c0
      Eric Blake 提交于
      Based on a report by Coverity.  waitpid() can leak resources if it
      fails with EINTR, so it should never be used without checking return
      status.  But we already have a helper function that does that, so
      use it in more places.
      
      * src/lxc/lxc_container.c (lxcContainerAvailable): Use safer
      virWaitPid.
      * daemon/libvirtd.c (daemonForkIntoBackground): Likewise.
      * tests/testutils.c (virtTestCaptureProgramOutput, virtTestMain):
      Likewise.
      * src/libvirt.c (virConnectAuthGainPolkit): Simplify with virCommand.
      69d044c0
  22. 21 10月, 2011 1 次提交
    • E
      virbuf: improve testsuite reporting · ef696300
      Eric Blake 提交于
      I had some temporary test failures while working on virbuf
      improvements in later patches, with output that looked like:
      
      Expected [<]
      Actual [  <]
      
      which is pretty hard to figure out.  Adding an Offset designation
      made it much easier to find which particular '<' was at the
      wrong indentation, to fix the right part of the code.
      
      * tests/testutils.c (virtTestDifference): Make it easier to
      diagnose test failures.
      ef696300
  23. 13 10月, 2011 1 次提交
  24. 29 9月, 2011 1 次提交
  25. 22 7月, 2011 1 次提交
    • E
      build: rename files.h to virfile.h · 8e22e089
      Eric Blake 提交于
      In preparation for a future patch adding new virFile APIs.
      
      * src/util/files.h, src/util/files.c: Move...
      * src/util/virfile.h, src/util/virfile.c: ...here, and rename
      functions to virFile prefix.  Macro names are intentionally
      left alone.
      * *.c: All '#include "files.h"' uses changed.
      * src/Makefile.am (UTIL_SOURCES): Reflect rename.
      * cfg.mk (exclude_file_name_regexp--sc_prohibit_close): Likewise.
      * src/libvirt_private.syms: Likewise.
      * docs/hacking.html.in: Likewise.
      * HACKING: Regenerate.
      8e22e089
  26. 11 7月, 2011 1 次提交
    • E
      tests: simplify formatting · 9693e293
      Eric Blake 提交于
      The shell version would output 40 extra spaces for a test with
      a multiple of 40 sub-tests, and the C version can use the same
      printf optimization for avoiding a loop over single space output
      as the shell version.
      
      * tests/testutils.c (virtTestMain): Avoid loop for alignment.
      * tests/test-lib.sh: Fix formatting when counter is multiple of 40.
      9693e293
  27. 09 7月, 2011 1 次提交
  28. 24 6月, 2011 2 次提交
    • E
      maint: typo fixes · acb31cf5
      Eric Blake 提交于
      * src/xenxs/xen_sxpr.c (xenParseSxprPCI): Comment fix.
      * tests/object-locking.ml (driverTables): Likewise.
      * tests/testutils.c (virtTestDifferenceBin): Likewise.
      acb31cf5
    • D
      Introduce a generic object for using network sockets · 58b5b14e
      Daniel P. Berrange 提交于
      Introduces a simple wrapper around the raw POSIX sockets APIs
      and name resolution APIs. Allows for easy creation of client
      and server sockets with correct usage of name resolution APIs
      for protocol agnostic socket setup.
      
      It can listen for UNIX and TCP stream sockets.
      
      It can connect to UNIX, TCP streams directly, or indirectly
      to UNIX sockets via an SSH tunnel or external command
      
      * src/Makefile.am: Add to libvirt-net-rpc.la
      * src/rpc/virnetsocket.c, src/rpc/virnetsocket.h: Generic
        sockets APIs
      * tests/Makefile.am: Add socket test
      * tests/virnetsockettest.c: New test case
      * tests/testutils.c: Avoid overriding LIBVIRT_DEBUG settings
      * tests/ssh.c: Dumb helper program for SSH tunnelling tests
      58b5b14e