xref: /openbmc/qemu/tests/qtest/libqtest.h (revision a6caeee8)
1 /*
2  * QTest
3  *
4  * Copyright IBM, Corp. 2012
5  * Copyright Red Hat, Inc. 2012
6  * Copyright SUSE LINUX Products GmbH 2013
7  *
8  * Authors:
9  *  Anthony Liguori   <aliguori@us.ibm.com>
10  *  Paolo Bonzini     <pbonzini@redhat.com>
11  *  Andreas Färber    <afaerber@suse.de>
12  *
13  * This work is licensed under the terms of the GNU GPL, version 2 or later.
14  * See the COPYING file in the top-level directory.
15  *
16  */
17 #ifndef LIBQTEST_H
18 #define LIBQTEST_H
19 
20 #include "qapi/qmp/qobject.h"
21 #include "qapi/qmp/qdict.h"
22 #include "libqmp.h"
23 
24 typedef struct QTestState QTestState;
25 
26 /**
27  * qtest_initf:
28  * @fmt: Format for creating other arguments to pass to QEMU, formatted
29  * like sprintf().
30  *
31  * Convenience wrapper around qtest_init().
32  *
33  * Returns: #QTestState instance.
34  */
35 QTestState *qtest_initf(const char *fmt, ...) G_GNUC_PRINTF(1, 2);
36 
37 /**
38  * qtest_vinitf:
39  * @fmt: Format for creating other arguments to pass to QEMU, formatted
40  * like vsprintf().
41  * @ap: Format arguments.
42  *
43  * Convenience wrapper around qtest_init().
44  *
45  * Returns: #QTestState instance.
46  */
47 QTestState *qtest_vinitf(const char *fmt, va_list ap) G_GNUC_PRINTF(1, 0);
48 
49 /**
50  * qtest_init:
51  * @extra_args: other arguments to pass to QEMU.  CAUTION: these
52  * arguments are subject to word splitting and shell evaluation.
53  *
54  * Returns: #QTestState instance.
55  */
56 QTestState *qtest_init(const char *extra_args);
57 
58 /**
59  * qtest_init_without_qmp_handshake:
60  * @extra_args: other arguments to pass to QEMU.  CAUTION: these
61  * arguments are subject to word splitting and shell evaluation.
62  *
63  * Returns: #QTestState instance.
64  */
65 QTestState *qtest_init_without_qmp_handshake(const char *extra_args);
66 
67 /**
68  * qtest_init_with_serial:
69  * @extra_args: other arguments to pass to QEMU.  CAUTION: these
70  * arguments are subject to word splitting and shell evaluation.
71  * @sock_fd: pointer to store the socket file descriptor for
72  * connection with serial.
73  *
74  * Returns: #QTestState instance.
75  */
76 QTestState *qtest_init_with_serial(const char *extra_args, int *sock_fd);
77 
78 /**
79  * qtest_kill_qemu:
80  * @s: #QTestState instance to operate on.
81  *
82  * Kill the QEMU process and wait for it to terminate. It is safe to call this
83  * function multiple times. Normally qtest_quit() is used instead because it
84  * also frees QTestState. Use qtest_kill_qemu() when you just want to kill QEMU
85  * and qtest_quit() will be called later.
86  */
87 void qtest_kill_qemu(QTestState *s);
88 
89 /**
90  * qtest_quit:
91  * @s: #QTestState instance to operate on.
92  *
93  * Shut down the QEMU process associated to @s.
94  */
95 void qtest_quit(QTestState *s);
96 
97 /**
98  * qtest_qmp_fds:
99  * @s: #QTestState instance to operate on.
100  * @fds: array of file descriptors
101  * @fds_num: number of elements in @fds
102  * @fmt: QMP message to send to qemu, formatted like
103  * qobject_from_jsonf_nofail().  See parse_interpolation() for what's
104  * supported after '%'.
105  *
106  * Sends a QMP message to QEMU with fds and returns the response.
107  */
108 QDict *qtest_qmp_fds(QTestState *s, int *fds, size_t fds_num,
109                      const char *fmt, ...)
110     G_GNUC_PRINTF(4, 5);
111 
112 /**
113  * qtest_qmp:
114  * @s: #QTestState instance to operate on.
115  * @fmt: QMP message to send to qemu, formatted like
116  * qobject_from_jsonf_nofail().  See parse_interpolation() for what's
117  * supported after '%'.
118  *
119  * Sends a QMP message to QEMU and returns the response.
120  */
121 QDict *qtest_qmp(QTestState *s, const char *fmt, ...)
122     G_GNUC_PRINTF(2, 3);
123 
124 /**
125  * qtest_qmp_send:
126  * @s: #QTestState instance to operate on.
127  * @fmt: QMP message to send to qemu, formatted like
128  * qobject_from_jsonf_nofail().  See parse_interpolation() for what's
129  * supported after '%'.
130  *
131  * Sends a QMP message to QEMU and leaves the response in the stream.
132  */
133 void qtest_qmp_send(QTestState *s, const char *fmt, ...)
134     G_GNUC_PRINTF(2, 3);
135 
136 /**
137  * qtest_qmp_send_raw:
138  * @s: #QTestState instance to operate on.
139  * @fmt: text to send, formatted like sprintf()
140  *
141  * Sends text to the QMP monitor verbatim.  Need not be valid JSON;
142  * this is useful for negative tests.
143  */
144 void qtest_qmp_send_raw(QTestState *s, const char *fmt, ...)
145     G_GNUC_PRINTF(2, 3);
146 
147 /**
148  * qtest_socket_server:
149  * @socket_path: the UNIX domain socket path
150  *
151  * Create and return a listen socket file descriptor, or abort on failure.
152  */
153 int qtest_socket_server(const char *socket_path);
154 
155 /**
156  * qtest_vqmp_fds:
157  * @s: #QTestState instance to operate on.
158  * @fds: array of file descriptors
159  * @fds_num: number of elements in @fds
160  * @fmt: QMP message to send to QEMU, formatted like
161  * qobject_from_jsonf_nofail().  See parse_interpolation() for what's
162  * supported after '%'.
163  * @ap: QMP message arguments
164  *
165  * Sends a QMP message to QEMU with fds and returns the response.
166  */
167 QDict *qtest_vqmp_fds(QTestState *s, int *fds, size_t fds_num,
168                       const char *fmt, va_list ap)
169     G_GNUC_PRINTF(4, 0);
170 
171 /**
172  * qtest_vqmp:
173  * @s: #QTestState instance to operate on.
174  * @fmt: QMP message to send to QEMU, formatted like
175  * qobject_from_jsonf_nofail().  See parse_interpolation() for what's
176  * supported after '%'.
177  * @ap: QMP message arguments
178  *
179  * Sends a QMP message to QEMU and returns the response.
180  */
181 QDict *qtest_vqmp(QTestState *s, const char *fmt, va_list ap)
182     G_GNUC_PRINTF(2, 0);
183 
184 /**
185  * qtest_qmp_vsend_fds:
186  * @s: #QTestState instance to operate on.
187  * @fds: array of file descriptors
188  * @fds_num: number of elements in @fds
189  * @fmt: QMP message to send to QEMU, formatted like
190  * qobject_from_jsonf_nofail().  See parse_interpolation() for what's
191  * supported after '%'.
192  * @ap: QMP message arguments
193  *
194  * Sends a QMP message to QEMU and leaves the response in the stream.
195  */
196 void qtest_qmp_vsend_fds(QTestState *s, int *fds, size_t fds_num,
197                          const char *fmt, va_list ap)
198     G_GNUC_PRINTF(4, 0);
199 
200 /**
201  * qtest_qmp_vsend:
202  * @s: #QTestState instance to operate on.
203  * @fmt: QMP message to send to QEMU, formatted like
204  * qobject_from_jsonf_nofail().  See parse_interpolation() for what's
205  * supported after '%'.
206  * @ap: QMP message arguments
207  *
208  * Sends a QMP message to QEMU and leaves the response in the stream.
209  */
210 void qtest_qmp_vsend(QTestState *s, const char *fmt, va_list ap)
211     G_GNUC_PRINTF(2, 0);
212 
213 /**
214  * qtest_qmp_receive_dict:
215  * @s: #QTestState instance to operate on.
216  *
217  * Reads a QMP message from QEMU and returns the response.
218  */
219 QDict *qtest_qmp_receive_dict(QTestState *s);
220 
221 /**
222  * qtest_qmp_receive:
223  * @s: #QTestState instance to operate on.
224  *
225  * Reads a QMP message from QEMU and returns the response.
226  * Buffers all the events received meanwhile, until a
227  * call to qtest_qmp_eventwait
228  */
229 QDict *qtest_qmp_receive(QTestState *s);
230 
231 /**
232  * qtest_qmp_eventwait:
233  * @s: #QTestState instance to operate on.
234  * @event: event to wait for.
235  *
236  * Continuously polls for QMP responses until it receives the desired event.
237  */
238 void qtest_qmp_eventwait(QTestState *s, const char *event);
239 
240 /**
241  * qtest_qmp_eventwait_ref:
242  * @s: #QTestState instance to operate on.
243  * @event: event to wait for.
244  *
245  * Continuously polls for QMP responses until it receives the desired event.
246  * Returns a copy of the event for further investigation.
247  */
248 QDict *qtest_qmp_eventwait_ref(QTestState *s, const char *event);
249 
250 /**
251  * qtest_qmp_event_ref:
252  * @s: #QTestState instance to operate on.
253  * @event: event to return.
254  *
255  * Removes non-matching events from the buffer that was set by
256  * qtest_qmp_receive, until an event bearing the given name is found,
257  * and returns it.
258  * If no event matches, clears the buffer and returns NULL.
259  *
260  */
261 QDict *qtest_qmp_event_ref(QTestState *s, const char *event);
262 
263 /**
264  * qtest_hmp:
265  * @s: #QTestState instance to operate on.
266  * @fmt: HMP command to send to QEMU, formats arguments like sprintf().
267  *
268  * Send HMP command to QEMU via QMP's human-monitor-command.
269  * QMP events are discarded.
270  *
271  * Returns: the command's output.  The caller should g_free() it.
272  */
273 char *qtest_hmp(QTestState *s, const char *fmt, ...) G_GNUC_PRINTF(2, 3);
274 
275 /**
276  * qtest_hmpv:
277  * @s: #QTestState instance to operate on.
278  * @fmt: HMP command to send to QEMU, formats arguments like vsprintf().
279  * @ap: HMP command arguments
280  *
281  * Send HMP command to QEMU via QMP's human-monitor-command.
282  * QMP events are discarded.
283  *
284  * Returns: the command's output.  The caller should g_free() it.
285  */
286 char *qtest_vhmp(QTestState *s, const char *fmt, va_list ap)
287     G_GNUC_PRINTF(2, 0);
288 
289 void qtest_module_load(QTestState *s, const char *prefix, const char *libname);
290 
291 /**
292  * qtest_get_irq:
293  * @s: #QTestState instance to operate on.
294  * @num: Interrupt to observe.
295  *
296  * Returns: The level of the @num interrupt.
297  */
298 bool qtest_get_irq(QTestState *s, int num);
299 
300 /**
301  * qtest_irq_intercept_in:
302  * @s: #QTestState instance to operate on.
303  * @string: QOM path of a device.
304  *
305  * Associate qtest irqs with the GPIO-in pins of the device
306  * whose path is specified by @string.
307  */
308 void qtest_irq_intercept_in(QTestState *s, const char *string);
309 
310 /**
311  * qtest_irq_intercept_out:
312  * @s: #QTestState instance to operate on.
313  * @string: QOM path of a device.
314  *
315  * Associate qtest irqs with the GPIO-out pins of the device
316  * whose path is specified by @string.
317  */
318 void qtest_irq_intercept_out(QTestState *s, const char *string);
319 
320 /**
321  * qtest_set_irq_in:
322  * @s: QTestState instance to operate on.
323  * @string: QOM path of a device
324  * @name: IRQ name
325  * @irq: IRQ number
326  * @level: IRQ level
327  *
328  * Force given device/irq GPIO-in pin to the given level.
329  */
330 void qtest_set_irq_in(QTestState *s, const char *string, const char *name,
331                       int irq, int level);
332 
333 /**
334  * qtest_outb:
335  * @s: #QTestState instance to operate on.
336  * @addr: I/O port to write to.
337  * @value: Value being written.
338  *
339  * Write an 8-bit value to an I/O port.
340  */
341 void qtest_outb(QTestState *s, uint16_t addr, uint8_t value);
342 
343 /**
344  * qtest_outw:
345  * @s: #QTestState instance to operate on.
346  * @addr: I/O port to write to.
347  * @value: Value being written.
348  *
349  * Write a 16-bit value to an I/O port.
350  */
351 void qtest_outw(QTestState *s, uint16_t addr, uint16_t value);
352 
353 /**
354  * qtest_outl:
355  * @s: #QTestState instance to operate on.
356  * @addr: I/O port to write to.
357  * @value: Value being written.
358  *
359  * Write a 32-bit value to an I/O port.
360  */
361 void qtest_outl(QTestState *s, uint16_t addr, uint32_t value);
362 
363 /**
364  * qtest_inb:
365  * @s: #QTestState instance to operate on.
366  * @addr: I/O port to read from.
367  *
368  * Returns an 8-bit value from an I/O port.
369  */
370 uint8_t qtest_inb(QTestState *s, uint16_t addr);
371 
372 /**
373  * qtest_inw:
374  * @s: #QTestState instance to operate on.
375  * @addr: I/O port to read from.
376  *
377  * Returns a 16-bit value from an I/O port.
378  */
379 uint16_t qtest_inw(QTestState *s, uint16_t addr);
380 
381 /**
382  * qtest_inl:
383  * @s: #QTestState instance to operate on.
384  * @addr: I/O port to read from.
385  *
386  * Returns a 32-bit value from an I/O port.
387  */
388 uint32_t qtest_inl(QTestState *s, uint16_t addr);
389 
390 /**
391  * qtest_writeb:
392  * @s: #QTestState instance to operate on.
393  * @addr: Guest address to write to.
394  * @value: Value being written.
395  *
396  * Writes an 8-bit value to memory.
397  */
398 void qtest_writeb(QTestState *s, uint64_t addr, uint8_t value);
399 
400 /**
401  * qtest_writew:
402  * @s: #QTestState instance to operate on.
403  * @addr: Guest address to write to.
404  * @value: Value being written.
405  *
406  * Writes a 16-bit value to memory.
407  */
408 void qtest_writew(QTestState *s, uint64_t addr, uint16_t value);
409 
410 /**
411  * qtest_writel:
412  * @s: #QTestState instance to operate on.
413  * @addr: Guest address to write to.
414  * @value: Value being written.
415  *
416  * Writes a 32-bit value to memory.
417  */
418 void qtest_writel(QTestState *s, uint64_t addr, uint32_t value);
419 
420 /**
421  * qtest_writeq:
422  * @s: #QTestState instance to operate on.
423  * @addr: Guest address to write to.
424  * @value: Value being written.
425  *
426  * Writes a 64-bit value to memory.
427  */
428 void qtest_writeq(QTestState *s, uint64_t addr, uint64_t value);
429 
430 /**
431  * qtest_readb:
432  * @s: #QTestState instance to operate on.
433  * @addr: Guest address to read from.
434  *
435  * Reads an 8-bit value from memory.
436  *
437  * Returns: Value read.
438  */
439 uint8_t qtest_readb(QTestState *s, uint64_t addr);
440 
441 /**
442  * qtest_readw:
443  * @s: #QTestState instance to operate on.
444  * @addr: Guest address to read from.
445  *
446  * Reads a 16-bit value from memory.
447  *
448  * Returns: Value read.
449  */
450 uint16_t qtest_readw(QTestState *s, uint64_t addr);
451 
452 /**
453  * qtest_readl:
454  * @s: #QTestState instance to operate on.
455  * @addr: Guest address to read from.
456  *
457  * Reads a 32-bit value from memory.
458  *
459  * Returns: Value read.
460  */
461 uint32_t qtest_readl(QTestState *s, uint64_t addr);
462 
463 /**
464  * qtest_readq:
465  * @s: #QTestState instance to operate on.
466  * @addr: Guest address to read from.
467  *
468  * Reads a 64-bit value from memory.
469  *
470  * Returns: Value read.
471  */
472 uint64_t qtest_readq(QTestState *s, uint64_t addr);
473 
474 /**
475  * qtest_memread:
476  * @s: #QTestState instance to operate on.
477  * @addr: Guest address to read from.
478  * @data: Pointer to where memory contents will be stored.
479  * @size: Number of bytes to read.
480  *
481  * Read guest memory into a buffer.
482  */
483 void qtest_memread(QTestState *s, uint64_t addr, void *data, size_t size);
484 
485 /**
486  * qtest_rtas_call:
487  * @s: #QTestState instance to operate on.
488  * @name: name of the command to call.
489  * @nargs: Number of args.
490  * @args: Guest address to read args from.
491  * @nret: Number of return value.
492  * @ret: Guest address to write return values to.
493  *
494  * Call an RTAS function
495  */
496 uint64_t qtest_rtas_call(QTestState *s, const char *name,
497                          uint32_t nargs, uint64_t args,
498                          uint32_t nret, uint64_t ret);
499 
500 /**
501  * qtest_bufread:
502  * @s: #QTestState instance to operate on.
503  * @addr: Guest address to read from.
504  * @data: Pointer to where memory contents will be stored.
505  * @size: Number of bytes to read.
506  *
507  * Read guest memory into a buffer and receive using a base64 encoding.
508  */
509 void qtest_bufread(QTestState *s, uint64_t addr, void *data, size_t size);
510 
511 /**
512  * qtest_memwrite:
513  * @s: #QTestState instance to operate on.
514  * @addr: Guest address to write to.
515  * @data: Pointer to the bytes that will be written to guest memory.
516  * @size: Number of bytes to write.
517  *
518  * Write a buffer to guest memory.
519  */
520 void qtest_memwrite(QTestState *s, uint64_t addr, const void *data, size_t size);
521 
522 /**
523  * qtest_bufwrite:
524  * @s: #QTestState instance to operate on.
525  * @addr: Guest address to write to.
526  * @data: Pointer to the bytes that will be written to guest memory.
527  * @size: Number of bytes to write.
528  *
529  * Write a buffer to guest memory and transmit using a base64 encoding.
530  */
531 void qtest_bufwrite(QTestState *s, uint64_t addr,
532                     const void *data, size_t size);
533 
534 /**
535  * qtest_memset:
536  * @s: #QTestState instance to operate on.
537  * @addr: Guest address to write to.
538  * @patt: Byte pattern to fill the guest memory region with.
539  * @size: Number of bytes to write.
540  *
541  * Write a pattern to guest memory.
542  */
543 void qtest_memset(QTestState *s, uint64_t addr, uint8_t patt, size_t size);
544 
545 /**
546  * qtest_clock_step_next:
547  * @s: #QTestState instance to operate on.
548  *
549  * Advance the QEMU_CLOCK_VIRTUAL to the next deadline.
550  *
551  * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds.
552  */
553 int64_t qtest_clock_step_next(QTestState *s);
554 
555 /**
556  * qtest_clock_step:
557  * @s: QTestState instance to operate on.
558  * @step: Number of nanoseconds to advance the clock by.
559  *
560  * Advance the QEMU_CLOCK_VIRTUAL by @step nanoseconds.
561  *
562  * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds.
563  */
564 int64_t qtest_clock_step(QTestState *s, int64_t step);
565 
566 /**
567  * qtest_clock_set:
568  * @s: QTestState instance to operate on.
569  * @val: Nanoseconds value to advance the clock to.
570  *
571  * Advance the QEMU_CLOCK_VIRTUAL to @val nanoseconds since the VM was launched.
572  *
573  * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds.
574  */
575 int64_t qtest_clock_set(QTestState *s, int64_t val);
576 
577 /**
578  * qtest_big_endian:
579  * @s: QTestState instance to operate on.
580  *
581  * Returns: True if the architecture under test has a big endian configuration.
582  */
583 bool qtest_big_endian(QTestState *s);
584 
585 /**
586  * qtest_get_arch:
587  *
588  * Returns: The architecture for the QEMU executable under test.
589  */
590 const char *qtest_get_arch(void);
591 
592 /**
593  * qtest_has_accel:
594  * @accel_name: Accelerator name to check for.
595  *
596  * Returns: true if the accelerator is built in.
597  */
598 bool qtest_has_accel(const char *accel_name);
599 
600 /**
601  * qtest_add_func:
602  * @str: Test case path.
603  * @fn: Test case function
604  *
605  * Add a GTester testcase with the given name and function.
606  * The path is prefixed with the architecture under test, as
607  * returned by qtest_get_arch().
608  */
609 void qtest_add_func(const char *str, void (*fn)(void));
610 
611 /**
612  * qtest_add_data_func:
613  * @str: Test case path.
614  * @data: Test case data
615  * @fn: Test case function
616  *
617  * Add a GTester testcase with the given name, data and function.
618  * The path is prefixed with the architecture under test, as
619  * returned by qtest_get_arch().
620  */
621 void qtest_add_data_func(const char *str, const void *data,
622                          void (*fn)(const void *));
623 
624 /**
625  * qtest_add_data_func_full:
626  * @str: Test case path.
627  * @data: Test case data
628  * @fn: Test case function
629  * @data_free_func: GDestroyNotify for data
630  *
631  * Add a GTester testcase with the given name, data and function.
632  * The path is prefixed with the architecture under test, as
633  * returned by qtest_get_arch().
634  *
635  * @data is passed to @data_free_func() on test completion.
636  */
637 void qtest_add_data_func_full(const char *str, void *data,
638                               void (*fn)(const void *),
639                               GDestroyNotify data_free_func);
640 
641 /**
642  * qtest_add:
643  * @testpath: Test case path
644  * @Fixture: Fixture type
645  * @tdata: Test case data
646  * @fsetup: Test case setup function
647  * @ftest: Test case function
648  * @fteardown: Test case teardown function
649  *
650  * Add a GTester testcase with the given name, data and functions.
651  * The path is prefixed with the architecture under test, as
652  * returned by qtest_get_arch().
653  */
654 #define qtest_add(testpath, Fixture, tdata, fsetup, ftest, fteardown) \
655     do { \
656         char *path = g_strdup_printf("/%s/%s", qtest_get_arch(), testpath); \
657         g_test_add(path, Fixture, tdata, fsetup, ftest, fteardown); \
658         g_free(path); \
659     } while (0)
660 
661 /**
662  * qtest_add_abrt_handler:
663  * @fn: Handler function
664  * @data: Argument that is passed to the handler
665  *
666  * Add a handler function that is invoked on SIGABRT. This can be used to
667  * terminate processes and perform other cleanup. The handler can be removed
668  * with qtest_remove_abrt_handler().
669  */
670 void qtest_add_abrt_handler(GHookFunc fn, const void *data);
671 
672 /**
673  * qtest_remove_abrt_handler:
674  * @data: Argument previously passed to qtest_add_abrt_handler()
675  *
676  * Remove an abrt handler that was previously added with
677  * qtest_add_abrt_handler().
678  */
679 void qtest_remove_abrt_handler(void *data);
680 
681 /**
682  * qtest_qmp_assert_success:
683  * @qts: QTestState instance to operate on
684  * @fmt: QMP message to send to qemu, formatted like
685  * qobject_from_jsonf_nofail().  See parse_interpolation() for what's
686  * supported after '%'.
687  *
688  * Sends a QMP message to QEMU and asserts that a 'return' key is present in
689  * the response.
690  */
691 void qtest_qmp_assert_success(QTestState *qts, const char *fmt, ...)
692     G_GNUC_PRINTF(2, 3);
693 
694 /**
695  * qtest_cb_for_every_machine:
696  * @cb: Pointer to the callback function
697  * @skip_old_versioned: true if versioned old machine types should be skipped
698  *
699  *  Call a callback function for every name of all available machines.
700  */
701 void qtest_cb_for_every_machine(void (*cb)(const char *machine),
702                                 bool skip_old_versioned);
703 
704 /**
705  * qtest_has_machine:
706  * @machine: The machine to look for
707  *
708  * Returns: true if the machine is available in the target binary.
709  */
710 bool qtest_has_machine(const char *machine);
711 
712 /**
713  * qtest_has_device:
714  * @device: The device to look for
715  *
716  * Returns: true if the device is available in the target binary.
717  */
718 bool qtest_has_device(const char *device);
719 
720 /**
721  * qtest_qmp_device_add_qdict:
722  * @qts: QTestState instance to operate on
723  * @drv: Name of the device that should be added
724  * @arguments: QDict with properties for the device to intialize
725  *
726  * Generic hot-plugging test via the device_add QMP command with properties
727  * supplied in form of QDict. Use NULL for empty properties list.
728  */
729 void qtest_qmp_device_add_qdict(QTestState *qts, const char *drv,
730                                 const QDict *arguments);
731 
732 /**
733  * qtest_qmp_device_add:
734  * @qts: QTestState instance to operate on
735  * @driver: Name of the device that should be added
736  * @id: Identification string
737  * @fmt: QMP message to send to qemu, formatted like
738  * qobject_from_jsonf_nofail().  See parse_interpolation() for what's
739  * supported after '%'.
740  *
741  * Generic hot-plugging test via the device_add QMP command.
742  */
743 void qtest_qmp_device_add(QTestState *qts, const char *driver, const char *id,
744                           const char *fmt, ...) G_GNUC_PRINTF(4, 5);
745 
746 /**
747  * qtest_qmp_add_client:
748  * @qts: QTestState instance to operate on
749  * @protocol: the protocol to add to
750  * @fd: the client file-descriptor
751  *
752  * Call QMP ``getfd`` followed by ``add_client`` with the given @fd.
753  */
754 void qtest_qmp_add_client(QTestState *qts, const char *protocol, int fd);
755 
756 /**
757  * qtest_qmp_device_del:
758  * @qts: QTestState instance to operate on
759  * @id: Identification string
760  *
761  * Generic hot-unplugging test via the device_del QMP command.
762  */
763 void qtest_qmp_device_del(QTestState *qts, const char *id);
764 
765 /**
766  * qtest_probe_child:
767  * @s: QTestState instance to operate on.
768  *
769  * Returns: true if the child is still alive.
770  */
771 bool qtest_probe_child(QTestState *s);
772 
773 /**
774  * qtest_set_expected_status:
775  * @s: QTestState instance to operate on.
776  * @status: an expected exit status.
777  *
778  * Set expected exit status of the child.
779  */
780 void qtest_set_expected_status(QTestState *s, int status);
781 
782 QTestState *qtest_inproc_init(QTestState **s, bool log, const char* arch,
783                     void (*send)(void*, const char*));
784 
785 void qtest_client_inproc_recv(void *opaque, const char *str);
786 
787 /**
788  * qtest_qom_set_bool:
789  * @s: QTestState instance to operate on.
790  * @path: Path to the property being set.
791  * @property: Property being set.
792  * @value: Value to set the property.
793  *
794  * Set the property with passed in value.
795  */
796 void qtest_qom_set_bool(QTestState *s, const char *path, const char *property,
797                          bool value);
798 
799 /**
800  * qtest_qom_get_bool:
801  * @s: QTestState instance to operate on.
802  * @path: Path to the property being retrieved.
803  * @property: Property from where the value is being retrieved.
804  *
805  * Returns: Value retrieved from property.
806  */
807 bool qtest_qom_get_bool(QTestState *s, const char *path, const char *property);
808 #endif
809