summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)AuthorFilesLines
2014-11-06tests: Fix a memory leak in test-send-recvPhilip Withnall1-2/+12
If n_messages ≠ n_valid_messages.
2014-09-26tests: Add more helgrind suppressionsPhilip Withnall1-0/+60
2014-09-25tests: Add a Valgrind suppression filePhilip Withnall2-0/+477
To be used with `make check-valgrind`.
2014-09-25tests: Fix various memory leaks in the unit testsPhilip Withnall10-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.
2014-09-25tests: Move a closure from the heap to the stackPhilip Withnall1-14/+10
There is no need for this to be heap-allocated.
2014-08-25tests: Fix test-build-io-stream for EOS changesPhilip Withnall1-3/+2
From commit 7b6935c66738d855c84fba291d47ece6ce1c43e2.
2014-08-21pseudotcp: Add a PseudoTcpSocket:support-fin-ack propertyPhilip Withnall1-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.
2014-08-21tests: Fix race conditions in test-threadPhilip Withnall1-14/+14
As found by tsan.
2014-08-21tests: Add a new segment-by-segment test framework for pseudo-TCPPhilip Withnall2-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.
2014-08-21pseudotcp: Add optional FIN–ACK and RST supportPhilip Withnall2-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
2014-08-21tests: Improve debug output of pseudotcp tests slightlyPhilip Withnall2-6/+6
2014-08-21tests: Add setlocale() call to test-pseudotcp.cPhilip Withnall1-0/+3
This ensures UTF-8 output is printed correctly.
2014-08-21tests: Add a logging domain for the unit testsPhilip Withnall1-0/+1
This clarifies the log output a little.
2014-08-13Fix bug in the ice-tcp unit testYouness Alaoui1-3/+4
2014-07-25Revert "agent: Separate reliability from ice-tcp vs ice-udp"Olivier Crête2-6/+6
This reverts commit 18e5dff4f25b12522e857c13d3ef3bdb40212246.
2014-07-25Change test-icetcp to be more robust against ready->connected->ready state ↵Youness Alaoui1-4/+17
changes
2014-05-17agent: Separate reliability from ice-tcp vs ice-udpOlivier Crête2-6/+6
We want ICE-TCP to not have reliable behavior unless the agent is reliable otherwise it will confuse existing VoIP applications.
2014-05-17Add support for ICE-TCPYouness Alaoui6-1/+488
This is a massive commit that can't be split. We add ice-tcp support into the agent by creating local host tcp-active/tcp-passive candidates. We also need to find the local and remote candidates whenever we discover a peer-reflexive because their data is important to setup the peer-reflexive so a few changes were added to look for the local or remote candidate. For TCP-ACTIVE remote peer-reflexive candidates, we can't add conncheck pairs normally because TCP-PASSIVE (local) do not generate candidate pairs, and we also can't have a connection from any local host, so we can only create a single candidatepair with the local/remote that are connected. The pair->socket of a candidate check pair will hold the connected tcp socket (through connect for ACT or accept for PASS) and we will either have a remote or a local peer-reflexive which will create a new candidate pair, we cannot trigger checks on the initial candidate pair, we must only do it on the new check pairs. but in the case of a tcp-passive, we don't get a new local peer-reflexive candidate, so there is no new candidate with a new NiceSocket, so when we get a triggered check, we need to match it to the candidate check pair or when we select a pair, it will still use the original TCP-PASS socket. We must store the new connected tcp socket in the peer reflexive candidates since they represent that unique peer-reflx candidate's connection
2014-05-17Disable reliable mode for test-fullmode, we already have pseudotcp unit testsYouness Alaoui1-1/+1
2014-05-17Add tcp-passive and tcp-active socket layers with unit testYouness Alaoui2-1/+165
2014-05-15test-fullmode: protect against ready->connected->ready state change and ↵Youness Alaoui1-7/+21
accept data reception on connected state
2014-05-15Remove priority functions from public header file and move to agent-priv.hYouness Alaoui1-0/+2
2014-05-15Change priority algorithm for better valuesYouness Alaoui1-3/+3
Now we will always give a handicap to UDP candidates, but still give relays the lower priority. We have the following priorities now : In reliable mode : TCP Host : 120 TCP peer-refl : 110 TCP nat-assist : 105 TCP srv-refl : 100 UDP Host : 60 UDP peer-refl : 55 UDP nat-assist : 52 UDP srv-refl : 50 TCP relay : 10 UDP relay : 5 In unreliable mode : UDP Host : 120 UDP peer-refl : 110 UDP nat-assist : 105 UDP srv-refl : 100 TCP Host : 60 TCP peer-refl : 55 TCP nat-assist : 52 TCP srv-refl : 50 UDP relay : 10 TCP relay : 5
2014-05-15test-priority: Unit test various configurations of candidate prioritiesYouness Alaoui1-5/+20
2014-05-15Add support for ice-tcp priorities, udp-tunneled and nat-assisted prioritiesYouness Alaoui1-1/+3
2014-05-02stunmessage: Revert another function to use sockaddrOlivier Crête1-1/+1
The farstream unit tests were using it.
2014-04-23Protect test-dribble against read->connected->ready state changesYouness Alaoui1-4/+14
2014-04-17tests: Add a test-pseudotcp-fuzzy test for fuzzing PseudoTcpSocketPhilip Withnall2-0/+470
As documented at the top of the file, this creates two PseudoTcpSockets in a loopback configuration, and mutates the raw packets which are sent between them, hoping to cause assertion failures and illegal memory accesses in the pseudotcp code. Best run under Valgrind or GDB.
2014-03-31Rename variables that shadow global definitionsOlivier Crête1-6/+6
2014-03-31stun: Use struct sockaddr_storage * for any pointer that we write toOlivier Crête1-2/+2
Some platforms have a larger alignment requirement for struct sockaddr_* than for plain struct sockaddr, in that case, we need to make sure that the incoming pointer has the right alignement before taking it in.
2014-03-31pseudotcp: Don't mix "long" and guint, one is signed, the other is unsignedOlivier Crête1-1/+2
So use guint64 everywhere, this is never supposed to be negative.
2014-03-27test-fullmode: Don't use gmainloop when not requiredOlivier Crête1-8/+21
There are more than one callback that could stop it
2014-03-27test-fullmode: Do #if instead of #ifdef as we set it to 0Olivier Crête1-1/+1
2014-03-27test-fullmode: Only wait for data on component 1Olivier Crête1-0/+3
2014-03-06tests: Add private header to tarballOlivier Crête1-0/+2
2014-03-06tests: Don't verify the message content with not in reliable mode, because ↵Olivier Crête2-33/+44
its unreliable
2014-02-25tests: Use dynamically allocated port for test-new-dribbleOlivier Crête1-15/+29
2014-02-25tests: Fix horribly raciness in test-new-dribbleOlivier Crête1-48/+87
2014-02-25tests: Split racy "closing" into a test for stopping while reading or writingOlivier Crête3-88/+194
We wan't to make sure not to have a race where a thread blocks in a blocking receive or send while nice_agent_remove_stream() is called
2014-02-25test: Use a less racy way to know if the test is ready to startOlivier Crête2-13/+61
Also, keep a pointer to the other structure for tests to use
2014-01-31agent: Replace nice_agent_build_io_stream() with nice_agent_get_io_stream()Olivier Crête2-45/+10
Also made the GIOStream into a singleton, it always returns the same one. Also make it impossible to create a GIOStream for a non-existing stream/component
2014-01-31Remove the "length" parameter from NiceOutputMessageOlivier Crête2-7/+22
It was used correctly only half the time anyway
2014-01-31Remove the "to" parameter from NiceOutputMessageOlivier Crête2-5/+3
We never send multiple messages to separate targets in practice, so this will simplify the code
2014-01-31tests: Fix test-restart to only quit on state changesPhilip Withnall1-1/+0
Previously, there was a race between receiving the data packets and changing state to READY, which would cause one of the final assertions to fail.
2014-01-31agent: Add support for vectored I/O for sendsPhilip Withnall1-53/+193
Add one new public function, nice_agent_send_messages_nonblocking(), which replaces nice_agent_send_full(). This isn’t an API break, because nice_agent_send_full() hasn’t been in a release yet. The new API allows sending multiple messages in a single call, and supports vectors of buffers to transmit the messages from. The existing nice_agent_send() API has been left untouched, although it’s a bit of a bugbear because it’s non-blocking and doesn’t fit with the new *_nonblocking() naming scheme. Oh well. This doesn’t bring any notable changes to the number of memcpy()s on the critical path: it remains at zero for the common cases and common socket types. It introduces the possibility for future work to eliminate some memcpy()s in more complex socket types, like tcp-turn and tcp-bsd, but these optimisations have not been made yet. FIXME comments have been added. This includes modifications to the test-send-recv unit test to cover the new API.
2014-01-31socket: Add vectored I/O support for sending on socketsPhilip Withnall1-44/+83
Replace the send() API with a send_messages() API, which supports sending multiple messages, each with multiple buffers rather than a single monolithic buffer. This doesn’t break API, as the socket API is not exposed outside libnice. It does introduce a new struct: NiceOutputMessage, which is analogous to struct mmsghdr and NiceInputMessage. This includes updates to the test-bsd test to cover the changed API. The existing nice_socket_send() API has been retained as a thin wrapper around nice_socket_send_messages(), for convenience only. It’s hoped that internal usage of this API will decline to the point where it can be removed.
2014-01-31tests: Update test-send-recv to support vectored I/OPhilip Withnall1-94/+338
2014-01-31tests: Fix a shadowed function name in test-pseudotcpPhilip Withnall1-2/+4
The write() function already exists; we can’t re-define it as a callback.
2014-01-31socket: Add vectored I/O support for receiving on socketsPhilip Withnall1-29/+293
Replace the recv() API with a recv_messages() API, which supports receiving multiple messages, each with multiple buffers rather than a single monolithic buffer. This doesn’t break API, as the socket API is not exposed outside libnice. It does introduce a new struct: NiceInputMessage, which is analogous to struct mmsghdr. This includes updates to the test-bsd test to cover the changed API.
2014-01-31agent: Only change pseudotcp clock if the new timeout is soonerOlivier Crête1-0/+1
Destroying and creating GSources is expensive, so also don't destroy and re-create if possible, instead lets use the new g_source_set_ready_time()