]> git.proxmox.com Git - mirror_qemu.git/blob - tests/libqtest.h
virtio: add AioContext-specific function for host notifiers
[mirror_qemu.git] / tests / libqtest.h
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 <stddef.h>
21 #include <stdint.h>
22 #include <stdbool.h>
23 #include <stdarg.h>
24 #include <sys/types.h>
25 #include "qapi/qmp/qdict.h"
26 #include "glib-compat.h"
27
28 typedef struct QTestState QTestState;
29
30 extern QTestState *global_qtest;
31
32 /**
33 * qtest_init:
34 * @extra_args: other arguments to pass to QEMU.
35 *
36 * Returns: #QTestState instance.
37 */
38 QTestState *qtest_init(const char *extra_args);
39
40 /**
41 * qtest_quit:
42 * @s: #QTestState instance to operate on.
43 *
44 * Shut down the QEMU process associated to @s.
45 */
46 void qtest_quit(QTestState *s);
47
48 /**
49 * qtest_qmp_discard_response:
50 * @s: #QTestState instance to operate on.
51 * @fmt...: QMP message to send to qemu
52 *
53 * Sends a QMP message to QEMU and consumes the response.
54 */
55 void qtest_qmp_discard_response(QTestState *s, const char *fmt, ...);
56
57 /**
58 * qtest_qmp:
59 * @s: #QTestState instance to operate on.
60 * @fmt...: QMP message to send to qemu
61 *
62 * Sends a QMP message to QEMU and returns the response.
63 */
64 QDict *qtest_qmp(QTestState *s, const char *fmt, ...);
65
66 /**
67 * qtest_async_qmp:
68 * @s: #QTestState instance to operate on.
69 * @fmt...: QMP message to send to qemu
70 *
71 * Sends a QMP message to QEMU and leaves the response in the stream.
72 */
73 void qtest_async_qmp(QTestState *s, const char *fmt, ...);
74
75 /**
76 * qtest_qmpv_discard_response:
77 * @s: #QTestState instance to operate on.
78 * @fmt: QMP message to send to QEMU
79 * @ap: QMP message arguments
80 *
81 * Sends a QMP message to QEMU and consumes the response.
82 */
83 void qtest_qmpv_discard_response(QTestState *s, const char *fmt, va_list ap);
84
85 /**
86 * qtest_qmpv:
87 * @s: #QTestState instance to operate on.
88 * @fmt: QMP message to send to QEMU
89 * @ap: QMP message arguments
90 *
91 * Sends a QMP message to QEMU and returns the response.
92 */
93 QDict *qtest_qmpv(QTestState *s, const char *fmt, va_list ap);
94
95 /**
96 * qtest_async_qmpv:
97 * @s: #QTestState instance to operate on.
98 * @fmt: QMP message to send to QEMU
99 * @ap: QMP message arguments
100 *
101 * Sends a QMP message to QEMU and leaves the response in the stream.
102 */
103 void qtest_async_qmpv(QTestState *s, const char *fmt, va_list ap);
104
105 /**
106 * qtest_receive:
107 * @s: #QTestState instance to operate on.
108 *
109 * Reads a QMP message from QEMU and returns the response.
110 */
111 QDict *qtest_qmp_receive(QTestState *s);
112
113 /**
114 * qtest_qmp_eventwait:
115 * @s: #QTestState instance to operate on.
116 * @s: #event event to wait for.
117 *
118 * Continuosly polls for QMP responses until it receives the desired event.
119 */
120 void qtest_qmp_eventwait(QTestState *s, const char *event);
121
122 /**
123 * qtest_hmpv:
124 * @s: #QTestState instance to operate on.
125 * @fmt...: HMP command to send to QEMU
126 *
127 * Send HMP command to QEMU via QMP's human-monitor-command.
128 *
129 * Returns: the command's output. The caller should g_free() it.
130 */
131 char *qtest_hmp(QTestState *s, const char *fmt, ...);
132
133 /**
134 * qtest_hmpv:
135 * @s: #QTestState instance to operate on.
136 * @fmt: HMP command to send to QEMU
137 * @ap: HMP command arguments
138 *
139 * Send HMP command to QEMU via QMP's human-monitor-command.
140 *
141 * Returns: the command's output. The caller should g_free() it.
142 */
143 char *qtest_hmpv(QTestState *s, const char *fmt, va_list ap);
144
145 /**
146 * qtest_get_irq:
147 * @s: #QTestState instance to operate on.
148 * @num: Interrupt to observe.
149 *
150 * Returns: The level of the @num interrupt.
151 */
152 bool qtest_get_irq(QTestState *s, int num);
153
154 /**
155 * qtest_irq_intercept_in:
156 * @s: #QTestState instance to operate on.
157 * @string: QOM path of a device.
158 *
159 * Associate qtest irqs with the GPIO-in pins of the device
160 * whose path is specified by @string.
161 */
162 void qtest_irq_intercept_in(QTestState *s, const char *string);
163
164 /**
165 * qtest_irq_intercept_out:
166 * @s: #QTestState instance to operate on.
167 * @string: QOM path of a device.
168 *
169 * Associate qtest irqs with the GPIO-out pins of the device
170 * whose path is specified by @string.
171 */
172 void qtest_irq_intercept_out(QTestState *s, const char *string);
173
174 /**
175 * qtest_outb:
176 * @s: #QTestState instance to operate on.
177 * @addr: I/O port to write to.
178 * @value: Value being written.
179 *
180 * Write an 8-bit value to an I/O port.
181 */
182 void qtest_outb(QTestState *s, uint16_t addr, uint8_t value);
183
184 /**
185 * qtest_outw:
186 * @s: #QTestState instance to operate on.
187 * @addr: I/O port to write to.
188 * @value: Value being written.
189 *
190 * Write a 16-bit value to an I/O port.
191 */
192 void qtest_outw(QTestState *s, uint16_t addr, uint16_t value);
193
194 /**
195 * qtest_outl:
196 * @s: #QTestState instance to operate on.
197 * @addr: I/O port to write to.
198 * @value: Value being written.
199 *
200 * Write a 32-bit value to an I/O port.
201 */
202 void qtest_outl(QTestState *s, uint16_t addr, uint32_t value);
203
204 /**
205 * qtest_inb:
206 * @s: #QTestState instance to operate on.
207 * @addr: I/O port to read from.
208 *
209 * Returns an 8-bit value from an I/O port.
210 */
211 uint8_t qtest_inb(QTestState *s, uint16_t addr);
212
213 /**
214 * qtest_inw:
215 * @s: #QTestState instance to operate on.
216 * @addr: I/O port to read from.
217 *
218 * Returns a 16-bit value from an I/O port.
219 */
220 uint16_t qtest_inw(QTestState *s, uint16_t addr);
221
222 /**
223 * qtest_inl:
224 * @s: #QTestState instance to operate on.
225 * @addr: I/O port to read from.
226 *
227 * Returns a 32-bit value from an I/O port.
228 */
229 uint32_t qtest_inl(QTestState *s, uint16_t addr);
230
231 /**
232 * qtest_writeb:
233 * @s: #QTestState instance to operate on.
234 * @addr: Guest address to write to.
235 * @value: Value being written.
236 *
237 * Writes an 8-bit value to memory.
238 */
239 void qtest_writeb(QTestState *s, uint64_t addr, uint8_t value);
240
241 /**
242 * qtest_writew:
243 * @s: #QTestState instance to operate on.
244 * @addr: Guest address to write to.
245 * @value: Value being written.
246 *
247 * Writes a 16-bit value to memory.
248 */
249 void qtest_writew(QTestState *s, uint64_t addr, uint16_t value);
250
251 /**
252 * qtest_writel:
253 * @s: #QTestState instance to operate on.
254 * @addr: Guest address to write to.
255 * @value: Value being written.
256 *
257 * Writes a 32-bit value to memory.
258 */
259 void qtest_writel(QTestState *s, uint64_t addr, uint32_t value);
260
261 /**
262 * qtest_writeq:
263 * @s: #QTestState instance to operate on.
264 * @addr: Guest address to write to.
265 * @value: Value being written.
266 *
267 * Writes a 64-bit value to memory.
268 */
269 void qtest_writeq(QTestState *s, uint64_t addr, uint64_t value);
270
271 /**
272 * qtest_readb:
273 * @s: #QTestState instance to operate on.
274 * @addr: Guest address to read from.
275 *
276 * Reads an 8-bit value from memory.
277 *
278 * Returns: Value read.
279 */
280 uint8_t qtest_readb(QTestState *s, uint64_t addr);
281
282 /**
283 * qtest_readw:
284 * @s: #QTestState instance to operate on.
285 * @addr: Guest address to read from.
286 *
287 * Reads a 16-bit value from memory.
288 *
289 * Returns: Value read.
290 */
291 uint16_t qtest_readw(QTestState *s, uint64_t addr);
292
293 /**
294 * qtest_readl:
295 * @s: #QTestState instance to operate on.
296 * @addr: Guest address to read from.
297 *
298 * Reads a 32-bit value from memory.
299 *
300 * Returns: Value read.
301 */
302 uint32_t qtest_readl(QTestState *s, uint64_t addr);
303
304 /**
305 * qtest_readq:
306 * @s: #QTestState instance to operate on.
307 * @addr: Guest address to read from.
308 *
309 * Reads a 64-bit value from memory.
310 *
311 * Returns: Value read.
312 */
313 uint64_t qtest_readq(QTestState *s, uint64_t addr);
314
315 /**
316 * qtest_memread:
317 * @s: #QTestState instance to operate on.
318 * @addr: Guest address to read from.
319 * @data: Pointer to where memory contents will be stored.
320 * @size: Number of bytes to read.
321 *
322 * Read guest memory into a buffer.
323 */
324 void qtest_memread(QTestState *s, uint64_t addr, void *data, size_t size);
325
326 /**
327 * qtest_bufread:
328 * @s: #QTestState instance to operate on.
329 * @addr: Guest address to read from.
330 * @data: Pointer to where memory contents will be stored.
331 * @size: Number of bytes to read.
332 *
333 * Read guest memory into a buffer and receive using a base64 encoding.
334 */
335 void qtest_bufread(QTestState *s, uint64_t addr, void *data, size_t size);
336
337 /**
338 * qtest_memwrite:
339 * @s: #QTestState instance to operate on.
340 * @addr: Guest address to write to.
341 * @data: Pointer to the bytes that will be written to guest memory.
342 * @size: Number of bytes to write.
343 *
344 * Write a buffer to guest memory.
345 */
346 void qtest_memwrite(QTestState *s, uint64_t addr, const void *data, size_t size);
347
348 /**
349 * qtest_bufwrite:
350 * @s: #QTestState instance to operate on.
351 * @addr: Guest address to write to.
352 * @data: Pointer to the bytes that will be written to guest memory.
353 * @size: Number of bytes to write.
354 *
355 * Write a buffer to guest memory and transmit using a base64 encoding.
356 */
357 void qtest_bufwrite(QTestState *s, uint64_t addr,
358 const void *data, size_t size);
359
360 /**
361 * qtest_memset:
362 * @s: #QTestState instance to operate on.
363 * @addr: Guest address to write to.
364 * @patt: Byte pattern to fill the guest memory region with.
365 * @size: Number of bytes to write.
366 *
367 * Write a pattern to guest memory.
368 */
369 void qtest_memset(QTestState *s, uint64_t addr, uint8_t patt, size_t size);
370
371 /**
372 * qtest_clock_step_next:
373 * @s: #QTestState instance to operate on.
374 *
375 * Advance the QEMU_CLOCK_VIRTUAL to the next deadline.
376 *
377 * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds.
378 */
379 int64_t qtest_clock_step_next(QTestState *s);
380
381 /**
382 * qtest_clock_step:
383 * @s: QTestState instance to operate on.
384 * @step: Number of nanoseconds to advance the clock by.
385 *
386 * Advance the QEMU_CLOCK_VIRTUAL by @step nanoseconds.
387 *
388 * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds.
389 */
390 int64_t qtest_clock_step(QTestState *s, int64_t step);
391
392 /**
393 * qtest_clock_set:
394 * @s: QTestState instance to operate on.
395 * @val: Nanoseconds value to advance the clock to.
396 *
397 * Advance the QEMU_CLOCK_VIRTUAL to @val nanoseconds since the VM was launched.
398 *
399 * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds.
400 */
401 int64_t qtest_clock_set(QTestState *s, int64_t val);
402
403 /**
404 * qtest_get_arch:
405 *
406 * Returns: The architecture for the QEMU executable under test.
407 */
408 const char *qtest_get_arch(void);
409
410 /**
411 * qtest_add_func:
412 * @str: Test case path.
413 * @fn: Test case function
414 *
415 * Add a GTester testcase with the given name and function.
416 * The path is prefixed with the architecture under test, as
417 * returned by qtest_get_arch().
418 */
419 void qtest_add_func(const char *str, void (*fn)(void));
420
421 /**
422 * qtest_add_data_func:
423 * @str: Test case path.
424 * @data: Test case data
425 * @fn: Test case function
426 *
427 * Add a GTester testcase with the given name, data and function.
428 * The path is prefixed with the architecture under test, as
429 * returned by qtest_get_arch().
430 */
431 void qtest_add_data_func(const char *str, const void *data,
432 void (*fn)(const void *));
433
434 /**
435 * qtest_add:
436 * @testpath: Test case path
437 * @Fixture: Fixture type
438 * @tdata: Test case data
439 * @fsetup: Test case setup function
440 * @ftest: Test case function
441 * @fteardown: Test case teardown function
442 *
443 * Add a GTester testcase with the given name, data and functions.
444 * The path is prefixed with the architecture under test, as
445 * returned by qtest_get_arch().
446 */
447 #define qtest_add(testpath, Fixture, tdata, fsetup, ftest, fteardown) \
448 do { \
449 char *path = g_strdup_printf("/%s/%s", qtest_get_arch(), testpath); \
450 g_test_add(path, Fixture, tdata, fsetup, ftest, fteardown); \
451 g_free(path); \
452 } while (0)
453
454 void qtest_add_abrt_handler(GHookFunc fn, const void *data);
455
456 /**
457 * qtest_start:
458 * @args: other arguments to pass to QEMU
459 *
460 * Start QEMU and assign the resulting #QTestState to a global variable.
461 * The global variable is used by "shortcut" functions documented below.
462 *
463 * Returns: #QTestState instance.
464 */
465 static inline QTestState *qtest_start(const char *args)
466 {
467 global_qtest = qtest_init(args);
468 return global_qtest;
469 }
470
471 /**
472 * qtest_end:
473 *
474 * Shut down the QEMU process started by qtest_start().
475 */
476 static inline void qtest_end(void)
477 {
478 qtest_quit(global_qtest);
479 global_qtest = NULL;
480 }
481
482 /**
483 * qmp:
484 * @fmt...: QMP message to send to qemu
485 *
486 * Sends a QMP message to QEMU and returns the response.
487 */
488 QDict *qmp(const char *fmt, ...);
489
490 /**
491 * qmp_async:
492 * @fmt...: QMP message to send to qemu
493 *
494 * Sends a QMP message to QEMU and leaves the response in the stream.
495 */
496 void qmp_async(const char *fmt, ...);
497
498 /**
499 * qmp_discard_response:
500 * @fmt...: QMP message to send to qemu
501 *
502 * Sends a QMP message to QEMU and consumes the response.
503 */
504 void qmp_discard_response(const char *fmt, ...);
505
506 /**
507 * qmp_receive:
508 *
509 * Reads a QMP message from QEMU and returns the response.
510 */
511 static inline QDict *qmp_receive(void)
512 {
513 return qtest_qmp_receive(global_qtest);
514 }
515
516 /**
517 * qmp_eventwait:
518 * @s: #event event to wait for.
519 *
520 * Continuosly polls for QMP responses until it receives the desired event.
521 */
522 static inline void qmp_eventwait(const char *event)
523 {
524 return qtest_qmp_eventwait(global_qtest, event);
525 }
526
527 /**
528 * hmp:
529 * @fmt...: HMP command to send to QEMU
530 *
531 * Send HMP command to QEMU via QMP's human-monitor-command.
532 *
533 * Returns: the command's output. The caller should g_free() it.
534 */
535 char *hmp(const char *fmt, ...);
536
537 /**
538 * get_irq:
539 * @num: Interrupt to observe.
540 *
541 * Returns: The level of the @num interrupt.
542 */
543 static inline bool get_irq(int num)
544 {
545 return qtest_get_irq(global_qtest, num);
546 }
547
548 /**
549 * irq_intercept_in:
550 * @string: QOM path of a device.
551 *
552 * Associate qtest irqs with the GPIO-in pins of the device
553 * whose path is specified by @string.
554 */
555 static inline void irq_intercept_in(const char *string)
556 {
557 qtest_irq_intercept_in(global_qtest, string);
558 }
559
560 /**
561 * qtest_irq_intercept_out:
562 * @string: QOM path of a device.
563 *
564 * Associate qtest irqs with the GPIO-out pins of the device
565 * whose path is specified by @string.
566 */
567 static inline void irq_intercept_out(const char *string)
568 {
569 qtest_irq_intercept_out(global_qtest, string);
570 }
571
572 /**
573 * outb:
574 * @addr: I/O port to write to.
575 * @value: Value being written.
576 *
577 * Write an 8-bit value to an I/O port.
578 */
579 static inline void outb(uint16_t addr, uint8_t value)
580 {
581 qtest_outb(global_qtest, addr, value);
582 }
583
584 /**
585 * outw:
586 * @addr: I/O port to write to.
587 * @value: Value being written.
588 *
589 * Write a 16-bit value to an I/O port.
590 */
591 static inline void outw(uint16_t addr, uint16_t value)
592 {
593 qtest_outw(global_qtest, addr, value);
594 }
595
596 /**
597 * outl:
598 * @addr: I/O port to write to.
599 * @value: Value being written.
600 *
601 * Write a 32-bit value to an I/O port.
602 */
603 static inline void outl(uint16_t addr, uint32_t value)
604 {
605 qtest_outl(global_qtest, addr, value);
606 }
607
608 /**
609 * inb:
610 * @addr: I/O port to read from.
611 *
612 * Reads an 8-bit value from an I/O port.
613 *
614 * Returns: Value read.
615 */
616 static inline uint8_t inb(uint16_t addr)
617 {
618 return qtest_inb(global_qtest, addr);
619 }
620
621 /**
622 * inw:
623 * @addr: I/O port to read from.
624 *
625 * Reads a 16-bit value from an I/O port.
626 *
627 * Returns: Value read.
628 */
629 static inline uint16_t inw(uint16_t addr)
630 {
631 return qtest_inw(global_qtest, addr);
632 }
633
634 /**
635 * inl:
636 * @addr: I/O port to read from.
637 *
638 * Reads a 32-bit value from an I/O port.
639 *
640 * Returns: Value read.
641 */
642 static inline uint32_t inl(uint16_t addr)
643 {
644 return qtest_inl(global_qtest, addr);
645 }
646
647 /**
648 * writeb:
649 * @addr: Guest address to write to.
650 * @value: Value being written.
651 *
652 * Writes an 8-bit value to guest memory.
653 */
654 static inline void writeb(uint64_t addr, uint8_t value)
655 {
656 qtest_writeb(global_qtest, addr, value);
657 }
658
659 /**
660 * writew:
661 * @addr: Guest address to write to.
662 * @value: Value being written.
663 *
664 * Writes a 16-bit value to guest memory.
665 */
666 static inline void writew(uint64_t addr, uint16_t value)
667 {
668 qtest_writew(global_qtest, addr, value);
669 }
670
671 /**
672 * writel:
673 * @addr: Guest address to write to.
674 * @value: Value being written.
675 *
676 * Writes a 32-bit value to guest memory.
677 */
678 static inline void writel(uint64_t addr, uint32_t value)
679 {
680 qtest_writel(global_qtest, addr, value);
681 }
682
683 /**
684 * writeq:
685 * @addr: Guest address to write to.
686 * @value: Value being written.
687 *
688 * Writes a 64-bit value to guest memory.
689 */
690 static inline void writeq(uint64_t addr, uint64_t value)
691 {
692 qtest_writeq(global_qtest, addr, value);
693 }
694
695 /**
696 * readb:
697 * @addr: Guest address to read from.
698 *
699 * Reads an 8-bit value from guest memory.
700 *
701 * Returns: Value read.
702 */
703 static inline uint8_t readb(uint64_t addr)
704 {
705 return qtest_readb(global_qtest, addr);
706 }
707
708 /**
709 * readw:
710 * @addr: Guest address to read from.
711 *
712 * Reads a 16-bit value from guest memory.
713 *
714 * Returns: Value read.
715 */
716 static inline uint16_t readw(uint64_t addr)
717 {
718 return qtest_readw(global_qtest, addr);
719 }
720
721 /**
722 * readl:
723 * @addr: Guest address to read from.
724 *
725 * Reads a 32-bit value from guest memory.
726 *
727 * Returns: Value read.
728 */
729 static inline uint32_t readl(uint64_t addr)
730 {
731 return qtest_readl(global_qtest, addr);
732 }
733
734 /**
735 * readq:
736 * @addr: Guest address to read from.
737 *
738 * Reads a 64-bit value from guest memory.
739 *
740 * Returns: Value read.
741 */
742 static inline uint64_t readq(uint64_t addr)
743 {
744 return qtest_readq(global_qtest, addr);
745 }
746
747 /**
748 * memread:
749 * @addr: Guest address to read from.
750 * @data: Pointer to where memory contents will be stored.
751 * @size: Number of bytes to read.
752 *
753 * Read guest memory into a buffer.
754 */
755 static inline void memread(uint64_t addr, void *data, size_t size)
756 {
757 qtest_memread(global_qtest, addr, data, size);
758 }
759
760 /**
761 * bufread:
762 * @addr: Guest address to read from.
763 * @data: Pointer to where memory contents will be stored.
764 * @size: Number of bytes to read.
765 *
766 * Read guest memory into a buffer, receive using a base64 encoding.
767 */
768 static inline void bufread(uint64_t addr, void *data, size_t size)
769 {
770 qtest_bufread(global_qtest, addr, data, size);
771 }
772
773 /**
774 * memwrite:
775 * @addr: Guest address to write to.
776 * @data: Pointer to the bytes that will be written to guest memory.
777 * @size: Number of bytes to write.
778 *
779 * Write a buffer to guest memory.
780 */
781 static inline void memwrite(uint64_t addr, const void *data, size_t size)
782 {
783 qtest_memwrite(global_qtest, addr, data, size);
784 }
785
786 /**
787 * bufwrite:
788 * @addr: Guest address to write to.
789 * @data: Pointer to the bytes that will be written to guest memory.
790 * @size: Number of bytes to write.
791 *
792 * Write a buffer to guest memory, transmit using a base64 encoding.
793 */
794 static inline void bufwrite(uint64_t addr, const void *data, size_t size)
795 {
796 qtest_bufwrite(global_qtest, addr, data, size);
797 }
798
799 /**
800 * qmemset:
801 * @addr: Guest address to write to.
802 * @patt: Byte pattern to fill the guest memory region with.
803 * @size: Number of bytes to write.
804 *
805 * Write a pattern to guest memory.
806 */
807 static inline void qmemset(uint64_t addr, uint8_t patt, size_t size)
808 {
809 qtest_memset(global_qtest, addr, patt, size);
810 }
811
812 /**
813 * clock_step_next:
814 *
815 * Advance the QEMU_CLOCK_VIRTUAL to the next deadline.
816 *
817 * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds.
818 */
819 static inline int64_t clock_step_next(void)
820 {
821 return qtest_clock_step_next(global_qtest);
822 }
823
824 /**
825 * clock_step:
826 * @step: Number of nanoseconds to advance the clock by.
827 *
828 * Advance the QEMU_CLOCK_VIRTUAL by @step nanoseconds.
829 *
830 * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds.
831 */
832 static inline int64_t clock_step(int64_t step)
833 {
834 return qtest_clock_step(global_qtest, step);
835 }
836
837 /**
838 * clock_set:
839 * @val: Nanoseconds value to advance the clock to.
840 *
841 * Advance the QEMU_CLOCK_VIRTUAL to @val nanoseconds since the VM was launched.
842 *
843 * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds.
844 */
845 static inline int64_t clock_set(int64_t val)
846 {
847 return qtest_clock_set(global_qtest, val);
848 }
849
850 /**
851 * qtest_big_endian:
852 *
853 * Returns: True if the architecture under test has a big endian configuration.
854 */
855 bool qtest_big_endian(void);
856
857
858 QDict *qmp_fd_receive(int fd);
859 void qmp_fd_sendv(int fd, const char *fmt, va_list ap);
860 void qmp_fd_send(int fd, const char *fmt, ...);
861 QDict *qmp_fdv(int fd, const char *fmt, va_list ap);
862 QDict *qmp_fd(int fd, const char *fmt, ...);
863
864 #endif