4 * Copyright IBM, Corp. 2012
5 * Copyright Red Hat, Inc. 2012
6 * Copyright SUSE LINUX Products GmbH 2013
9 * Anthony Liguori <aliguori@us.ibm.com>
10 * Paolo Bonzini <pbonzini@redhat.com>
11 * Andreas Färber <afaerber@suse.de>
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.
20 typedef struct QTestState QTestState
;
22 extern QTestState
*global_qtest
;
26 * @fmt...: Format for creating other arguments to pass to QEMU, formatted
29 * Convenience wrapper around qtest_start().
31 * Returns: #QTestState instance.
33 QTestState
*qtest_initf(const char *fmt
, ...) GCC_FMT_ATTR(1, 2);
37 * @fmt: Format for creating other arguments to pass to QEMU, formatted
39 * @ap: Format arguments.
41 * Convenience wrapper around qtest_start().
43 * Returns: #QTestState instance.
45 QTestState
*qtest_vinitf(const char *fmt
, va_list ap
) GCC_FMT_ATTR(1, 0);
49 * @extra_args: other arguments to pass to QEMU. CAUTION: these
50 * arguments are subject to word splitting and shell evaluation.
52 * Returns: #QTestState instance.
54 QTestState
*qtest_init(const char *extra_args
);
57 * qtest_init_without_qmp_handshake:
58 * @extra_args: other arguments to pass to QEMU. CAUTION: these
59 * arguments are subject to word splitting and shell evaluation.
61 * Returns: #QTestState instance.
63 QTestState
*qtest_init_without_qmp_handshake(const char *extra_args
);
67 * @s: #QTestState instance to operate on.
69 * Shut down the QEMU process associated to @s.
71 void qtest_quit(QTestState
*s
);
75 * @s: #QTestState instance to operate on.
76 * @fmt...: QMP message to send to qemu, formatted like
77 * qobject_from_jsonf_nofail(). See parse_escape() for what's
78 * supported after '%'.
80 * Sends a QMP message to QEMU and returns the response.
82 QDict
*qtest_qmp(QTestState
*s
, const char *fmt
, ...)
87 * @s: #QTestState instance to operate on.
88 * @fmt...: QMP message to send to qemu, formatted like
89 * qobject_from_jsonf_nofail(). See parse_escape() for what's
90 * supported after '%'.
92 * Sends a QMP message to QEMU and leaves the response in the stream.
94 void qtest_qmp_send(QTestState
*s
, const char *fmt
, ...)
99 * @s: #QTestState instance to operate on.
100 * @fmt...: text to send, formatted like sprintf()
102 * Sends text to the QMP monitor verbatim. Need not be valid JSON;
103 * this is useful for negative tests.
105 void qtest_qmp_send_raw(QTestState
*s
, const char *fmt
, ...)
110 * @s: #QTestState instance to operate on.
111 * @fmt: QMP message to send to QEMU, formatted like
112 * qobject_from_jsonf_nofail(). See parse_escape() for what's
113 * supported after '%'.
114 * @ap: QMP message arguments
116 * Sends a QMP message to QEMU and returns the response.
118 QDict
*qtest_vqmp(QTestState
*s
, const char *fmt
, va_list ap
)
123 * @s: #QTestState instance to operate on.
124 * @fmt: QMP message to send to QEMU, formatted like
125 * qobject_from_jsonf_nofail(). See parse_escape() for what's
126 * supported after '%'.
127 * @ap: QMP message arguments
129 * Sends a QMP message to QEMU and leaves the response in the stream.
131 void qtest_qmp_vsend(QTestState
*s
, const char *fmt
, va_list ap
)
136 * @s: #QTestState instance to operate on.
138 * Reads a QMP message from QEMU and returns the response.
140 QDict
*qtest_qmp_receive(QTestState
*s
);
143 * qtest_qmp_eventwait:
144 * @s: #QTestState instance to operate on.
145 * @s: #event event to wait for.
147 * Continuously polls for QMP responses until it receives the desired event.
149 void qtest_qmp_eventwait(QTestState
*s
, const char *event
);
152 * qtest_qmp_eventwait_ref:
153 * @s: #QTestState instance to operate on.
154 * @s: #event event to wait for.
156 * Continuously polls for QMP responses until it receives the desired event.
157 * Returns a copy of the event for further investigation.
159 QDict
*qtest_qmp_eventwait_ref(QTestState
*s
, const char *event
);
162 * qtest_qmp_receive_success:
163 * @s: #QTestState instance to operate on
164 * @event_cb: Event callback
165 * @opaque: Argument for @event_cb
167 * Poll QMP messages until a command success response is received.
168 * If @event_cb, call it for each event received, passing @opaque,
169 * the event's name and data.
170 * Return the success response's "return" member.
172 QDict
*qtest_qmp_receive_success(QTestState
*s
,
173 void (*event_cb
)(void *opaque
,
180 * @s: #QTestState instance to operate on.
181 * @fmt...: HMP command to send to QEMU, formats arguments like sprintf().
183 * Send HMP command to QEMU via QMP's human-monitor-command.
184 * QMP events are discarded.
186 * Returns: the command's output. The caller should g_free() it.
188 char *qtest_hmp(QTestState
*s
, const char *fmt
, ...) GCC_FMT_ATTR(2, 3);
192 * @s: #QTestState instance to operate on.
193 * @fmt: HMP command to send to QEMU, formats arguments like vsprintf().
194 * @ap: HMP command arguments
196 * Send HMP command to QEMU via QMP's human-monitor-command.
197 * QMP events are discarded.
199 * Returns: the command's output. The caller should g_free() it.
201 char *qtest_vhmp(QTestState
*s
, const char *fmt
, va_list ap
)
206 * @s: #QTestState instance to operate on.
207 * @num: Interrupt to observe.
209 * Returns: The level of the @num interrupt.
211 bool qtest_get_irq(QTestState
*s
, int num
);
214 * qtest_irq_intercept_in:
215 * @s: #QTestState instance to operate on.
216 * @string: QOM path of a device.
218 * Associate qtest irqs with the GPIO-in pins of the device
219 * whose path is specified by @string.
221 void qtest_irq_intercept_in(QTestState
*s
, const char *string
);
224 * qtest_irq_intercept_out:
225 * @s: #QTestState instance to operate on.
226 * @string: QOM path of a device.
228 * Associate qtest irqs with the GPIO-out pins of the device
229 * whose path is specified by @string.
231 void qtest_irq_intercept_out(QTestState
*s
, const char *string
);
235 * @s: #QTestState instance to operate on.
236 * @addr: I/O port to write to.
237 * @value: Value being written.
239 * Write an 8-bit value to an I/O port.
241 void qtest_outb(QTestState
*s
, uint16_t addr
, uint8_t value
);
245 * @s: #QTestState instance to operate on.
246 * @addr: I/O port to write to.
247 * @value: Value being written.
249 * Write a 16-bit value to an I/O port.
251 void qtest_outw(QTestState
*s
, uint16_t addr
, uint16_t value
);
255 * @s: #QTestState instance to operate on.
256 * @addr: I/O port to write to.
257 * @value: Value being written.
259 * Write a 32-bit value to an I/O port.
261 void qtest_outl(QTestState
*s
, uint16_t addr
, uint32_t value
);
265 * @s: #QTestState instance to operate on.
266 * @addr: I/O port to read from.
268 * Returns an 8-bit value from an I/O port.
270 uint8_t qtest_inb(QTestState
*s
, uint16_t addr
);
274 * @s: #QTestState instance to operate on.
275 * @addr: I/O port to read from.
277 * Returns a 16-bit value from an I/O port.
279 uint16_t qtest_inw(QTestState
*s
, uint16_t addr
);
283 * @s: #QTestState instance to operate on.
284 * @addr: I/O port to read from.
286 * Returns a 32-bit value from an I/O port.
288 uint32_t qtest_inl(QTestState
*s
, uint16_t addr
);
292 * @s: #QTestState instance to operate on.
293 * @addr: Guest address to write to.
294 * @value: Value being written.
296 * Writes an 8-bit value to memory.
298 void qtest_writeb(QTestState
*s
, uint64_t addr
, uint8_t value
);
302 * @s: #QTestState instance to operate on.
303 * @addr: Guest address to write to.
304 * @value: Value being written.
306 * Writes a 16-bit value to memory.
308 void qtest_writew(QTestState
*s
, uint64_t addr
, uint16_t value
);
312 * @s: #QTestState instance to operate on.
313 * @addr: Guest address to write to.
314 * @value: Value being written.
316 * Writes a 32-bit value to memory.
318 void qtest_writel(QTestState
*s
, uint64_t addr
, uint32_t value
);
322 * @s: #QTestState instance to operate on.
323 * @addr: Guest address to write to.
324 * @value: Value being written.
326 * Writes a 64-bit value to memory.
328 void qtest_writeq(QTestState
*s
, uint64_t addr
, uint64_t value
);
332 * @s: #QTestState instance to operate on.
333 * @addr: Guest address to read from.
335 * Reads an 8-bit value from memory.
337 * Returns: Value read.
339 uint8_t qtest_readb(QTestState
*s
, uint64_t addr
);
343 * @s: #QTestState instance to operate on.
344 * @addr: Guest address to read from.
346 * Reads a 16-bit value from memory.
348 * Returns: Value read.
350 uint16_t qtest_readw(QTestState
*s
, uint64_t addr
);
354 * @s: #QTestState instance to operate on.
355 * @addr: Guest address to read from.
357 * Reads a 32-bit value from memory.
359 * Returns: Value read.
361 uint32_t qtest_readl(QTestState
*s
, uint64_t addr
);
365 * @s: #QTestState instance to operate on.
366 * @addr: Guest address to read from.
368 * Reads a 64-bit value from memory.
370 * Returns: Value read.
372 uint64_t qtest_readq(QTestState
*s
, uint64_t addr
);
376 * @s: #QTestState instance to operate on.
377 * @addr: Guest address to read from.
378 * @data: Pointer to where memory contents will be stored.
379 * @size: Number of bytes to read.
381 * Read guest memory into a buffer.
383 void qtest_memread(QTestState
*s
, uint64_t addr
, void *data
, size_t size
);
387 * @s: #QTestState instance to operate on.
388 * @name: name of the command to call.
389 * @nargs: Number of args.
390 * @args: Guest address to read args from.
391 * @nret: Number of return value.
392 * @ret: Guest address to write return values to.
394 * Call an RTAS function
396 uint64_t qtest_rtas_call(QTestState
*s
, const char *name
,
397 uint32_t nargs
, uint64_t args
,
398 uint32_t nret
, uint64_t ret
);
402 * @s: #QTestState instance to operate on.
403 * @addr: Guest address to read from.
404 * @data: Pointer to where memory contents will be stored.
405 * @size: Number of bytes to read.
407 * Read guest memory into a buffer and receive using a base64 encoding.
409 void qtest_bufread(QTestState
*s
, uint64_t addr
, void *data
, size_t size
);
413 * @s: #QTestState instance to operate on.
414 * @addr: Guest address to write to.
415 * @data: Pointer to the bytes that will be written to guest memory.
416 * @size: Number of bytes to write.
418 * Write a buffer to guest memory.
420 void qtest_memwrite(QTestState
*s
, uint64_t addr
, const void *data
, size_t size
);
424 * @s: #QTestState instance to operate on.
425 * @addr: Guest address to write to.
426 * @data: Pointer to the bytes that will be written to guest memory.
427 * @size: Number of bytes to write.
429 * Write a buffer to guest memory and transmit using a base64 encoding.
431 void qtest_bufwrite(QTestState
*s
, uint64_t addr
,
432 const void *data
, size_t size
);
436 * @s: #QTestState instance to operate on.
437 * @addr: Guest address to write to.
438 * @patt: Byte pattern to fill the guest memory region with.
439 * @size: Number of bytes to write.
441 * Write a pattern to guest memory.
443 void qtest_memset(QTestState
*s
, uint64_t addr
, uint8_t patt
, size_t size
);
446 * qtest_clock_step_next:
447 * @s: #QTestState instance to operate on.
449 * Advance the QEMU_CLOCK_VIRTUAL to the next deadline.
451 * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds.
453 int64_t qtest_clock_step_next(QTestState
*s
);
457 * @s: QTestState instance to operate on.
458 * @step: Number of nanoseconds to advance the clock by.
460 * Advance the QEMU_CLOCK_VIRTUAL by @step nanoseconds.
462 * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds.
464 int64_t qtest_clock_step(QTestState
*s
, int64_t step
);
468 * @s: QTestState instance to operate on.
469 * @val: Nanoseconds value to advance the clock to.
471 * Advance the QEMU_CLOCK_VIRTUAL to @val nanoseconds since the VM was launched.
473 * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds.
475 int64_t qtest_clock_set(QTestState
*s
, int64_t val
);
479 * @s: QTestState instance to operate on.
481 * Returns: True if the architecture under test has a big endian configuration.
483 bool qtest_big_endian(QTestState
*s
);
488 * Returns: The architecture for the QEMU executable under test.
490 const char *qtest_get_arch(void);
494 * @str: Test case path.
495 * @fn: Test case function
497 * Add a GTester testcase with the given name and function.
498 * The path is prefixed with the architecture under test, as
499 * returned by qtest_get_arch().
501 void qtest_add_func(const char *str
, void (*fn
)(void));
504 * qtest_add_data_func:
505 * @str: Test case path.
506 * @data: Test case data
507 * @fn: Test case function
509 * Add a GTester testcase with the given name, data and function.
510 * The path is prefixed with the architecture under test, as
511 * returned by qtest_get_arch().
513 void qtest_add_data_func(const char *str
, const void *data
,
514 void (*fn
)(const void *));
517 * qtest_add_data_func_full:
518 * @str: Test case path.
519 * @data: Test case data
520 * @fn: Test case function
521 * @data_free_func: GDestroyNotify for data
523 * Add a GTester testcase with the given name, data and function.
524 * The path is prefixed with the architecture under test, as
525 * returned by qtest_get_arch().
527 * @data is passed to @data_free_func() on test completion.
529 void qtest_add_data_func_full(const char *str
, void *data
,
530 void (*fn
)(const void *),
531 GDestroyNotify data_free_func
);
535 * @testpath: Test case path
536 * @Fixture: Fixture type
537 * @tdata: Test case data
538 * @fsetup: Test case setup function
539 * @ftest: Test case function
540 * @fteardown: Test case teardown function
542 * Add a GTester testcase with the given name, data and functions.
543 * The path is prefixed with the architecture under test, as
544 * returned by qtest_get_arch().
546 #define qtest_add(testpath, Fixture, tdata, fsetup, ftest, fteardown) \
548 char *path = g_strdup_printf("/%s/%s", qtest_get_arch(), testpath); \
549 g_test_add(path, Fixture, tdata, fsetup, ftest, fteardown); \
553 void qtest_add_abrt_handler(GHookFunc fn
, const void *data
);
557 * @args: other arguments to pass to QEMU
559 * Start QEMU and assign the resulting #QTestState to a global variable.
560 * The global variable is used by "shortcut" functions documented below.
562 * Returns: #QTestState instance.
564 static inline QTestState
*qtest_start(const char *args
)
566 global_qtest
= qtest_init(args
);
573 * Shut down the QEMU process started by qtest_start().
575 static inline void qtest_end(void)
577 qtest_quit(global_qtest
);
583 * @fmt...: QMP message to send to qemu, formatted like
584 * qobject_from_jsonf_nofail(). See parse_escape() for what's
585 * supported after '%'.
587 * Sends a QMP message to QEMU and returns the response.
589 QDict
*qmp(const char *fmt
, ...) GCC_FMT_ATTR(1, 2);
593 * @fmt...: QMP message to send to qemu, formatted like
594 * qobject_from_jsonf_nofail(). See parse_escape() for what's
595 * supported after '%'.
597 * Sends a QMP message to QEMU and leaves the response in the stream.
599 void qmp_send(const char *fmt
, ...) GCC_FMT_ATTR(1, 2);
604 * Reads a QMP message from QEMU and returns the response.
606 static inline QDict
*qmp_receive(void)
608 return qtest_qmp_receive(global_qtest
);
613 * @s: #event event to wait for.
615 * Continuously polls for QMP responses until it receives the desired event.
617 static inline void qmp_eventwait(const char *event
)
619 return qtest_qmp_eventwait(global_qtest
, event
);
624 * @s: #event event to wait for.
626 * Continuously polls for QMP responses until it receives the desired event.
627 * Returns a copy of the event for further investigation.
629 static inline QDict
*qmp_eventwait_ref(const char *event
)
631 return qtest_qmp_eventwait_ref(global_qtest
, event
);
636 * @fmt...: HMP command to send to QEMU, formats arguments like sprintf().
638 * Send HMP command to QEMU via QMP's human-monitor-command.
640 * Returns: the command's output. The caller should g_free() it.
642 char *hmp(const char *fmt
, ...) GCC_FMT_ATTR(1, 2);
646 * @num: Interrupt to observe.
648 * Returns: The level of the @num interrupt.
650 static inline bool get_irq(int num
)
652 return qtest_get_irq(global_qtest
, num
);
657 * @string: QOM path of a device.
659 * Associate qtest irqs with the GPIO-in pins of the device
660 * whose path is specified by @string.
662 static inline void irq_intercept_in(const char *string
)
664 qtest_irq_intercept_in(global_qtest
, string
);
668 * qtest_irq_intercept_out:
669 * @string: QOM path of a device.
671 * Associate qtest irqs with the GPIO-out pins of the device
672 * whose path is specified by @string.
674 static inline void irq_intercept_out(const char *string
)
676 qtest_irq_intercept_out(global_qtest
, string
);
681 * @addr: I/O port to write to.
682 * @value: Value being written.
684 * Write an 8-bit value to an I/O port.
686 static inline void outb(uint16_t addr
, uint8_t value
)
688 qtest_outb(global_qtest
, addr
, value
);
693 * @addr: I/O port to write to.
694 * @value: Value being written.
696 * Write a 16-bit value to an I/O port.
698 static inline void outw(uint16_t addr
, uint16_t value
)
700 qtest_outw(global_qtest
, addr
, value
);
705 * @addr: I/O port to write to.
706 * @value: Value being written.
708 * Write a 32-bit value to an I/O port.
710 static inline void outl(uint16_t addr
, uint32_t value
)
712 qtest_outl(global_qtest
, addr
, value
);
717 * @addr: I/O port to read from.
719 * Reads an 8-bit value from an I/O port.
721 * Returns: Value read.
723 static inline uint8_t inb(uint16_t addr
)
725 return qtest_inb(global_qtest
, addr
);
730 * @addr: I/O port to read from.
732 * Reads a 16-bit value from an I/O port.
734 * Returns: Value read.
736 static inline uint16_t inw(uint16_t addr
)
738 return qtest_inw(global_qtest
, addr
);
743 * @addr: I/O port to read from.
745 * Reads a 32-bit value from an I/O port.
747 * Returns: Value read.
749 static inline uint32_t inl(uint16_t addr
)
751 return qtest_inl(global_qtest
, addr
);
756 * @addr: Guest address to write to.
757 * @value: Value being written.
759 * Writes an 8-bit value to guest memory.
761 static inline void writeb(uint64_t addr
, uint8_t value
)
763 qtest_writeb(global_qtest
, addr
, value
);
768 * @addr: Guest address to write to.
769 * @value: Value being written.
771 * Writes a 16-bit value to guest memory.
773 static inline void writew(uint64_t addr
, uint16_t value
)
775 qtest_writew(global_qtest
, addr
, value
);
780 * @addr: Guest address to write to.
781 * @value: Value being written.
783 * Writes a 32-bit value to guest memory.
785 static inline void writel(uint64_t addr
, uint32_t value
)
787 qtest_writel(global_qtest
, addr
, value
);
792 * @addr: Guest address to write to.
793 * @value: Value being written.
795 * Writes a 64-bit value to guest memory.
797 static inline void writeq(uint64_t addr
, uint64_t value
)
799 qtest_writeq(global_qtest
, addr
, value
);
804 * @addr: Guest address to read from.
806 * Reads an 8-bit value from guest memory.
808 * Returns: Value read.
810 static inline uint8_t readb(uint64_t addr
)
812 return qtest_readb(global_qtest
, addr
);
817 * @addr: Guest address to read from.
819 * Reads a 16-bit value from guest memory.
821 * Returns: Value read.
823 static inline uint16_t readw(uint64_t addr
)
825 return qtest_readw(global_qtest
, addr
);
830 * @addr: Guest address to read from.
832 * Reads a 32-bit value from guest memory.
834 * Returns: Value read.
836 static inline uint32_t readl(uint64_t addr
)
838 return qtest_readl(global_qtest
, addr
);
843 * @addr: Guest address to read from.
845 * Reads a 64-bit value from guest memory.
847 * Returns: Value read.
849 static inline uint64_t readq(uint64_t addr
)
851 return qtest_readq(global_qtest
, addr
);
856 * @addr: Guest address to read from.
857 * @data: Pointer to where memory contents will be stored.
858 * @size: Number of bytes to read.
860 * Read guest memory into a buffer.
862 static inline void memread(uint64_t addr
, void *data
, size_t size
)
864 qtest_memread(global_qtest
, addr
, data
, size
);
869 * @addr: Guest address to read from.
870 * @data: Pointer to where memory contents will be stored.
871 * @size: Number of bytes to read.
873 * Read guest memory into a buffer, receive using a base64 encoding.
875 static inline void bufread(uint64_t addr
, void *data
, size_t size
)
877 qtest_bufread(global_qtest
, addr
, data
, size
);
882 * @addr: Guest address to write to.
883 * @data: Pointer to the bytes that will be written to guest memory.
884 * @size: Number of bytes to write.
886 * Write a buffer to guest memory.
888 static inline void memwrite(uint64_t addr
, const void *data
, size_t size
)
890 qtest_memwrite(global_qtest
, addr
, data
, size
);
895 * @addr: Guest address to write to.
896 * @data: Pointer to the bytes that will be written to guest memory.
897 * @size: Number of bytes to write.
899 * Write a buffer to guest memory, transmit using a base64 encoding.
901 static inline void bufwrite(uint64_t addr
, const void *data
, size_t size
)
903 qtest_bufwrite(global_qtest
, addr
, data
, size
);
908 * @addr: Guest address to write to.
909 * @patt: Byte pattern to fill the guest memory region with.
910 * @size: Number of bytes to write.
912 * Write a pattern to guest memory.
914 static inline void qmemset(uint64_t addr
, uint8_t patt
, size_t size
)
916 qtest_memset(global_qtest
, addr
, patt
, size
);
922 * Advance the QEMU_CLOCK_VIRTUAL to the next deadline.
924 * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds.
926 static inline int64_t clock_step_next(void)
928 return qtest_clock_step_next(global_qtest
);
933 * @step: Number of nanoseconds to advance the clock by.
935 * Advance the QEMU_CLOCK_VIRTUAL by @step nanoseconds.
937 * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds.
939 static inline int64_t clock_step(int64_t step
)
941 return qtest_clock_step(global_qtest
, step
);
946 * @val: Nanoseconds value to advance the clock to.
948 * Advance the QEMU_CLOCK_VIRTUAL to @val nanoseconds since the VM was launched.
950 * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds.
952 static inline int64_t clock_set(int64_t val
)
954 return qtest_clock_set(global_qtest
, val
);
957 QDict
*qmp_fd_receive(int fd
);
958 void qmp_fd_vsend(int fd
, const char *fmt
, va_list ap
) GCC_FMT_ATTR(2, 0);
959 void qmp_fd_send(int fd
, const char *fmt
, ...) GCC_FMT_ATTR(2, 3);
960 void qmp_fd_send_raw(int fd
, const char *fmt
, ...) GCC_FMT_ATTR(2, 3);
961 void qmp_fd_vsend_raw(int fd
, const char *fmt
, va_list ap
) GCC_FMT_ATTR(2, 0);
962 QDict
*qmp_fdv(int fd
, const char *fmt
, va_list ap
) GCC_FMT_ATTR(2, 0);
963 QDict
*qmp_fd(int fd
, const char *fmt
, ...) GCC_FMT_ATTR(2, 3);
966 * qtest_cb_for_every_machine:
967 * @cb: Pointer to the callback function
968 * @skip_old_versioned: true if versioned old machine types should be skipped
970 * Call a callback function for every name of all available machines.
972 void qtest_cb_for_every_machine(void (*cb
)(const char *machine
),
973 bool skip_old_versioned
);
976 * qtest_qmp_device_add:
977 * @driver: Name of the device that should be added
978 * @id: Identification string
979 * @fmt...: QMP message to send to qemu, formatted like
980 * qobject_from_jsonf_nofail(). See parse_escape() for what's
981 * supported after '%'.
983 * Generic hot-plugging test via the device_add QMP command.
985 void qtest_qmp_device_add(const char *driver
, const char *id
, const char *fmt
,
986 ...) GCC_FMT_ATTR(3, 4);
989 * qtest_qmp_device_del:
990 * @id: Identification string
992 * Generic hot-unplugging test via the device_del QMP command.
994 void qtest_qmp_device_del(const char *id
);
998 * @rsp: QMP response to check for error
1000 * Test @rsp for error and discard @rsp.
1001 * Returns 'true' if there is error in @rsp and 'false' otherwise.
1003 bool qmp_rsp_is_err(QDict
*rsp
);
1006 * qmp_assert_error_class:
1007 * @rsp: QMP response to check for error
1008 * @class: an error class
1010 * Assert the response has the given error class and discard @rsp.
1012 void qmp_assert_error_class(QDict
*rsp
, const char *class);