Commit graph

880 commits

Author SHA1 Message Date
Oleg Zhurakivskyy 8aed3aa669 tests: net: tcp2: Update test_sem_take()
Fail solely on semaphore timeout.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-07-20 13:55:22 +03:00
Oleg Zhurakivskyy 31aff65165 tests: net: tcp2: Check for failed connect on SYN resend
Since the peer isn't replying on SYN resend, update the
test to check for failed connect.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-07-20 13:55:22 +03:00
Oleg Zhurakivskyy f5a94e5877 tests: net: tcp2: Update timeout values
Since the connect is now blocking, update the timeout values
for the tests to pass.

In case of resend test, set the timeout to 1000ms to account
for the retransmission.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-07-20 13:55:22 +03:00
Flavio Ceolin c4f7faea10 random: Include header where it is used
Unit tests were failing to build because random header was included by
kernel_includes.h. The problem is that rand32.h includes a generated
file that is either not generated or not included when building unit
tests. Also, it is better to limit the scope of this file to where it is
used.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-07-08 21:05:36 -04:00
Stephanos Ioannidis 4b66aae3d3 tests: net: vlan: Fix typos
Fix typos in the test assert messages ("numer" to "number").

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-07-02 08:37:17 -04:00
Paul Sokolovsky 1ca1193a9d tests: socket: getaddrinfo: Explicitly ignore return of sys_mutex_lock
This is a test, and the function is called with K_FOREVER, so it's not
supposed to fail.

Fixes: #25735
CID: 210582

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2020-06-30 10:02:46 -04:00
Anas Nashif 98c75038c8 tests: net: remove duplicate test
remove duplicate, no need to specify test twice (one for userspace,
another for default).

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-06-25 22:36:17 -05:00
Jukka Rissanen 6ecea4b3dd net: conn: Handle multi interface AF_PACKET recv() properly
If we have multiple network interfaces and we are waiting incoming
network packets, make sure to honor the bind of the socket so that
correct socket will receive data in certain network interface.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-06-24 23:34:27 +03:00
Lukasz Maciejonczyk 8acebb5cd0 tests: net: Add tests for IPv6 mesh addresses
This tests make sure that the right source address is chosen during
the mesh multicasting.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2020-06-16 19:14:52 +02:00
Marcin Niestroj f74bea04aa tests: net: poll: disable NET_IPV4
Unit test code uses IPv6 only, so disable IPv4.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-06-15 10:31:37 +03:00
Marcin Niestroj 0995246edb tests: net: poll: select NET_CONFIG_NEED_IPV6
Unit test code requires IPv6 to be ready. Select
CONFIG_NET_CONFIG_NEED_IPV6=y to ensure that.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-06-15 10:31:37 +03:00
Marcin Niestroj acd8b8d93e tests: net: select: disable NET_IPV4
Unit test code uses IPv6 only, so disable IPv4.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-06-15 10:31:37 +03:00
Marcin Niestroj ec57ebff66 tests: net: select: select NET_CONFIG_NEED_IPV6
Unit test code requires IPv6 to be ready. Select
CONFIG_NET_CONFIG_NEED_IPV6=y to ensure that.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-06-15 10:31:37 +03:00
Reto Schneider 0b4b3ae4dd cmake, samples, tests: Use semi-accurate project names
When using an IDE (e.g. Eclipse, Qt Creator), the project name gets
displayed. This greatly simplifies the navigation between projects when
having many of them open at the same time. Naming multiple projects
"NONE" defeats this functionality.

This patch tries to use sensible project names while not duplicating
too much of what is already represented in the path. This is done by
using the name of the directory the relevant CMakeLists.txt file is
stored in. To ensure unique project names, small, manual adjustments
have been done.

See also 7eabab2f5d ("samples, tests: Use semi-accurate project names")

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2020-06-09 08:18:29 -04:00
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Andrew Boie 4482f83cdb tests: net: tcp: test zsock_get_context_object
Add test case to prove that this new API works.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-03 22:33:32 +02:00
Andrew Boie 9a27ba57bb tests: net_mgmt: grant socket access
This socket is shared by all the test cases which run in
different threads. Just make it a global object here.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-03 22:33:32 +02:00
Jukka Rissanen a2f0a9effe net: sockets: Fix sendmsg() user mode param checks for aux data
If we are calling sendmsg() without any aux data, then msg_controllen
is 0 and msg_control is NULL. Check these allowed values properly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-06-03 18:33:59 +02:00
Jukka Rissanen d3dde1ad1c net: sockets: Fix sendmsg() user mode param checks for dst address
If we are calling sendmsg() for a connected socket, then msg_namelen
is 0 and msg_name is NULL. Check these allowed values properly.

Also modify unit tests so that we test this scenario.

Fixes #25925

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-06-03 18:33:59 +02:00
Christopher Friedt 79728a63ab tests: socket: socketpair: init param before passing by ref
Fixes #25797
Coverity-CID: 210607

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-06-03 18:33:19 +02:00
Christopher Friedt 3f30ce21cb tests: socket: socketpair: init param before passing by ref
Fixes #25796
Coverity-CID: 210579

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-06-03 18:33:19 +02:00
Christopher Friedt 15a2a6ddb7 tests: socket: socketpair: assert recvfrom returns >= 0
Fixes #25731
Coverity-CID: 210568

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-06-03 18:33:19 +02:00
Jukka Rissanen 1bb41c49ce tests: net: udp: Enable more usermode tests for sendmsg()
Some of the sendmsg() tests were not run when in usermode.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-06-02 15:22:47 +02:00
Marc Herbert debade9121 tests: make find_package(Zephyr...) REQUIRED
... because it is (required).

This makes a difference when building with CMake and forgetting
ZEPHYR_BASE or not registering Zephyr in the CMake package registry.

In this particular case, REQUIRED turns this harmless looking log
statement:

-- Could NOT find Zephyr (missing: Zephyr_DIR)
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- ...
-- ...
-- ...
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:8 (target_sources):
  Cannot specify sources for target "app" which is not built by
  this project.

... into this louder, clearer, faster and (last but not least) final
error:

CMake Error at CMakeLists.txt:5 (find_package):
  Could not find a package configuration file provided by "Zephyr" with
  any of the following names:

    ZephyrConfig.cmake
    zephyr-config.cmake

  Add the installation prefix of "Zephyr" to CMAKE_PREFIX_PATH or set
  "Zephyr_DIR" to a directory containing one of the above files.  If
  "Zephyr" provides a separate development package or SDK, be sure it
  has been installed.

-- Configuring incomplete, errors occurred!

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-05-29 10:47:25 +02:00
Tomasz Bursztyka 9dd822dc93 tests/net: Test network power management awareness
A quick test on a dummy device that:
- opens a socket (success)
- sends data (success)
- suspends (success)
- suspends (failure)
- sends data (failure)
- resumes (success)
- resumes (failure)
- sends data (success)

This permits to show that PM states are properly handled in network
stack.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-26 21:41:00 +02:00
Oleg Zhurakivskyy 593f7c4556 tests: net: tcp2: Avoid trying to free net_pkt twice
For success cases, the net_pkt is handled by the IP stack
so no need to free the net_pkt. The double free is not causing
any issues as the net_pkt code will just ignore the request but
we should avoid doing it because of error prints that are printed.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-05-25 12:42:22 +02:00
Christopher Friedt ecf32b6eca tests: socket: socketpair: fix userspace thread permissions
Kernel objects were being directly accessed without previously
calling k_thread_access_grant().

This change allows each test that requires an asynchronous
event to send it to a common work queue with correct
permissions.

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-05-20 10:34:07 +02:00
Wentong Wu 72227574d8 timer: remove QEMU_TICKLESS_WORKAROUND
Qemu icount mode enabled, remove QEMU_TICKLESS_WORKAROUND.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2020-05-14 13:52:07 +02:00
Anas Nashif ad82b38b8f tests: ztest: prefix tests with test_
Tests should always start with test_, otherwise detection of subtests
will not work through sanitycheck.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-13 18:16:07 +02:00
Christopher Friedt 3bfc765aad tests: socket: socketpair: tests for socketpair(2) syscall
Tests for issue #24366

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-05-10 17:46:43 +02:00
Kumar Gala db725c0ec9 drivers: Replace GPIO_CS Kconfig with devicetree detection
Use DT_INST_SPI_DEV_HAS_CS_GPIOS() in drivers to determine if we should
utilize CS_GPIO base SPI chipselect handling.  This allows us to remove
Kconfig option for this feature.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-09 13:07:05 +02:00
Stephanos Ioannidis ff2cba56a9 tests: net: websocket: Remove redundant logging configurations
This commit removes the redundant `LOG` and `LOG_IMMEDIATE` selections
in `prj.conf`, since the `TEST_LOGGING_DEFAULTS`, which is enabled by
default for all tests, selects `LOG` and `LOG_MINIMAL`.

This effectively allows the test to run with the default test logging
policy, set by the testing subsystem.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-05-07 14:47:35 +02:00
Jukka Rissanen f95c349c36 tests: net: dns: Increase stack size for coverage support
Increase stack size so that coverage information can be generated.

Fixes #17323

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-06 13:43:17 +03:00
Jukka Rissanen 65a1bebe85 net: Replace NET_WAIT_FOREVER by SYS_FOREVER_MS
As we now have SYS_FOREVER_MS, use that instead of network
specific NET_WAIT_FOREVER.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-05 16:29:23 +03:00
Jukka Rissanen 8160385b57 net: pkt: Fix removal of empty buffers in net_pkt_pull()
If we have removed first net_buf, then we must not restore the
original cursor as that will point to wrong head net_buf.
Add also unit test to check that the packets are removed
properly.
Clarify the documentation that we are removing data from
beginning of the function, also document that the cursor
is reset after this call.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-05 13:39:45 +03:00
Ravi kumar Veeramally d9c505c745 tests: net: tcp2: Add flags checks
Verify TCP header flags.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2020-04-30 12:52:11 +03:00
Jukka Rissanen 3d3801ab27 tests: net: pkt: Add more tests for net_pkt_pull()
Add test that pulls more than one net_buf amount of data.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-30 09:27:16 +03:00
Stephanos Ioannidis 773de88db0 tests: net: Rename local PORT definition
This commit renames all local definitions with the name `PORT` in the
net tests, in order to prevent name conflict with certain HALs
(notably, Atmel SAM E5x HAL).

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-04-28 09:57:04 +03:00
Jukka Rissanen ba9f20a6eb tests: net: mgmt: Change timeout back to u32_t
No point to change the throw_sleep to k_timeout_t because we
are calculating the timeout beforehand which can lead to
unexpected results if using k_timeout_t.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-27 10:35:17 +03:00
Ravi kumar Veeramally 4c8ad3b0c6 test: net: tcp2: Tests for connection close
Added tests for FIN_WAIT_1, FIN_WAIT_2 and CLOSING
states.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2020-04-22 12:41:39 +03:00
Jukka Rissanen cb4c09d702 tests: net: tcp2: Add more debugging info
It is useful to know which test fails to semaphore timeout so
add line number of the failing test to assert print.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-19 11:10:37 +03:00
Ravi kumar Veeramally 3b3c7e71a0 tests: net: tcp2: Add minimal unit tests
Minimal tests for TCP2 functionality added.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2020-04-17 14:49:18 +03:00
Robert Lubos 073ec8d4aa net: mqtt: Refactor because of timeout overhaul
Align MQTT with timeout API changes.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-04-09 21:58:42 +03:00
Jukka Rissanen 7e56d90ccd tests: net: route: Fix timeout data type
Convert to use k_timeout_t

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-09 16:07:03 +03:00
Jukka Rissanen 19d7031d15 tests: net: udp: Fix timeout value type
Convert to use k_timeout_t

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-09 16:07:03 +03:00
Jukka Rissanen 66d394d97a net: getaddrinfo: Fix timeout data type
Convert to use k_timeout_t

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-09 16:07:03 +03:00
Jukka Rissanen 38dd9bc299 net: mgmt: Refactor because of timeout overhaul
Convert to use k_timeout_t

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-09 16:07:03 +03:00
Jukka Rissanen 005ee2f768 net: ipv6: nbr: Refactor because of timeout overhaul
Convert minimal parts to support k_timeout_t values.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-09 16:07:03 +03:00
Jukka Rissanen 63a7b92fd8 net: if: Refactor because of timeout overhaul
Convert to use k_timeout_t

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-09 16:07:03 +03:00
Jukka Rissanen e56fa75ade net: context: Refactor because of timeout overhaul
The net_context API will change, the s32_t timeout parameter
will be changed to k_timeout_t. All the Zephyr users of this API will
be changed in subsequent commits. This is internal Zephyr API only,
so the API is not deprecated etc.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-09 16:07:03 +03:00