Commit Graph

19 Commits

Author SHA1 Message Date
Peter Krempa
7fb2639bfc tests: qemu: Add helper to load full monitor conversation from file
Similar to the existing qemuMonitorTestNewFromFile the *Full version
will allow to check both commands and supply responses for a better
monitor testing.
2017-01-18 10:04:11 +01:00
Peter Krempa
e3c781cef6 tests: qemu: monitor: Add helpers to test full command syntax
Add test monitor infrastructure that will test the commands verbatim
rather than trying to do any smart handling.
2017-01-18 10:02:09 +01:00
Peter Krempa
dcb397b8fd tests: qemumonitor: Propagate better error messages 2017-01-18 09:57:06 +01:00
Peter Krempa
030b1caa13 tests: qemu: Add support for testing aguments on monitor verbatim
Add code that takes a string and matches it against the data passed as
arguments from qemu. This is a simpler version of
qemuMonitorTestAddItemParams.
2016-10-06 09:11:28 +02:00
Jiri Denemark
474e627892 tests: Create simple monitor in qemuMonitorTestNewFromFile
The current version uses the first JSON reply from the file as monitor
greeting. With the new parameter the caller can now request a simple
test monitor to be created, which uses an artificial greeting and uses
all JSON strings from the file as regular replies.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
08529e1e27 tests: Fix "Reponse" typo
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
2dcacc0ecf tests: Introduce qemuMonitorTestNewFromFile
It's a convenient wrapper around qemuMonitorTestNew which feeds the test
monitor with QMP replies from a specified file.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Michal Privoznik
0badd8a43d tests: Learn qemuMonitorTestNew optional greeting
Currently, when creating a new mocked monitor, the greeting can't be
chosen. This is crucial for next patches, because some info as qemu
version is obtained in the greeting message.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2013-10-01 10:48:47 +02:00
Jiri Denemark
201f01ab97 tests: Add support for passing driver to qemu monitor
The driver is then passed to monitor event handlers.
2013-08-26 16:09:55 +02:00
Jiri Denemark
a950b4f91d tests: Add support for passing vm to qemu monitor
Some tests need the monitor to operate on an already existing VM object
rather than on a new mock-up the monitor test normally creates.
2013-08-26 16:09:55 +02:00
Peter Krempa
e32f6e778b qemumonitortestutils: Add the ability to check arguments of commands
This patch adds helpers that allow to check for argument values in
commands sent to the monitor.
2013-07-31 14:25:43 +02:00
Peter Krempa
69441df4d0 qemumonitortestutils: Improve error reporting from mock qemu monitor
Use the JSON error messages to report errors back to the caller in
addition to erroring out. The error reported from the event loop from
the mock function of the monitor was later overwritten by the call to
the monitor/agent interaction API. This will also allow testing of error
reporting.
2013-07-31 14:25:43 +02:00
Peter Krempa
659fe6d2db qemumonitortestutils: Add instrumentation for guest agent testing
Add helper functions to open guest agent connections and a handler for
replying to the "guest-sync" command.
2013-07-31 14:25:43 +02:00
Peter Krempa
5467cbef4b qemumonitortestutils: Refactor the test helpers to allow reuse
Refactor the test helpers to allow adding callbacks to verify the
monitor responses instead of simple command name checking and clean up
various parts to prepare for adding guest agent tests.
2013-07-31 14:25:43 +02:00
Peter Krempa
d24dbdd0a2 qemumonitortestutils: Use consistent header style and line spacing 2013-07-31 14:25:43 +02:00
Peter Krempa
e84b19316a maint: Rename xmlconf to xmlopt and virDomainXMLConfig to virDomainXMLOption
This patch is the result of running:

for i in $(git ls-files | grep -v html | grep -v \.po$ ); do
  sed -i -e "s/virDomainXMLConf/virDomainXMLOption/g" -e "s/xmlconf/xmlopt/g" $i
done

and a few manual tweaks.
2013-04-04 22:18:56 +02:00
Peter Krempa
27cf98e2d1 virCaps: conf: start splitting out irrelevat data
The virCaps structure gathered a ton of irrelevant data over time that.
The original reason is that it was propagated to the XML parser
functions.

This patch aims to create a new data structure virDomainXMLConf that
will contain immutable data that are used by the XML parser. This will
allow two things we need:

1) Get rid of the stuff from virCaps

2) Allow us to add callbacks to check and add driver specific stuff
after domain XML is parsed.

This first attempt removes pointers to private data allocation functions
to this new structure and update all callers and function that require
them.
2013-03-13 09:27:14 +01:00
Eric Blake
4ecb723b9e maint: fix up copyright notice inconsistencies
https://www.gnu.org/licenses/gpl-howto.html recommends that
the 'If not, see <url>.' phrase be a separate sentence.

* tests/securityselinuxhelper.c: Remove doubled line.
* tests/securityselinuxtest.c: Likewise.
* globally: s/;  If/.  If/
2012-09-20 16:30:55 -06:00
Daniel P. Berrange
8d78fd04be Add helper library for testing the qemu monitor code
To be able to test the QEMU monitor code, we need to have a fake
QEMU monitor server. This introduces a simple (dumb) framework
that can do this. The test case registers a series of items to
be sent back as replies to commands that will be executed. A
thread runs the event loop looking for incoming replies and
sending back this pre-registered data. This allows testing all
QEMU monitor code that deals with parsing responses and errors
from QEMU, without needing QEMU around

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-09-07 13:18:04 +01:00