Skip to contentSkip to conversation

tests/qtest: netdev: test stream and dgram backends

PATCH Superseded Laurent Vivier 2 participants 3 messages Jan 17, 2023 Arm/Amlogic Meson SoC support

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

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

---

Notes:
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 | 444 ++++++++++++++++++++++++++++++++++++
 2 files changed, 446 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 +444 -0

444 lines not on this page · raw message

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

---

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

Last problem fixed, next one occurring:

218/556 qemu:qtest+qtest-aarch64 / qtest-aarch64/netdev-socket ERROR 0.77s exit status 3
------------------------------------- 8< -------------------------------------
stderr:
qemu-system-aarch64: -netdev dgram,id=st0,remote.type=inet,remote.host=230.0.0.1,remote.port=1234: can't bind ip=230.0.0.1 to socket: Unknown error Broken pipe
../tests/qtest/libqtest.c:195: kill_qemu() tried to terminate QEMU process but encountered exit status 1 (expected 0)
TAP parsing error: Too few tests run (expected 6, got 4)
(test program exited with status code 3)
------------------------------------------------------------------------------

See: https://cirrus-ci.com/task/6491942456918016

... maybe it would be better to simply limit the test to CONFIG_POSIX in the meson.build file?

Thomas

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

---

Quoted 7 lines
Quoted 5 lines

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

Last problem fixed, next one occurring:

Thank you Thomas

Quoted 6 lines

218/556 qemu:qtest+qtest-aarch64 / qtest-aarch64/netdev-socket ERROR           0.77s   exit status 3
------------------------------------- 8< -------------------------------------
stderr:
qemu-system-aarch64: -netdev dgram,id=st0,remote.type=inet,remote.host=230.0.0.1,remote.port=1234: can't bind ip=230.0.0.1 to socket: Unknown error Broken pipe

It seems to be the test_dgram_mcast() test. Perhaps windows doesn't support multicast datagram?

Quoted 6 lines

../tests/qtest/libqtest.c:195: kill_qemu() tried to terminate QEMU process but encountered exit status 1 (expected 0) TAP parsing error: Too few tests run (expected 6, got 4)
(test program exited with status code 3)
------------------------------------------------------------------------------

See: https://cirrus-ci.com/task/6491942456918016

I'm sorry I've not been able to find the cirrus-ci option in github, so I didn't test.

Quoted 3 lines

... maybe it would be better to simply limit the test to CONFIG_POSIX in the meson.build file?

I agree but first I'd like to only disable the multicast test. If it fails, I'll limit the test to POSIX.

I'm sorry for the inconvenient.

Thanks,
Laurent