Skip to contentSkip to conversation

tests/qtest: netdev: test stream and dgram backends

PATCH In review Laurent Vivier 3 participants 3 messages Jan 18, 2023 – Jan 29, 2023 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH v7 1/1 tests/qtest: netdev: test stream and dgram backends

---

Notes:
v7:
- disable test_dgram_mcast() on windows
- disable test_dgram_unix() on windows as it also fails (we test for unix support dynamically but the test is done with SOCK_STREAM, and it fails here with SOCK_DGRAM)
- Tested with cirrus-ci (Thank you Thomas)

v6:
- call socket_init() otherwise socket_check_protocol_support() fails
- if socket_check_protocol_support() fails then calls g_abort() to report a problem.

v5:
- disable test_stream_fd and test_dgram_fd on windows as socketpair() is not defined.
- enable test_stream_unix_abstract only on linux as "abstract" unix socket parameter is only defined on linux.

v4:
- rework EXPECT_STATE()
- use g_dir_make_tmp()

v3:
- Add "-M none" to avoid error:
"No machine specified, and there is no default"

v2:
- Fix ipv6 free port allocation
- Check for IPv4, IPv6, AF_UNIX
- Use g_mkdtemp() rather than g_file_open_tmp()
- Use socketpair() in test_stream_fd()

v1: compared to v14 of "qapi: net: add unix socket type support to netdev backend":
- use IP addresses 127.0.0.1 and ::1 rather than localhost

 tests/qtest/meson.build     |   2 +
 tests/qtest/netdev-socket.c | 448 ++++++++++++++++++++++++++++++++++++
 2 files changed, 450 insertions(+)
 create mode 100644 tests/qtest/netdev-socket.c
tests/qtest/meson.build +2 -0
index f0ebb5fac603..d752304711e2 100644
@@ -21,6 +21,7 @@ qtests_generic = [
   'test-hmp',
   'qos-test',
   'readconfig-test',
+  'netdev-socket',
 ]
 if config_host.has_key('CONFIG_MODULES')
   qtests_generic += [ 'modules-test' ]
@@ -298,6 +299,7 @@ qtests = {
   'tpm-tis-device-swtpm-test': [io, tpmemu_files, 'tpm-tis-util.c'],
   'tpm-tis-device-test': [io, tpmemu_files, 'tpm-tis-util.c'],
   'vmgenid-test': files('boot-sector.c', 'acpi-utils.c'),
+  'netdev-socket': files('netdev-socket.c', '../unit/socket-helpers.c'),
 }
 
 gvnc = dependency('gvnc-1.0', required: false)
tests/qtest/netdev-socket.c new file +448 -0

448 lines not on this page · raw message

Signature · 1 line
2.39.0
#1 lore raw
Quoted 5 lines · Laurent Vivier

---

Quoted 7 lines

Notes:
v7:
- disable test_dgram_mcast() on windows
- disable test_dgram_unix() on windows as it also fails (we test for unix support dynamically but the test is done with SOCK_STREAM, and it fails here with SOCK_DGRAM)
- Tested with cirrus-ci (Thank you Thomas)

Thanks, added to my staging branch:

https://gitlab.com/thuth/qemu/-/commits/staging

Thomas

#2 lore raw
Quoted 15 lines · Thomas Huth
Quoted 5 lines · Laurent Vivier

---

Quoted 7 lines

Notes:
v7:
- disable test_dgram_mcast() on windows
- disable test_dgram_unix() on windows as it also fails (we test for unix support dynamically but the test is done with SOCK_STREAM, and it fails here with SOCK_DGRAM)
- Tested with cirrus-ci (Thank you Thomas)

Quoted 5 lines

Thanks, added to my staging branch:

https://gitlab.com/thuth/qemu/-/commits/staging

Thomas

I've also queued this since it is required for the patch:

[PATCH v4] net: stream: add a new option to automatically reconnect

Thanks

Quoted 1 line