checkpatch.pl: add common glib defines to typelist
[qemu/ar7.git] / tests / libqtest.h
blobcbe8df4473048d23f0279b3c195dfa8c4552e25e
1 /*
2 * QTest
4 * Copyright IBM, Corp. 2012
5 * Copyright Red Hat, Inc. 2012
6 * Copyright SUSE LINUX Products GmbH 2013
8 * Authors:
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.
17 #ifndef LIBQTEST_H
18 #define LIBQTEST_H
20 typedef struct QTestState QTestState;
22 extern QTestState *global_qtest;
24 /**
25 * qtest_startf:
26 * @fmt...: Format for creating other arguments to pass to QEMU, formatted
27 * like sprintf().
29 * Start QEMU and return the resulting #QTestState (but unlike qtest_start(),
30 * #global_qtest is left at NULL).
32 * Returns: #QTestState instance.
34 QTestState *qtest_startf(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
36 /**
37 * qtest_vstartf:
38 * @fmt: Format for creating other arguments to pass to QEMU, formatted
39 * like vsprintf().
40 * @ap: Format arguments.
42 * Start QEMU and return the resulting #QTestState (but unlike qtest_start(),
43 * #global_qtest is left at NULL).
45 * Returns: #QTestState instance.
47 QTestState *qtest_vstartf(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0);
49 /**
50 * qtest_init:
51 * @extra_args: other arguments to pass to QEMU.
53 * Returns: #QTestState instance.
55 QTestState *qtest_init(const char *extra_args);
57 /**
58 * qtest_init_without_qmp_handshake:
59 * @use_oob: true to have the server advertise OOB support
60 * @extra_args: other arguments to pass to QEMU. CAUTION: these
61 * arguments are subject to word splitting and shell evaluation.
63 * Returns: #QTestState instance.
65 QTestState *qtest_init_without_qmp_handshake(bool use_oob,
66 const char *extra_args);
68 /**
69 * qtest_quit:
70 * @s: #QTestState instance to operate on.
72 * Shut down the QEMU process associated to @s.
74 void qtest_quit(QTestState *s);
76 /**
77 * qtest_qmp_discard_response:
78 * @s: #QTestState instance to operate on.
79 * @fmt...: QMP message to send to qemu
81 * Sends a QMP message to QEMU and consumes the response.
83 void qtest_qmp_discard_response(QTestState *s, const char *fmt, ...);
85 /**
86 * qtest_qmp:
87 * @s: #QTestState instance to operate on.
88 * @fmt...: QMP message to send to qemu
90 * Sends a QMP message to QEMU and returns the response.
92 QDict *qtest_qmp(QTestState *s, const char *fmt, ...);
94 /**
95 * qtest_async_qmp:
96 * @s: #QTestState instance to operate on.
97 * @fmt...: QMP message to send to qemu
99 * Sends a QMP message to QEMU and leaves the response in the stream.
101 void qtest_async_qmp(QTestState *s, const char *fmt, ...);
104 * qtest_qmpv_discard_response:
105 * @s: #QTestState instance to operate on.
106 * @fmt: QMP message to send to QEMU
107 * @ap: QMP message arguments
109 * Sends a QMP message to QEMU and consumes the response.
111 void qtest_qmpv_discard_response(QTestState *s, const char *fmt, va_list ap);
114 * qtest_qmpv:
115 * @s: #QTestState instance to operate on.
116 * @fmt: QMP message to send to QEMU
117 * @ap: QMP message arguments
119 * Sends a QMP message to QEMU and returns the response.
121 QDict *qtest_qmpv(QTestState *s, const char *fmt, va_list ap);
124 * qtest_async_qmpv:
125 * @s: #QTestState instance to operate on.
126 * @fmt: QMP message to send to QEMU
127 * @ap: QMP message arguments
129 * Sends a QMP message to QEMU and leaves the response in the stream.
131 void qtest_async_qmpv(QTestState *s, const char *fmt, va_list ap);
134 * qtest_receive:
135 * @s: #QTestState instance to operate on.
137 * Reads a QMP message from QEMU and returns the response.
139 QDict *qtest_qmp_receive(QTestState *s);
142 * qtest_qmp_eventwait:
143 * @s: #QTestState instance to operate on.
144 * @s: #event event to wait for.
146 * Continuously polls for QMP responses until it receives the desired event.
148 void qtest_qmp_eventwait(QTestState *s, const char *event);
151 * qtest_qmp_eventwait_ref:
152 * @s: #QTestState instance to operate on.
153 * @s: #event event to wait for.
155 * Continuously polls for QMP responses until it receives the desired event.
156 * Returns a copy of the event for further investigation.
158 QDict *qtest_qmp_eventwait_ref(QTestState *s, const char *event);
161 * qtest_hmp:
162 * @s: #QTestState instance to operate on.
163 * @fmt...: HMP command to send to QEMU, formats arguments like sprintf().
165 * Send HMP command to QEMU via QMP's human-monitor-command.
166 * QMP events are discarded.
168 * Returns: the command's output. The caller should g_free() it.
170 char *qtest_hmp(QTestState *s, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
173 * qtest_hmpv:
174 * @s: #QTestState instance to operate on.
175 * @fmt: HMP command to send to QEMU
176 * @ap: HMP command arguments
178 * Send HMP command to QEMU via QMP's human-monitor-command.
179 * QMP events are discarded.
181 * Returns: the command's output. The caller should g_free() it.
183 char *qtest_hmpv(QTestState *s, const char *fmt, va_list ap);
186 * qtest_get_irq:
187 * @s: #QTestState instance to operate on.
188 * @num: Interrupt to observe.
190 * Returns: The level of the @num interrupt.
192 bool qtest_get_irq(QTestState *s, int num);
195 * qtest_irq_intercept_in:
196 * @s: #QTestState instance to operate on.
197 * @string: QOM path of a device.
199 * Associate qtest irqs with the GPIO-in pins of the device
200 * whose path is specified by @string.
202 void qtest_irq_intercept_in(QTestState *s, const char *string);
205 * qtest_irq_intercept_out:
206 * @s: #QTestState instance to operate on.
207 * @string: QOM path of a device.
209 * Associate qtest irqs with the GPIO-out pins of the device
210 * whose path is specified by @string.
212 void qtest_irq_intercept_out(QTestState *s, const char *string);
215 * qtest_outb:
216 * @s: #QTestState instance to operate on.
217 * @addr: I/O port to write to.
218 * @value: Value being written.
220 * Write an 8-bit value to an I/O port.
222 void qtest_outb(QTestState *s, uint16_t addr, uint8_t value);
225 * qtest_outw:
226 * @s: #QTestState instance to operate on.
227 * @addr: I/O port to write to.
228 * @value: Value being written.
230 * Write a 16-bit value to an I/O port.
232 void qtest_outw(QTestState *s, uint16_t addr, uint16_t value);
235 * qtest_outl:
236 * @s: #QTestState instance to operate on.
237 * @addr: I/O port to write to.
238 * @value: Value being written.
240 * Write a 32-bit value to an I/O port.
242 void qtest_outl(QTestState *s, uint16_t addr, uint32_t value);
245 * qtest_inb:
246 * @s: #QTestState instance to operate on.
247 * @addr: I/O port to read from.
249 * Returns an 8-bit value from an I/O port.
251 uint8_t qtest_inb(QTestState *s, uint16_t addr);
254 * qtest_inw:
255 * @s: #QTestState instance to operate on.
256 * @addr: I/O port to read from.
258 * Returns a 16-bit value from an I/O port.
260 uint16_t qtest_inw(QTestState *s, uint16_t addr);
263 * qtest_inl:
264 * @s: #QTestState instance to operate on.
265 * @addr: I/O port to read from.
267 * Returns a 32-bit value from an I/O port.
269 uint32_t qtest_inl(QTestState *s, uint16_t addr);
272 * qtest_writeb:
273 * @s: #QTestState instance to operate on.
274 * @addr: Guest address to write to.
275 * @value: Value being written.
277 * Writes an 8-bit value to memory.
279 void qtest_writeb(QTestState *s, uint64_t addr, uint8_t value);
282 * qtest_writew:
283 * @s: #QTestState instance to operate on.
284 * @addr: Guest address to write to.
285 * @value: Value being written.
287 * Writes a 16-bit value to memory.
289 void qtest_writew(QTestState *s, uint64_t addr, uint16_t value);
292 * qtest_writel:
293 * @s: #QTestState instance to operate on.
294 * @addr: Guest address to write to.
295 * @value: Value being written.
297 * Writes a 32-bit value to memory.
299 void qtest_writel(QTestState *s, uint64_t addr, uint32_t value);
302 * qtest_writeq:
303 * @s: #QTestState instance to operate on.
304 * @addr: Guest address to write to.
305 * @value: Value being written.
307 * Writes a 64-bit value to memory.
309 void qtest_writeq(QTestState *s, uint64_t addr, uint64_t value);
312 * qtest_readb:
313 * @s: #QTestState instance to operate on.
314 * @addr: Guest address to read from.
316 * Reads an 8-bit value from memory.
318 * Returns: Value read.
320 uint8_t qtest_readb(QTestState *s, uint64_t addr);
323 * qtest_readw:
324 * @s: #QTestState instance to operate on.
325 * @addr: Guest address to read from.
327 * Reads a 16-bit value from memory.
329 * Returns: Value read.
331 uint16_t qtest_readw(QTestState *s, uint64_t addr);
334 * qtest_readl:
335 * @s: #QTestState instance to operate on.
336 * @addr: Guest address to read from.
338 * Reads a 32-bit value from memory.
340 * Returns: Value read.
342 uint32_t qtest_readl(QTestState *s, uint64_t addr);
345 * qtest_readq:
346 * @s: #QTestState instance to operate on.
347 * @addr: Guest address to read from.
349 * Reads a 64-bit value from memory.
351 * Returns: Value read.
353 uint64_t qtest_readq(QTestState *s, uint64_t addr);
356 * qtest_memread:
357 * @s: #QTestState instance to operate on.
358 * @addr: Guest address to read from.
359 * @data: Pointer to where memory contents will be stored.
360 * @size: Number of bytes to read.
362 * Read guest memory into a buffer.
364 void qtest_memread(QTestState *s, uint64_t addr, void *data, size_t size);
367 * qtest_rtas_call:
368 * @s: #QTestState instance to operate on.
369 * @name: name of the command to call.
370 * @nargs: Number of args.
371 * @args: Guest address to read args from.
372 * @nret: Number of return value.
373 * @ret: Guest address to write return values to.
375 * Call an RTAS function
377 uint64_t qtest_rtas_call(QTestState *s, const char *name,
378 uint32_t nargs, uint64_t args,
379 uint32_t nret, uint64_t ret);
382 * qtest_bufread:
383 * @s: #QTestState instance to operate on.
384 * @addr: Guest address to read from.
385 * @data: Pointer to where memory contents will be stored.
386 * @size: Number of bytes to read.
388 * Read guest memory into a buffer and receive using a base64 encoding.
390 void qtest_bufread(QTestState *s, uint64_t addr, void *data, size_t size);
393 * qtest_memwrite:
394 * @s: #QTestState instance to operate on.
395 * @addr: Guest address to write to.
396 * @data: Pointer to the bytes that will be written to guest memory.
397 * @size: Number of bytes to write.
399 * Write a buffer to guest memory.
401 void qtest_memwrite(QTestState *s, uint64_t addr, const void *data, size_t size);
404 * qtest_bufwrite:
405 * @s: #QTestState instance to operate on.
406 * @addr: Guest address to write to.
407 * @data: Pointer to the bytes that will be written to guest memory.
408 * @size: Number of bytes to write.
410 * Write a buffer to guest memory and transmit using a base64 encoding.
412 void qtest_bufwrite(QTestState *s, uint64_t addr,
413 const void *data, size_t size);
416 * qtest_memset:
417 * @s: #QTestState instance to operate on.
418 * @addr: Guest address to write to.
419 * @patt: Byte pattern to fill the guest memory region with.
420 * @size: Number of bytes to write.
422 * Write a pattern to guest memory.
424 void qtest_memset(QTestState *s, uint64_t addr, uint8_t patt, size_t size);
427 * qtest_clock_step_next:
428 * @s: #QTestState instance to operate on.
430 * Advance the QEMU_CLOCK_VIRTUAL to the next deadline.
432 * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds.
434 int64_t qtest_clock_step_next(QTestState *s);
437 * qtest_clock_step:
438 * @s: QTestState instance to operate on.
439 * @step: Number of nanoseconds to advance the clock by.
441 * Advance the QEMU_CLOCK_VIRTUAL by @step nanoseconds.
443 * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds.
445 int64_t qtest_clock_step(QTestState *s, int64_t step);
448 * qtest_clock_set:
449 * @s: QTestState instance to operate on.
450 * @val: Nanoseconds value to advance the clock to.
452 * Advance the QEMU_CLOCK_VIRTUAL to @val nanoseconds since the VM was launched.
454 * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds.
456 int64_t qtest_clock_set(QTestState *s, int64_t val);
459 * qtest_big_endian:
460 * @s: QTestState instance to operate on.
462 * Returns: True if the architecture under test has a big endian configuration.
464 bool qtest_big_endian(QTestState *s);
467 * qtest_get_arch:
469 * Returns: The architecture for the QEMU executable under test.
471 const char *qtest_get_arch(void);
474 * qtest_add_func:
475 * @str: Test case path.
476 * @fn: Test case function
478 * Add a GTester testcase with the given name and function.
479 * The path is prefixed with the architecture under test, as
480 * returned by qtest_get_arch().
482 void qtest_add_func(const char *str, void (*fn)(void));
485 * qtest_add_data_func:
486 * @str: Test case path.
487 * @data: Test case data
488 * @fn: Test case function
490 * Add a GTester testcase with the given name, data and function.
491 * The path is prefixed with the architecture under test, as
492 * returned by qtest_get_arch().
494 void qtest_add_data_func(const char *str, const void *data,
495 void (*fn)(const void *));
498 * qtest_add_data_func_full:
499 * @str: Test case path.
500 * @data: Test case data
501 * @fn: Test case function
502 * @data_free_func: GDestroyNotify for data
504 * Add a GTester testcase with the given name, data and function.
505 * The path is prefixed with the architecture under test, as
506 * returned by qtest_get_arch().
508 * @data is passed to @data_free_func() on test completion.
510 void qtest_add_data_func_full(const char *str, void *data,
511 void (*fn)(const void *),
512 GDestroyNotify data_free_func);
515 * qtest_add:
516 * @testpath: Test case path
517 * @Fixture: Fixture type
518 * @tdata: Test case data
519 * @fsetup: Test case setup function
520 * @ftest: Test case function
521 * @fteardown: Test case teardown function
523 * Add a GTester testcase with the given name, data and functions.
524 * The path is prefixed with the architecture under test, as
525 * returned by qtest_get_arch().
527 #define qtest_add(testpath, Fixture, tdata, fsetup, ftest, fteardown) \
528 do { \
529 char *path = g_strdup_printf("/%s/%s", qtest_get_arch(), testpath); \
530 g_test_add(path, Fixture, tdata, fsetup, ftest, fteardown); \
531 g_free(path); \
532 } while (0)
534 void qtest_add_abrt_handler(GHookFunc fn, const void *data);
537 * qtest_start:
538 * @args: other arguments to pass to QEMU
540 * Start QEMU and assign the resulting #QTestState to a global variable.
541 * The global variable is used by "shortcut" functions documented below.
543 * Returns: #QTestState instance.
545 static inline QTestState *qtest_start(const char *args)
547 global_qtest = qtest_init(args);
548 return global_qtest;
552 * qtest_end:
554 * Shut down the QEMU process started by qtest_start().
556 static inline void qtest_end(void)
558 qtest_quit(global_qtest);
559 global_qtest = NULL;
563 * qmp:
564 * @fmt...: QMP message to send to qemu
566 * Sends a QMP message to QEMU and returns the response.
568 QDict *qmp(const char *fmt, ...);
571 * qmp_async:
572 * @fmt...: QMP message to send to qemu
574 * Sends a QMP message to QEMU and leaves the response in the stream.
576 void qmp_async(const char *fmt, ...);
579 * qmp_discard_response:
580 * @fmt...: QMP message to send to qemu
582 * Sends a QMP message to QEMU and consumes the response.
584 void qmp_discard_response(const char *fmt, ...);
587 * qmp_receive:
589 * Reads a QMP message from QEMU and returns the response.
591 static inline QDict *qmp_receive(void)
593 return qtest_qmp_receive(global_qtest);
597 * qmp_eventwait:
598 * @s: #event event to wait for.
600 * Continuously polls for QMP responses until it receives the desired event.
602 static inline void qmp_eventwait(const char *event)
604 return qtest_qmp_eventwait(global_qtest, event);
608 * qmp_eventwait_ref:
609 * @s: #event event to wait for.
611 * Continuously polls for QMP responses until it receives the desired event.
612 * Returns a copy of the event for further investigation.
614 static inline QDict *qmp_eventwait_ref(const char *event)
616 return qtest_qmp_eventwait_ref(global_qtest, event);
620 * hmp:
621 * @fmt...: HMP command to send to QEMU, formats arguments like sprintf().
623 * Send HMP command to QEMU via QMP's human-monitor-command.
625 * Returns: the command's output. The caller should g_free() it.
627 char *hmp(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
630 * get_irq:
631 * @num: Interrupt to observe.
633 * Returns: The level of the @num interrupt.
635 static inline bool get_irq(int num)
637 return qtest_get_irq(global_qtest, num);
641 * irq_intercept_in:
642 * @string: QOM path of a device.
644 * Associate qtest irqs with the GPIO-in pins of the device
645 * whose path is specified by @string.
647 static inline void irq_intercept_in(const char *string)
649 qtest_irq_intercept_in(global_qtest, string);
653 * qtest_irq_intercept_out:
654 * @string: QOM path of a device.
656 * Associate qtest irqs with the GPIO-out pins of the device
657 * whose path is specified by @string.
659 static inline void irq_intercept_out(const char *string)
661 qtest_irq_intercept_out(global_qtest, string);
665 * outb:
666 * @addr: I/O port to write to.
667 * @value: Value being written.
669 * Write an 8-bit value to an I/O port.
671 static inline void outb(uint16_t addr, uint8_t value)
673 qtest_outb(global_qtest, addr, value);
677 * outw:
678 * @addr: I/O port to write to.
679 * @value: Value being written.
681 * Write a 16-bit value to an I/O port.
683 static inline void outw(uint16_t addr, uint16_t value)
685 qtest_outw(global_qtest, addr, value);
689 * outl:
690 * @addr: I/O port to write to.
691 * @value: Value being written.
693 * Write a 32-bit value to an I/O port.
695 static inline void outl(uint16_t addr, uint32_t value)
697 qtest_outl(global_qtest, addr, value);
701 * inb:
702 * @addr: I/O port to read from.
704 * Reads an 8-bit value from an I/O port.
706 * Returns: Value read.
708 static inline uint8_t inb(uint16_t addr)
710 return qtest_inb(global_qtest, addr);
714 * inw:
715 * @addr: I/O port to read from.
717 * Reads a 16-bit value from an I/O port.
719 * Returns: Value read.
721 static inline uint16_t inw(uint16_t addr)
723 return qtest_inw(global_qtest, addr);
727 * inl:
728 * @addr: I/O port to read from.
730 * Reads a 32-bit value from an I/O port.
732 * Returns: Value read.
734 static inline uint32_t inl(uint16_t addr)
736 return qtest_inl(global_qtest, addr);
740 * writeb:
741 * @addr: Guest address to write to.
742 * @value: Value being written.
744 * Writes an 8-bit value to guest memory.
746 static inline void writeb(uint64_t addr, uint8_t value)
748 qtest_writeb(global_qtest, addr, value);
752 * writew:
753 * @addr: Guest address to write to.
754 * @value: Value being written.
756 * Writes a 16-bit value to guest memory.
758 static inline void writew(uint64_t addr, uint16_t value)
760 qtest_writew(global_qtest, addr, value);
764 * writel:
765 * @addr: Guest address to write to.
766 * @value: Value being written.
768 * Writes a 32-bit value to guest memory.
770 static inline void writel(uint64_t addr, uint32_t value)
772 qtest_writel(global_qtest, addr, value);
776 * writeq:
777 * @addr: Guest address to write to.
778 * @value: Value being written.
780 * Writes a 64-bit value to guest memory.
782 static inline void writeq(uint64_t addr, uint64_t value)
784 qtest_writeq(global_qtest, addr, value);
788 * readb:
789 * @addr: Guest address to read from.
791 * Reads an 8-bit value from guest memory.
793 * Returns: Value read.
795 static inline uint8_t readb(uint64_t addr)
797 return qtest_readb(global_qtest, addr);
801 * readw:
802 * @addr: Guest address to read from.
804 * Reads a 16-bit value from guest memory.
806 * Returns: Value read.
808 static inline uint16_t readw(uint64_t addr)
810 return qtest_readw(global_qtest, addr);
814 * readl:
815 * @addr: Guest address to read from.
817 * Reads a 32-bit value from guest memory.
819 * Returns: Value read.
821 static inline uint32_t readl(uint64_t addr)
823 return qtest_readl(global_qtest, addr);
827 * readq:
828 * @addr: Guest address to read from.
830 * Reads a 64-bit value from guest memory.
832 * Returns: Value read.
834 static inline uint64_t readq(uint64_t addr)
836 return qtest_readq(global_qtest, addr);
840 * memread:
841 * @addr: Guest address to read from.
842 * @data: Pointer to where memory contents will be stored.
843 * @size: Number of bytes to read.
845 * Read guest memory into a buffer.
847 static inline void memread(uint64_t addr, void *data, size_t size)
849 qtest_memread(global_qtest, addr, data, size);
853 * bufread:
854 * @addr: Guest address to read from.
855 * @data: Pointer to where memory contents will be stored.
856 * @size: Number of bytes to read.
858 * Read guest memory into a buffer, receive using a base64 encoding.
860 static inline void bufread(uint64_t addr, void *data, size_t size)
862 qtest_bufread(global_qtest, addr, data, size);
866 * memwrite:
867 * @addr: Guest address to write to.
868 * @data: Pointer to the bytes that will be written to guest memory.
869 * @size: Number of bytes to write.
871 * Write a buffer to guest memory.
873 static inline void memwrite(uint64_t addr, const void *data, size_t size)
875 qtest_memwrite(global_qtest, addr, data, size);
879 * bufwrite:
880 * @addr: Guest address to write to.
881 * @data: Pointer to the bytes that will be written to guest memory.
882 * @size: Number of bytes to write.
884 * Write a buffer to guest memory, transmit using a base64 encoding.
886 static inline void bufwrite(uint64_t addr, const void *data, size_t size)
888 qtest_bufwrite(global_qtest, addr, data, size);
892 * qmemset:
893 * @addr: Guest address to write to.
894 * @patt: Byte pattern to fill the guest memory region with.
895 * @size: Number of bytes to write.
897 * Write a pattern to guest memory.
899 static inline void qmemset(uint64_t addr, uint8_t patt, size_t size)
901 qtest_memset(global_qtest, addr, patt, size);
905 * clock_step_next:
907 * Advance the QEMU_CLOCK_VIRTUAL to the next deadline.
909 * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds.
911 static inline int64_t clock_step_next(void)
913 return qtest_clock_step_next(global_qtest);
917 * clock_step:
918 * @step: Number of nanoseconds to advance the clock by.
920 * Advance the QEMU_CLOCK_VIRTUAL by @step nanoseconds.
922 * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds.
924 static inline int64_t clock_step(int64_t step)
926 return qtest_clock_step(global_qtest, step);
930 * clock_set:
931 * @val: Nanoseconds value to advance the clock to.
933 * Advance the QEMU_CLOCK_VIRTUAL to @val nanoseconds since the VM was launched.
935 * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds.
937 static inline int64_t clock_set(int64_t val)
939 return qtest_clock_set(global_qtest, val);
942 QDict *qmp_fd_receive(int fd);
943 void qmp_fd_sendv(int fd, const char *fmt, va_list ap);
944 void qmp_fd_send(int fd, const char *fmt, ...);
945 QDict *qmp_fdv(int fd, const char *fmt, va_list ap);
946 QDict *qmp_fd(int fd, const char *fmt, ...);
949 * qtest_cb_for_every_machine:
950 * @cb: Pointer to the callback function
952 * Call a callback function for every name of all available machines.
954 void qtest_cb_for_every_machine(void (*cb)(const char *machine));
957 * qtest_qmp_device_add:
958 * @driver: Name of the device that should be added
959 * @id: Identification string
960 * @fmt: printf-like format string for further options to device_add
962 * Generic hot-plugging test via the device_add QMP command.
964 void qtest_qmp_device_add(const char *driver, const char *id, const char *fmt,
965 ...) GCC_FMT_ATTR(3, 4);
968 * qtest_qmp_device_del:
969 * @id: Identification string
971 * Generic hot-unplugging test via the device_del QMP command.
973 void qtest_qmp_device_del(const char *id);
975 #endif