1. 15 9月, 2017 1 次提交
    • E
      test-qga: Kill broken and dead QGA_TEST_SIDE_EFFECTING code · f94b3f64
      Eric Blake 提交于
      Back when the test was introduced, in commit 62c39b30, the
      test was set up to run qemu-ga directly on the host performing
      the test, and defaults to limiting itself to safe commands.  At
      the time, it was envisioned that setting QGA_TEST_SIDE_EFFECTING
      in the environment could cover a few more commands, while noting
      the potential danger of those side effects running in the host.
      
      But this has NEVER been tested: if you enable the environment
      variable, the test WILL fail.  One obvious reason: if you are not
      running as root, you'll probably get a permission failure when
      trying to freeze the file systems, or when changing system time.
      Less obvious: if you run the test as root (wow, you're brave), you
      could end up hanging if the test tries to log things to a
      temporarily frozen filesystem.  But the cutest reason of all: if
      you get past the above hurdles, the test uses invalid JSON in
      test_qga_fstrim() (missing '' around the dictionary key 'minimum'),
      and will thus fail an assertion in qmp_fd().
      
      Rather than leave this untested time-bomb in place, rip it out.
      Hopefully, as originally envisioned, we can find an opportunity
      to test an actual sandboxed guest where the guest-agent has
      full permissions and will not unduly affect the host running
      the test - if so, 'git revert' can be used if desired, for
      salvaging any useful parts of this attempt.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Reviewed-by: NThomas Huth <thuth@redhat.com>
      Signed-off-by: NThomas Huth <thuth@redhat.com>
      f94b3f64
  2. 18 7月, 2017 2 次提交
  3. 09 5月, 2017 1 次提交
    • E
      test-qga: Actually test 0xff sync bytes · 5229564b
      Eric Blake 提交于
      Commit 62c39b30 introduced test-qga, and at face value, appears
      to be testing the 'guest-sync' behavior that is recommended for
      guests in sending 0xff to QGA to force the parser to reset.  But
      this aspect of the test has never actually done anything: the
      qmp_fd() call chain converts its string argument into QObject,
      then converts that QObject back to the actual string that is
      sent over the wire - and the conversion process silently drops
      the 0xff byte from the string sent to QGA, thus never resetting
      the QGA parser.
      
      An upcoming patch will get rid of the wasteful round trip
      through QObject, at which point the string in test-qga will be
      directly sent over the wire.
      
      But fixing qmp_fd() to actually send 0xff over the wire is not
      all we have to do - the actual QMP parser loudly complains that
      0xff is not valid JSON, and sends an error message _prior_ to
      actually parsing the 'guest-sync' or 'guest-sync-delimited'
      command.  With 'guest-sync', we cannot easily tell if this error
      message is a result of our command - which is WHY we invented
      the 'guest-sync-delimited' command.  So for the testsuite, fix
      things to only check 0xff behavior on 'guest-sync-delimited',
      and to loop until we've consumed all garbage prior to the
      requested delimiter, which is compatible with the documented actions
      that a real QGA client is supposed to do.
      
      Ideally, we'd fix the QGA JSON parser to silently ignore 0xff
      rather than sending an error message back, at which point we
      could enhance this test for 'guest-sync' as well as for
      'guest-sync-delimited'.  But for the sake of this patch, our
      testing of 'guest-sync' is no worse than it was pre-patch,
      because we have never been sending 0xff over the wire in the
      first place.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20170427215821.19397-11-eblake@redhat.com>
      Reviewed-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      [Additional comment squashed in, along with matching commit message
      update]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      5229564b
  4. 06 3月, 2017 1 次提交
  5. 05 3月, 2017 1 次提交
    • M
      qapi: Improve a QObject input visitor error message · 910f738b
      Markus Armbruster 提交于
      The QObject input visitor has three error message formats:
      
      * Parameter '%s' is missing
      * "Invalid parameter type for '%s', expected: %s"
      * "QMP input object member '%s' is unexpected"
      
      The '%s' are member names (or "null", but I'll fix that later).
      
      The last error message calls the thing "QMP input object member"
      instead of "parameter".  Misleading when the visitor is used on
      QObjects that don't come from QMP.  Change it to "Parameter '%s' is
      unexpected".
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1488544368-30622-12-git-send-email-armbru@redhat.com>
      910f738b
  6. 06 12月, 2016 1 次提交
    • E
      test-qga: Avoid qobject_from_jsonv("%"PRId64) · 1792d7d0
      Eric Blake 提交于
      The qobject_from_jsonv() function implements a pseudo-printf
      language for creating a QObject; however, it is hard-coded to
      only parse a subset of formats understood by -Wformat, and is
      not a straight synonym to bare printf().  In particular, any
      use of an int64_t integer works only if the system's
      definition of PRId64 matches what the parser expects; which
      works on glibc (%lld or %ld depending on 32- vs. 64-bit) and
      mingw (%I64d), but not on Mac OS (%qd).  Rather than enhance
      the parser, it is just as easy to use normal printf() for
      this particular conversion, matching what is done elsewhere
      in this file [1], which is safe in this instance because the
      format does not contain any of the problematic differences
      (bare '%' or the '%s' format).
      
      The use of PRId64 for a variable named 'pid' is gross, but it
      is a sad reality of the 64-bit mingw environment, which
      mistakenly defines pid_t as a 64-bit type even though getpid()
      returns 'int' on that platform [2].  Our definition of the
      QGA GuestExec type defines 'pid' as a 64-bit entity, and we
      can't tighten it to 'int32' unless the mingw header is fixed.
      Using 'long long' instead of 'int64_t' just so that we can
      stick with qobject_from_jsonv("%lld") instead of printf() is
      not any prettier, since we may have later type churn anyways.
      
      [1] see 'git grep -A2 strdup_printf tests/test-qga.c'
      [2] https://bugzilla.redhat.com/show_bug.cgi?id=1397787
      
      Reported by: G 3 <programmingkidx@gmail.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1479922617-4400-3-git-send-email-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      1792d7d0
  7. 19 9月, 2016 1 次提交
  8. 08 9月, 2016 1 次提交
  9. 26 7月, 2016 1 次提交
  10. 08 6月, 2016 1 次提交
  11. 07 6月, 2016 1 次提交
  12. 25 2月, 2016 1 次提交
  13. 16 2月, 2016 1 次提交
  14. 26 11月, 2015 2 次提交
  15. 23 10月, 2015 1 次提交
    • M
      tests: test-qga, loosen assumptions about host filesystems · b3e9e584
      Michael Roth 提交于
      QGA skips pseudo-filesystems when querying filesystems via
      guest-get-fsinfo. On some hosts, such as travis-ci which uses
      containers with simfs filesystems, QGA might not report *any*
      filesystems. Our test case assumes there would be at least one,
      leading to false error messages in these situations.
      
      Instead, sanity-check values iff we get at least one filesystem.
      
      Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
      Cc: Peter Maydell <peter.maydell@linaro.org>
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      b3e9e584
  16. 20 10月, 2015 1 次提交
    • M
      tests: add a local test for guest agent · 62c39b30
      Marc-André Lureau 提交于
      Add some local guest agent tests, as it is better than nothing, only
      when CONFIG_POSIX (using unix sockets).
      
      With the QGA_TEST_SIDE_EFFECTING environment variable, it will include
      tests with side effects, such as freezing/thawing the FS or changing the
      time.
      
      (a better test would involve a managed VM (or container), but it might
      be better to leave that off to autotest/avocado)
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      * use mkdtemp() in placeof g_mkdtemp() for glib 2.22 compat
      * drop redundant/conflicting compat defines for
        g_assert_{true,false}, since glib-compat has them now.
      * build fixes for OSX: use PRId64 instead of glib formats, drop
        g_spawn_default usage for glib compat
      * assert connect_qga() doesn't fail
      * only enable test-qga for linux hosts
      * allow get-memory-block-info* to fail
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      62c39b30