[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 32/41] qtest: simplify socket_send()
From: |
marcandre . lureau |
Subject: |
[PATCH 32/41] qtest: simplify socket_send() |
Date: |
Wed, 20 Apr 2022 17:26:15 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Reuse qemu_write_full().
Signed-off-by: Marc-André Lureau <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.35.1.693.g805e0a68082a
- Re: [PATCH 28/41] Use QEMU_SANITIZE_ADDRESS, (continued)
- [PATCH 29/41] tests: run-time skip test-qga if TSAN is enabled, marcandre . lureau, 2022/04/20
- [PATCH 30/41] Move error_printf_unless_qmp() with monitor unit, marcandre . lureau, 2022/04/20
- [PATCH 31/41] qga: move qga_get_host_name(), marcandre . lureau, 2022/04/20
- [PATCH 32/41] qtest: simplify socket_send(),
marcandre . lureau <=
- [PATCH 35/41] util: simplify write in signal handler, marcandre . lureau, 2022/04/20
- [PATCH 34/41] libqtest: split QMP part in libqmp, marcandre . lureau, 2022/04/20
- [PATCH 33/41] tests: move libqtest.c under libqos/, marcandre . lureau, 2022/04/20