Re: [Qemu-devel] [PATCH v3 07/12] qtest: Add a new helper qmp_cmd() and friends

2017-08-01 Thread Eric Blake
On 08/01/2017 12:48 AM, Markus Armbruster wrote: >> Hmm. What if we assert that qobject_from_jsonf() can never fail halfway >> through? > I don't buy the "primarily for the testsuite argument". It's for > whatever finds it useful. Safer than formatting the JSON text (no JSON > injection

Re: [Qemu-devel] [PATCH v3 07/12] qtest: Add a new helper qmp_cmd() and friends

2017-07-31 Thread Markus Armbruster
Eric Blake writes: > On 07/31/2017 07:34 AM, Eric Blake wrote: >> On 07/31/2017 03:16 AM, Markus Armbruster wrote: >> >> qtest_qmp(s, "%p", QOBJECT(dict)) takes ownership of dict? > >> So given the clean bill of health from valgrind, we definitely DO turn

Re: [Qemu-devel] [PATCH v3 07/12] qtest: Add a new helper qmp_cmd() and friends

2017-07-31 Thread Eric Blake
On 07/31/2017 07:34 AM, Eric Blake wrote: > On 07/31/2017 03:16 AM, Markus Armbruster wrote: > > qtest_qmp(s, "%p", QOBJECT(dict)) takes ownership of dict? > >>> So given the clean bill of health from valgrind, we definitely DO turn >>> over responsibility for freeing on object to its

Re: [Qemu-devel] [PATCH v3 07/12] qtest: Add a new helper qmp_cmd() and friends

2017-07-31 Thread Eric Blake
On 07/31/2017 03:16 AM, Markus Armbruster wrote: qtest_qmp(s, "%p", QOBJECT(dict)) takes ownership of dict? >>> >> So given the clean bill of health from valgrind, we definitely DO turn >> over responsibility for freeing on object to its new wrapper, once it is >> passed through %p.

Re: [Qemu-devel] [PATCH v3 07/12] qtest: Add a new helper qmp_cmd() and friends

2017-07-31 Thread Markus Armbruster
Eric Blake writes: > On 07/28/2017 08:06 AM, Eric Blake wrote: >> On 07/28/2017 07:57 AM, Stefan Hajnoczi wrote: >>> On Tue, Jul 25, 2017 at 04:15:18PM -0500, Eric Blake wrote: +QDict *qtest_qmp_cmd(QTestState *s, const char *cmd, QObject *args) +{ +QDict

Re: [Qemu-devel] [PATCH v3 07/12] qtest: Add a new helper qmp_cmd() and friends

2017-07-28 Thread Eric Blake
On 07/28/2017 01:45 PM, Markus Armbruster wrote: > Eric Blake writes: > >> When interpolating a QMP command from the testsuite, we have >> a very common pattern that the command to be executed is a >> string constant, while the arguments may need to be crafted >> from

Re: [Qemu-devel] [PATCH v3 07/12] qtest: Add a new helper qmp_cmd() and friends

2017-07-28 Thread Markus Armbruster
Eric Blake writes: > When interpolating a QMP command from the testsuite, we have > a very common pattern that the command to be executed is a > string constant, while the arguments may need to be crafted > from qobject_from_jsonf() or even by hand. Make it easier to > craft

Re: [Qemu-devel] [PATCH v3 07/12] qtest: Add a new helper qmp_cmd() and friends

2017-07-28 Thread Eric Blake
On 07/28/2017 08:06 AM, Eric Blake wrote: > On 07/28/2017 07:57 AM, Stefan Hajnoczi wrote: >> On Tue, Jul 25, 2017 at 04:15:18PM -0500, Eric Blake wrote: >>> +QDict *qtest_qmp_cmd(QTestState *s, const char *cmd, QObject *args) >>> +{ >>> +QDict *dict = qdict_new(); >>> + >>> +

Re: [Qemu-devel] [PATCH v3 07/12] qtest: Add a new helper qmp_cmd() and friends

2017-07-28 Thread Eric Blake
On 07/28/2017 07:57 AM, Stefan Hajnoczi wrote: > On Tue, Jul 25, 2017 at 04:15:18PM -0500, Eric Blake wrote: >> +QDict *qtest_qmp_cmd(QTestState *s, const char *cmd, QObject *args) >> +{ >> +QDict *dict = qdict_new(); >> + >> +qdict_put_str(dict, "execute", cmd); >> +if (args) { >> +

Re: [Qemu-devel] [PATCH v3 07/12] qtest: Add a new helper qmp_cmd() and friends

2017-07-28 Thread Stefan Hajnoczi
On Tue, Jul 25, 2017 at 04:15:18PM -0500, Eric Blake wrote: > +QDict *qtest_qmp_cmd(QTestState *s, const char *cmd, QObject *args) > +{ > +QDict *dict = qdict_new(); > + > +qdict_put_str(dict, "execute", cmd); > +if (args) { > +qdict_put_obj(dict, "arguments", args); > +} >

[Qemu-devel] [PATCH v3 07/12] qtest: Add a new helper qmp_cmd() and friends

2017-07-25 Thread Eric Blake
When interpolating a QMP command from the testsuite, we have a very common pattern that the command to be executed is a string constant, while the arguments may need to be crafted from qobject_from_jsonf() or even by hand. Make it easier to craft the arguments without having to save all the