Commit Graph

121 Commits

Author SHA1 Message Date
goldsimon
48213650cd Try to make unit tests work without -Wno-address 2017-06-21 21:55:00 +02:00
goldsimon
35ba3a877d Moved NUM_SOCKETS and struct lwip_sock to sockets_priv.h; added test case for fd_use count with select 2017-06-13 21:07:34 +02:00
Joel Cunningham
c03fef9a3c bug #50837: add zero-window probe timeout
This commit adds a timeout to the zero-window probing (persist timer)
mechanism. LwIP has not historically had a timeout for the persist
timer, leading to unbounded blocking if connection drops during the
zero-window condition

This commit also adds two units test, one to check the RTO timeout
and a second to check the zero-window probe timeout
2017-05-09 09:01:03 -05:00
goldsimon
7617a76b19 added unit test to allocate zero length pbufs 2017-04-26 20:16:27 +02:00
goldsimon
842a235a68 fix test_sockets_msgapi_cmsg unit test (msvc gives me "warning C4706: assignment within conditional expression") 2017-04-25 23:08:53 +02:00
Joel Cunningham
3a01c32e55 test_sockets: fix pointer to integer conversion
This fixes a pointer to integer conversion in test_sockets_msgapi_cmsg()

This was identified by Travis CI: https://travis-ci.org/yarrick/lwip-merged/builds/225640702
2017-04-25 13:48:14 -05:00
Joel Cunningham
2f117add7a sockets: task #14247, add CMSG and IP_PKTINFO
This commit adds CMSG infrastructure (currently used with recvmsg) and
the IP_PKTINFO socket option.

In order to use IP_PKTINFO, set LWIP_NETBUF_RECVINFO to 1

Unit test is added to verify this feature
2017-04-25 09:44:03 -05:00
Joel Cunningham
de90d03e48 tcp: task #14128 - Appropriate Byte Counting support
This commit adds TCP Appropriate Byte Counting (ABC) support based on
RFC 3465

ABC replaces the previous congestion window growth mechanism and has been
configured with limit of 2 SMSS.  See task #14128 for discussion on
defaults, but the goal is to mitigate the performance impact of delayed
ACKs on congestion window growth

This commit also introduces a mechanism to track when the stack is
undergoing a period following an RTO where data is being retransmitted.

Lastly, this adds a unit test to verify RTO period tracking and some
basic ABC cwnd checking
2017-04-20 15:59:24 -05:00
goldsimon
1e02f9e88b add mqtt_test.c to test/unit/Filelists.mk 2017-04-12 22:05:53 +02:00
goldsimon
5cc168c0f1 added unit test for mqtt (that does not really do something useful yet) 2017-04-12 21:54:42 +02:00
goldsimon
7b477b32b8 let unit test sys_arch check that a mutex is not taken recursively 2017-04-11 12:43:33 +02:00
Joel Cunningham
557a11047d Patch #9307: Replace mem_malloc+memset with mem_calloc
Aside from reducing source code, on systems which use MEM_LIBC_MALLOC,
this has the potential to improve performance depending on the underlying
memory allocator

See http://stackoverflow.com/questions/2688466/why-mallocmemset-is-slower-than-calloc
2017-04-05 14:53:24 -05:00
Joel Cunningham
6fe66771cb test_tcp: de-duplicate test IP addresses, netmask, and ports
This creates a single version of test IP addresses, netmasks, and ports.
All tests were using the same values, but duplicated in each test

This also adds const to some functions so we can use a const version
of addresses
2017-03-31 12:01:43 -05:00
Joel Cunningham
648b2b6f2b test_tcp: remove unnecessary memsets
test_tcp_init_netif() memsets both netif and txcounters, so no need to manually do it
2017-03-31 11:59:12 -05:00
Joel Cunningham
34c9e30225 test_tcp: de-duplicate seqno checking defines
This commit moves common defines and senqo array so they can be
re-used in mulptiple places for sequence number checking rather
than duplicated

Currently they are used in two places, but I'm anticipating needing
them in future TCP unit tests
2017-03-31 11:57:33 -05:00
Joan Lledó
172dab1289 lwip_fcntl() returns access modes 2017-03-29 20:46:30 +02:00
Mikhail Lappo
f7d215043c Possible null-pointer dereference
In unit test if_fail check for nullptr
is always located after dereferencing this
null pointer. This patch introduces correct
order: first check, then use
2017-03-22 22:51:08 +01:00
goldsimon
972b7c2bfd sys_arch unit tests: refine test_sys_arch_waiting_fn a bit 2017-03-18 10:22:44 +01:00
Joel Cunningham
81e4726607 test_socket: conditional compile buffer trailer code
This code is marked as dead when BUF_SZ is a multiple of 4 (current
situation with unit tests)

This hopefully fixes a -Wunreachable-code failure found by Travis CI
2017-03-17 17:12:12 -05:00
Joel Cunningham
0a5a18e703 test_socket: add sendmsg/recvmsg TCP test
This migrates the sendmsg TCP test from socket examples (task #14408)
to socket unit tests

Additionally, this adds support for testing recvmsg, creating a TCP
test for both sendmsg/recvmsg (referred to as msgapi test)

This also makes a small change to msgapi UDP to clear the receive
buffer after verifying the previous datagram
2017-03-17 16:47:44 -05:00
Joel Cunningham
551d76eadd test_sockets: move loopback addr logic to utility function
This moves the loopback address creation logic to a utility function
so it can be shared with forth coming message API TCP test
2017-03-17 14:52:05 -05:00
Joel Cunningham
4c78ec7931 test_socket: replace {0} with memset
Using {0} broke Travis CI even though this should be correct for
initializing struct msghdr (see example in Linxu man pages:
http://man7.org/linux/man-pages/man3/cmsg.3.html)

Just use memset for now which is the common approach in LwIP codebase
2017-03-17 14:44:47 -05:00
Joel Cunningham
02e957de1e test_socket: convert sendmsg test to use recvmsg
This converts the sendmsg test to use recvmsg for receiving, thus
exercising both sendmsg and recvmsg in a single test

This also adjusts the test naming to communicate all message APIs
(sendmsg/recvmsg) are being tested
2017-03-17 14:19:26 -05:00
goldsimon
dffb75c5fa test_sockets: fix warning about unused variable "addr_size" 2017-03-17 11:03:49 +01:00
goldsimon
aa129f35a2 hopefully fix building unit tests on linux/clang 2017-03-17 09:29:06 +01:00
goldsimon
e1d818bb5f sockets unit tests: removed commented-out test code :-/ 2017-03-17 09:26:58 +01:00
goldsimon
b0444a63b0 tried to fix sockets unit tests; fix configuration to run with any NO_SYS setting and with/without IPv6 (IPv4 is required) 2017-03-17 09:05:36 +01:00
goldsimon
a42d1678eb tcp unit tests: don't break later tests relying on loopif 2017-03-17 08:56:03 +01:00
Joel Cunningham
53fcd50870 task #14408: move sendmsg UDP to unit tests
This commit moves the sendmsg UDP test from socket examples to socket
unit tests

The test has been converted to send/receive on the loopback interface
and also test a connected sendmsg with NULL msg_name
2017-03-16 19:27:26 -05:00
goldsimon
d820fb2f8d Try to add a Filelists.mk file for the unit tests (to fix unix build of unit tests) 2017-03-16 22:54:50 +01:00
goldsimon
fc47f846ed Fix and improve sockets unit test and unit test sys_arch (with a little help of tcpip.c) 2017-03-16 22:49:38 +01:00
goldsimon
8313c4d870 tried to add basic socket unit tests (nonsense only for now); made LOCK_TCPIP_CORE()/UNLOCK_TCPIP_CORE() overridable for that 2017-03-16 21:52:30 +01:00
Joel Cunningham
8bf402fd67 Fix unit test with assumed congestion avoidance
test_tcp_fast_rexmit_wraparound correctness relied on the congestion
window being in congestion avoidance so that only a single TCP_MSS
segment is sent upon ACKing the first segment.

It's not known whether the test was relying tcp_alloc() to set ssthresh
to 0 and thus start in congestion avoidance or if the test was working by
accident until changes in b90a54f989

This fixes the test by enforcing the requirement of starting in
congestion avoidance

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-03-10 08:12:17 +01:00
goldsimon
e9e9ec23b8 tcp unit tests: fixed that tcp_teardown() could lead to accessing a netif pointer that is not valid any more (netif added in test function stored on stack) 2017-03-09 20:23:16 +01:00
sg
b198c877db fix compiling TCP unit tests with IPv6 enabled 2017-01-16 14:21:08 +01:00
Erik Ekman
6c9a9b9d99 Remove duplicate netif_dhcp_data() macro
Fix compilation of unit tests
2017-01-05 21:14:43 +01:00
sg
8760fb677f fixed warnings in mdns unit tests 2017-01-04 15:25:52 +01:00
Dirk Ziegelmeier
1884c7e83f Fix TCP unit tests after changes from "Add hook for TCP Initial Sequence Number generation" commit
(pcb->lastack and friends are not initialized during allocation any more, but by connect() / bind() call)
2016-12-31 11:46:27 +01:00
Dirk Ziegelmeier
7f319f5ec5 Fix compile of test_tcp.c unit test after introduction of tcp_next_iss hook 2016-12-18 21:46:49 +01:00
goldsimon
0e07ed4b13 fixed bug #49676 (Possible endless loop when parsing dhcp options) & added unit test for that 2016-11-25 10:03:43 +01:00
Erik Ekman
b90682dc8b Update email address
I am leaving Verisure at the end of the month.
2016-11-10 11:19:51 +01:00
goldsimon
96c3c48ba7 mdns: moved private things into mdns_priv.h 2016-08-19 09:52:30 +02:00
Dirk Ziegelmeier
e844159f0a Fix warning in test_etharp.c 2016-08-19 09:03:57 +02:00
Dirk Ziegelmeier
11386a26d9 Fix compile of DHCP unit test 2016-08-19 09:00:35 +02:00
Dirk Ziegelmeier
5df88220c4 Fix compile of MDNS unit test with GCC 2016-08-18 20:43:33 +02:00
Dirk Ziegelmeier
a8c8e08984 Minor: cleanups in unit test code 2016-08-18 13:02:59 +02:00
Dirk Ziegelmeier
7f60cb3889 Improve netif client data API for lwIP internal clients - these can use a compile-time constant to access their data now 2016-08-18 12:37:21 +02:00
Dirk Ziegelmeier
fa6a2d48cc Fix DHCP unit test after my last changes 2016-08-18 06:09:02 +02:00
Dirk Ziegelmeier
93b286e508 Also rename LWIP_MDNS to LWIP_MDNS_RESPONDER in unit tests... 2016-08-17 16:03:42 +02:00
Erik Ekman
4919932c49 Apply patch #8755: Multicast DNS responder support from Erik Ekman 2016-08-14 15:07:45 +02:00