Commit Graph

212 Commits

Author SHA1 Message Date
Erik Ekman
e8b0c52806 ip6: Add test for fragmenting special packet
Reproduces bug #57374 (Found by Hiromasa Ito).
2021-09-24 00:12:11 +02:00
Erik Ekman
5c8fd3158d unit: Support check v0.13.0 and later
Function name no longer needs to be fed separately when adding tests.

Also fix collision of non-static net_test variables in dhcp and netif
tests.
2021-08-16 08:56:06 +02:00
Erik Ekman
d5843944cc netif: Add test for netif_find 2021-08-16 08:45:25 +02:00
Erik Ekman
f62be85576 netif: Add test for netif_is_flag_set() 2021-08-16 08:45:25 +02:00
Simon Goldschmidt
d58e0f1a1a fix compiling unit tests after adding compile-time check for LWIP_NETCONN_FULLDUPLEX 2021-08-15 10:07:58 +02:00
Simon Goldschmidt
fee64d7515 udp: fix udp_bind for IPADDR_TYPE_ANY
See bug #55171

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
(cherry picked from commit 752cdb1a53)
2019-02-26 16:25:19 +01:00
Jacob Kroon
aad77fcacb Fix compile of UDP unit test
Fix building unit tests via contrib/ports/unix/check on Debian 9, gcc 6.3.0.

Fixes:
  <snip>/ip_addr.h:105:58: error: the comparison will always evaluate as ‘true’ for the address of ‘ip1’ will never be NULL [-Werror=address]
   #define IP_SET_TYPE(ipaddr, iptype)     do { if((ipaddr) != NULL) { IP_SET_TYPE_VAL(*(ipaddr),iptype); }}while(0)

Signed-off-by: Jacob Kroon <jacob.kroon@gmail.com>
(cherry picked from commit 2f098c42a7)
2019-02-26 16:25:10 +01:00
Dirk Ziegelmeier
7f53f7ced4 Add testcase for bug #55171: Binding UDP PCB with different IP type PCBs does not work
(cherry picked from commit 91037b4c28)
2019-02-26 16:23:05 +01:00
Axel Lin
ba3a39957d Fix mqtt unit test broken ebb0dc14a7
Fixes: ebb0dc14a7 ("tcp_recved: check for overflow and warn about too big values")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-10-30 21:21:08 +08:00
Simon Goldschmidt
b7bee87fb5 Add a unit test for bug #54833 (tcp_abort with wrong ports)
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-10-17 21:44:44 +02:00
Simon Goldschmidt
eeee2b1c55 dhcp: adapt unit test to ignoring packets without END 2018-07-03 20:47:49 +02:00
Simon Goldschmidt
824ebbe0e9 tcp: fix RTO timer not working if link is down
... and added some test cases for this situation
See bug #54139

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-19 22:48:06 +02:00
Simon Goldschmidt
e61b925709 try to fix compiling with gcc & clang 2018-06-14 15:01:57 +02:00
Simon Goldschmidt
39faa8f61d added tests for ip6addr_ntoa_r 2018-06-14 12:30:14 +02:00
Simon Goldschmidt
b0e5eeb7d2 udp: prefer correctly bound pcbs when receiving broadcast
See bug #53301

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-13 22:01:18 +02:00
Simon Goldschmidt
38614e4f3e unit tests: remove dummy netif input function
This partly reverts a26a2e13 after removing that NULL check again.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-13 10:46:44 +02:00
Simon Goldschmidt
392c676ef5 fix bug #53273: IPv6 link-local address generation for non-ethernet type netif does not convert byte order 2018-06-13 08:57:17 +02:00
Simon Goldschmidt
0c5133d7cf fix ip6addr_aton for non-shortened ipv4 mapped addresses 2018-06-12 21:48:32 +02:00
Simon Goldschmidt
a26a2e1340 adapt unit tests to additional NULL checks 2018-06-12 13:47:13 +02:00
Simon Goldschmidt
2837bb310c fix ip6addr_aton handling IPv4-mapped addresses
... and added a unit test for it

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-11 22:21:31 +02:00
Simon Goldschmidt
f8e7cccf21 add new ip6 tests to (c)make list files 2018-06-10 19:23:02 +02:00
Simon Goldschmidt
fd050b8a97 fix bug #53971 Lwip sends Router Solicitation on address changes
... and add a unit test for it.

Moved resetting netif->rs_count from all reports to link-up and netif-up only.
While at it, clean up the interface a bit so that netif->rs_count is touched
from nd6.c only.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-06-08 22:18:50 +02:00
Simon Goldschmidt
d4845abac6 test_etharp: fix compiler warning 2018-06-08 20:03:51 +02:00
Dirk Ziegelmeier
f116bc37d1 Cleanups in CMake files 2018-04-30 22:29:07 +02:00
Dirk Ziegelmeier
ab5bc1e766 Work on CMake build system - add Filelists.cmake for unit tests 2018-04-27 23:58:36 +02:00
goldsimon
4a22d6d5a2 sockets_stresstest: fix typo (&1, not %1) 2018-04-20 07:52:35 +02:00
goldsimon
71c13c6079 Improve the socket stress test to better test fullduplex 2018-04-18 22:03:11 +02:00
goldsimon
61a1b98cc9 various IPv6-only compile fixes 2018-03-07 20:55:00 +01:00
Joel Cunningham
b28e979739 unit: write out XML file
This writes out the results of the unit tests in an XML file called
lwip_unittests.xml in the same directory as the unittests executable.

See https://libcheck.github.io/check/doc/check_html/check_4.html#XML-Logging
for an example of the ouput. Of particular use is the duration field, for
each test and for the entire test run.
2018-03-04 10:42:54 -06:00
Joel Cunningham
b1258bf8e6 unit: speed up test_pbuf_queueing_bigger_than_64k
Speed up test_pbuf_queueing_bigger_than_64k by using memcmp rather than
a byte by byte comparision. This allows using word aligned compares
within the memcmp implementation

This fixes a unit test timeout on my Windows 10 box with WSL which was
taking longer than 4 seconds for the unix port unit test to complete

See failure details in https://savannah.nongnu.org/patch/index.php?9579
2018-03-03 17:43:23 -06:00
goldsimon
ca0a356221 sockets_stresstest: don't compile when LWIP_SOCKET is disabled 2018-02-18 08:56:57 +01:00
goldsimon
e6f0700c81 fuzz: fix compile error, ignore 0 length pbufs 2018-02-18 08:56:23 +01:00
goldsimon
58de2af5f2 test/fuzz: add some applications, add an experimental multi-packet mode
The experimental multi-packet mode splits input bytes depending on a length
decoded from the first 2 bytes and does that until the end of input.
To use this mode, compile with "make D=-DLWIP_FUZZ_MULTI_PACKET"

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-15 14:35:08 +01:00
goldsimon
7b6d2870ca test: add a unit test for TCP_CHECKSUM_ON_COPY with retransmissions
This triggers bug #50914 (TCP_CHECKSUM_ON_COPY when adding data to
retransmission) when data is added to an already transmitted segment
with an uneven length of tcp data.
2018-02-12 12:34:45 +01:00
goldsimon
cff31ba5de test: enable LWIP_CHECKSUM_ON_COPY and TCP_CHECKSUM_ON_COPY_SANITY_CHECK
To find and verify bug #50914 (TCP_CHECKSUM_ON_COPY when adding data to
retransmission), enable checksum-on-copy for the unit tests.
2018-02-12 12:32:40 +01:00
goldsimon
b1b6275110 socket/netconn recv: FIN should only be reported once
FIN should only be reported once (as '0' for sockets, as 'ERR_CLSD' for
netconns). Before this change, ERR_CLSD was returned forever...

This is the 2nd try. First try (commit ebcae98ae6)
was buggy in that it could drop the FIN if it was read together with data
(reverted in commit ebcae98ae6).

This version fixes this by adding an apiflag and a netconn flag to keep
track of this.
2018-02-04 20:16:53 +01:00
goldsimon
fe828634ac socket unit test: check receiving FIN together with data works 2018-02-04 20:14:02 +01:00
goldsimon
a7a8d9273c sockets_stresstest: replace printf with LWIP_DEBUGF, fix unused arg 2018-01-17 19:46:32 +01:00
goldsimon
f343a67b40 netif unit test: add some more tests for ext callbacks 2018-01-13 15:22:09 +01:00
goldsimon
e645d00484 netif unit test: fix -Werror=c++-compat 2018-01-13 15:16:12 +01:00
goldsimon
734b6ab57a netif: ensure netif_set_addr() only results in one "ext_status_callback"
This can be used e.g. in mdns to create one, not multiple "changed" triggers
if IP address and netmask change at the same time.
2018-01-12 23:11:38 +01:00
goldsimon
fa75ffed9d unit tests: added test_netif (checking ext_callbacks only, for now) 2018-01-12 22:27:15 +01:00
Dirk Ziegelmeier
990c25d4f3 Add unit test for a long running timer 2018-01-12 12:37:16 +01:00
Dirk Ziegelmeier
b6b14438b7 Rename lwip_sys_timers_get_next_timout() to sys_timeouts_get_next_timeout() 2018-01-11 09:53:07 +01:00
goldsimon
1affbb4bd5 unit tests: fixed testing itoa with too small buffer 2018-01-08 21:38:16 +01:00
Dirk Ziegelmeier
d7566216c9 Remove Simon's compile fix in test_timers.c, it is not needed any more. The function is now used. 2018-01-08 13:02:58 +01:00
Dirk Ziegelmeier
b4768f1711 Once again: Fix build warnings in test_timers.c 2018-01-08 08:34:17 +01:00
Dirk Ziegelmeier
3f30bfae28 lwipopts.h for unit tests: Increase number of timeouts 2018-01-08 07:34:38 +01:00
Dirk Ziegelmeier
eaca067c7d Make _cyclic_ timers interval more deterministic - next timeout is calculated from last due time instead of relative to current time
This eliminates the cyclic timer jitter
2018-01-08 07:16:49 +01:00
Dirk Ziegelmeier
dd3861720f Fix bug #52748: the bug in timeouts.c by reimplementing timer logic to use absolute instead of relative timeout values 2018-01-08 07:16:47 +01:00