aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2019-09-03 07:50:26 +0200
committerThomas Huth <thuth@redhat.com>2019-09-05 13:18:52 +0200
commitdd210749727530cdef7c335040edbf81c3c5d041 (patch)
tree0e761474de9ed8bf6a10190a30141edb58cd9182
parent0ba67974aff2b42105c93e61b852d90197f37a20 (diff)
downloadqemu-dd210749727530cdef7c335040edbf81c3c5d041.zip
qemu-dd210749727530cdef7c335040edbf81c3c5d041.tar.gz
qemu-dd210749727530cdef7c335040edbf81c3c5d041.tar.bz2
tests/libqtest: Use libqtest-single.h in tests that require global_qtest
Tests that require global_qtest or the related wrapper functions now use the libqtest-single.h header that is dedicated for everything related to global_qtest. The core libqtest.c and libqtest.h files are now completely indepedent from global_qtest, so that the core library is now not depending on a global state anymore. Message-Id: <20190904130047.25808-7-thuth@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
-rw-r--r--tests/cpu-plug-test.c2
-rw-r--r--tests/display-vga-test.c2
-rw-r--r--tests/e1000e-test.c2
-rw-r--r--tests/fdc-test.c2
-rw-r--r--tests/i440fx-test.c2
-rw-r--r--tests/i82801b11-test.c2
-rw-r--r--tests/intel-hda-test.c2
-rw-r--r--tests/ioh3420-test.c2
-rw-r--r--tests/ipmi-kcs-test.c3
-rw-r--r--tests/libqtest-single.h4
-rw-r--r--tests/libqtest.c2
-rw-r--r--tests/libqtest.h4
-rw-r--r--tests/m25p80-test.c2
-rw-r--r--tests/qos-test.c2
-rw-r--r--tests/rtc-test.c2
-rw-r--r--tests/rtl8139-test.c2
-rw-r--r--tests/test-arm-mptimer.c2
-rw-r--r--tests/test-netfilter.c2
-rw-r--r--tests/test-x86-cpuid-compat.c2
-rw-r--r--tests/tmp105-test.c2
-rw-r--r--tests/tpm-crb-test.c2
-rw-r--r--tests/tpm-tests.c2
-rw-r--r--tests/tpm-tis-test.c2
-rw-r--r--tests/usb-hcd-ohci-test.c2
-rw-r--r--tests/usb-hcd-uhci-test.c2
-rw-r--r--tests/usb-hcd-xhci-test.c2
-rw-r--r--tests/vhost-user-test.c2
-rw-r--r--tests/virtio-9p-test.c2
-rw-r--r--tests/virtio-blk-test.c2
-rw-r--r--tests/virtio-ccw-test.c2
-rw-r--r--tests/virtio-net-test.c2
-rw-r--r--tests/virtio-scsi-test.c2
-rw-r--r--tests/virtio-serial-test.c2
33 files changed, 34 insertions, 37 deletions
diff --git a/tests/cpu-plug-test.c b/tests/cpu-plug-test.c
index 3049620..776407e 100644
--- a/tests/cpu-plug-test.c
+++ b/tests/cpu-plug-test.c
@@ -10,7 +10,7 @@
#include "qemu/osdep.h"
#include "qemu-common.h"
-#include "libqtest.h"
+#include "libqtest-single.h"
#include "qapi/qmp/qdict.h"
struct PlugTestData {
diff --git a/tests/display-vga-test.c b/tests/display-vga-test.c
index bd176dc..ace3bb2 100644
--- a/tests/display-vga-test.c
+++ b/tests/display-vga-test.c
@@ -8,7 +8,7 @@
*/
#include "qemu/osdep.h"
-#include "libqtest.h"
+#include "libqtest-single.h"
static void pci_cirrus(void)
{
diff --git a/tests/e1000e-test.c b/tests/e1000e-test.c
index 93628c5..1a232a6 100644
--- a/tests/e1000e-test.c
+++ b/tests/e1000e-test.c
@@ -26,7 +26,7 @@
#include "qemu/osdep.h"
#include "qemu-common.h"
-#include "libqtest.h"
+#include "libqtest-single.h"
#include "qemu-common.h"
#include "libqos/pci-pc.h"
#include "qemu/sockets.h"
diff --git a/tests/fdc-test.c b/tests/fdc-test.c
index 31cd329..26b69f7 100644
--- a/tests/fdc-test.c
+++ b/tests/fdc-test.c
@@ -25,7 +25,7 @@
#include "qemu/osdep.h"
-#include "libqtest.h"
+#include "libqtest-single.h"
#include "qapi/qmp/qdict.h"
#include "qemu-common.h"
diff --git a/tests/i440fx-test.c b/tests/i440fx-test.c
index 69205b5..1f57d96 100644
--- a/tests/i440fx-test.c
+++ b/tests/i440fx-test.c
@@ -14,7 +14,7 @@
#include "qemu/osdep.h"
-#include "libqtest.h"
+#include "libqtest-single.h"
#include "libqos/pci.h"
#include "libqos/pci-pc.h"
#include "hw/pci/pci_regs.h"
diff --git a/tests/i82801b11-test.c b/tests/i82801b11-test.c
index a6e3159..4345da3 100644
--- a/tests/i82801b11-test.c
+++ b/tests/i82801b11-test.c
@@ -8,7 +8,7 @@
*/
#include "qemu/osdep.h"
-#include "libqtest.h"
+#include "libqtest-single.h"
/* Tests only initialization so far. TODO: Replace with functional tests */
static void nop(void)
diff --git a/tests/intel-hda-test.c b/tests/intel-hda-test.c
index b782b2e..fc25ccc 100644
--- a/tests/intel-hda-test.c
+++ b/tests/intel-hda-test.c
@@ -8,7 +8,7 @@
*/
#include "qemu/osdep.h"
-#include "libqtest.h"
+#include "libqtest-single.h"
#define HDA_ID "hda0"
#define CODEC_DEVICES " -device hda-output,bus=" HDA_ID ".0" \
diff --git a/tests/ioh3420-test.c b/tests/ioh3420-test.c
index b54c4b9..f6ca43c 100644
--- a/tests/ioh3420-test.c
+++ b/tests/ioh3420-test.c
@@ -8,7 +8,7 @@
*/
#include "qemu/osdep.h"
-#include "libqtest.h"
+#include "libqtest-single.h"
/* Tests only initialization so far. TODO: Replace with functional tests */
static void nop(void)
diff --git a/tests/ipmi-kcs-test.c b/tests/ipmi-kcs-test.c
index a2354c1..693a6aa 100644
--- a/tests/ipmi-kcs-test.c
+++ b/tests/ipmi-kcs-test.c
@@ -24,8 +24,7 @@
#include "qemu/osdep.h"
-
-#include "libqtest.h"
+#include "libqtest-single.h"
#define IPMI_IRQ 5
diff --git a/tests/libqtest-single.h b/tests/libqtest-single.h
index 4925955..6f1bb13 100644
--- a/tests/libqtest-single.h
+++ b/tests/libqtest-single.h
@@ -11,6 +11,10 @@
#ifndef LIBQTEST_SINGLE_H
#define LIBQTEST_SINGLE_H
+#include "libqtest.h"
+
+QTestState *global_qtest __attribute__((common, weak));
+
/**
* qtest_start:
* @args: other arguments to pass to QEMU
diff --git a/tests/libqtest.c b/tests/libqtest.c
index e5101d9..0a6b917 100644
--- a/tests/libqtest.c
+++ b/tests/libqtest.c
@@ -35,8 +35,6 @@
#define SOCKET_TIMEOUT 50
#define SOCKET_MAX_FDS 16
-QTestState *global_qtest;
-
struct QTestState
{
int fd;
diff --git a/tests/libqtest.h b/tests/libqtest.h
index 6a7d7e4..c8cffe5 100644
--- a/tests/libqtest.h
+++ b/tests/libqtest.h
@@ -22,8 +22,6 @@
typedef struct QTestState QTestState;
-extern QTestState *global_qtest;
-
/**
* qtest_initf:
* @fmt...: Format for creating other arguments to pass to QEMU, formatted
@@ -641,8 +639,6 @@ void qtest_add_abrt_handler(GHookFunc fn, const void *data);
void qtest_qmp_assert_success(QTestState *qts, const char *fmt, ...)
GCC_FMT_ATTR(2, 3);
-#include "libqtest-single.h"
-
QDict *qmp_fd_receive(int fd);
void qmp_fd_vsend_fds(int fd, int *fds, size_t fds_num,
const char *fmt, va_list ap) GCC_FMT_ATTR(4, 0);
diff --git a/tests/m25p80-test.c b/tests/m25p80-test.c
index 055f724..50c6b79 100644
--- a/tests/m25p80-test.c
+++ b/tests/m25p80-test.c
@@ -25,7 +25,7 @@
#include "qemu/osdep.h"
#include "qemu/bswap.h"
-#include "libqtest.h"
+#include "libqtest-single.h"
/*
* ASPEED SPI Controller registers
diff --git a/tests/qos-test.c b/tests/qos-test.c
index 3c0071b..fd70d73 100644
--- a/tests/qos-test.c
+++ b/tests/qos-test.c
@@ -18,7 +18,7 @@
#include "qemu/osdep.h"
#include <getopt.h>
-#include "libqtest.h"
+#include "libqtest-single.h"
#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qbool.h"
#include "qapi/qmp/qstring.h"
diff --git a/tests/rtc-test.c b/tests/rtc-test.c
index 509be70..6309b0e 100644
--- a/tests/rtc-test.c
+++ b/tests/rtc-test.c
@@ -13,7 +13,7 @@
#include "qemu/osdep.h"
-#include "libqtest.h"
+#include "libqtest-single.h"
#include "qemu/timer.h"
#include "hw/timer/mc146818rtc_regs.h"
diff --git a/tests/rtl8139-test.c b/tests/rtl8139-test.c
index d6d0c24..4506049 100644
--- a/tests/rtl8139-test.c
+++ b/tests/rtl8139-test.c
@@ -8,7 +8,7 @@
*/
#include "qemu/osdep.h"
-#include "libqtest.h"
+#include "libqtest-single.h"
#include "libqos/pci-pc.h"
#include "qemu/timer.h"
#include "qemu-common.h"
diff --git a/tests/test-arm-mptimer.c b/tests/test-arm-mptimer.c
index 156a39f..7a56d56 100644
--- a/tests/test-arm-mptimer.c
+++ b/tests/test-arm-mptimer.c
@@ -9,7 +9,7 @@
#include "qemu/osdep.h"
#include "qemu/timer.h"
-#include "libqtest.h"
+#include "libqtest-single.h"
#define TIMER_BLOCK_SCALE(s) ((((s) & 0xff) + 1) * 10)
diff --git a/tests/test-netfilter.c b/tests/test-netfilter.c
index e47075d..22927ee 100644
--- a/tests/test-netfilter.c
+++ b/tests/test-netfilter.c
@@ -9,7 +9,7 @@
*/
#include "qemu/osdep.h"
-#include "libqtest.h"
+#include "libqtest-single.h"
#include "qapi/qmp/qdict.h"
/* add a netfilter to a netdev and then remove it */
diff --git a/tests/test-x86-cpuid-compat.c b/tests/test-x86-cpuid-compat.c
index e75b959..772287b 100644
--- a/tests/test-x86-cpuid-compat.c
+++ b/tests/test-x86-cpuid-compat.c
@@ -4,7 +4,7 @@
#include "qapi/qmp/qlist.h"
#include "qapi/qmp/qnum.h"
#include "qapi/qmp/qbool.h"
-#include "libqtest.h"
+#include "libqtest-single.h"
static char *get_cpu0_qom_path(void)
{
diff --git a/tests/tmp105-test.c b/tests/tmp105-test.c
index f599309..f930a96 100644
--- a/tests/tmp105-test.c
+++ b/tests/tmp105-test.c
@@ -9,7 +9,7 @@
#include "qemu/osdep.h"
-#include "libqtest.h"
+#include "libqtest-single.h"
#include "libqos/qgraph.h"
#include "libqos/i2c.h"
#include "qapi/qmp/qdict.h"
diff --git a/tests/tpm-crb-test.c b/tests/tpm-crb-test.c
index a139caa..632fb7f 100644
--- a/tests/tpm-crb-test.c
+++ b/tests/tpm-crb-test.c
@@ -15,7 +15,7 @@
#include "hw/acpi/tpm.h"
#include "io/channel-socket.h"
-#include "libqtest.h"
+#include "libqtest-single.h"
#include "qemu/module.h"
#include "tpm-emu.h"
diff --git a/tests/tpm-tests.c b/tests/tpm-tests.c
index e640777..6e45a0b 100644
--- a/tests/tpm-tests.c
+++ b/tests/tpm-tests.c
@@ -15,7 +15,7 @@
#include "qemu/osdep.h"
#include <glib/gstdio.h>
-#include "libqtest.h"
+#include "libqtest-single.h"
#include "tpm-tests.h"
static bool
diff --git a/tests/tpm-tis-test.c b/tests/tpm-tis-test.c
index 92a7e95..dcf30e0 100644
--- a/tests/tpm-tis-test.c
+++ b/tests/tpm-tis-test.c
@@ -17,7 +17,7 @@
#include "hw/acpi/tpm.h"
#include "io/channel-socket.h"
-#include "libqtest.h"
+#include "libqtest-single.h"
#include "qemu/module.h"
#include "tpm-emu.h"
diff --git a/tests/usb-hcd-ohci-test.c b/tests/usb-hcd-ohci-test.c
index 0cd73b7..19d760f 100644
--- a/tests/usb-hcd-ohci-test.c
+++ b/tests/usb-hcd-ohci-test.c
@@ -8,7 +8,7 @@
*/
#include "qemu/osdep.h"
-#include "libqtest.h"
+#include "libqtest-single.h"
#include "qemu/module.h"
#include "libqos/usb.h"
#include "libqos/qgraph.h"
diff --git a/tests/usb-hcd-uhci-test.c b/tests/usb-hcd-uhci-test.c
index 2eef8e3..7a117b6 100644
--- a/tests/usb-hcd-uhci-test.c
+++ b/tests/usb-hcd-uhci-test.c
@@ -8,7 +8,7 @@
*/
#include "qemu/osdep.h"
-#include "libqtest.h"
+#include "libqtest-single.h"
#include "libqos/libqos.h"
#include "libqos/usb.h"
#include "libqos/libqos-pc.h"
diff --git a/tests/usb-hcd-xhci-test.c b/tests/usb-hcd-xhci-test.c
index 0184537..10ef9d2 100644
--- a/tests/usb-hcd-xhci-test.c
+++ b/tests/usb-hcd-xhci-test.c
@@ -8,7 +8,7 @@
*/
#include "qemu/osdep.h"
-#include "libqtest.h"
+#include "libqtest-single.h"
#include "libqos/usb.h"
diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
index 6ae8a23..91ea373 100644
--- a/tests/vhost-user-test.c
+++ b/tests/vhost-user-test.c
@@ -10,7 +10,7 @@
#include "qemu/osdep.h"
-#include "libqtest.h"
+#include "libqtest-single.h"
#include "qapi/error.h"
#include "qapi/qmp/qdict.h"
#include "qemu/config-file.h"
diff --git a/tests/virtio-9p-test.c b/tests/virtio-9p-test.c
index 30e6cf3..e7b58e3 100644
--- a/tests/virtio-9p-test.c
+++ b/tests/virtio-9p-test.c
@@ -8,7 +8,7 @@
*/
#include "qemu/osdep.h"
-#include "libqtest.h"
+#include "libqtest-single.h"
#include "qemu/module.h"
#include "hw/9pfs/9p.h"
#include "hw/9pfs/9p-synth.h"
diff --git a/tests/virtio-blk-test.c b/tests/virtio-blk-test.c
index 45375dc..ed13167 100644
--- a/tests/virtio-blk-test.c
+++ b/tests/virtio-blk-test.c
@@ -9,7 +9,7 @@
*/
#include "qemu/osdep.h"
-#include "libqtest.h"
+#include "libqtest-single.h"
#include "qemu/bswap.h"
#include "qemu/module.h"
#include "standard-headers/linux/virtio_blk.h"
diff --git a/tests/virtio-ccw-test.c b/tests/virtio-ccw-test.c
index 9f445ef..d052364 100644
--- a/tests/virtio-ccw-test.c
+++ b/tests/virtio-ccw-test.c
@@ -14,7 +14,7 @@
*/
#include "qemu/osdep.h"
-#include "libqtest.h"
+#include "libqtest-single.h"
#include "libqos/virtio.h"
static void virtio_balloon_nop(void)
diff --git a/tests/virtio-net-test.c b/tests/virtio-net-test.c
index 840875a..a08e2ff 100644
--- a/tests/virtio-net-test.c
+++ b/tests/virtio-net-test.c
@@ -9,7 +9,7 @@
#include "qemu/osdep.h"
#include "qemu-common.h"
-#include "libqtest.h"
+#include "libqtest-single.h"
#include "qemu/iov.h"
#include "qemu/module.h"
#include "qapi/qmp/qdict.h"
diff --git a/tests/virtio-scsi-test.c b/tests/virtio-scsi-test.c
index 0934876..7c8f9b2 100644
--- a/tests/virtio-scsi-test.c
+++ b/tests/virtio-scsi-test.c
@@ -9,7 +9,7 @@
*/
#include "qemu/osdep.h"
-#include "libqtest.h"
+#include "libqtest-single.h"
#include "qemu/module.h"
#include "scsi/constants.h"
#include "libqos/libqos-pc.h"
diff --git a/tests/virtio-serial-test.c b/tests/virtio-serial-test.c
index e584ad7..2541034 100644
--- a/tests/virtio-serial-test.c
+++ b/tests/virtio-serial-test.c
@@ -8,7 +8,7 @@
*/
#include "qemu/osdep.h"
-#include "libqtest.h"
+#include "libqtest-single.h"
#include "qemu/module.h"
#include "libqos/virtio-serial.h"