Commit graph

880 commits

Author SHA1 Message Date
Maksim Masalski
03e6d3bb41 tests: updated names for the dns tests
After run Sanitycheck script I found out that
some test cases have a same test case name
in the test result .xml file.
For boards mimxrt1050_evk, qemu_x86, sam_e70_xplained
in .xml files that cases were dublicated.
Problem happened only with cases net.dns.no_ipv6.init
and net.dns.init. Only that cases were dublicated.
To solve it, I decided to change test cases names for the dns tests.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2019-10-18 15:30:06 +03:00
Ulf Magnusson
2d8bd31b37 tests: net: Remove CONFIG_NET_HEADERS_ALWAYS_CONTIGUOUS assignment
This symbol is not user-configurable (has no prompt), so assignments in
prj.conf have no effect on it.

(It has no defaults either, and isn't selected/implied, so nothing in
vanilla Zephyr will ever enable it.)

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-10-18 09:13:49 +02:00
Jukka Rissanen
d500ac87c4 tests: net: tls: Increasing stack size
The default main stack is too small for some boards so increasing
it to 2048. The issue was seen with sam_e70_xplained.

Fixes #19762

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-10-17 17:01:23 +03:00
Jukka Rissanen
6188185c57 tests: net: tcp: Initialize TCP header properly
When constructing TCP packet, make sure the TCP header is
initialized.

Fixes #19775

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-10-15 11:01:20 +03:00
Peter Bigot
e28f330a8e coccinelle: standardize k_thread create/define calls with integer timeouts
Re-run with updated script to convert integer literal delay arguments
to k_thread_create and K_THREAD_DEFINE to use the standard timeout
macros.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-10-09 08:38:10 -04:00
Jukka Rissanen
8a4fa570ac tests: net: hostname: Set MAC address properly to all interfaces
The test creates two network interfaces, but does not set MAC
address of one of them correctly (MAC address is all zeros).
This is not good and the issue fixed in commit 9468cb6eb1
could have been revealed earlier.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-10-04 17:42:14 +03:00
Jan Van Winkel
9468cb6eb1 tests: net: hostname: Corrected unique hostname conversion
Replaced net_bytes_from_str in hostname_get test by a new function that
converts the unique part of the hostname in a byte array.

net_bytes_from_str can not be used as it assumes that the string input
is of the format "xx:xx:xx:xx:xx:xx" where as the unique part of the
hostname is a MAC address string without colons. If net_bytes_from_str
is used this could result in buffer overrun on the input string.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-10-02 12:52:16 +03:00
Jukka Rissanen
49a4144ac5 tests: net: hostname: Add tests for hostname set/get
Add tests that set or get system network hostname.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-20 11:42:51 +03:00
Andrew Boie
c91b9b37d0 tests: net: stop whitelisting
This is bad practice and may conceal issues on platforms
not in the whitelist.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-20 09:21:11 +03:00
Jukka Rissanen
a077bdd417 tests: net: shell: Add some simple tests for net-shell
Make sure net-shell is started properly and it does not crash.
The purpose of this test is to catch issues described in #19178
where UART was not working which was seen as net-shell crashing
at startup.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-17 22:41:56 +08:00
Jukka Rissanen
8e6aaaf919 tests: net: socket: Test that non-blocking accept() works
Mark socket non-blocking and make sure that accept() will return
immediately.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-13 10:41:33 +03:00
Jukka Rissanen
f6c5ea6c81 tests: net: dhcpv4: Increase the buffer count
Test requires more network buffers to work properly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-12 17:33:44 +03:00
Jukka Rissanen
117d385de8 tests: net: socket: register: Fix unit tests when proto == 0
Make sure the tests pass properly if the socket() is called
with proto 0.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-12 11:22:45 +03:00
Jukka Rissanen
b14856589e tests: net: getaddrinfo: Logging was missing log_strdup() call
A call to log_strdup() was missing which caused tests to fail if
logging was enabled.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-11 16:17:42 +03:00
Jukka Rissanen
8108f06113 tests: net: getaddrinfo: Resolve using wrong address family
Make sure that resolving IPv4 address but returning IPv6 address
(and vice versa) is failing and we catch that scenario.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-11 16:17:42 +03:00
Jukka Rissanen
8fa6dfbe5a tests: net: tcp: Test connection cleanup after receiving SYN
Make sure the net_context is properly removed if done after
receiving SYN.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-10 22:53:12 +03:00
Jukka Rissanen
b73a3de4ed tests: net: poll: Increase the poll timeout value
Got several sanity failures with this information

Assertion failed at tests/net/socket/poll/src/main.c:76: \
  test_poll: (tstamp >= 30U && tstamp <= 30 + FUZZ is false)

In one of the failed tests, the tstamp was 50. Dunno what is
wrong here but in order to proceed with this, increasing the
timeout temporarily. This commit can be removed if the root
cause for this timeout is figured out.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-10 12:45:38 +03:00
Jukka Rissanen
a76b786eb6 tests: net: poll: Moving config options from yaml to conf file
Moving Kconfig options from testcase.yaml file to prj.conf so
that we can run the test app easily from command line and without
sanitycheck.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-10 12:45:38 +03:00
Charles E. Youse
cda625b726 drivers/ethernet/eth_dw: remove DesignWare Ethernet driver
This was only used on the Quark SoCs. It is no longer used, can no
longer be tested, and it's reliant upon the deprecated legacy PCI
subsystem. Remove it to prevent bitrot.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-09-08 22:09:10 -04:00
Ioannis Glaropoulos
571b42e74e tests: net: dns_addremove: increase main stack size
We need to increase the stack size of the main thread, to
avoid stack overflow, when executing the tests on various
platforms.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-08-27 11:02:18 +02:00
Vincent Wan
fdf0af3b5a tests: net: trickle: use separate semaphore for second trickle timer
A second semaphore is used for the second trickle timer, so that if the
first timer expires twice before the second one, the test would still
wait before proceeding to check on cb_2_called.

Fixes #18598.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2019-08-26 12:57:56 +02:00
Jan Van Winkel
029189cb68 tests: mqtt Corrected memcmp in mqtt pubsub tests
Corrected payload memcmp in function publish_handler of mqtt pusub
tests.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-08-26 11:29:53 +02:00
Tomasz Bursztyka
7ea5ec8baf tests: net: Fix for coverity CID 203499
Adding an assertion on returned allocation.

Coverity-CID: 203499
Fixes #18454

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-08-19 16:27:23 +02:00
Kumar Gala
deae969de3 tests: net: lib: dns: dns_addremove: Increase stack size for FRDM-K64F
CONFIG_MAIN_STACK_SIZE was originally 1344 in this test.  The following
commit removed setting the stack size in the test:

commit 7b3cd7d371
Author: Cami Carballo <cami.carballo@intel.com>
Date:   Fri Jul 26 10:59:16 2019 -0400

    tests: net: increase stack size

However getting the default stack size on FRDM-K64F of 512 causes the
following panic:

FATAL: ***** BUS FAULT *****
FATAL:   Stacking error
FATAL:   Imprecise data bus error
FATAL:   NXP MPU error, port 3
FATAL:     Mode: Supervisor, Data Address: 0x20002ff0
FATAL:     Type: Write, Master: 0, Regions: 0x8200
FATAL: r0/a1:  0x00000000  r1/a2:  0x00000000  r2/a3:  0x00000000
FATAL: r3/a4:  0x00000000 r12/ip:  0x00000000 r14/lr:  0x00000000
FATAL:  xpsr:  0x200002f4
FATAL: Faulting instruction address (r15/pc): 0x00000000
FATAL: >>> ZEPHYR FATAL ERROR 2: Stack overflow
FATAL: Current thread: 0x2000182c (main)
FATAL: Halting system

Bump stack back to original 1344 fixes the issue.

Fixes #18292

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-08-16 09:20:45 +02:00
Jukka Rissanen
7da78796de tests: net: udp: We need to reserve enough space for the data
We are trying to pass 64-bit value to the driver, but we only
allocate space for an integer. This will not work and will cause
invalid memory access.

Fixes #18205

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-08-14 09:15:34 +03:00
Cami Carballo
7b3cd7d371 tests: net: increase stack size
fixes issues with tests/net when code coverage is enabled in qemu_x86

Signed-off-by: Cami Carballo <cami.carballo@intel.com>
2019-08-08 13:50:32 -07:00
Jukka Rissanen
ed10c9068e tests: net: sendmsg: Verify that connected UDP sock works
Add new tests that make sure that sendmsg() works when using
connected UDP socket and when not setting msghdr destination
address.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-08-08 23:13:51 +03:00
Alexander Wachter
35f01673ac net: l2: 6LoCAN implementation
This commit is an implementation of 6LoCAN, a 6Lo adaption layer for
Controller Area Networks. 6LoCAN is not yet standardised.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-08-08 13:25:01 +03:00
Alexander Wachter
c8c5f3bbf3 net: canbus: Rename canbus to canbus_raw
Rename the socket_can implementation from CANBUS to CANBUS_RAW.
This is a preperation for 6LoCAN which is a CANBUS L2 for IPv6.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-08-08 13:25:01 +03:00
Jukka Rissanen
fc79a789c7 tests: net: context: Let the net_context cb to run first
An issue was seen after changes introduced in #17933.
The net_context callback was run after we checked that it
was run ok. This test failed of course in that case. Simple
solution is to k_yield() which will make sure that the
callback gets called before we continue. This works for this
test as our threads have suitably selected priorities.
There is also no need to use K_NO_WAIT here so replacing the
timeout with K_FOREVER.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-08-05 16:25:18 +03:00
Anas Nashif
578ae40761 boards: remove quarl_se_c1000
This board and SoC was discontinued some time ago and is currently not
maintained in the zephyr tree.
Remove all associated configurations and variants from the tree.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-07-29 21:30:25 -07:00
Anas Nashif
ffaba63b10 boards: remove arduino 101 and related boards
This board and SoC was discontinued some time ago and is currently not
maintained in the zephyr tree.
Remove all associated configurations and variants from the tree.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-07-29 21:30:25 -07:00
Jukka Rissanen
d09248219d tests: net: ppp: Add unit tests for PPP driver
Make sure that we are able to parse incoming PPP data
correctly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-29 10:24:46 +03:00
Alexander Wachter
62ded2ded4 tests: net: 6Lo: Add test criterion HDR diff
This commit adds a test criterion that checks how many bytes
are compressed.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-07-25 15:19:28 +03:00
Alexander Wachter
0f8c2acece tests: net: 6lo: Adapt tests to deal with headers in multiple frames
The testcases are adapted to handle more than one net buffer in
a net_pkt. After the IPHC optimization it is possible that IP header
is not in the same buffer than the UDP header.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-07-25 15:19:28 +03:00
Jukka Rissanen
c470fff3c9 tests: net: txtime: Add tests for SO_TXTIME and SCM_TXTIME
Make sure that SO_TXTIME socket option can be set and get.
Verify also that TX time is passed properly to network device
driver.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-24 10:17:16 +03:00
Jukka Rissanen
4a8154f6c1 tests: net: udp: Add tests for sendmsg() call
Make sure we are able to pass ancillary data using the
sendmsg() API.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-24 10:17:16 +03:00
Nicolas Pitre
6609c12516 tests: enable native_posix_64 testing
Whenever conditions are applied to native_posix, they should apply to
native_posix_64 too.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-16 10:41:11 -07:00
Marc Herbert
c429051380 tests/net/: samples/net/: add a few 'userspace' tags
See commit message 4afcc0f8af for the long story.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-07-15 09:05:10 -04:00
Jukka Rissanen
600c1d6fa7 tests: net: trickle: Adjust config options to avoid error prints
Noticed this error print when running in mps2_an385 platform.

   <err> net_if: There is no network interface to work with!

Adding CONFIG_NET_LOOPBACK=y removes this error. After this
the CONFIG_NET_IPV6_MLD=n needed to be added in order to avoid
crashes when IPv6 MLD is done which is not needed for this test.

Removed also the whitelisting as that is not really needed and
we want to run these in as many platforms as possible.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-10 18:55:37 +03:00
Jamie McCrae
3e734ddbce tests: net: lib: dns: dns_addremove
Adds test code for new net_mgmt events relating to adding and
removing DNS servers

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdtech.com>
2019-07-09 17:04:55 +03:00
Jukka Rissanen
0d8b0c6714 tests: net: dhcpv4: Make sure we get DNS add/del events
Verify that DNS server add/del event is received properly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-09 17:04:55 +03:00
Nicolas Pitre
d19a5f9119 net: socket: mgmt: use uintptr_t for the nm_pid field
This may contain a pointer so make sure it is sufficiently wide
on 64-bit targets.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-05 10:06:23 -04:00
Jukka Rissanen
ac56fd8d27 tests: net: Increase stack sizes for coverage testing
We need to increase the stack sizes if user enables CONFIG_COVERAGE
option. You can test this by this command

    sanitycheck --coverage -p qemu_x86 -T tests/net/udp \
                -T tests/net/mgmt  -T tests/net/mld

This is partial fix for issues described in #17323

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-04 09:42:44 -07:00
Jukka Rissanen
06136e5670 tests: net: socket: register: Do not close invalid fd
If the socket descriptor is invalid (fd < 0), there is no
need to try to close it.

Coverity-CID: 198949
Fixes #16785

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-04 07:23:50 -04:00
Marc Herbert
5acb622171 tests/net/ptp/clock: add 'userspace' tag
... because this test does use userspace, as seen in the source or
demonstrated by the failure of this command:

  sanitycheck --extra-args=CONFIG_TEST_USERSPACE=n

See commit message of 4afcc0f8af for the long story.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-07-04 11:44:11 +03:00
Jukka Rissanen
4bb57c481e tests: net: tx_timestmp: Fix the tests
Fix tests because of changes in TX timestamping options.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-03 09:42:45 +03:00
Jukka Rissanen
efd99e6634 tests: net: ip-addr: Avoid possible null pointer dereference
Check return value of net_if_ipv6_get_ll() before accessing it.

Coverity-CID: 199437
Fixes #17201

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-02 11:37:05 +03:00
Jukka Rissanen
3b3844a921 tests: net: socket: mgmt: Add tests for get|setsockopt()
Test AF_NET_MGMT API getsockopt() and setsockopt() functions that
they work properly when called from kernel or from userspace.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-01 13:50:08 -07:00
Jukka Rissanen
40ec4bc15c tests: net: socket: mgmt: Add unit tests for net_mgmt sockets
Almost the same as the net_mgmt socket sample but can be run by
sanitychecker.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-01 13:50:08 -07:00
Jukka Rissanen
8cf4d59180 tests: net: utils: Add userspace tests for net_addr_ntop/pton()
Add unit tests to net_addr_ntop() and net_addr_pton() in order to
verify that the functions can be called from userspace.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-01 13:50:08 -07:00
Jukka Rissanen
eb018f8109 tests: net: mgmt: Verify that info_length is correct
If info is sent by net_mgmt, make sure it contains correct data.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-01 13:50:08 -07:00
Jukka Rissanen
02b3826fa0 net: mgmt: Add info length to event wait API
The info parameter is difficult to use if the caller does not
get information how long the info struct is. So add info_length
parameter to net_mgmt_event_wait_on_iface() and
net_mgmt_event_wait() APIs.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-01 13:50:08 -07:00
Jukka Rissanen
7063921e87 net: if: Add userspace support to IPv4 gateway set function
Allow application to call net_if_ipv4_set_gw_by_index()
and set the gateway if enabled by configuration.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-01 15:34:11 +03:00
Jukka Rissanen
813ae63f6b net: if: Add userspace support to IPv4 netmask set function
Allow application to call net_if_ipv4_set_netmask_by_index()
and set the netmask if enabled by configuration.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-01 15:34:11 +03:00
Jukka Rissanen
01fa8a6fe2 tests: net: if: Test userspace support in net_if
Add more tests to test userspace enabled APIs.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-01 15:34:11 +03:00
Jukka Rissanen
f3b0b441ed tests: net: dns: Add tests for dns_unpack_answer()
Make sure that dns_unpack_answer() works as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-01 09:44:29 +03:00
Anas Nashif
a2fd7d70ec cleanup: include/: move misc/util.h to sys/util.h
move misc/util.h to sys/util.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif
9ab2a56751 cleanup: include/: move misc/printk.h to sys/printk.h
move misc/printk.h to sys/printk.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif
0c9e280547 cleanup: include/: move misc/mutex.h to sys/mutex.h
move misc/mutex.h to sys/mutex.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Jukka Rissanen
c9aaab74db net: ptp: clock: Add usermode support to ptp_clock_get()
It is useful that the ptp_clock_get() function can be called from
the userspace. Create also unit test for calling that function
from userspace.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-06-25 15:22:51 +03:00
Jukka Rissanen
95e8498c27 net: ptp: Add usermode support to net_eth_get_ptp_clock_by_index()
Make net_eth_get_ptp_clock_by_index() clock API to work with user space.
Create also unit test for testing this user mode support.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-06-25 15:22:51 +03:00
Jukka Rissanen
2c4b2a16a5 tests: net: getaddrinfo: Make sure we receive two queries
If user supplies AF_UNSPEC, we need to do two queries, one for
IPv4 A record and one for IPv6 AAAA record.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-06-20 14:45:43 +03:00
Håkon Øye Amundsen
05cd3420ac net: mqtt: add mqtt_readall_publish_payload()
This function uses mqtt_read_publish_payload_blocking to perform a
blocking read of the specified number of bytes.

When reading out a payload, the normal use case is to read the
entire payload. This function facilitates that use case.

Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
2019-06-20 13:06:08 +03:00
Anas Nashif
f2cb20c772 docs: fix misspelling across the tree
Found a few annoying typos and figured I better run script and
fix anything it can find, here are the results...

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-19 15:34:13 -05:00
Andrew Boie
86586b2d8d tests: getaddrinfo: set newlib heap size
Some MPU systems require region power-of-two alignment
and can't automatically use remaining RAM for the newlib
heap. Set it for this case. Fixes this test on mps2_an385.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-06-19 10:57:33 +03:00
Jukka Rissanen
194893d52d tests: net: udp: Add tests for SO_PRIORITY and setsockopt
Verify that user is able to set SO_PRIORITY socket option.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-06-09 12:54:05 +03:00
Jukka Rissanen
1cbda7d4ac tests: net: socket: register: Close socket after test
The file descriptor was not closed after the test which caused
Coverity to complain about resource leak.

Coverity-CID: 198640
Fixes #16493

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-06-06 17:49:01 +08:00
Marc Herbert
4afcc0f8af sanitycheck: CONFIG_TEST_USERSPACE / userspace tag cleanup
- Delete CONFIG_TEST_USERSPACE=n no-ops because it's the default
since commit 7b1ee5cf13

- Some tests have a "userspace" tag pretending to TEST_USERSPACE but
don't and vice versa: fix missing or spurious "userspace" tags in
testcase.yaml files.

Tests have a _spurious_ "userspace" tag when they PASS this command
cause none should pass:

  ./scripts/sanitycheck --tag=userspace -p qemu_x86 \
      --extra-args=CONFIG_TEST_USERSPACE=n  \
      --extra-args=CONFIG_USERSPACE=n | tee userspace.log

All tests run by this command must either fail to build or fail to run
with some userspace related error. Shortcut to look at all test
failures:

 zephyr_failure_logs() {
     awk '/see.*log/ {print $2}' "$@"
 }

Tests _missing_ "userspace" tag FAIL to either build or to run with some
userspace related error when running this:

  ./scripts/sanitycheck --exclude=userspace -p qemu_x86 \
      --extra-args=CONFIG_TEST_USERSPACE=n  \
      --extra-args=CONFIG_USERSPACE=n | tee excludeuserspace.log

Note the detection methods above are not 100% perfect because some
flexible tests like tests/kernel/queue/src/main.c evade them with #ifdef
CONFIG_USERSPACE smarts. Considering they never break, it is purely the
test author's decision to include or not such flexible tests in the
"userspace" subset.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-05-30 08:45:39 -04:00
Tomasz Bursztyka
c3c6dfaaeb tests/net: Fix IPv6 and UDP test as UDP got stricter on checking header
Now length of the UDP header is checked, and obviously these test were
avoiding setting it properly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-05-30 13:01:30 +08:00
Nicolas Pitre
4d4cd7e3c8 test/net: fix PTP clock test code
The various ptp_clock_driver_api methods receive a struct ptp_context
not a struct eth_context, and the later must be obtained from a
reference stored in the former. Failing to do so by directly
interpreting driver_data as a struct eth_context instance does end up
corrupting memory past the actual struct ptp_context storage. The test
may still pass as ptp_clock_get() reads from the same out-of-bounds
memory as the previous ptp_clock_set() and therefore the content
matches, and with luck the corrupted memory is not essential to the
completion of the test. But that wasn't my case which allowed me to
find this issue.

Fix this by properly obtaining a reference to the struct eth_context
instance via the actual struct ptp_context, and adding a test like
the one found in eth_tx() to make sure we got the right memory.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-05-30 10:53:24 +08:00
Paul Sokolovsky
4d8941a91d tests: net: getaddrinfo: Add cases for numeric IPv4 addr
And also for AI_NUMERICHOST flag.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-05-29 17:46:56 +08:00
Jukka Rissanen
0c639a8a9a tests: net: socket: Add tests for socket family registration
Make sure that socket registration does something sane.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-05-10 22:43:27 +03:00
Robert Lubos
b8494d9a51 net: lib: mqtt: Enable blocking PUBLISH payload readout
It is convenient to have a blocking version of
`mqtt_read_publish_payload` function, for cases when it is called from
the event handler. Therefore, extend the 'mqtt_read_publish_payload'
argument list with information whether the call should block or not.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2019-05-07 22:08:30 -04:00
Tomasz Bursztyka
b2b21412ae net/connection: Removing cache feature
There were various flaws in it that motivated its removal:

- No hash collision handling mechanism. In case that would happen, the
behavior of the network connection would be unknown. This is the main
drawback
- The lookup is not that much more efficient than the default one. The
only difference of gain is in connection comparison (a u32t comparison
vs a full connection compare). But the list handling is the same. It's
made worse by the presence of a negatives match array which can be
easily filled in and becomes then fully usless, appart from consuming
CPU. As well as adding a new connection: it requires the whole cache
to be cleared which is unefficient.
- Not memory efficient, even compared to a proper hash table.
Two arrays instead of one etc...

All of this could be fixed by using a proper hash table, though it
remains to be seen if such object could fit in Zephyr core.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-05-07 15:40:53 +03:00
Maksim Masalski
f1f1a9f38a tests: fix unchecked return value in test_net_pkt_basics_of_rw
Inside function test_net_pkt_basics_of_rw result of function call
net_pkt_read_be16 is not checked which might result performance
of the program and cause errors.

Coverity-CID 198003
Fixes #15776

Signed-off-by: Maksim Masalski <maxxliferobot@gmail.com>
2019-05-07 15:27:31 +03:00
Paul Sokolovsky
b2bfcc27b9 tests: socket: misc: Add tests for inet_pton()
Basic testcases for accepting correct input and rejecting invalid.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-05-07 08:30:32 +03:00
Jukka Rissanen
758a2468fd tests: net: mqtt_publisher: Allow compilation in every platform
Fixes the compile errors in various platforms like:
* sam_e70_xplained (too few network buffers)
* galileo, cc3220sf_launchxl and mps2_an385 (missing random number
  generator configuration options)

Fixes #15878

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-05-04 18:28:37 -04:00
Andrew Boie
e9b5fe333e tests: ieee802154: set min_ram
Fix a sanitycheck failure on usb_kw24d512 with the
whitelist removed.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-05-03 14:21:45 -04:00
Andrew Boie
643d689107 tests: mqtt_publisher: enable random numbers
tls_entropy_func() requires an entropy source.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-05-03 14:21:45 -04:00
Andrew Boie
dc27ec3e05 tests: ethernet_mgmt: enable random generator
net_if_ipv6_calc_reachable_time() requires sys_rand32_get().
Enable the test random number generator so the build doesn't
fail.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-05-03 14:21:45 -04:00
Andrew Boie
543c5c1b7f tests: getaddrinfo: fix stack overflow
This thread was blowing its stack if code coverage was
enabled.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-05-02 11:13:31 +03:00
Jukka Rissanen
960e6d9504 tests: net: getaddrinfo: Fix test to check the query is sent
As the getaddrinfo() test is suppose to be self contained, then
we will need to install handler for the sent DNS query. After we
receive the query in process_dns() thread, we verify that the
query was sent properly. We do not return DNS reply back to
the caller in this case as we do not want to create DNS server
just for this simple test application. This can be changed later
if we get DNS server functionality in Zephyr network stack.

Fixes #15193

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-04-30 09:56:01 -07:00
Ravi kumar Veeramally
7fbe087d8d net: tests: ipv6_fragment: Use NET_DBG instead of DBG
ipv6_fragment tests registered log module but still use DBG
macro of printk. Replaced them with NET_DBG.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-04-26 10:45:45 +03:00
Ravi kumar Veeramally
d19097f8c5 tests: net: Add more tests to ipv6 fragmentation
IPv6 fragmentation test case for reassembly.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-04-26 10:45:45 +03:00
Jukka Rissanen
fcf392c6c8 tests: net: all: Add more options to catch-all test
Add more Kconfig options to prj.conf file. In the future we need
to compile also in other hw than qemu_x86 in which case we need to
create separate test cases for those configurations.

Fixes #15282

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-04-23 10:29:38 +03:00
Jukka Rissanen
6bf369f306 tests: net: pkt: Verify that net_pkt_write() writes correct data
Write the net_pkt using net_pkt_write() and then verify that the
data is actually written into net_buf.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-04-17 10:50:09 -04:00
Anas Nashif
3ae52624ff license: cleanup: add SPDX Apache-2.0 license identifier
Update the files which contain no license information with the
'Apache-2.0' SPDX license identifier.  Many source files in the tree are
missing licensing information, which makes it harder for compliance
tools to determine the correct license.

By default all files without license information are under the default
license of Zephyr, which is Apache version 2.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-04-07 08:45:22 -04:00
Andrew Boie
7b1ee5cf13 tests: CONFIG_TEST_USERSPACE now off by default
Unlike CONFIG_HW_STACK_PROTECTION, which greatly helps
expose stack overflows in test code, activating
userspace without putting threads in user mode is of
very limited value.

Now CONFIG_TEST_USERSPACE is off by default. Any test
which puts threads in user mode will need to set
CONFIG_TEST_USERSPACE.

This should greatly increase sanitycheck build times
as there is non-trivial build time overhead to
enabling this feature. This also allows some tests
which failed the build on RAM-constrained platforms
to compile properly.

tests/drivers/build_all is a special case; it doesn't
put threads in user mode, but we want to ensure all
the syscall handlers compile properly.

Fixes: #15103 (and probably others)

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-04-06 14:30:42 -04:00
Andrew Boie
027b6aaf89 tests: set userspace tag for all tests that use it
This lets us quickly filter tests that exercise userspace
when developing it.

Some tests had a whitelist with qemu_cortex_m3; change
this to mps2_an385, which is the QEMU target with an
MPU enabled.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-04-06 14:30:42 -04:00
Andrew Boie
ce6b80470d net: add missing syscall for gethostname()
We need all the socket APIs to work from user mode.
tests/net/socket/misc now runs in userspace.

Fixes: #15227

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-04-06 14:30:42 -04:00
Andrew Boie
1d0369f606 tests: net: getnameinfo: run in user mode
The test is designed to run in user mode, but was disabled
for some reason.

Re-enable, and add mps2_an385 to the whitelist as this is
the QEMU target that emulates an MPU.

Fixes: #15228

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-04-06 14:30:42 -04:00
Andrew Boie
0ccaa5d908 tests: mqtt_packet: run in user mode
Various globals for the test cases have been moved to
the ztest memory domain data section via ZTEST_DMEM tags
so that user mode can access them.

Some anonymous arrays whose address was being placed in
the msg_subackX structs have been split out so they
are in ztest memory domain.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-04-03 13:47:45 -04:00
Patrik Flykt
21358baa72 all: Update unsigend 'U' suffix due to multiplication
As the multiplication rule is updated, new unsigned suffixes
are added in the code.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-28 17:15:58 -05:00
Patrik Flykt
24d71431e9 all: Add 'U' suffix when using unsigned variables
Add a 'U' suffix to values when computing and comparing against
unsigned variables.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-28 17:15:58 -05:00
Ravi kumar Veeramally
65d100e7f0 tests: net: Add more tests to ipv6 fragmentation
IPv6 fragmentation test case without any extra header (HBHO)
added.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-03-26 15:55:15 -04:00
Jukka Rissanen
079a2919cb tests: socket: tcp: Increase the buf count
With default buf count, we ran out of bufs in connect() in
test_v6_sendto_recvfrom().

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-26 07:29:26 -05:00
Ravi kumar Veeramally
2f941d2630 tests: net: ipv6: Add one more test case
Test case added for IPv6 neighbors. This will add more than
CONFIG_NET_IPV6_MAX_NEIGHBORS neighbors. Network stack should
remove oldest neighbor which is in STALE state and it should
add new neighbor. So call to net_ipv6_nbr_add() should succeed.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-03-25 22:49:52 -04:00
Tedd Ho-Jeong An
2d8ac0cf5e tests: net: mld: Check return after updating packet
This patch checks the return value after updating the packet.

Fix Bugs: #14821
Coverity CID: 196635

Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
2019-03-25 15:53:13 -04:00
Tomasz Bursztyka
cf322c44db net: Switch usage of net_pkt_get_reserve to net_pkt_alloc
Some places were still using the old allocator. Using the new one does
not change any behavior. This will help to remove the useless data_len
attribute in net_pkt which legacy allocator was still setting.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka
03bfc5dd0f net/context: Remove token parameter from net_context_send/sendto
And also to the relevant callbacks.

That parameter is not used anywhere so it is useless.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka
d6d52ce9e5 net/pkt: Remove _new suffix to net_pkt_write functions
Suffix is now useless, as these functions are now the only ones.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka
a25f054cbd net/pkt: Remove _new suffix to net_pkt_read functions
Suffix is now useless, as these functions are now the only ones.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka
f8a091104e net/pkt: Remove _new suffix to net_pkt_get_data_new function
Now that legacy - and unrelated - function named net_pkt_get_data has
been removed, we can rename net_pkt_get_data_new relevantly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka
820f3ad006 net/ipv6: Replace legacy net_ipv6_create by the new one
Thus removing the legacy one, and renaming the new one to legacy name.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka
ca58b4c761 net/ipv4: Replace legacy net_ipv4_create by the new one
Thus removing the legacy one, and renaming the new one to legacy name.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka
172fe5a87b net/context: Remove _new suffix on net_context_send/sendto functions
Now that legacy functions are removew, let's rename the new functions by
removing the _new suffix.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Andrei Emeltchenko
99403c5b13 net: ethernet: Define and use Ethernet frame and datagram size
Remove magic numbers from Ethernet drivers and tests by defining
NET_ETH_MAX_DATAGRAM_SIZE and NET_ETH_MAX_FRAME_SIZE.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-03-15 06:44:13 -05:00
Paul Sokolovsky
f38c4c97ce tests: socket_helpers: Use zsock_ prefixed socket functions
Don't depend on CONFIG_NET_SOCKETS_POSIX_NAMES being defined (e.g.,
it's going to conflict with POSIX API).

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-03-15 06:00:21 +01:00
Jukka Rissanen
dc41aad2a5 tests: net: mld: Check null ptr dereference
If pkt allocation fails, then prepare to handle NULL pointer.

Coverity-CID: 195844
Fixes #14405

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-14 13:01:01 +01:00
Tedd Ho-Jeong An
401a598503 tests: net: iface: Handle pkt allocation failure
This patch handles null pointer when packet allocation fails.

Fixes: #14390
Coverity-CID: 195903

Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
2019-03-14 12:06:21 +01:00
Jukka Rissanen
6301ae74d9 tests: net: tcp: Check null ptr dereference
If pkt allocation fails, then prepare to handle NULL pointer.

Coverity-CID: 195819
Coverity-CID: 195860
Coverity-CID: 195921

Fixes #14412
Fixes #14399
Fixes #14388

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-13 05:39:41 -05:00
Jukka Rissanen
55cd97bc43 tests: net: dhcpv4: Check null ptr dereference
If pkt allocation fails, then prepare to handle NULL pointer.

Coverity-CID: 195880
Coverity-CID: 195816

Fixes #14413
Fixes #14395

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-13 05:38:26 -05:00
Jukka Rissanen
bafdf5b329 tests: net: ipv6: Check null ptr dereference
If pkt allocation fails, then prepare to handle NULL pointer.

Coverity-CID: 195835
Fixes #14409

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-13 05:34:46 -05:00
Thomas Stenersen
7516476386 kconfig: Use depend on instead of select to avoid kconfig loop
Remove use of select to "force" enabling other configs in subsys/fs
and subsys/net/l2. The forcing will cause infinite kconfig recursion.

Signed-off-by: Thomas Stenersen <thomas.stenersen@nordicsemi.no>
2019-03-12 19:42:40 +01:00
Tedd Ho-Jeong An
922f53864f tests: net: mqtt: Fix the error handling aftre read
If the rc = -EAGAIN from mqtt_read_publich_payload(), it shouldn't be
used in memcpy() since it is a negative value, and instead, it should
try to read again.

Fix: #13825
Coverity-CID: 191002

Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
2019-03-09 10:50:25 -05:00
Tomasz Bursztyka
462fc32f7c tests/unit: Switch vlan test to new net_pkt/net_context API
Use the new net_pkt allocator. Fix a small leak in the test as well.

No need to build the net_pkt, just send the data directly through
net_context_sendto_new()

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka
a03efe1928 tests/net: Fix vlan test timeout values
s/0/K_NO_WAIT for all timeouts

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka
ab1d38c3c3 tests/net: Reducing utils test by removing redundant ones
The very first test was basically testing the checksum calculation. And
that's already tested in more relevant tests. It was also trying in a
cumbersome way to generate packets scattered over many net_buf. But
that's also already tested in various other tests, and it's not at all
part of core utils anyway.

In any case, that all redundant, so let's remove it.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka
6a1387d1cf tests/net: Switch tx timestamp test to new net_context API
No need to build the net_pkt, just send the data directly through
net_context_sendto_new()

Use the new net_context option to enable timestamping of outgoing
packet (NET_CONTEXT_TIMESTAMP).

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka
3e6e0922fe tests/net: Fix tx timestamp test timeout values
s/0/K_NO_WAIT for timeouts

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka
3fb49d89d6 tests/net: Switch traffic class test to new net_context API
No need to build the packet by ourselves.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka
5cff958a4f tests/net: Fix traffic class test timeout values
s/0/K_NO_WAIT for all timeouts

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka
eca8f1072a tests/net: Switch tcp test to new net_pkt API
Switch to new allocators and r/w functions.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka
344962270e tests/net: Switch promiscuous test to new net_pkt API
Switch to new allocator and write function.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka
2a18ec99bf tests/net: Switch MLD to new net_pkt API
Switch to new allocators and r/w functions.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka
07d34b0f3e tests/net: Replace the legacy net_pkt API test by the new one.
Just a quick rm/mv. The new API is going to be the only one, so legacy
test can disappear.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka
da37c67aba tests/net: Switch ipv6 fragmentation test to new net_pkt API
Switch to new allocators and r/w functions.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka
07f9040ebb tests/net: Switch ipv6 test to new net_pkt API
Switch to new allocators and r/w functions.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka
32dfb13b03 tests/net: Switch iface test to new net_pkt API
No need to play with net_buf by ourselves.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka
8e8bd65783 tests/net: Switch icmpv6 test to new net_pkt API
No need to play with net_buf by ourselves.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka
ae94e2ec1d tests/net: Switch context test to new net_context API
No need to build the net_pkt, just send the data directly through
net_context_sendto_new()

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka
a05c29f0db tests/net: Fix context test timeout values and function calls
s/0/K_NO_WAIT for all timeouts
And fix tcp context connect call (it's not net_context_listen obviously,
and one parameter was missing).

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka
8b857dadc5 tests/net: Switch checksum test to new net_context API
No need to build the net_pkt, just send the data directly through
net_context_sendto_new()

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Ravi kumar Veeramally
a391daa95a net: tests: Migrate ARP tests
Migrate ARP tests to new net_pkt API.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-03-08 07:18:19 -05:00
Ravi kumar Veeramally
746618460b net: tests: Migrate UDP tests
Migrate UDP tests to new net_pkt API.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-03-07 07:17:36 -05:00
Paul Sokolovsky
1b837d64de tests: socket: tcp: Test handling of EOF condition on socket
If peer socket closed, the other side should get 0 from recv(), and
should get in stable manner (no matter how much time went from the
closure and/or how many times recv() is called).

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-03-06 15:57:40 -05:00
Ravi kumar Veeramally
0aa61651ce net: tests: Fix DHCPv4 tests
net_pkt_alloc_with_buffer() takes IP header and protocol header
length while calculating total length internally. Need not
specify explicitly. Also mutex was not properly initialized.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-03-05 08:29:02 -05:00
Maksim Masalski
b324f35e61 macros: deleted macros SECONDS(), MSEC(), USEC()
Changed everywhere these macros to the K_MSEC(), K_SECONDS()

Signed-off-by: Maksim Masalski <maxxliferobot@gmail.com>
2019-03-04 19:04:21 -05:00
Sebastian Bøe
4e5300ba7f cmake: Drop all in-tree usage 'set_conf_file'
Port all users of 'set_conf_file' to use the built-in rules
instead. This follows the convention-over-configuration principle to
make the system as a whole simpler and more consistent.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-03-01 09:44:09 +01:00
Ravi kumar Veeramally
c4f2ab143d net: tests: Migrate DHCPv4 tests
Migrate DHCPv4 tests to new net_pkt API.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-02-26 02:25:14 +01:00
Tomasz Bursztyka
ca7b3b3703 net/ieee802154: Switch fragmentation support to new net_pkt API
- differentiating actual "fragment" to buffer element from a net_pkt
- instead of copying data (and thus allocating buffer) let's just take
the fragment buffer and put it into result packet.
- fixing compilation issue in relevant test

It's more efficient that way, as we use already allocated fragment
buffer instead of reallocating/deallocating after each fragment
reception.

A possible optimization would be to calculate the actual size + header
difference if only the actual size is close to the target size.
It would avoid to get a dry run of the header decompression for each
fragment received. The difficulty being in finding the sweet spot when
it is relevant to calculate the header difference.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-23 07:44:59 -05:00
Paul Sokolovsky
49341e0065 tests: socket: Add test for getnameinfo()
Basic test for IPv4/IPv6 addresses conversion.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-02-19 17:34:57 -05:00
Jukka Rissanen
d4d61895b8 tests: net: ipv6_fragment: Fix interface index values
The test needs to use interface index starting from 1.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-18 15:10:54 -05:00
Jukka Rissanen
299832738e tests: net: ip-addr: Fix interface index values
The test needs to use interface index starting from 1.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-18 15:10:54 -05:00
Jukka Rissanen
3043b50403 tests: net: dns: Fix test as the interface index starts from 1
The test was using index 0 which is no longer correct.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-18 15:10:54 -05:00
Carlos Stuart
75f77db432 include: misc: util.h: Rename min/max to MIN/MAX
There are issues using lowercase min and max macros when compiling a C++
application with a third-party toolchain such as GNU ARM Embedded when
using some STL headers i.e. <chrono>.

This is because there are actual C++ functions called min and max
defined in some of the STL headers and these macros interfere with them.
By changing the macros to UPPERCASE, which is consistent with almost all
other pre-processor macros this naming conflict is avoided.

All files that use these macros have been updated.

Signed-off-by: Carlos Stuart <carlosstuart1970@gmail.com>
2019-02-14 22:16:03 -05:00
Tomasz Bursztyka
2b22b71e42 net/pkt: Remove useless legacy net_frag_linearize function
Now that the stack does not use this function, it can be removed
safely.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka
bc5411816a net/pkt: Remove useless legacy net_pkt_append_memset function
Now that the stack does not use this function, it can be removed
safely.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka
1fab039102 net/pkt: Remove useless legacy net_pkt_split function
Now that the stack does not use this function, it can be removed
safely.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00