Commit Graph

1801 Commits

Author SHA1 Message Date
Jukka Rissanen 12dadf7a24 tests: net: pkt: Add build test for allocation statistics
Make sure we build test the allocation statistics.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-10-22 20:38:57 +02:00
Maximilian Deubel a441492c7d tests: net: lib: wifi_credentials: add tests
This patch adds tests for the wifi_credentials library.

Both the main functions and the backend implementations are tested.

Signed-off-by: Maximilian Deubel <maximilian.deubel@nordicsemi.no>
2024-10-22 08:21:04 -04:00
Ibe Van de Veire bb76d22540 test: net: igmp: Cleanup asserts
Cleanup of existing asserts in the IGMP test.

Signed-off-by: Ibe Van de Veire <ibe.vandeveire@basalte.be>
2024-10-21 18:41:47 -05:00
Ibe Van de Veire fa07b9fcf1 test: net: igmp: Add IGMP query test
Add functionality to test the IGMP query handling. This test should
prevent the IGMP logic from sending IGMPv3 messages to IGMPv2 queriers.
The test does now also check backwards compatability when IGMPv3 queries
are received but only IGMPv2 is enabled.

Signed-off-by: Ibe Van de Veire <ibe.vandeveire@basalte.be>
2024-10-21 18:41:47 -05:00
Mustafa Abdullah Kus abea54e574 test: net: lib: add prometheus library tests
Tests for prometheus library support.
It contains integration and unit test
each metric types.

Signed-off-by: Mustafa Abdullah Kus <mustafa.kus@sparsetechnology.com>
2024-10-18 14:17:11 +02:00
Andrej Butok e53eec0851 yaml: use EXTRA_CONF_FILE in .yaml files
Use EXTRA_CONF_FILE in sample yaml files,
that replaced deprecated OVERLAY_CONFIG
since the Zephyr v3.4 release.

Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
2024-10-17 09:45:25 +02:00
Ibe Van de Veire e6dd4cda89 test: net: igmp: Add extra IGMPv3 testcase
Added extra testcases for the IGMPv3 protocol. The IGMP driver is
supposed to send an IGMPv3 report when joining a group.

Signed-off-by: Ibe Van de Veire <ibe.vandeveire@basalte.be>
2024-10-17 09:44:33 +02:00
Robert Lubos 45a79d3208 tests: net: conn_mgr_monitor: Improve test reliability under heavy load
conn_mgr_tests were occasionally failing when executed under heavy load.
The reason for this are short timeout values used when waiting for
events - if executed under heavy load, the even might not be delivered
on time.

An obvious solution would be to simply increase the timeout, however
when testing it turned out the actual timeout value would need to be
pretty high to ensure tests reliability. Therefore, to avoid
unnecessary increase of the overall test execution time to protect
against rare edge cases, rework the event waiting mechanism to use
semaphore instead. The test cases will now specify the events they're
waiting for, and the event handlers will feed the semaphore if all
expected events have been delivered. This allows the increase the
maximum timeout when waiting for events, w/o affecting too much the test
execution time under normal conditions.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-10-15 13:52:24 +02:00
Robert Lubos c4803752a8 net: Deprecate CONFIG_NET_SOCKETS_POLL_MAX
CONFIG_ZVFS_POLL_MAX is now used to control the maximum number of poll()
entires. Thereby, CONFIG_NET_SOCKETS_POLL_MAX is redundant and shall
be deprecated.

Modify the defaults for NET_SOCKETS_POLL_MAX and ZVS_POLL_MAX so that
the deprecation actually makes sense instead of symbol removal. In case
the application still sets the old config, it will modify the
ZVS_POLL_MAX default.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2024-10-14 13:01:51 +02:00
Chris Friedt 881dc1fa7a net: sockets: move poll implementation to zvfs
Move the implementation of zsock_poll to zvfs_poll. This allows
other types of file descriptors to also make use of poll()
functionality even when the network subsystem is not enabled.

Additionally, it partially removes a dependency cycle between
posix and networking by moving functionality into a mutual
dependency.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2024-10-14 13:01:51 +02:00
Declan Snyder 42c43b9f9c boards: frdm_rw612: Add ethernet to twister yaml
Add netif:eth to twister yaml for frdm_rw612

Exclude from wifi test because of binary blob requirement

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-10-09 18:23:57 +01:00
Jordan Yates 4953389b1e net: socket_service: remove `work_q` parameter
Remove the `work_q` parameter from `NET_SOCKET_SERVICE_SYNC_DEFINE` and
`NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC` as this feature was dropped
during review but the removal was not 100% complete.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-10-09 13:48:54 +02:00
Robert Lubos c6498bb68d net: ipv6: Make Multicast Listener Discovery API public
IPv6 MLD API was so far defined in an internal header. This does not
seem correct though, as application code should be able to join/leave
multicast groups, hence the API should be exposed in a public header,
just as it is done for its IPv4 countepart - IGMP.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-10-08 17:00:06 +02:00
Adrian Friedli 98289e594d net: lib: coap: make ACK random factor runtime configurable
Extend the `coap_transmission_parameters` struct with the field
`ack_random_percent`. This was the last remaining CoAP transmission
parameter that was not configurable at runtime.

Signed-off-by: Adrian Friedli <adrian.friedli@husqvarnagroup.com>
2024-10-08 06:00:56 -04:00
Francois Gervais 736344b310 tests: coap_client: optimize/reduce sleep time
The goal of this commit is to reduce the overall test time by optimizing
the time spent sleeping.

However while doing so, a few glitches became apparent and those have
been fixed as well.

1. The way the ZSOCK_POLLIN event is managed has been modified

In most tests, the event would stick for the whole test and this would
sometimes results in the client receiving more data than intended which
in turn would results in various unexpected warnings and errors.

The management of the ZSOCK_POLLIN event has now been mostly moved to
the send/receive overrides which better represent how things would
happen outside of the test scenario.

For example, when sending data, if this send would normally result in
receiving some response, the send function sets the ZSOCK_POLLIN event.
Then when receiving, we clear the event as the data has been received.

There are a few exceptions to this for cases where we need to simulate
some specific abnormal behavior.

2. The `messages_needing_response` queue now includes a valid bit

The test manages a queue of messages id to be able to respond to the
correct id in the receive hooks.

It was built in a way that the id 0 would be treated as invalid
although it is a valid id.
In practice, it would not be an issue in most cases however, it would
result in an unexpected behavior if the `test_multiple_requests` test
would be run first.

To fix this issue in the simplest way, the queue has been changed to
uint32_t which gives us 16 extra bits for the management of the queue,
1 of which is used to tell if the entry is valid or not.

Signed-off-by: Francois Gervais <francoisgervais@gmail.com>
2024-10-07 17:13:47 +01:00
Jukka Rissanen 2e6c038363 tests: net: wifi: Run wifi tests together with net tests
Make sure wifi tests are run when verifying networking.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-10-05 14:06:15 -04:00
Robert Lubos 0376a417fd tests: net: ipv6: Enable mbed TLS heap
mbed TLS MD operations, used by IPv6 Privacy Extensions, require access
to heap. This may vary depending on platform/mbed TLS variant used,
hence enable CONFIG_MBEDTLS_ENABLE_HEAP in tests to ensure mbed TLS has
always access to some heap memory.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-10-04 10:50:06 +01:00
Seppo Takalo 73a3438b82 net: lwm2m: Remove hostname_verify flag from context
Use security mode (PSK or X509) to detect if we should
set the socket option to verify hostname.

PSK security mode cannot verify hostnames as this information
is coming in the certificate, so don't set the options.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-10-03 17:09:32 +01:00
Seppo Takalo 77e09916f7 tests: lwm2m: Remove qemu-cortex-m3
This board just don't have enough RAM for all tests
so it is just a maintenance headache without any
benefits.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-10-03 17:08:55 +01:00
Seppo Takalo 871aab7c45 tests: lwm2m: Fix minor timing issues on tests
* Wait for update when new object is created

  Sometimes our blockwise transfer starts before server have
  received an LwM2M Update. This causes Leshan to reject the SEND
  because is was not aware of object /19/0

* Wait "registered" message already in conftest.py.
  Sometimes Qemu boots faster, and the testcase don't see the
  log.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-10-03 17:08:55 +01:00
Jukka Rissanen 759f3a0c7c tests/samples: net: Fix the max number of file descriptors
Make sure that CONFIG_ZVFS_OPEN_MAX in the tests and samples is at
least the same value as CONFIG_NET_SOCKETS_POLL_MAX so that we
cannot have more polled sockets than there are available file
descriptors.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-30 17:12:15 +01:00
Robert Lubos 7aef84ce52 tests: net: sockets: tls: Increase connect timeout
Since fc007eeef5 TLS sockets support
timeout based on CONFIG_NET_SOCKETS_CONNECT_TIMEOUT value. The TLS test
suite reduced this config value to speed up the tests, however it turns
out the 100ms timeout is too low to finalize the handshake on slower
platforms (nrf52840 specifically). Therefore increase the timeout value
to 200ms to prevent test failures on those.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-09-28 08:21:51 -05:00
Robert Lubos 1dca822483 tests: net: http_server: Add netif dependency
Some of the http_server tests suites were missing netif dependency.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-09-27 10:56:47 +01:00
Francois Gervais 13cad59542 tests: coap_client: wait enough for requests to be unallocated
As confirmable requests will stay allocated for (3 * ACK_TIMEOUT), we
need to adjust the timings so all requests are unallocated by the end
of the test.

Signed-off-by: Francois Gervais <francoisgervais@gmail.com>
2024-09-26 09:20:23 -05:00
Torsten Rasmussen 205691edce cmake: linker: evaluate CONFIG_LINKER_ITERABLE_SUBALIGN in CMake
Evaluate CONFIG_LINKER_ITERABLE_SUBALIGN in CMake instead of in the
linker script.

It cannot be assumed that a linker generator implementation is
pre-processed and therefore Kconfig settings cannot be used in those
but must be evaluated in CMake.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-09-25 16:16:35 -05:00
Valerio Setti a913c9f2e3 tests: tls_configurations: remove tests on native/64 platform
Since the same test might be run in parallel on different platforms,
the one that it's started later will fail due to port re-use for
the OpenSSL server.
Since it's not really required to run the tests on native_sim and
native_sim/native/64, the latter is removed in order to solve this
problem.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-09-25 12:58:04 +02:00
Alberto Escolar Piedras 9666e7c638 tests/net: Don't test on native_posix
native_posix is now deprecated.
Building these tests in both native_sim and native_posix does not
improve coverage for the tests or subsystem but doubles CI time.
As anyhow native_posix will be removed all together in
2 releases, let's remove it already for these.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-09-25 04:04:36 -04:00
Robert Lubos 4595295028 test: net: offloaded_netdev: Add tests for IPv4/6 address registration
Make sure it's possible to register IPv4/6 addresses on an offloaded
interface. Add an extra build configuration to make sure it's also
possible when native IP stack is disabled.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-09-23 14:08:34 +01:00
Matt Rodgers bc9eee4286 tests: net: http_server: Add tests for long GET/POST data
Add test cases for dynamic GET/POST, where the payload is transferred
across more than one call to the dynamic resource callback.

Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
2024-09-23 12:00:54 +02:00
Matt Rodgers f2d8766b5d net: lib: http_server: remove dynamic resource data buffer
After introduction of struct http_response_ctx, the dynamic resource
data buffer is no longer needed for transferring data between the
application callback and the server. It is therefore removed to avoid
unnecessary copying of data.

Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
2024-09-23 12:00:54 +02:00
Matt Rodgers 96061428e0 tests: http_server: add tests for dynamic response context
Add tests covering new method of providing a response for dynamic
resources.

Tests cover the application sending response codes and headers,
overriding "default" headers, and sending various combinations of
headers and body data. Each case is tested for HTTP1 & HTTP2, both POST
and GET methods.

Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
2024-09-23 12:00:54 +02:00
Matt Rodgers 4cc905c513 net: lib: http_server: allow application to send headers/response code
Allow the application to send headers and response codes from a dynamic
resource callback by filling out a response context structure.

This also allows simple requests to be completed in a single execution
of the callback, by setting the final_chunk flag.

Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
2024-09-23 12:00:54 +02:00
Daniel DeGrasse 793d8bb3d2 tests: net: wifi: exclude RW612 ethernet variant
Ethernet board variant was missed in commit 138e9591f8 (tests: net:
wifi: exclude RW612 based boards), but is the sole variant that actually
was running this test. Exclude this variant only, since it cannot build
this test due to requiring binary blobs.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-09-18 19:56:18 +01:00
Arkadiusz Cholewinski 9d9089edd0 ztest: Add Support for Multiple Test Runs.
Introduces new kconfig options to enable multiple test runs in the ztest.

Signed-off-by: Arkadiusz Cholewinski <arkadiuszx.cholewinski@intel.com>
2024-09-18 15:32:28 +02:00
Valerio Setti 91fa8a2b63 tests: net: socket_tls: test different TLS configurations with sockets
This commit adds a test to showcase how to configure TLS 1.2 and 1.3
socket connections against an OpenSSL server. Only a limited number
of combinations are available for now:

- TLS 1.2
	- RSA certificate and key exchange.
	- ECDSA certificate and ECDHE key exchange.

- TLS 1.3 only supports ephemeral (ECDHE) key exchange with/without
  session tickets.

Since the goal is to test TLS connection and not low level ethernet
functionalities or similar, the only supported platform is "native_sim"
where Linux sockets are used to connect to the OpenSSL server locally.

The idea is that the Zephyr application acts a client and tries to connect
to the OpenSSL server running on the same PC. For sake of simplificity a
bash script is provided to start the OpenSSL server properly.
For completeness a bash script is also provided to re-generate
certificates and keys.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-09-12 13:31:20 -04:00
Jukka Rissanen b9a3edc43a tests: net: cm: Increase event wait time
This was seen in CI

START - test_cycle_ready_CC

  Assertion failed at ...tests/net/conn_mgr_monitor/src/main.c:262:
    cycle_ready_ifaces: (stats.conn_count_gen not equal to 1)
    NET_EVENT_L4_CONNECTED should be fired when connectivity is gained.
FAIL - test_cycle_ready_CC in 0.015 seconds

As the event wait timeout is very short (1ms) by default, increase
it to 10ms so that we will not miss the event.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-10 12:37:38 -04:00
Robert Lubos ac51e30957 tests: net: lib: lwm2m: content_link_format: Update BS discovery test
Align bootstrap discovery tests case with the enabler version reporting
changes.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-09-10 11:43:18 +02:00
Henrik Brix Andersen 83e30552ab tests: lib: net_buf: move network buffer tests to tests/lib/net_buf
Move the network buffer tests to tests/lib/net_buf as their implementation
now lives outside of the networking subsystem.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2024-09-07 11:19:05 -05:00
Henrik Brix Andersen 159f7dbbb1 lib: net_buf: rename header file from zephyr/net/buf.h to zephyr/net_buf.h
Move the network buffer header file from zephyr/net/buf.h to
zephyr/net_buf.h as the implementation now lives outside of the networking
subsystem.

Add (deprecated) zephyr/net/buf.h header to maintain compatibility with old
file path.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2024-09-07 11:19:05 -05:00
Henrik Brix Andersen ced80b13bf lib: net_buf: move the network buffer implementation to lib
Move the net_buf implementation from the networking subsystem to a library
as they have no dependency on the networking subsystem.

Network buffers are used in subsystems outside of networking
(e.g. Bluetooth, USB).

Fixes: #36374

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2024-09-07 11:19:05 -05:00
Jukka Rissanen 5355920f98 tests: net: bridge: Update the bridging tests
Make sure that tests work after overhaul.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-06 18:01:15 -04:00
Matt Rodgers 0c8bdbc45d net: lib: http_server: allow application to access request headers
Allow application to register certain HTTP request headers to be stored
by the server. These stored headers can then be accessed from a dynamic
resource callback.

Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
2024-09-06 11:27:37 -04:00
Chaitanya Tata a449b748cb Revert "tests: wifi: nm: exclude nrf7002dk"
This reverts commit 65af3ab34c.

Build only mode is now supported without FW blobs.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-09-02 12:31:06 -04:00
Daniel DeGrasse 138e9591f8 tests: net: wifi: exclude RW612 based boards
Exclude RW612 based boards from the WiFi testsuite, as these boards
require binary blobs be downloaded in order to build as expected

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-08-27 12:44:22 +02:00
Axel Le Bourhis 179c85aa06 tests: net: socket: udp: clear control data buffer before recvmsg
Currently, the test doesn't clear the control data buffer before
calling recvmsg. This leads to recvmsg being unable to add the new
control data, which corresponds to the current received data.
This commit aims to clear the control data buffer to match most use
cases, when the control data buffer is empty before calling recvmsg.

Signed-off-by: Axel Le Bourhis <axel.lebourhis@nxp.com>
2024-08-23 15:50:37 +01:00
Pisit Sawangvonganan b7d55d8ec6 style: tests: comply with MISRA C:2012 Rule 15.6
Add missing braces to comply with MISRA C:2012 Rule 15.6 and
also following Zephyr's style guideline.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-08-20 10:33:51 +02:00
Alberto Escolar Piedras 1aaea30adb tests/net/lib/lwm2m: Switch description to native_sim
native_posix is deprecated, let's switch the
description & comments to refer to native_sim instead.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-08-16 11:20:34 +01:00
Henrik Brix Andersen 69fe9b0c50 net: buf: remove use of special putter and getter functions
Convert users of net_buf_put() and net_buf_get() functions to use
non-wrapped putters and getters k_fifo_put() and k_fifo_get().

Special handling of net_bufs in k_fifos is no longer needed after commit
3d306c181f, since these actions are now
atomic regardless of any net_buf fragments.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2024-08-16 09:55:11 +02:00
Bjarki Arge Andreasen 65af3ab34c tests: wifi: nm: exclude nrf7002dk
The nrf7002dk board's wifi chip requires blobs to build wifi driver.
Therefore it can not be built by CI. Exclude the board and its
variants from the wifi test suite.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2024-08-13 18:21:01 -04:00
Robert Lubos d5fc86ed0a tests: net: mqtt: Make publisher/subscriber test suites self contained
The MQTT publisher/subscriber/pubsub tests suites are currently
depending on an external MQTT broker being available. In result, the
test suites cannot be executed in twister and need to be run manually,
which makes them kind of pointless from the CI perspective.

This commit reworks the tests, so that they no longer rely on an
external broker being available, but rather implement minimalistic
broker functionality for test purposes only. This will make the tests
self contained, and thus executable in the CI.

Since it makes not point to duplicate the effort between the test
suites, the test suites have been merged into a single mqtt_client test
suite.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-08-08 20:22:33 -04:00