summaryrefslogtreecommitdiff
path: root/tests/qmp-test.c
AgeCommit message (Collapse)AuthorFilesLines
2018-03-23Revert "monitor: enable IO thread for (qmp & !mux) typed"Peter Xu1-9/+1
This reverts commit 3fd2457d18edf5736f713dfe1ada9c87a9badab1. Enabling OOB caused several iotests failures; due to the imminent 2.12 release, the safest action is to disable OOB for now. If other patches fix the issues that iotests exposed, it may be turned back on in time for the release, otherwise it will be 2.13 material; either way, the framework changes not reverted now do not hurt if they remain as part of the 2.12 release. Additionally, revert the tests in the patch 02130314d8 ("qmp: introduce QMPCapability", 2018-03-19), as both parts must be reverted at once to keep 'make check' passing. Signed-off-by: Peter Xu <peterx@redhat.com> Message-Id: <20180323140821.28957-2-peterx@redhat.com> Tested-by: Christian Borntraeger <borntraeger@de.ibm.com> [eblake: reorder/squash commits, enhance commit message] Signed-off-by: Eric Blake <eblake@redhat.com>
2018-03-23Revert "tests: qmp-test: verify command batching"Peter Xu1-22/+0
This reverts commit 91ad45061af0fe44ac5dadb5bedaf4d7a08077c8. Enabling OOB caused several iotests failures; due to the imminent 2.12 release, the safest action is to disable OOB, but first we have to revert tests that rely on OOB. Signed-off-by: Peter Xu <peterx@redhat.com> Message-Id: <20180323140821.28957-4-peterx@redhat.com> Tested-by: Christian Borntraeger <borntraeger@de.ibm.com> [eblake: reorder commits, enhance commit message] Signed-off-by: Eric Blake <eblake@redhat.com>
2018-03-23Revert "tests: qmp-test: add oob test"Peter Xu1-65/+0
This reverts commit d003f7a8f9cafe50119975844fa01afc2baf41fb. Enabling OOB caused several iotests failures; due to the imminent 2.12 release, the safest action is to disable OOB, but first we have to revert tests that rely on OOB. Signed-off-by: Peter Xu <peterx@redhat.com> Message-Id: <20180323140821.28957-3-peterx@redhat.com> Tested-by: Christian Borntraeger <borntraeger@de.ibm.com> [eblake: reorder commits, enhance commit message] Signed-off-by: Eric Blake <eblake@redhat.com>
2018-03-19tests: qmp-test: add oob testPeter Xu1-0/+65
Test the new OOB capability. Here we used the new "x-oob-test" command. First, we send a lock=true and oob=false command to hang the main thread. Then send another lock=false and oob=true command (which will be run inside parser this time) to free that hanged command. Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Peter Xu <peterx@redhat.com> Message-Id: <20180309090006.10018-24-peterx@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> [eblake: grammar tweaks] Signed-off-by: Eric Blake <eblake@redhat.com>
2018-03-19tests: qmp-test: verify command batchingPeter Xu1-0/+22
OOB introduced DROP event for flow control. This should not affect old QMP clients. Add a command batching check to make sure of it. Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Peter Xu <peterx@redhat.com> Message-Id: <20180309090006.10018-23-peterx@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Eric Blake <eblake@redhat.com>
2018-03-19qmp: introduce QMPCapabilityPeter Xu1-1/+9
There were no QMP capabilities defined. Define the first capability, "oob", to allow out-of-band messages. After this patch, we will allow QMP clients to enable QMP capabilities when sending the first "qmp_capabilities" command. Originally we are starting QMP session with no arguments like: { "execute": "qmp_capabilities" } Now we can enable some QMP capabilities using (take OOB as example, which is the only capability that we support): { "execute": "qmp_capabilities", "arguments": { "enable": [ "oob" ] } } When the "arguments" key is not provided, no capability is enabled. For capability "oob", the monitor needs to be run on a dedicated IO thread, otherwise the command will fail. For example, trying to enable OOB on a MUXed typed QMP monitor will fail. One thing to mention is that QMP capabilities are per-monitor, and also when the connection is closed due to some reason, the capabilities will be reset. Also, touch up qmp-test.c to test the new bits. Signed-off-by: Peter Xu <peterx@redhat.com> Message-Id: <20180309090006.10018-11-peterx@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> [eblake: touch up commit message] Signed-off-by: Eric Blake <eblake@redhat.com>
2018-03-13sev/i386: qmp: add query-sev-capabilities commandBrijesh Singh1-0/+1
The command can be used by libvirt to query the SEV capabilities. Cc: "Daniel P. Berrangé" <berrange@redhat.com> Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com> Cc: Markus Armbruster <armbru@redhat.com> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-03-13sev/i386: qmp: add query-sev-launch-measure commandBrijesh Singh1-0/+2
The command can be used by libvirt to retrieve the measurement of SEV guest. This measurement is a signature of the memory contents that was encrypted through the LAUNCH_UPDATE_DATA. Cc: "Daniel P. Berrangé" <berrange@redhat.com> Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com> Cc: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-03-13sev/i386: qmp: add query-sev commandBrijesh Singh1-0/+2
The QMP query command can used to retrieve the SEV information when memory encryption is enabled on AMD platform. Cc: Eric Blake <eblake@redhat.com> Cc: "Daniel P. Berrangé" <berrange@redhat.com> Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com> Cc: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-03-02qapi: Empty out qapi-schema.jsonMarkus Armbruster1-1/+2
The previous commit improved compile time by including less of the generated QAPI headers. This is impossible for stuff defined directly in qapi-schema.json, because that ends up in headers that that pull in everything. Move everything but include directives from qapi-schema.json to new sub-module qapi/misc.json, then include just the "misc" shard where possible. It's possible everywhere, except: * monitor.c needs qmp-command.h to get qmp_init_marshal() * monitor.c, ui/vnc.c and the generated qapi-event-FOO.c need qapi-event.h to get enum QAPIEvent Perhaps we'll get rid of those some other day. Adding a type to qapi/migration.json now recompiles some 120 instead of 2300 out of 5100 objects. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20180211093607.27351-25-armbru@redhat.com> [eblake: rebase to master] Signed-off-by: Eric Blake <eblake@redhat.com>
2018-02-14qmp-test: Drop dependence on global_qtestEric Blake1-17/+18
As a general rule, we prefer avoiding implicit global state because it makes code harder to safely copy and paste without thinking about the global state. Although qmp-test does not maintain parallel qtest connections, it was the last test assigning to global_qtest. It's just as easy to be explicit about the state; once all tests have been cleaned up, a later patch can then get rid of global_qtest and a layer of wrappers in libqtest. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2018-02-09Include qapi/qmp/qdict.h exactly where neededMarkus Armbruster1-0/+1
This cleanup makes the number of objects depending on qapi/qmp/qdict.h drop from 4550 (out of 4743) to 368 in my "build everything" tree. For qapi/qmp/qobject.h, the number drops from 4552 to 390. While there, separate #include from file comment with a blank line. Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20180201111846.21846-13-armbru@redhat.com>
2018-02-09Include qapi/qmp/qlist.h exactly where neededMarkus Armbruster1-0/+1
This cleanup makes the number of objects depending on qapi/qmp/qlist.h drop from 4551 (out of 4743) to 16 in my "build everything" tree. While there, separate #include from file comment with a blank line. Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20180201111846.21846-12-armbru@redhat.com>
2018-01-16tests: fix qmp-test leakMarc-André Lureau1-1/+2
Direct leak of 913 byte(s) in 43 object(s) allocated from: #0 0x55880a15df60 in __interceptor_malloc (/home/elmarco/src/qq/build/tests/qmp-test+0x110f60) #1 0x7f3f20fd098f in _IO_vasprintf (/lib64/libc.so.6+0x8098f) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20180104160523.22995-15-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-09-04qapi: Change data type of the FOO_lookup generated for enum FOOMarc-André Lureau1-1/+1
Currently, a FOO_lookup is an array of strings terminated by a NULL sentinel. A future patch will generate enums with "holes". NULL-termination will cease to work then. To prepare for that, store the length in the FOO_lookup by wrapping it in a struct and adding a member for the length. The sentinel will be dropped next. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20170822132255.23945-13-marcandre.lureau@redhat.com> [Basically redone] Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1503564371-26090-16-git-send-email-armbru@redhat.com> [Rebased]
2017-09-04qapi: Drop superfluous qapi_enum_parse() parameter maxMarkus Armbruster1-2/+1
The lookup tables have a sentinel, no need to make callers pass their size. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1503564371-26090-3-git-send-email-armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> [Rebased, commit message corrected]
2017-09-04tests/qmp-test: Add generic, basic test of query commandsMarkus Armbruster1-1/+181
A command is a query if it has no side effect and yields a result. Such commands are typically named query-FOO, but there are exceptions. The basic idea is to find candidates with query-qmp-schema, filter out the ones that aren't queries with an explicit blacklist, and test the remaining ones against a QEMU with no special arguments. The current blacklist is just add-fd. The test can't do queries with arguments, because it knows nothing about the arguments. No coverage for query-cpu-model-baseline, query-cpu-model-comparison, query-cpu-model-expansion, query-rocker, query-rocker-ports, query-rocker-of-dpa-flows, and query-rocker-of-dpa-groups. Most tested commands are expected to succeed. The test does not check the return value then. query-balloon and query-vm-generation-id are expected to fail because they need a virtio-balloon / vmgenid device to succeed, and this test is too dumb to set one up. Could be addressed later. query-acpi-ospm-status and query-hotpluggable-cpus are expected to fail because they require features provided only by special machine types, and this test is too dumb to set that up. Could also be addressed later. Several commands may either be functional or stubs that always fail, depending on build configuration. Ideally, the stubs shouldn't be in query-qmp-schema, but that requires QAPI schema compile-time configuration, which we don't have, yet. Until we do, we need to figure out whether a command is a stub. When we have a suitable CONFIG_FOO preprocessor symbol is available, use that. Else, simply blacklist the command for now. We get basic test coverage for the following commands, except as noted: qom-list-types query-acpi-ospm-status (expected to fail) query-balloon (expected to fail) query-block query-block-jobs query-blockstats query-chardev query-chardev-backends query-command-line-options query-commands query-cpu-definitions (blacklisted for now) query-cpus query-dump query-dump-guest-memory-capability query-events query-fdsets query-gic-capabilities (blacklisted for now) query-hotpluggable-cpus (expected to fail) query-iothreads query-kvm query-machines query-memdev query-memory-devices query-mice query-migrate query-migrate-cache-size query-migrate-capabilities query-migrate-parameters query-name query-named-block-nodes query-pci (blacklisted for now) query-qmp-schema query-rx-filter query-spice query-status query-target query-tpm query-tpm-models query-tpm-types query-uuid query-version query-vm-generation-id (expected to fail) query-vnc query-vnc-servers query-xen-replication-status Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1502461148-10154-1-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> [Typos in code under #ifndef and in the commit message fixed]
2017-03-05qapi: Drop unused non-strict qobject input visitorMarkus Armbruster1-1/+1
The split between tests/test-qobject-input-visitor.c and tests/test-qobject-input-strict.c now makes less sense than ever. The next commit will take care of that. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <1488544368-30622-20-git-send-email-armbru@redhat.com>
2017-03-05qmp-test: New, covering basic QMP protocolMarkus Armbruster1-0/+139
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <1488544368-30622-4-git-send-email-armbru@redhat.com>