diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2014-03-13 12:32:47 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2014-03-13 12:32:47 +0000 |
commit | c8d146aecceb560664b112279ffddf6fe1db99db (patch) | |
tree | ee6ad1ab9701df1b9fb69be823b0a6ac9cd03933 /tests/libqtest.c | |
parent | 0100f42550201f346cc0c20c1864f941509eb592 (diff) | |
parent | f8762027a33e2f5d0915c56a904962b1481f75c1 (diff) |
Merge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-peter' into staging
QOM/QTest infrastructure fixes and device conversions
* QTest cleanups and test cases for some virtio devices
* QTest for sPAPR PCI host bridge
* qom-test now tests reading all properties beneath /machine
* QOM API leak fixes
* QOM cleanups for SSI devices
* QOM conversion of QEMUMachine
* QOM realize for buses
* sPAPR PCI bus name change
# gpg: Signature made Thu 13 Mar 2014 00:22:40 GMT using RSA key ID 3E7E013F
# gpg: Good signature from "Andreas Färber <afaerber@suse.de>"
# gpg: aka "Andreas Färber <afaerber@suse.com>"
* remotes/afaerber/tags/qom-devices-for-peter: (31 commits)
libqtest: Fix possible deadlock in qtest initialization
pci: Move VMState registration/unregistration to QOM realize/unrealize
qdev: Realize buses on device realization
qdev: Prepare realize/unrealize hooks for BusState
tests: Add spapr-pci-host-bridge qtest
virtio-serial-port: Convert to QOM realize/unrealize
virtio-console: QOM cast cleanup for VirtConsole
tests: Add virtio-console qtest
tests: Add virtio-serial qtest
tests: Add virtio-scsi qtest
tests: Add virtio-rng qtest
tests: Add virtio-balloon qtest
tests: Add virtio-blk qtest
tests: Clean up IndustryPack TPCI200 gcov paths
qom-test: Test QOM properties
hw/boards: Convert current_machine to MachineState
vl: Use MachineClass instead of global QEMUMachine list
hw/core: Introduce QEMU machine as QOM object
qdev-monitor-test: Don't test human-readable error message
qdev-monitor-test: Simplify using g_assert_cmpstr()
...
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests/libqtest.c')
-rw-r--r-- | tests/libqtest.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/libqtest.c b/tests/libqtest.c index b69dfca6bc..2b90e4a76e 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -34,6 +34,7 @@ #include "qapi/qmp/json-parser.h" #define MAX_IRQ 256 +#define SOCKET_TIMEOUT 5 QTestState *global_qtest; @@ -78,12 +79,16 @@ static int socket_accept(int sock) struct sockaddr_un addr; socklen_t addrlen; int ret; + struct timeval timeout = { .tv_sec = SOCKET_TIMEOUT, + .tv_usec = 0 }; + + setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (void *)&timeout, + sizeof(timeout)); addrlen = sizeof(addr); do { ret = accept(sock, (struct sockaddr *)&addr, &addrlen); } while (ret == -1 && errno == EINTR); - g_assert_no_errno(ret); close(sock); return ret; @@ -147,12 +152,16 @@ QTestState *qtest_init(const char *extra_args) } s->fd = socket_accept(sock); - s->qmp_fd = socket_accept(qmpsock); + if (s->fd >= 0) { + s->qmp_fd = socket_accept(qmpsock); + } unlink(socket_path); unlink(qmp_socket_path); g_free(socket_path); g_free(qmp_socket_path); + g_assert(s->fd >= 0 && s->qmp_fd >= 0); + s->rx = g_string_new(""); for (i = 0; i < MAX_IRQ; i++) { s->irq_level[i] = false; |