1. 14 5月, 2016 2 次提交
    • M
      virmock.h: Introduce VIR_MOCK_CALL_STAT · 86d1705a
      Michal Privoznik 提交于
      There is some magic going on when it comes to stat() or lstat().
      Basically, stat() can either be a regular function, an inline
      function that calls __xstat(_STAT_VER, ...) or a macro that does
      the same as the inline func. Don't ask why is that, just read the
      documentation in sys/stat.h and make sure you have a bucket next
      to you. Anyway, currently there will not be both stat and __xstat
      symbols at the same time, as one of them gets overwritten to the
      other one during compilation. But this is not true anymore once
      we start chaining our mocking libraries. Therefore we need a
      wrapper that calls desired function from glibc.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      86d1705a
    • M
      virpcimock: Adapt to virmock.h · 57c484db
      Michal Privoznik 提交于
      Instead of introducing our own wrapper for dlsym()
      we can use the one provided by virmock.h.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      57c484db
  2. 09 12月, 2015 4 次提交
  3. 08 4月, 2014 1 次提交
  4. 25 3月, 2014 1 次提交
  5. 25 1月, 2014 1 次提交
    • M
      tests: Fix PCI test data filenames for Windows · 96f274a9
      Matthias Bolte 提交于
      Windows doesn't allow : in filenames.
      
      Commit 21685c95 added files with a : in
      their names. This broke git operations on Windows as git is not able to
      create those files on clone or pull.
      
      Replace : with - in the offending filenames and adapt the test case.
      96f274a9
  6. 20 1月, 2014 3 次提交
  7. 08 1月, 2014 1 次提交
  8. 28 11月, 2013 2 次提交
    • E
      tests: fix virpcitest with read-only srcdir · e821de2c
      Eric Blake 提交于
      'make distcheck' has been broken since commit 21685c95; basically,
      it emulates the case of a read-only $(srcdir) (such as building
      from a tarball exploded onto a CD-ROM), but we were creating our
      fake pci device as a symlink into $(srcdir) and failing when that
      requires opening the config file for writing:
      
       3) testVirPCIDeviceReset                                             ... libvirt:  error : Failed to open config space file '/sys/bus/pci/devices/0000:00:01.0/config': Permission denied
      
      Fix it by copying rather than symlinking.
      
      * tests/virpcimock.c (make_file): Add parameter to allow binary
      creation; adjust all callers.
      (pci_device_new_from_stub): Copy rather than symlink.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      e821de2c
    • E
      tests: guarantee abs_srcdir in all C tests · 0aa873d7
      Eric Blake 提交于
      While trying to debug a failure of virpcitest during 'make distcheck',
      I noticed that with a VPATH build, 'cd tests; ./virpcitest' fails for
      an entirely different reason.  To reproduce the distcheck failure, I
      had to run 'cd tests; abs_srcdir=/path/to/src ./virpcitest'.  But we
      document in HACKING that all of our tests are supposed to be runnable
      without requiring extra environment variables.
      
      The solution: hardcode the location of srcdir into the just-built
      binaries, rather than requiring make to prepopulate environment
      variables.  With this, './virpcitest' passes even in a VPATH build
      (provided that $(srcdir) is writable; a followup patch will fix the
      conditions required by 'make distcheck').  [Note: the makefile must
      still pass on directory variables to the test environment of shell
      scripts, since those aren't compiled.  So while this solves the case
      of a compiled test, it still requires environment variables to pass
      a VPATH build of any shell script test case that relies on srcdir.]
      
      * tests/Makefile.am (AM_CFLAGS): Define abs_srcdir in all compiled
      tests.
      * tests/testutils.h (abs_srcdir): Quit declaring.
      * tests/testutils.c (virtTestMain): Rely on define rather than
      environment variable.
      * tests/virpcimock.c (pci_device_new_from_stub): Rely on define.
      * tests/cputest.c (mymain): Adjust abs_top_srcdir default.
      * tests/qemuxml2argvtest.c (mymain): Likewise.
      * tests/qemuxmlnstest.c (mymain): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      0aa873d7
  9. 07 11月, 2013 1 次提交
  10. 06 11月, 2013 2 次提交
    • M
      virpcitest: Introduce testVirPCIDeviceReset · 21685c95
      Michal Privoznik 提交于
      This addition, however, requires some refactoring to be done.  First of
      all, to match the best practice we should detach the device prior
      resetting it. That's why testVirPCIDeviceDetach is detaching all devices
      within 0000:00:01.0 and 0000:00:03.0 range. Then, the brand new test
      will reset the 0000:00:02.0 device, so the last testVirPCIDeviceReattach
      can reattach all the devices back.
      
      In order to perform a PCI device reset, the dummy config file is not
      sufficient anymore and must be replaced with real PCI config (binary
      mess). Such config files are to be stored under tests/virpcitestdata/
      and ought to have '.config' suffix.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      21685c95
    • M
      virpcitest: Fix variable arguments using in pci_driver_new · 361f2fa8
      Michal Privoznik 提交于
      In the pci_driver_new function it is possible to set a list of
      <vendor:device> IDs that the driver knows. These IDs are passed as
      variable arguments and are processed  the usual way using va_start() and
      va_arg(). However, after all arguments has been processed, we should
      call va_end() what we aren't currently doing.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      361f2fa8
  11. 05 11月, 2013 1 次提交
    • M
      virpcitest: Test virPCIDeviceDetach · 25527ae2
      Michal Privoznik 提交于
      This commit introduces yet another test under virpcitest:
      virPCIDeviceDetach. However, in order to be able to do this, the
      virpcimock needs to be extended to model the kernel behavior on PCI
      device binding and unbinding (create 'driver' symlinks under the device
      tree, check for device ID in driver's ID table, etc.)
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      25527ae2
  12. 04 11月, 2013 1 次提交