1. 26 2月, 2013 2 次提交
    • E
      tests: don't test json when not compiled in · f20b0476
      Eric Blake 提交于
      Now that the segfault is solved, we can skip instead of fail
      the test when yajl is not present.
      
      * tests/qemumonitorjsontest.c (mymain): Skip if no yajl.
      f20b0476
    • E
      tests: avoid segfault if json monitor not present · 848a3b1d
      Eric Blake 提交于
      On a machine without yajl headers, I was seeing random segfaults
      from qemumonitorjsontest (about 90% of the runs on my particular
      machine).  The segfault was inside virClassIsDerivedFrom, which
      points to a case of a race leading to unreferencing a stale
      pointer to an object that had already been freed.  I also noticed
      that if I got the segfault, I was seeing messages such as:
      
      2013-02-22 16:12:37.504+0000: 19833: error : virNetSocketWriteWire:1361 : Cannot write data: Bad file descriptor
      
      which is also evidence of deferencing a stale pointer.  I traced it
      to a race where qemuMonitorTestIO could execute late, after the
      main thread had already called qemuMonitorTestFree and called
      virNetSocketClose(test->client) but not clearing it out to NULL.
      Sure enough, after test->client has been closed, fd is -1, which
      causes an attempt to write to the socket to fail, which in turn
      triggers the error code of qemuMonitorTestIO that tries to re-close
      test->client.
      
      * tests/qemumonitortestutils.c (qemuMonitorTestIO): Don't attempt
      to free client again if test already quit.
      848a3b1d
  2. 25 2月, 2013 4 次提交
  3. 23 2月, 2013 1 次提交
  4. 22 2月, 2013 1 次提交
  5. 16 2月, 2013 4 次提交
  6. 13 2月, 2013 1 次提交
    • E
      util: add virendian.h macros · c6f1060c
      Eric Blake 提交于
      We have several cases where we need to read endian-dependent
      data regardless of host endianness; rather than open-coding
      these call sites, it will be nicer to funnel things through
      a macro.
      
      The virendian.h file can be expanded to add writer functions,
      and/or 16-bit access patterns, if needed.  Also, if we need
      to turn things into a function to avoid multiple evaluations
      of buf, that can be done later.  But for now, a macro worked.
      
      * src/util/virendian.h: New file.
      * src/Makefile.am (UTIL_SOURCES): Ship it.
      * tests/virendiantest.c: New test.
      * tests/Makefile.am (test_programs, virendiantest_SOURCES): Run
      the test.
      * .gitignore: Ignore built file.
      c6f1060c
  7. 12 2月, 2013 1 次提交
    • E
      build: fix VPATH testsuite · ca7cc852
      Eric Blake 提交于
      'make check' has been failing on VPATH builds since commit
      907a39e7.  The tests already had magic for munging path names,
      but were munging to the wrong location, thus working only on
      an in-tree build.
      
      * tests/securityselinuxlabeltest.c (testSELinuxMungePath): Munge
      to correct path.
      ca7cc852
  8. 11 2月, 2013 1 次提交
  9. 08 2月, 2013 8 次提交
  10. 06 2月, 2013 2 次提交
    • E
      bitmap: add way to find next clear bit · 98fc0137
      Eric Blake 提交于
      We had an easy way to iterate set bits, but not for iterating
      cleared bits.
      
      * src/util/virbitmap.h (virBitmapNextClearBit): New prototype.
      * src/util/virbitmap.c (virBitmapNextClearBit): Implement it.
      * src/libvirt_private.syms (bitmap.h): Export it.
      * tests/virbitmaptest.c (test4): Test it.
      98fc0137
    • E
      tests: reserve more fds for commandtest · 3a9382ca
      Eric Blake 提交于
      Commit 39c77fe5 triggered random failures, depending on the platform
      and what other fds leak into the testsuite (for me, it passed on
      RHEL 6 but failed on Fedora 18).  The reason was that we were
      expecting an fd that fell outside of our reserved range.  By reserving
      a larger range, the test once again passes on all platforms.
      
      * tests/commandtest.c (mymain): Reserve enough fds.
      3a9382ca
  11. 05 2月, 2013 3 次提交
    • D
      Introduce a virQEMUDriverConfigPtr object · b090aa7d
      Daniel P. Berrange 提交于
      Currently the virQEMUDriverPtr struct contains an wide variety
      of data with varying access needs. Move all the static config
      data into a dedicated virQEMUDriverConfigPtr object. The only
      locking requirement is to hold the driver lock, while obtaining
      an instance of virQEMUDriverConfigPtr. Once a reference is held
      on the config object, it can be used completely lockless since
      it is immutable.
      
      NB, not all APIs correctly hold the driver lock while getting
      a reference to the config object in this patch. This is safe
      for now since the config is never updated on the fly. Later
      patches will address this fully.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      b090aa7d
    • M
      tests: Create test for virCommandDoAsyncIO · f0154959
      Michal Privoznik 提交于
      This is just a basic test, so we don't break virCommand in the
      future. A "Hello world\n" string is written to commanhelper,
      which copies input to stdout and stderr where we read it from.
      Then the read strings are compared with expected values.
      f0154959
    • M
      Introduce event loop to commandtest · 39c77fe5
      Michal Privoznik 提交于
      This is just preparing environment for the next patch, which is
      going to need an event loop.
      39c77fe5
  12. 01 2月, 2013 1 次提交
    • E
      tests: add a comment about our fake qmp · 949ebc30
      Eric Blake 提交于
      While testing QMP, I used a simple qemu session of
      'qemu-kvm -M none -nodefaults -nographic -qmp stdio'
      for some experiments.  But it took me far too long to remember
      the magic invocation to unlock QMP into accepting normal commands.
      While I was able to grep libvirt sources and easily find where
      libvirt expects the normal "QMP" greeting, I could not find the
      proper reply to that greeting nearby.
      
      Reading the testsuite didn't help either, since there we don't
      emulate the mandatory handshake.  But since my grep hit the
      testsuite, adding a bit of documentation will make it much easier
      to jog my memory in the future.
      
      * tests/qemumonitortestutils.c (QEMU_JSON_GREETING): Mention that
      the normal counterpart reply is skipped.
      949ebc30
  13. 31 1月, 2013 2 次提交
  14. 25 1月, 2013 1 次提交
    • J
      qemu: escape ipv6 for rbd network disk hosts · c1509ab4
      Josh Durgin 提交于
      Hosts for rbd are ceph monitor daemons. These have fixed IP addresses,
      so they are often referenced by IP rather than hostname for
      convenience, or to avoid relying on DNS. Using IPv4 addresses as the
      host name works already, but IPv6 addresses require rbd-specific
      escaping because the colon is used as an option separator in the
      string passed to qemu.
      
      Escape these colons, and enclose the IPv6 address in square brackets
      so it is distinguished from the port, which is currently mandatory.
      Acked-by: NOsier Yang <jyang@redhat.com>
      Signed-off-by: NJosh Durgin <josh.durgin@inktank.com>
      c1509ab4
  15. 23 1月, 2013 6 次提交
  16. 18 1月, 2013 1 次提交
    • E
      build: fix build on BSD · f403bdc1
      Eric Blake 提交于
      A build on FreeBSD failed with:
      util/virportallocator.c:108: error: storage size of 'addr' isn't known
      util/virportallocator.c:123: error: 'INADDR_ANY' undeclared (first use in this function)
      
      It turns out that while POSIX allows sockaddr_in to leak in through
      <arpa/inet.h> (the way Linux does it), it is not mandatory, and
      conforming applications are required to get it through <netinet/in.h>.
      
      * src/util/virportallocator.c: Include header for struct
      sockaddr_in.
      * tests/virportallocatortest.c: Likewise.
      f403bdc1
  17. 17 1月, 2013 1 次提交
    • D
      Avoid integer wrap on remotePortMax in QEMU driver · da5a8aee
      Daniel P. Berrange 提交于
      The QEMU driver default max port is 65535, but it then increments
      this by 1 to 65536. This maps to 0 in an unsigned short :-( This
      was apparently done so that for() loops could use "< max" instead
      of "<= max". Remove this insanity and just make the loop do the
      right thing.
      da5a8aee