aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2022-03-22 18:43:03 +0000
committerPeter Maydell <peter.maydell@linaro.org>2022-03-22 18:43:03 +0000
commit04ddcda6a2387274b3f31a501be3affd172aea3d (patch)
tree719b0f5e1064947da363fad71a10ca3f4cb99573 /tests
parent309df6acb29346f89e1ee542b1986f60cab12b87 (diff)
parent4ea4bec6f459ff1af6af01677d5bfac240db0201 (diff)
downloadqemu-04ddcda6a2387274b3f31a501be3affd172aea3d.zip
qemu-04ddcda6a2387274b3f31a501be3affd172aea3d.tar.gz
qemu-04ddcda6a2387274b3f31a501be3affd172aea3d.tar.bz2
Merge tag 'fixes-pull-request' of gitlab.com:marcandre.lureau/qemu into staging
Fixes and cleanups for 7.0 Hi, A collection of fixes & cleanup patches that should be safe for 7.0 inclusion. # gpg: Signature made Tue 22 Mar 2022 12:11:30 GMT # gpg: using RSA key 87A9BD933F87C606D276F62DDAE8E10975969CE5 # gpg: issuer "marcandre.lureau@redhat.com" # gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>" [full] # gpg: aka "Marc-André Lureau <marcandre.lureau@gmail.com>" [full] # Primary key fingerprint: 87A9 BD93 3F87 C606 D276 F62D DAE8 E109 7596 9CE5 * tag 'fixes-pull-request' of gitlab.com:marcandre.lureau/qemu: (21 commits) qapi: remove needless include Remove trailing ; after G_DEFINE_AUTO macro tests: remove needless include error: use GLib to remember the program name qga: remove bswap.h include qapi: remove needless include meson: fix CONFIG_ATOMIC128 check meson: move int128 checks from configure qapi: remove needless include util: remove the net/net.h dependency util: remove needless includes scripts/modinfo-collect: remove unused/dead code Move HOST_LONG_BITS to compiler.h Simplify HOST_LONG_BITS compiler.h: replace QEMU_SENTINEL with G_GNUC_NULL_TERMINATED compiler.h: replace QEMU_WARN_UNUSED_RESULT with G_GNUC_WARN_UNUSED_RESULT Replace GCC_FMT_ATTR with G_GNUC_PRINTF Drop qemu_foo() socket API wrapper m68k/nios2-semi: fix gettimeofday() result check vl: typo fix in a comment ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/qtest/e1000e-test.c4
-rw-r--r--tests/qtest/libqos/libqtest.h42
-rw-r--r--tests/qtest/libqtest-single.h2
-rw-r--r--tests/qtest/libqtest.c6
-rw-r--r--tests/qtest/migration-helpers.h6
-rw-r--r--tests/qtest/npcm7xx_emc-test.c4
-rw-r--r--tests/qtest/test-filter-mirror.c4
-rw-r--r--tests/qtest/test-filter-redirector.c8
-rw-r--r--tests/qtest/virtio-net-test.c10
-rw-r--r--tests/unit/check-qobject.c1
-rw-r--r--tests/unit/socket-helpers.c2
-rw-r--r--tests/unit/test-qobject-input-visitor.c4
12 files changed, 46 insertions, 47 deletions
diff --git a/tests/qtest/e1000e-test.c b/tests/qtest/e1000e-test.c
index 0273fe4..e648fdd 100644
--- a/tests/qtest/e1000e-test.c
+++ b/tests/qtest/e1000e-test.c
@@ -91,9 +91,9 @@ static void e1000e_send_verify(QE1000E *d, int *test_sockets, QGuestAllocator *a
g_assert_cmphex(le32_to_cpu(descr.upper.data) & dsta_dd, ==, dsta_dd);
/* Check data sent to the backend */
- ret = qemu_recv(test_sockets[0], &recv_len, sizeof(recv_len), 0);
+ ret = recv(test_sockets[0], &recv_len, sizeof(recv_len), 0);
g_assert_cmpint(ret, == , sizeof(recv_len));
- ret = qemu_recv(test_sockets[0], buffer, 64, 0);
+ ret = recv(test_sockets[0], buffer, 64, 0);
g_assert_cmpint(ret, >=, 5);
g_assert_cmpstr(buffer, == , "TEST");
diff --git a/tests/qtest/libqos/libqtest.h b/tests/qtest/libqos/libqtest.h
index cf38d27..552667f 100644
--- a/tests/qtest/libqos/libqtest.h
+++ b/tests/qtest/libqos/libqtest.h
@@ -31,7 +31,7 @@ typedef struct QTestState QTestState;
*
* Returns: #QTestState instance.
*/
-QTestState *qtest_initf(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
+QTestState *qtest_initf(const char *fmt, ...) G_GNUC_PRINTF(1, 2);
/**
* qtest_vinitf:
@@ -43,7 +43,7 @@ QTestState *qtest_initf(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
*
* Returns: #QTestState instance.
*/
-QTestState *qtest_vinitf(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0);
+QTestState *qtest_vinitf(const char *fmt, va_list ap) G_GNUC_PRINTF(1, 0);
/**
* qtest_init:
@@ -106,7 +106,7 @@ void qtest_quit(QTestState *s);
*/
QDict *qtest_qmp_fds(QTestState *s, int *fds, size_t fds_num,
const char *fmt, ...)
- GCC_FMT_ATTR(4, 5);
+ G_GNUC_PRINTF(4, 5);
/**
* qtest_qmp:
@@ -118,7 +118,7 @@ QDict *qtest_qmp_fds(QTestState *s, int *fds, size_t fds_num,
* Sends a QMP message to QEMU and returns the response.
*/
QDict *qtest_qmp(QTestState *s, const char *fmt, ...)
- GCC_FMT_ATTR(2, 3);
+ G_GNUC_PRINTF(2, 3);
/**
* qtest_qmp_send:
@@ -130,7 +130,7 @@ QDict *qtest_qmp(QTestState *s, const char *fmt, ...)
* Sends a QMP message to QEMU and leaves the response in the stream.
*/
void qtest_qmp_send(QTestState *s, const char *fmt, ...)
- GCC_FMT_ATTR(2, 3);
+ G_GNUC_PRINTF(2, 3);
/**
* qtest_qmp_send_raw:
@@ -141,7 +141,7 @@ void qtest_qmp_send(QTestState *s, const char *fmt, ...)
* this is useful for negative tests.
*/
void qtest_qmp_send_raw(QTestState *s, const char *fmt, ...)
- GCC_FMT_ATTR(2, 3);
+ G_GNUC_PRINTF(2, 3);
/**
* qtest_socket_server:
@@ -165,7 +165,7 @@ int qtest_socket_server(const char *socket_path);
*/
QDict *qtest_vqmp_fds(QTestState *s, int *fds, size_t fds_num,
const char *fmt, va_list ap)
- GCC_FMT_ATTR(4, 0);
+ G_GNUC_PRINTF(4, 0);
/**
* qtest_vqmp:
@@ -178,7 +178,7 @@ QDict *qtest_vqmp_fds(QTestState *s, int *fds, size_t fds_num,
* Sends a QMP message to QEMU and returns the response.
*/
QDict *qtest_vqmp(QTestState *s, const char *fmt, va_list ap)
- GCC_FMT_ATTR(2, 0);
+ G_GNUC_PRINTF(2, 0);
/**
* qtest_qmp_vsend_fds:
@@ -194,7 +194,7 @@ QDict *qtest_vqmp(QTestState *s, const char *fmt, va_list ap)
*/
void qtest_qmp_vsend_fds(QTestState *s, int *fds, size_t fds_num,
const char *fmt, va_list ap)
- GCC_FMT_ATTR(4, 0);
+ G_GNUC_PRINTF(4, 0);
/**
* qtest_qmp_vsend:
@@ -207,7 +207,7 @@ void qtest_qmp_vsend_fds(QTestState *s, int *fds, size_t fds_num,
* Sends a QMP message to QEMU and leaves the response in the stream.
*/
void qtest_qmp_vsend(QTestState *s, const char *fmt, va_list ap)
- GCC_FMT_ATTR(2, 0);
+ G_GNUC_PRINTF(2, 0);
/**
* qtest_qmp_receive_dict:
@@ -269,7 +269,7 @@ QDict *qtest_qmp_event_ref(QTestState *s, const char *event);
*
* Returns: the command's output. The caller should g_free() it.
*/
-char *qtest_hmp(QTestState *s, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
+char *qtest_hmp(QTestState *s, const char *fmt, ...) G_GNUC_PRINTF(2, 3);
/**
* qtest_hmpv:
@@ -283,7 +283,7 @@ char *qtest_hmp(QTestState *s, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
* Returns: the command's output. The caller should g_free() it.
*/
char *qtest_vhmp(QTestState *s, const char *fmt, va_list ap)
- GCC_FMT_ATTR(2, 0);
+ G_GNUC_PRINTF(2, 0);
void qtest_module_load(QTestState *s, const char *prefix, const char *libname);
@@ -688,17 +688,17 @@ void qtest_remove_abrt_handler(void *data);
* the response.
*/
void qtest_qmp_assert_success(QTestState *qts, const char *fmt, ...)
- GCC_FMT_ATTR(2, 3);
+ G_GNUC_PRINTF(2, 3);
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);
-void qmp_fd_vsend(int fd, const char *fmt, va_list ap) GCC_FMT_ATTR(2, 0);
-void qmp_fd_send(int fd, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
-void qmp_fd_send_raw(int fd, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
-void qmp_fd_vsend_raw(int fd, const char *fmt, va_list ap) GCC_FMT_ATTR(2, 0);
-QDict *qmp_fdv(int fd, const char *fmt, va_list ap) GCC_FMT_ATTR(2, 0);
-QDict *qmp_fd(int fd, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
+ const char *fmt, va_list ap) G_GNUC_PRINTF(4, 0);
+void qmp_fd_vsend(int fd, const char *fmt, va_list ap) G_GNUC_PRINTF(2, 0);
+void qmp_fd_send(int fd, const char *fmt, ...) G_GNUC_PRINTF(2, 3);
+void qmp_fd_send_raw(int fd, const char *fmt, ...) G_GNUC_PRINTF(2, 3);
+void qmp_fd_vsend_raw(int fd, const char *fmt, va_list ap) G_GNUC_PRINTF(2, 0);
+QDict *qmp_fdv(int fd, const char *fmt, va_list ap) G_GNUC_PRINTF(2, 0);
+QDict *qmp_fd(int fd, const char *fmt, ...) G_GNUC_PRINTF(2, 3);
/**
* qtest_cb_for_every_machine:
@@ -750,7 +750,7 @@ void qtest_qmp_device_add_qdict(QTestState *qts, const char *drv,
* Generic hot-plugging test via the device_add QMP command.
*/
void qtest_qmp_device_add(QTestState *qts, const char *driver, const char *id,
- const char *fmt, ...) GCC_FMT_ATTR(4, 5);
+ const char *fmt, ...) G_GNUC_PRINTF(4, 5);
/**
* qtest_qmp_add_client:
diff --git a/tests/qtest/libqtest-single.h b/tests/qtest/libqtest-single.h
index 0d7f568..b0838b9 100644
--- a/tests/qtest/libqtest-single.h
+++ b/tests/qtest/libqtest-single.h
@@ -52,7 +52,7 @@ static inline void qtest_end(void)
*
* Sends a QMP message to QEMU and returns the response.
*/
-GCC_FMT_ATTR(1, 2)
+G_GNUC_PRINTF(1, 2)
static inline QDict *qmp(const char *fmt, ...)
{
va_list ap;
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 41f4da4..dc5566c 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -94,8 +94,8 @@ static int socket_accept(int sock)
struct timeval timeout = { .tv_sec = SOCKET_TIMEOUT,
.tv_usec = 0 };
- if (qemu_setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO,
- (void *)&timeout, sizeof(timeout))) {
+ if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO,
+ (void *)&timeout, sizeof(timeout))) {
fprintf(stderr, "%s failed to set SO_RCVTIMEO: %s\n",
__func__, strerror(errno));
close(sock);
@@ -437,7 +437,7 @@ static void qtest_client_socket_send(QTestState *s, const char *buf)
socket_send(s->fd, buf, strlen(buf));
}
-static void GCC_FMT_ATTR(2, 3) qtest_sendf(QTestState *s, const char *fmt, ...)
+static void G_GNUC_PRINTF(2, 3) qtest_sendf(QTestState *s, const char *fmt, ...)
{
va_list ap;
diff --git a/tests/qtest/migration-helpers.h b/tests/qtest/migration-helpers.h
index d63bba9..555adaf 100644
--- a/tests/qtest/migration-helpers.h
+++ b/tests/qtest/migration-helpers.h
@@ -16,13 +16,13 @@
extern bool got_stop;
-GCC_FMT_ATTR(3, 4)
+G_GNUC_PRINTF(3, 4)
QDict *wait_command_fd(QTestState *who, int fd, const char *command, ...);
-GCC_FMT_ATTR(2, 3)
+G_GNUC_PRINTF(2, 3)
QDict *wait_command(QTestState *who, const char *command, ...);
-GCC_FMT_ATTR(3, 4)
+G_GNUC_PRINTF(3, 4)
void migrate_qmp(QTestState *who, const char *uri, const char *fmt, ...);
QDict *migrate_query(QTestState *who);
diff --git a/tests/qtest/npcm7xx_emc-test.c b/tests/qtest/npcm7xx_emc-test.c
index 9eec71d..7c435ac 100644
--- a/tests/qtest/npcm7xx_emc-test.c
+++ b/tests/qtest/npcm7xx_emc-test.c
@@ -521,12 +521,12 @@ static void emc_send_verify1(QTestState *qts, const EMCModule *mod, int fd,
/* Check data sent to the backend. */
recv_len = ~0;
- ret = qemu_recv(fd, &recv_len, sizeof(recv_len), MSG_DONTWAIT);
+ ret = recv(fd, &recv_len, sizeof(recv_len), MSG_DONTWAIT);
g_assert_cmpint(ret, == , sizeof(recv_len));
g_assert(wait_socket_readable(fd));
memset(buffer, 0xff, sizeof(buffer));
- ret = qemu_recv(fd, buffer, test_size, MSG_DONTWAIT);
+ ret = recv(fd, buffer, test_size, MSG_DONTWAIT);
g_assert_cmpmem(buffer, ret, test_data, test_size);
}
diff --git a/tests/qtest/test-filter-mirror.c b/tests/qtest/test-filter-mirror.c
index 95367d1..da4f94d 100644
--- a/tests/qtest/test-filter-mirror.c
+++ b/tests/qtest/test-filter-mirror.c
@@ -58,13 +58,13 @@ static void test_mirror(void)
g_assert_cmpint(ret, ==, sizeof(send_buf) + sizeof(size));
close(send_sock[0]);
- ret = qemu_recv(recv_sock[0], &len, sizeof(len), 0);
+ ret = recv(recv_sock[0], &len, sizeof(len), 0);
g_assert_cmpint(ret, ==, sizeof(len));
len = ntohl(len);
g_assert_cmpint(len, ==, sizeof(send_buf));
recv_buf = g_malloc(len);
- ret = qemu_recv(recv_sock[0], recv_buf, len, 0);
+ ret = recv(recv_sock[0], recv_buf, len, 0);
g_assert_cmpstr(recv_buf, ==, send_buf);
g_free(recv_buf);
diff --git a/tests/qtest/test-filter-redirector.c b/tests/qtest/test-filter-redirector.c
index 4f3f59c..fc16cf7 100644
--- a/tests/qtest/test-filter-redirector.c
+++ b/tests/qtest/test-filter-redirector.c
@@ -115,13 +115,13 @@ static void test_redirector_tx(void)
g_assert_cmpint(ret, ==, sizeof(send_buf) + sizeof(size));
close(backend_sock[0]);
- ret = qemu_recv(recv_sock, &len, sizeof(len), 0);
+ ret = recv(recv_sock, &len, sizeof(len), 0);
g_assert_cmpint(ret, ==, sizeof(len));
len = ntohl(len);
g_assert_cmpint(len, ==, sizeof(send_buf));
recv_buf = g_malloc(len);
- ret = qemu_recv(recv_sock, recv_buf, len, 0);
+ ret = recv(recv_sock, recv_buf, len, 0);
g_assert_cmpstr(recv_buf, ==, send_buf);
g_free(recv_buf);
@@ -182,13 +182,13 @@ static void test_redirector_rx(void)
ret = iov_send(send_sock, iov, 2, 0, sizeof(size) + sizeof(send_buf));
g_assert_cmpint(ret, ==, sizeof(send_buf) + sizeof(size));
- ret = qemu_recv(backend_sock[0], &len, sizeof(len), 0);
+ ret = recv(backend_sock[0], &len, sizeof(len), 0);
g_assert_cmpint(ret, ==, sizeof(len));
len = ntohl(len);
g_assert_cmpint(len, ==, sizeof(send_buf));
recv_buf = g_malloc(len);
- ret = qemu_recv(backend_sock[0], recv_buf, len, 0);
+ ret = recv(backend_sock[0], recv_buf, len, 0);
g_assert_cmpstr(recv_buf, ==, send_buf);
close(send_sock);
diff --git a/tests/qtest/virtio-net-test.c b/tests/qtest/virtio-net-test.c
index 8bf74e5..a713958 100644
--- a/tests/qtest/virtio-net-test.c
+++ b/tests/qtest/virtio-net-test.c
@@ -87,11 +87,11 @@ static void tx_test(QVirtioDevice *dev,
QVIRTIO_NET_TIMEOUT_US);
guest_free(alloc, req_addr);
- ret = qemu_recv(socket, &len, sizeof(len), 0);
+ ret = recv(socket, &len, sizeof(len), 0);
g_assert_cmpint(ret, ==, sizeof(len));
len = ntohl(len);
- ret = qemu_recv(socket, buffer, len, 0);
+ ret = recv(socket, buffer, len, 0);
g_assert_cmpstr(buffer, ==, "TEST");
}
@@ -202,11 +202,11 @@ static void announce_self(void *obj, void *data, QGuestAllocator *t_alloc)
qobject_unref(rsp);
/* Catch the first packet and make sure it's a RARP */
- ret = qemu_recv(sv[0], &len, sizeof(len), 0);
+ ret = recv(sv[0], &len, sizeof(len), 0);
g_assert_cmpint(ret, ==, sizeof(len));
len = ntohl(len);
- ret = qemu_recv(sv[0], buffer, len, 0);
+ ret = recv(sv[0], buffer, len, 0);
g_assert_cmpint(*proto, ==, htons(ETH_P_RARP));
/*
@@ -230,7 +230,7 @@ static void announce_self(void *obj, void *data, QGuestAllocator *t_alloc)
while (true) {
int saved_err;
- ret = qemu_recv(sv[0], buffer, 60, MSG_DONTWAIT);
+ ret = recv(sv[0], buffer, 60, MSG_DONTWAIT);
saved_err = errno;
now = g_get_monotonic_time();
g_assert_cmpint(now, <, deadline);
diff --git a/tests/unit/check-qobject.c b/tests/unit/check-qobject.c
index c1713d1..c3d50e9 100644
--- a/tests/unit/check-qobject.c
+++ b/tests/unit/check-qobject.c
@@ -8,7 +8,6 @@
*/
#include "qemu/osdep.h"
-#include "block/qdict.h"
#include "qapi/error.h"
#include "qapi/qmp/qbool.h"
#include "qapi/qmp/qdict.h"
diff --git a/tests/unit/socket-helpers.c b/tests/unit/socket-helpers.c
index f704fd1..ef31664 100644
--- a/tests/unit/socket-helpers.c
+++ b/tests/unit/socket-helpers.c
@@ -105,7 +105,7 @@ static int socket_can_bind_connect(const char *hostname, int family)
}
if (check_soerr) {
- if (qemu_getsockopt(cfd, SOL_SOCKET, SO_ERROR, &soerr, &soerrlen) < 0) {
+ if (getsockopt(cfd, SOL_SOCKET, SO_ERROR, &soerr, &soerrlen) < 0) {
goto cleanup;
}
if (soerr) {
diff --git a/tests/unit/test-qobject-input-visitor.c b/tests/unit/test-qobject-input-visitor.c
index 6f59a7f..22538f8 100644
--- a/tests/unit/test-qobject-input-visitor.c
+++ b/tests/unit/test-qobject-input-visitor.c
@@ -64,7 +64,7 @@ static Visitor *test_init_internal(TestInputVisitorData *data, bool keyval,
return data->qiv;
}
-static GCC_FMT_ATTR(3, 4)
+static G_GNUC_PRINTF(3, 4)
Visitor *visitor_input_test_init_full(TestInputVisitorData *data,
bool keyval,
const char *json_string, ...)
@@ -79,7 +79,7 @@ Visitor *visitor_input_test_init_full(TestInputVisitorData *data,
return v;
}
-static GCC_FMT_ATTR(2, 3)
+static G_GNUC_PRINTF(2, 3)
Visitor *visitor_input_test_init(TestInputVisitorData *data,
const char *json_string, ...)
{