tests/unit/test-qga: enable on FreeBSD
PATCH v2 1/1 tests/unit/test-qga: enable on FreeBSD
FreeBSD has all necessary commands implemented,
so enable test-qga for it.
Requires only minimal portability fixes for sockets in connect_qga().
---
Changes since v1:
- Drop SUN_LEN() for 'len' calculation on FreeBSD, use 'len = sizeof(remote)' on all platforms.
tests/unit/meson.build | 2 +- tests/unit/test-qga.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
tests/unit/meson.build +1 -1
@@ -169,7 +169,7 @@ if have_system tests += {'test-qdev': [qom, hwcore]} endif -if have_ga and host_os == 'linux' +if have_ga and host_os in ['freebsd', 'linux'] tests += {'test-qga': ['../qtest/libqmp.c', '../qtest/libqtest.c']} test_deps += {'test-qga': qga} endif
tests/unit/test-qga.c +2 -2
@@ -18,7 +18,7 @@ typedef struct {static int connect_qga (char *path) {int s, ret, len, i =0 ; -struct sockaddr_un remote; +struct sockaddr_un remote = {0 }; s =socket (AF_UNIX ,SOCK_STREAM ,0 );g_assert (s !=-1 );
@@ -26,7 +26,7 @@ static int connect_qga(char *path) remote.sun_family =AF_UNIX ; do { strcpy(remote.sun_path, path); - len = strlen(remote.sun_path) + sizeof(remote.sun_family); + len = sizeof(remote); ret = connect(s, (struct sockaddr *)&remote, len); if (ret == -1) { g_usleep(G_USEC_PER_SEC);
Signature · 1 line
2.55.0
Quoted 6 lines · Roman Bogorodskiy
FreeBSD has all necessary commands implemented,
so enable test-qga for it.Requires only minimal portability fixes for sockets in
connect_qga().
Quoted 7 lines
Signed-off-by Roman Bogorodskiy <[email protected]>Reviewed-by Kostiantyn Kostiuk <[email protected]>---
Changes since v1:- Drop
SUN_LEN()for 'len' calculation on FreeBSD, use 'len = sizeof(remote)' on all platforms.
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
Quoted 11 lines · Roman Bogorodskiy
FreeBSD has all necessary commands implemented,
so enable test-qga for it.Requires only minimal portability fixes for sockets in
connect_qga().Signed-off-by Roman Bogorodskiy <[email protected]>Reviewed-by Kostiantyn Kostiuk <[email protected]>---
Changes since v1:
Quoted 6 lines
- Drop
SUN_LEN()for 'len' calculation on FreeBSD, use 'len = sizeof(remote)' on all platforms.tests/unit/meson.build | 2 +- tests/unit/test-qga.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
ping?
Kostiantyn Kostiuk
Reviewed-byQuoted 23 lines · Roman Bogorodskiy
Quoted 11 lines · Roman Bogorodskiy
FreeBSD has all necessary commands implemented,
so enable test-qga for it.Requires only minimal portability fixes for sockets in
connect_qga().Signed-off-by Roman Bogorodskiy <[email protected]>Reviewed-by Kostiantyn Kostiuk <[email protected]>---
Changes since v1:Quoted 6 lines
- Drop
SUN_LEN()for 'len' calculation on FreeBSD, use 'len = sizeof(remote)' on all platforms.tests/unit/meson.build | 2 +- tests/unit/test-qga.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)ping?