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