[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 6/9] tests: extend qmp test with pereconfig c
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v3 6/9] tests: extend qmp test with pereconfig checks |
Date: |
Tue, 27 Feb 2018 16:13:20 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 |
On 02/16/2018 06:37 AM, Igor Mammedov wrote:
In the subject line: s/pereconfig/preconfig/
Add permission checks for commands in 'preconfig' state.
It should work for all targets, but won't work with
machine 'none' as it's limited to -smp 1 only.
So use PC machine for testing preconfig and 'runstate'
parameter.
Signed-off-by: Igor Mammedov <address@hidden>
---
tests/qmp-test.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
+static bool is_err(QDict *rsp)
+{
+ const char *desc = NULL;
+ QDict *error = qdict_get_qdict(rsp, "error");
+ if (error) {
+ desc = qdict_get_try_str(error, "desc");
+ }
+ QDECREF(rsp);
+ return !!desc;
Wait, so this returns false if this was an error but without a valid desc?
+}
+
+static void test_qmp_preconfig(void)
+{
+ QDict *rsp, *ret;
+ QTestState *qs = qtest_startf("-nodefaults -preconfig -smp 2");
+
+ /* preconfig state */
+ /* enabled commands, no error expected */
+ g_assert(!is_err(qtest_qmp(qs, "{ 'execute': 'query-commands' }")));
+
+ /* forbidden commands, expected error */
+ g_assert(is_err(qtest_qmp(qs, "{ 'execute': 'query-cpus' }")));
Does introspection show which commands are valid in preconfig state?
That may be useful information for a client to know.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
- [Qemu-devel] [PATCH v3 0/9] enable numa configuration before machine_init() from QMP, Igor Mammedov, 2018/02/16
- [Qemu-devel] [PATCH v3 1/9] numa: postpone options post-processing till machine_run_board_init(), Igor Mammedov, 2018/02/16
- [Qemu-devel] [PATCH v3 2/9] numa: split out NumaOptions parsing into parse_NumaOptions(), Igor Mammedov, 2018/02/16
- [Qemu-devel] [PATCH v3 4/9] HMP: disable monitor in preconfig state, Igor Mammedov, 2018/02/16
- [Qemu-devel] [PATCH v3 3/9] CLI: add -preconfig option, Igor Mammedov, 2018/02/16
- [Qemu-devel] [PATCH v3 5/9] QAPI: allow to specify valid runstates per command, Igor Mammedov, 2018/02/16
- [Qemu-devel] [PATCH v3 6/9] tests: extend qmp test with pereconfig checks, Igor Mammedov, 2018/02/16
- Re: [Qemu-devel] [PATCH v3 6/9] tests: extend qmp test with pereconfig checks,
Eric Blake <=
- [Qemu-devel] [PATCH v3 8/9] QMP: add set-numa-node command, Igor Mammedov, 2018/02/16
- [Qemu-devel] [PATCH v3 7/9] QMP: permit query-hotpluggable-cpus in preconfig state, Igor Mammedov, 2018/02/16
- [Qemu-devel] [PATCH v3 9/9] tests: functional tests for QMP command set-numa-node, Igor Mammedov, 2018/02/16
- Re: [Qemu-devel] [PATCH v3 0/9] enable numa configuration before machine_init() from QMP, Igor Mammedov, 2018/02/27