1. 13 8月, 2011 1 次提交
    • E
      build: fix recent build failures · be427e8b
      Eric Blake 提交于
      With gcc 4.5.1:
      
      util/virpidfile.c: In function 'virPidFileAcquirePath':
      util/virpidfile.c:308:66: error: nested extern declaration of '_gl_verify_function2' [-Wnested-externs]
      
      Then in tests/commandtest.c, the new virPidFile APIs need to be used.
      
      * src/util/virpidfile.c (virPidFileAcquirePath): Move verify to
      top level.
      * tests/commandtest.c: Use new pid APIs.
      be427e8b
  2. 29 7月, 2011 2 次提交
  3. 26 7月, 2011 1 次提交
    • L
      util: change virFile*Pid functions to return < 0 on failure · d6354c16
      Laine Stump 提交于
      Although most functions in libvirt return 0 on success and < 0 on
      failure, there are a few functions lingering around that return errno
      (a positive value) on failure, and sometimes code calling those
      functions incorrectly assumes the <0 standard. I noticed one of these
      the other day when auditing networkStartDhcpDaemon after Guido Gunther
      found a place where success was improperly returned on failure (that
      patch has been acked and is pending a push). The problem was that it
      expected the return value from virFileReadPid to be < 0 on failure,
      but it was actually positive (it was also neglected to set the return
      code in this case, similar to the bug found by Guido).
      
      This all led to the fact that *all* of the virFile*Pid functions in
      util.c are returning errno on failure. This patch remedies that
      problem by changing them all to return -errno on failure, and makes
      any necessary changes to callers of the functions. (In the meantime, I
      also properly set the return code on failure of virFileReadPid in
      networkStartDhcpDaemon).
      d6354c16
  4. 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
  5. 11 5月, 2011 1 次提交
    • E
      tests: avoid crash when run under gcov · 70ea7dec
      Eric Blake 提交于
      Running ./autobuild.sh failed when gcov is installed, because
      commandtest ended up crashing during gcov's getenv() call after
      exit() had already started.  I traced this nasty bug back to
      a scoping issue present since the test introduction.
      
      * tests/commandtest.c (mymain): Move newenv...
      (newenv): ...to a scope that is still useful during exit().
      70ea7dec
  6. 04 5月, 2011 1 次提交
  7. 30 4月, 2011 2 次提交
    • E
      build: fix getcwd portability problems · e39c46a5
      Eric Blake 提交于
      * bootstrap.conf (gnulib_modules): Add getcwd-lgpl.
      * tests/commandtest.c (checkoutput): Drop unused cwd.
      * tests/commandhelper.c (main): Let getcwd malloc.
      * tests/testutils.c (virTestMain): Likewise.
      * tools/virsh.c (cmdPwd): Likewise.
      (virshCmds): Expose cmdPwd and cmdCd on mingw.
      e39c46a5
    • E
      tests: simplify common setup · 20986e58
      Eric Blake 提交于
      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.
      20986e58
  8. 25 3月, 2011 1 次提交
    • E
      command: add virCommandAbort for cleanup paths · 9ed54518
      Eric Blake 提交于
      Sometimes, an asynchronous helper is started (such as a compressor
      or iohelper program), but a later error means that we want to
      abort that child.  Make this easier.
      
      Note that since daemons and virCommandRunAsync can't mix, the only
      time virCommandFree can reap a process is if someone did
      virCommandRunAsync for a non-daemon and didn't stash the pid.
      
      * src/util/command.h (virCommandAbort): New prototype.
      * src/util/command.c (_virCommand): Add new field.
      (virCommandRunAsync, virCommandWait): Track whether pid was used.
      (virCommandFree): Reap child if caller did not request pid.
      (virCommandAbort): New function.
      * src/libvirt_private.syms (command.h): Export it.
      * tests/commandtest.c (test19): New test.
      9ed54518
  9. 25 2月, 2011 1 次提交
  10. 30 1月, 2011 1 次提交
    • E
      build: avoid close, system · e67ae619
      Eric Blake 提交于
      * src/fdstream.c (virFDStreamOpenFile, virFDStreamCreateFile):
      Use VIR_FORCE_CLOSE instead of close.
      * tests/commandtest.c (mymain): Likewise.
      * tools/virsh.c (editFile): Use virCommand instead of system.
      * src/util/util.c (__virExec): Special case preservation of std
      file descriptors to child.
      e67ae619
  11. 22 12月, 2010 1 次提交
  12. 14 12月, 2010 1 次提交
  13. 10 12月, 2010 1 次提交
    • E
      build: distribute commandtest files · 2a5ccbef
      Eric Blake 提交于
      * tests/Makefile.am (SUBDIRS): Add commanddata.
      * tests/commandtest.c (checkoutput): Delete correct file.
      (test4): Delete pid file.
      (mymain): Delete unused variable.
      * tests/commanddata/Makefile.am: New file.
      * configure.ac (AC_OUTPUT): Build new makefile.
      Reported by Dominik Klein.
      2a5ccbef
  14. 08 12月, 2010 5 次提交
  15. 03 12月, 2010 1 次提交
    • D
      Introduce new APIs for spawning processes · f16ad06f
      Daniel P. Berrange 提交于
      This introduces a new set of APIs in src/util/command.h
      to use for invoking commands. This is intended to replace
      all current usage of virRun and virExec variants, with a
      more flexible and less error prone API.
      
      * src/util/command.c: New file.
      * src/util/command.h: New header.
      * src/Makefile.am (UTIL_SOURCES): Build it.
      * src/libvirt_private.syms: Export symbols internally.
      * tests/commandtest.c: New test.
      * tests/Makefile.am (check_PROGRAMS): Run it.
      * tests/commandhelper.c: Auxiliary program.
      * tests/commanddata/test2.log - test15.log: New expected outputs.
      * cfg.mk (useless_free_options): Add virCommandFree.
      (msg_gen_function): Add virCommandError.
      * po/POTFILES.in: New translation.
      * .x-sc_avoid_write: Add exemption.
      * tests/.gitignore: Ignore new built file.
      f16ad06f