171 Commits

Author SHA1 Message Date
Fletcher Dunn bde7c7b858 test_p2p.py: Add symmetric test that requires TURN 2026-05-27 20:57:23 -07:00
Fletcher Dunn 53b6ca0a22 Test STUN/TURN server: Add --relay-latency arg, use 75ms in tests
This helps make sure that relayed routes don't win a race, and we
can use the naive RFC algorithm and confirm that we get the route
type that we expect
2026-05-27 20:55:29 -07:00
Fletcher Dunn ea9c4ade95 test_p2p.cpp now understands --turn-server 2026-05-27 08:33:55 -07:00
Fletcher Dunn 75f621aadb Test STUN server now supports minimal TURN features 2026-05-27 08:33:52 -07:00
Fletcher Dunn 19fd53901c test_p2p now supports --repeat 2026-05-22 21:26:57 -07:00
Fletcher Dunn 2ca71d516f Add cases that require IPv6 server reflexive to work 2026-05-21 21:58:17 -07:00
Fletcher Dunn 7a871443ed Test STUN server now supports IPv6 2026-05-21 21:54:09 -07:00
Fletcher Dunn 7db494c6e7 Compiler warnings
P4:10650618
(cherry picked from commit f7e8d96de3)
2026-05-18 15:43:46 -07:00
Fletcher Dunn 3ff74eae0e Setup loopback aliases for p2p tests properly 2026-05-18 07:34:44 -07:00
Fletcher Dunn 3060bfd781 Add IPv6 support to p2p mock framework 2026-05-18 00:05:26 -07:00
Fletcher Dunn f4eb1c6403 Tweak output when setting up aliases 2026-05-17 23:16:53 -07:00
Fletcher Dunn c18d9e3d27 test_p2p will muck with the local network stack
To allow us to bind to other addresses besides 127.0.0.1.
We'll need something similar for IPv6, but for now we only
need it for IPv4 on MacOS
2026-05-17 23:05:23 -07:00
Fletcher Dunn 7515a9e00c test_p2p now deliberately selects ICE implementation
Our implementation honors the mock network.  We know that webrtc has
their own very robust mocking framework they put their own implementation
through.
2026-05-17 22:29:48 -07:00
Fletcher Dunn e3ac0ede5e Imrove p2p tests
Make sure we test a super common and important scenario: two hosts
on the same LAN that *also* have the same gateway, and thus could
talk thorugh a hairpinned public route, but should use the LAN
route instead based purely on priority numbers, not latency
2026-05-17 21:49:51 -07:00
Fletcher Dunn d790bd66e2 Improve P2P mocking framework
There can be more than one gateway.  (E.g. cell connection and local
internet connection.)  Each interface is assigned to one gateway,
or none of the interface is public.

Add ability to tag an adapter as non-functioning.

Simulate network latency.

Add more test cases.
2026-05-17 20:01:31 -07:00
Fletcher Dunn 0e18b7dd57 Confirm route type in p2p test
p2p_test.cpp will print the route type
The runner script will extract it and check that the route type is what
we expect
2026-05-13 22:12:22 -07:00
Fletcher Dunn 6947ea3064 test_p2p: run local STUN server and test several mock cases. 2026-05-13 22:12:22 -07:00
Fletcher Dunn af470f47f6 Add a STUN server 2026-05-13 22:12:21 -07:00
Fletcher Dunn eb25f201c1 test_p2p: Add option to set stun server 2026-05-13 22:12:21 -07:00
Fletcher Dunn 2cb87c1c82 test_p2p.exe: add command line args to setup mock network 2026-05-13 22:12:21 -07:00
Fletcher Dunn 1ca37d421b Add framework for setting a mock network environment 2026-05-13 22:12:20 -07:00
Fletcher Dunn e47e9ff3f1 Add 'test' version of the library
The test version defines STEAMNETWORKINGSOCKETS_ENABLE_MOCK
and has internal functions tests can use to mock up network
environments (network adapters, gateway/NAT behaviour, etc)
2026-05-13 22:12:20 -07:00
Fletcher Dunn 4f4804a563 Tweak how tests ignore lock perf warnings 2026-05-06 20:00:29 -07:00
Fletcher Dunn d907a1da6c test_p2p: missing add_sanitizers 2026-05-06 19:50:00 -07:00
Fletcher Dunn 2a40b7a652 Tweak lock warning thresholds to fix tests 2026-05-04 10:16:47 -07:00
Fletcher Dunn e15f7e3fa3 Add tsan suppression 2026-05-03 22:34:19 -07:00
Fletcher Dunn 537bdcc4d6 Tests: remove netloopback_throughput from suite-quick 2026-04-28 17:24:07 -07:00
Fletcher Dunn b6480e71b0 Fix how tests are checking the returned message number 2026-04-28 16:20:06 -07:00
Fletcher Dunn 676e0c95ea Add "test_connection send_buffer_full" 2026-04-28 16:15:58 -07:00
Fletcher Dunn 4fbfe83ef4 Semantic change to ISteamNetworkingSockets::SendMessages
Added bDeleteFailedMessages.  By setting this to false, the caller has
the opportunity to retry failed messages, which is an especially
reasonably thing to do in the case of the send buffer being full.

Also clarified expected (and enforced) expected behaviour on
how subsequent messages on a connection are handled after a failed
message send.  Previously, there was a fairly significant bug, which is
that we would coutinue to try to send messages, which is bad because
it can break fundamental guarantees about message delivery order.  Now,
we will always stop at the first failure.

This fixes issue #317
2026-04-28 10:11:25 -07:00
Fletcher Dunn 75451a0c52 trivial formatting issues 2026-04-28 10:11:25 -07:00
Fletcher Dunn e3034ee400 Add "test_connection pipe"
It exercises some basic functionality of the pipe connection and
confirms that huge messages can be sent and are zero-copy.
2026-04-28 10:11:25 -07:00
Fletcher Dunn 57ed3fa8c1 CreateSocketPair: add identity checks to tests 2026-04-26 20:52:40 -07:00
Fletcher Dunn 7c4e3c8cd4 Tests: Restore the error message in fatal assert 2026-04-26 11:46:05 -07:00
Fletcher Dunn 4fa4c78ff5 tests: fix posix build call of _exit()
And remove unneeded assert.h include
2026-04-25 17:16:16 -07:00
Fletcher Dunn 8bfa71b558 Tests: another attempt to quit with a fatal error 2026-04-25 14:37:11 -07:00
Fletcher Dunn 82557feb2d test_connection now explicitly tests IPv4/v6 variations
I added a connection test mode 'cursory' which just makes
sure we can bind and exchange packets.  We don't need to
test every variation with a soak or even quick test.
2026-04-25 14:11:01 -07:00
Fletcher Dunn 85e296f397 Add enable_testing() and add_test()
I think this is standard cmake practice...?
2026-04-25 13:19:54 -07:00
Fletcher Dunn 092ec40cfb Don't use assert() in tests
It pops a dialog on windows and hangs
2026-04-25 13:15:41 -07:00
Fletcher Dunn 4c75e51da0 test_p2p: add --loglevel-p2prendezvous 2026-04-20 22:19:04 -07:00
Fletcher Dunn 62f86f63b3 test_p2p can now adjust the spew level
We'll want CI to print detailed info to stdio
2026-04-20 22:18:50 -07:00
Fletcher Dunn 7dc6f6d523 Add some test coverage for SHA256 and HMACs
These had no test coverage and the bcrypt version is busted
2026-04-18 22:39:55 -07:00
Fletcher Dunn 7067b9a3b9 test_p2p.py:
Wait for signs of life from signaling server.  If it fails to startup,
abort test immediately
2026-04-18 12:42:22 -07:00
Fletcher Dunn f96117f95a Port P2P trivial_signaling_server to Python
Writing it in go was a fine learning experience for me, but it was
just one more dependency/complexity and not very useful.
2026-04-18 01:01:20 -07:00
Fletcher Dunn fb2e965666 test_p2p.py
Catch exceptions if we fail to launch the process.
Previously, we would generate a false success
2026-04-17 22:12:01 -07:00
Fletcher Dunn 0f04d02b57 Fix compiler warning
(cherry picked from commit fa8f4be973)
2026-04-17 21:08:16 -07:00
Timothee 'TTimo' Besset 405e2bfc75 fix test_p2p on Windows 2024-09-30 09:32:51 -07:00
Timothee 'TTimo' Besset 538ae81ec9 test_p2p : make the RunProcessInThread a daemon thread so we cleanly exit on error. 2024-09-30 09:32:07 -07:00
Fletcher Dunn e4b7cdcf6a Add accessors for other platform identities.
This is in the public SDK, it's not trade secret stuff.
2024-03-13 16:13:54 -07:00
Fletcher Dunn ea429d4540 Better logging for P2P tests
P4:8088395
2023-05-28 19:06:31 -07:00