summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* udp-turn: handle multiple RFC4571 frames received in a TCP-TURN messageJakub Adam2018-10-312-0/+222
| | | | | | | | | | There might be multiple RFC4571-framed messages (or fragments thereof) within a single TCP-TURN message. Make sure each NiceInputMessage passed by the user into socket_recv_messages() gets exactly one RFC4571 frame, or remains empty if there aren't any messages to receive. We should keep any data that doesn't fit into the user buffers for the next time socket_recv_messages() gets called with the socket.
* tests: Remove non-existing mainloop test from Makefile.amOlivier Crête2018-10-211-2/+0
|
* test-pseudotcp(-fuzzy): Fix format string warnings causing build errors on ↵Brendan Shanks2018-06-062-3/+4
| | | | | | 32-bit Closes: ttps://gitlab.freedesktop.org/libnice/libnice/issues/45
* test-new-dribble: make credentials swap asymmetricFabrice Bellet2018-03-231-32/+23
| | | | | | | | | | | | the first case of test-new-dribble (standard-test) is updated, by making the credentials swap between the left and right agent asymmetric. Previously, ragent started to receive stun requests without initially knowing lagent candidates. Now, ragent also ignores lagent credentials. This modification allows to test changes introduced by the previous commit. Reviewed-by: Olivier Crête <olivier.crete@collabora.com> Differential Revision: https://phabricator.freedesktop.org/D1890
* conncheck: do not require that all streams have a connection check listMiguel París2017-11-282-0/+211
| | | | | | One or more streams might not have any connection check list if the number of streams differs from the peer agent. Differential Revision: https://phabricator.freedesktop.org/D1880
* Makefile: really enable debug for testsFabrice Bellet2017-11-271-1/+1
| | | | Differential Revision: https://phabricator.freedesktop.org/D1888
* agent: prevent external role change while conncheck is runningFabrice Bellet2017-11-271-0/+15
| | | | | | | | | With this patch, we stash the controlling mode property change, and apply it safely, when it won't interfere with an ongoing conncheck running. According to RFC5245, sect 5.2. "Determining Role", the role is determined for a session, and persists unless an ICE is restarted. Differential Revision: https://phabricator.freedesktop.org/D1887
* tests: Fix agent.h header inclusion in test-gstreamer.cPhilip Withnall2017-09-121-1/+1
| | | | | | Spotted by Lukas Gradl on the mailing list. Signed-off-by: Philip Withnall <withnall@endlessm.com>
* tests: Fix copyright dates in test-gstreamer.cPhilip Withnall2017-09-121-1/+1
| | | | | | This code is not 1000 years old. Signed-off-by: Philip Withnall <withnall@endlessm.com>
* agent: Adjust the nice_agent_new_full() to use flagsOlivier Crête2017-06-211-4/+4
| | | | This makes it easier to read and more extensible.
* test-nomination: added a new test for the nomination modeFabrice Bellet2017-06-122-1/+267
| | | | Differential Revision: https://phabricator.freedesktop.org/D1107
* tests_: Add test to verify that only packets from validated addresses passOlivier Crête2017-04-112-1/+521
| | | | | | | https://phabricator.freedesktop.org/T104 Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk> Differential Revision: https://phabricator.freedesktop.org/D1717
* agent: Drop packets not from validated addressesOlivier Crête2017-04-112-109/+0
| | | | | | | | | | | This is required by the WebRTC spec. Remove test-mainloop as it doesnt even try to do a negotiation. https://phabricator.freedesktop.org/T104 Differential Revision: https://phabricator.freedesktop.org/D1716
* test-credentials: Fix leakOlivier Crête2017-04-051-0/+2
|
* candidate: Test against possible typeOlivier Crête2017-04-031-2/+2
| | | | There was a confusion and it tested against a value not in the enum.
* test-turn: wait for gathering done sequentiallyFabrice Bellet2016-06-231-1/+3
| | | | | | | | Fixes a bug in the logic of the wait loop, where only a single gathering done was required to exit the loop, the other was caught by the following assert. Differential Revision: https://phabricator.freedesktop.org/D1110
* tests: fix io-stream when built with optimizationsFabrice Bellet2016-06-202-2/+2
| | | | | | In construct like "while (foo);" when foo is modified outside of the current thread, the variable should be declared volatile to suggest the compiler to read its value without making code optimization.
* test-send-recv: reduce deadlock timeoutFabrice Bellet2016-06-201-2/+2
|
* pseudotcp-fuzzy: fix this testFabrice Bellet2016-06-201-3/+3
| | | | | | | | The header size should be 24 bytes only, if we don't want to fuzz the payload too. Moreover, the default lambda parameter is decreased to one, to not fuzz the header too heavily, and consequently increase too much the time for the test to complete, due to exponential retransmission timeout when packets are corrupted.
* pseudotcp: Set min RTO to 1 secondOlivier Crête2016-06-031-4/+4
| | | | This is recommended by RFC 6298
* pseudotcp: Correct behaviour of buffer size methods when part-closedPhilip Withnall2016-06-031-0/+22
| | | | | | | | Correct the behaviour of pseudo_tcp_socket_get_available_bytes() and pseudo_tcp_get_available_send_space() when the socket is not in TCP_ESTABLISHED state. It’s still permissible to send and receive up until the local side calls pseudo_tcp_socket_close(), which means we may be in state TCP_ESTABLISHED *or TCP_CLOSE_WAIT*.
* pseudotcp: Fix pseudo_tcp_socket_recv() in state TCP_CLOSE_WAITPhilip Withnall2016-06-031-0/+38
| | | | | | | | | Previously, pseudo_tcp_socket_recv() would start returning 0 (EOS) as soon as a FIN segment was received from the peer, even if there was unread data already in the receive buffer. Instead, the unread data should all be accessible before pseudo_tcp_socket_recv() starts returning 0.
* pseudotcp: Fix retransmission of segments before handling a FINPhilip Withnall2016-06-031-2/+86
| | | | | | | | | | | Previously, if peer A transmitted one or more data segments (1), followed by a FIN segment (2) to peer B, and segments 1 were dropped, peer B would not request retransmission of them and would instead continue with the FIN handshake. This effectively meant segments 1 were lost without peer B realising. Fix this by only handling the FIN segment once its sequence number is acknowledged in the receive window.
* tests: Add TURN testOlivier Crête2016-06-022-1/+383
| | | | | This test depends on rfc5766-turn-server which must be installed for this test to run.
* test-icetcp: don't be sensitive to the signal orderJakub Adam2016-06-011-2/+12
| | | | | | | | | | | | | "new-selected-pair" may be emitted after "component-state-changed" to READY, by which time the main loop might have gotten quit in cb_component_state_changed(). Consequently, cb_new_selected_pair() could miss to register the selected pair, ultimately leading to an assertion failure in main(). We should wait for both selected pair and state change events to occur before stopping the main loop. Differential Revision: https://phabricator.freedesktop.org/D1044
* socket: refactor nice_socket_is_base_of()Jakub Adam2016-04-042-18/+18
| | | | | | | | | | | | | | • rename to nice_socket_is_based_on() and swap the order of arguments accordingly; the implementation doesn't have to use the confusing 'return other->is_base_of()' pattern anymore • fix potential NULL dereferences The argument order in agent_recv_message_unlocked() was already wrongly swapped in 1732c7d6 and thus this commit isn't changing it back because that order has become the correct one. Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk> Differential Revision: https://phabricator.freedesktop.org/D866
* socket: fix wrong function called in nice_socket_is_base_of()Jakub Adam2016-04-042-0/+125
| | | | | | | | | | | | | | | | | | | | | We have to call is_base_of "virtual function pointer" of 'other' object, not 'sock', since 'other' is the structure whose base NiceSocket we need to get from its private data. For instance calling nice_socket_is_base_of() with 'sock' and 'other' being respectively pseudo-SSL and UDP-TURN-over-TCP invoked is_base_of variant for pseudo-SSL, casting other->priv into PseudoSSLPriv *, but other->priv is actually TurnTcpPriv *. It must be called the other way around. https://phabricator.freedesktop.org/T7335 https://phabricator.freedesktop.org/T7336 Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk> Reviewed-by: José Antonio Santos Cadenas <santoscadenas@gmail.com> Reviewed-by: Philip Withnall <philip@tecnocode.co.uk> Reviewed-by: José Antonio Santos Cadenas <santoscadenas@gmail.com> Differential Revision: https://phabricator.freedesktop.org/D785
* test-new-dribble: wait until ragent reaches state completedPhilip Withnall2016-03-011-0/+4
| | | | | | | | The test didn't let enough time for ragent to reach the completed state after obtaining its remote candidates and switching to connecting state. Reviewed-by: Olivier Crête <olivier.crete@collabora.com> Differential Revision: https://phabricator.freedesktop.org/D817
* test-priority: ignore the local preferencePhilip Withnall2016-03-011-4/+4
| | | | | | | | | The local preference depends on the rank of the IP address in the list of all IP addresses available of the box running the test. As this value is not fixed we ignore it in the test. Reviewed-by: Olivier Crête <olivier.crete@collabora.com> Differential Revision: https://phabricator.freedesktop.org/D818
* tests: Enable G_MESSAGES_DEBUG for all unit testsPhilip Withnall2015-10-181-0/+4
| | | | | | | | | Now that we’re using automake’s parallel test harness, it automatically redirects all the debug log spew away from the console, so we should always have it enabled. Reviewed-by: Olivier Crête <olivier.crete@collabora.com> Differential Revision: https://phabricator.freedesktop.org/D292
* tests: Update expected priority values in test-priorityPhilip Withnall2015-10-011-4/+4
| | | | | | | | | This is a follow up to T3324, to update the test case to match the new values generated. Bug: https://phabricator.freedesktop.org/T3324 Reviewed-by: Olivier Crête <olivier.crete@collabora.com> Differential Revision: https://phabricator.freedesktop.org/D301
* tests: Use g_assert_cmpuint() to make test failures easier to diagnosePhilip Withnall2015-10-011-9/+9
| | | | | | | Now we can actually see the priority numbers which are unequal. Reviewed-by: Olivier Crête <olivier.crete@collabora.com> Differential Revision: https://phabricator.freedesktop.org/D300
* tests: Set candidate addresses in test-priorityPhilip Withnall2015-10-011-1/+4
| | | | | | | | This avoids an assertion failure in nice_address_to_string() when the addresses are compared for priority. Reviewed-by: Olivier Crête <olivier.crete@collabora.com> Differential Revision: https://phabricator.freedesktop.org/D299
* agent: Remove redundant GLIB_CHECK_VERSION macrosPhilip Withnall2015-10-012-15/+1
| | | | | | | | We depend on GLib 2.36.0, which is a higher version than any of these version checks cared about, so they were all trivially true or false. Reviewed-by: Olivier Crête <olivier.crete@collabora.com> Differential Revision: https://phabricator.freedesktop.org/D298
* tests: Remove g_thread_init() callsPhilip Withnall2015-10-0118-48/+8
| | | | | | | | We depend on GLib 2.36.0; g_thread_init() has been deprecated since 2.32.0, when thread initialisation was changed to happen automatically. Reviewed-by: Olivier Crête <olivier.crete@collabora.com> Differential Revision: https://phabricator.freedesktop.org/D297
* tests: Remove g_type_init() callsPhilip Withnall2015-10-0122-26/+0
| | | | | | | | We depend on GLib 2.36.0, which deprecated g_type_init() since GType initialisation is now done automatically. Reviewed-by: Olivier Crête <olivier.crete@collabora.com> Differential Revision: https://phabricator.freedesktop.org/D296
* agent: Add API to set local credentialsRohan Garg2015-04-142-1/+208
| | | | Adds new API: nice_agent_set_local_credentials().
* nicesink: Add test for buffer list supportJose Antonio Santos Cadenas2015-03-272-0/+337
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=89609
* tests: Use G_SOURCE_[CONTINUE|REMOVE] instead of booleansPhilip Withnall2014-11-061-6/+6
| | | | Makes the test code a little clearer. Introduces no functional changes.
* tests: Fix a memory leak in test-send-recvPhilip Withnall2014-11-061-2/+12
| | | | If n_messages ≠ n_valid_messages.
* tests: Add more helgrind suppressionsPhilip Withnall2014-09-261-0/+60
|
* tests: Add a Valgrind suppression filePhilip Withnall2014-09-252-0/+477
| | | | To be used with `make check-valgrind`.
* tests: Fix various memory leaks in the unit testsPhilip Withnall2014-09-2510-1/+142
| | | | | The theory being that if we can get check-valgrind to pass, we could acutally use it to find more memory leaks and other errors in the agent.
* tests: Move a closure from the heap to the stackPhilip Withnall2014-09-251-14/+10
| | | | There is no need for this to be heap-allocated.
* tests: Fix test-build-io-stream for EOS changesPhilip Withnall2014-08-251-3/+2
| | | | From commit 7b6935c66738d855c84fba291d47ece6ce1c43e2.
* pseudotcp: Add a PseudoTcpSocket:support-fin-ack propertyPhilip Withnall2014-08-211-4/+74
| | | | | | | | This allows FIN–ACK support to be disabled entirely. This is mostly for testing purposes, since TCP_OPT_FIN_ACK is negotiated when establishing the connection, and is disabled if the other side doesn’t support it. This includes an interoperability test.
* tests: Fix race conditions in test-threadPhilip Withnall2014-08-211-14/+14
| | | | As found by tsan.
* tests: Add a new segment-by-segment test framework for pseudo-TCPPhilip Withnall2014-08-212-0/+1067
| | | | | | | | This explicitly removes all timers and main loop considerations from the pseudo-TCP testing, which considerably simplifies arranging packet swaps and mistimings for testing purposes. This test suite includes a few tests for the FIN–ACK support.
* pseudotcp: Add optional FIN–ACK and RST supportPhilip Withnall2014-08-212-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to detect cases where the peer closes its connection without an explicit in-band close message (e.g. in protocols such as Telnet where there is none), pseudo-TCP needs to grow support for a shutdown handshake, following the TCP FIN–ACK specification. Arguably it should have had this all along, but Jingle apparently doesn’t need it. This adds support for FIN–ACK to the pseudo-TCP implementation. It is backwards-compatible, only being used if the TCP_OPT_FIN_ACK option is specified in the SYN segment. If enabled, full-duplex closes are supported, and the standard method for notifying a peer of the other end closing its connection (returning 0 from recv()) is used. Also allow rapidly tearing down a connection, discarding unsent and unreceived data, by sending an RST segment. This preserves the ability to do a forced socket closure with pseudo_tcp_socket_close(sock, TRUE). It also permits graceful socket shutdown in the case where the final ACK is lost, and one peer gets stuck in the LAST-ACK state: that peer will eventually re-transmit its FIN segment. The other peer, in the CLOSED state, will respond with a RST segment, and the first peer will then reach CLOSED. References (most useful first): • http://tools.ietf.org/html/rfc793#section-3.5 • http://tools.ietf.org/html/rfc1122#page-87 • http://vincent.bernat.im/en/blog/2014-tcp-time-wait-state-linux.html • http://tools.ietf.org/html/rfc675 Diagram: • http://en.wikipedia.org/wiki/Transmission_Control_Protocol#mediaviewer/File:TCP_CLOSE.svg
* tests: Improve debug output of pseudotcp tests slightlyPhilip Withnall2014-08-212-6/+6
|