[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 23/30] qtest: simplify socket_send()
From: |
marcandre . lureau |
Subject: |
[PULL 23/30] qtest: simplify socket_send() |
Date: |
Thu, 21 Apr 2022 17:49:33 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Reuse qemu_write_full().
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20220420132624.2439741-33-marcandre.lureau@redhat.com>
---
tests/qtest/libqtest.c | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 7b5890dcc487..2b9bdb947d6f 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -414,21 +414,9 @@ void qtest_quit(QTestState *s)
static void socket_send(int fd, const char *buf, size_t size)
{
- size_t offset;
-
- offset = 0;
- while (offset < size) {
- ssize_t len;
+ size_t res = qemu_write_full(fd, buf, size);
- len = write(fd, buf + offset, size - offset);
- if (len == -1 && errno == EINTR) {
- continue;
- }
-
- g_assert_cmpint(len, >, 0);
-
- offset += len;
- }
+ assert(res == size);
}
static void qtest_client_socket_send(QTestState *s, const char *buf)
--
2.36.0
- [PULL 14/30] include: move qemu_msync() to osdep, (continued)
- [PULL 14/30] include: move qemu_msync() to osdep, marcandre . lureau, 2022/04/21
- [PULL 15/30] include: move qemu_fdatasync() to osdep, marcandre . lureau, 2022/04/21
- [PULL 16/30] include: add qemu/keyval.h, marcandre . lureau, 2022/04/21
- [PULL 17/30] include: move qdict_{crumple,flatten} declarations, marcandre . lureau, 2022/04/21
- [PULL 19/30] compiler.h: add QEMU_SANITIZE_{ADDRESS,THREAD}, marcandre . lureau, 2022/04/21
- [PULL 18/30] tests: remove block/qdict checks from check-qobject.c, marcandre . lureau, 2022/04/21
- [PULL 20/30] tests: run-time skip test-qga if TSAN is enabled, marcandre . lureau, 2022/04/21
- [PULL 21/30] Move error_printf_unless_qmp() with monitor unit, marcandre . lureau, 2022/04/21
- [PULL 22/30] qga: move qga_get_host_name(), marcandre . lureau, 2022/04/21
- [PULL 24/30] util: simplify write in signal handler, marcandre . lureau, 2022/04/21
- [PULL 23/30] qtest: simplify socket_send(),
marcandre . lureau <=
- [PULL 25/30] util: use qemu_write_full() in qemu_write_pidfile(), marcandre . lureau, 2022/04/21
- [PULL 26/30] util: use qemu_create() in qemu_write_pidfile(), marcandre . lureau, 2022/04/21
- [PULL 27/30] util: replace qemu_get_local_state_pathname(), marcandre . lureau, 2022/04/21
- [PULL 28/30] qga: remove need for QEMU atomic.h, marcandre . lureau, 2022/04/21
- [PULL 29/30] tests/fuzz: fix warning, marcandre . lureau, 2022/04/21
- [PULL 30/30] qga: use fixed-length and GDateTime for log timestamp, marcandre . lureau, 2022/04/21
- Re: [PULL 00/30] Misc patches, Richard Henderson, 2022/04/21