2143 Commits

Author SHA1 Message Date
Cristian Bulacu
f87fff19a7 tests: net: remove OT reference device flag for OT tests
This commit removes OPENTHREAD_REFERENCE_DEVICE flag for OpenThread tests.

Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
2026-01-23 09:21:10 -06:00
Robert Lubos
59b653bb4f tests: net: lib: http_server: Add test case for overlapping resources
Add a test case verifying that if there's a static resource defined
which overlaps a FS resource pointing to a directory, it takes
preference on exact URI match.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-01-23 13:52:47 +01:00
Robert Lubos
ba04734220 net: sockets: tls: Optimze helper buffer for sendmsg and CID check
Both cases use a large static buffer, we can optimize here and use a
single mutex-protected buffer for both.

sendmsg() test case needed adjustments, as it was also testing a buffer
overflow scenario. This can only be properly tested however if CID
feature is disabled, as otherwise the common helper buffer size is
increased for the CID use case, preventing the overflow from taking
place.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-01-23 10:46:05 +01:00
Robert Lubos
3cc194ee35 tests: net: sockets: tls: Add test cases for DTLS server multi-client
Add test cases verifying that DTLS server socket can handle multiple
clients.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-01-23 10:46:05 +01:00
Gaetan Perrot
69f318ab16 tests: net: lwm2m: interop: client: make lwm2m_setup void
lwm2m_setup() never reports errors and always returns 0.
The error check at the call site is therefore dead code.

Make the function void and drop the unused error handling.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2026-01-15 15:27:04 +01:00
Tom Hughes
c1b8c14995 tests: net: Use ARG_UNUSED instead of self assignment
When building with clang it warns about self-assignment in these tests:

* net.icmpv6
* net.shell
* net.arp
* net.tcp
* net.ip_addr
* net.6lo
* net.icmpv4
* net.udp

Example:

error: explicitly assigning value of variable of type
'struct net_udp_context *' to itself [-Werror,-Wself-assign]

Signed-off-by: Tom Hughes <tomhughes@chromium.org>
2026-01-15 11:07:52 +00:00
Tim Pambor
d40c003513 net: http_server: Add transaction complete status
When the response has been sent completely to the client, the server
reports the new `HTTP_SERVER_TRANSACTION_COMPLETE` status. Together with
the existing `HTTP_SERVER_TRANSACTION_ABORTED` status, the application
can now also for successful completions of requests clean up any
resources allocated for handling the request.

This especially allows to dynamically allocate the response buffer
passed to the server in the request callback and free it when the
request is done.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-01-11 13:04:52 +01:00
Tim Pambor
43d3387634 net: http_server: clarify naming of HTTP server callback status enum
Rename enum http_data_status to enum http_transaction_status
to better reflect its purpose, which is to indicate the status of the
overall HTTP transaction, not just data transfer.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-01-11 13:04:52 +01:00
Sam Friedman
6383a7222b tests: net: coap_client: allow native_sim/native/64
Fix build failures when compiling for 64-bit native_sim,
and add native_sim/native/64 to the platform allow list for
the coap client tests.

Signed-off-by: Sam Friedman <sam@golioth.io>
2026-01-09 17:12:31 -06:00
Fabio Baltieri
2cf6167357 tests: net: socket: run igmp on the mcast tests
The ipv4 code now filters for multicast packets for non joined groups,
make sure the test join the group before trying to create traffic on
that address.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2026-01-07 14:55:36 +00:00
Chris Friedt
31e54732f5 tests: net: use zsock APIs instead of POSIX APIs
Use zsock APIs rather than POSIX APIs in net subsys tests.

The primary last remaining API call was `fcntl()` and related
constants, strings, etc.

It's convention to use native zephyr APIs in the testsuites and
POSIX APIs in samples.

Signed-off-by: Chris Friedt <chris@fr4.co>
2026-01-07 10:22:34 +01:00
Robert Lubos
346e4d041e tests: net: lib: lwm2m: interop: Add missing PSA configs
Some PSA configs were missing for DTLS to work in LwM2M interop tests.

CONFIG_MBEDTLS_SSL_DTLS_CONNECTION_ID was defined twice, so remove
redundant entry.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-12-23 19:50:17 +00:00
Grzegorz Chwierut
29e8a95004 tests: Aligned with changes in pytest-twister-harness plugin
Aligned with changes in pytest plugin, where added support
of multiple connections from one device.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2025-12-22 20:36:34 +01:00
Alberto Escolar Piedras
242b69e1ac tests: net: dns_resolver: Increase heap size
The test fails on 64bit targets running out of heap.
Let's just increase it.

Circumstantially it started failing after
d5982f0f89

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-12-20 15:04:29 +01:00
Robert Lubos
46cf6e707e tests: net: socket: offload_dispatcher: Add extra test case for TLS
Socket dispatcher should create a native TLS socket with a native
underlying socket even if the socket is only bound to a native interface,
it shouldn't be needed to call ZSOCK_TLS_NATIVE specifically. This works
just fine, so add a test case for this scenario to make sure it remains
that way.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-12-18 18:52:44 +00:00
Alberto Escolar Piedras
88f1faec32 tests: net: all: Also build net shell disabled commands
It seems no other test (or sample) was building this.
So let's enable them in this test, so we at least build test them
somewhere.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-12-18 18:51:59 +00:00
Alberto Escolar Piedras
555887ec11 net: Fix net API use
In d45cd6716b the mayority of the
Zephyr codebased was changed to use the Zephyr native net_ prefixed
types, but some were forgotten.
Without this fix/change the code still builds as we are by now setting
CONFIG_NET_NAMESPACE_COMPAT_MODE. But when this is not set, things
fail to build.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-12-18 18:51:59 +00:00
Alberto Escolar Piedras
1a347f6f6c tests: net: all: Do not disable sys_getopt users
Since the shell (and its use of sys_getopt) does not have any dependency
on the POSIX_API anymore, we do not need to disable it when we disable
the POSIX_API compatibility layer.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-12-18 14:52:17 +00:00
Alberto Escolar Piedras
ddfdd8b389 tests: net: all: Also build zperf
Also build the zperf common and server code.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-12-18 14:52:17 +00:00
Sylvio Alves
f8d2e00a0e includes: remove duplicated entries in zephyr-tree
Remove duplicated #include directives within the same
preprocessor scope across the Zephyr tree.

Duplicates inside different #ifdef branches are preserved
as they may be intentional.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2025-12-17 13:57:38 -05:00
Michael Zimmermann
4759e39122 net: mqtt_sn: Disable support for GWINFO messages
The MQTT-SN v1.2 [0] specification specified the GwAddr as follows:
The GwAdd field has a variable length and contains the address of a GW. Its
depends on the network over which MQTT-SN operates and is indicated in the
first octet of this field. For example, in a ZigBee network the network
address is 2-octet long.

It specifies neither the possible values for the first octet, nor the
format of the network-specific address that follows. Thus, the
specification is incomplete and this functionality unusable.

I also wasn't able to find any implementation which implements a gwinfo
message where the address length is not zero. This includes
https://github.com/eclipse-paho/paho.mqtt-sn.embedded-c .

The current implementation in Zephyr simply copies a `struct sockaddr`
into GwAddr. This is a bad idea for many reasons, the most important one
being that the format is not even specified by POSIX [1]. They only say,
which defines must exist, not what their values are. And in fact, these
even differ between Zephyr and Linux.

Thus, I think it's best to remove the implementation to prevent people from
using this, which may even lead to memory safety issues, depending on the
length of CONFIG_MQTT_SN_LIB_MAX_ADDR_SIZE. If we were to receive an
updated specification, all we'd have to do is to convert between `struct
sockaddr` and mqtt-sn addresses both ways.

[0] https://groups.oasis-open.org/higherlogic/ws/public/download/66091/MQTT-SN_spec_v1.2.pdf
[1] https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_socket.h.html

Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
2025-12-15 07:27:57 -05:00
Michael Zimmermann
53012f9cc2 tests: net: mqtt_sn: client: Test gwinfo response from a gateway itself.
When the response comes from a gateway, the address length is 0. I renamed
the test which tests a gwinfo from another client to make this more clear.

Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
2025-12-15 07:27:57 -05:00
Michael Zimmermann
2d8cb5dad9 tests: net: mqtt_sn: client: fix running just search_gw
Since the code can't handle timestamp 0, we have to sleep during setup.

Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
2025-12-15 07:27:57 -05:00
Alberto Escolar Piedras
a90994006a tests: net: all: Also build latmon
Also build the latency monitor support code.

As a sideeffect, we run out of bits in the kernel objects per thread
permissions tracking field. So let's increase it to 6 bytes.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-12-11 16:57:22 +01:00
Jukka Rissanen
9fe1570117 tests: net: all: Compile test NET_CANBUS
Enable CONFIG_NET_CANBUS and make sure the code enabling it
compiles ok.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-12-08 06:12:04 -05:00
Valerio Setti
4f947f00f9 tests: net: tls_configurations: replace legacy crypto with PSA API
Replace selection of legacy Mbed TLS crypto Kconfig with PSA Crypto API
ones.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2025-12-02 11:32:35 +01:00
Valerio Setti
99bb73537c tests: net: lwm2m: replace legacy crypto deps with PSA API
Replace usage of legacy Mbed TLS crypto with PSA Crypto API.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2025-12-02 11:32:35 +01:00
Valerio Setti
52df6fb770 tests: net: http_server: replace legacy crypto deps with PSA API
Replace legacy Mbed TLS crypto support with PSA API.
RSA key exchange dependency was removed because all certificates and
keys used in the test are EC.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2025-12-02 11:32:35 +01:00
Valerio Setti
b7d0e1293c tests: net: ieee802154: remove cipher selection in mbedtls-shim driver
Cipher support is already implied by default so there is no need to
select it explicitly.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2025-12-01 08:26:29 +01:00
Jukka Rissanen
5a0fb5c011 tests: net: all: Increase CONFIG_MAX_THREAD_BYTES to 5
This is done to avoid this error

  Too many thread objects (38)
  Increase CONFIG_MAX_THREAD_BYTES to 5

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-11-28 17:27:52 +00:00
Jukka Rissanen
e39c6c56fb tests: net: all: Make sure OpenThread tests are run
The platform_allow line in common: overrides the setting in
individual tests, so add the platform_allow line to each test
separately so that OpenThread tests are run with proper platform.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-11-28 17:27:52 +00:00
Robert Lubos
a00fefc5a9 net: sockets: tls: Specify a separate Kconfig option for TLS timeout
It's been periodically reported that the default connect timeout shared
with regular TCP sockets (3 seconds) is not enough for the TLS handshake
to complete. Therefore, it'd make sense to increase the default value
for TLS sockets specifically. However currently the option is used by
both TCP and TLS connections, which makes this impractical.

Therefore, introduce a separate CONFIG_NET_SOCKETS_TLS_CONNECT_TIMEOUT
Kconfig option for TLS sockets specifically, and set the default to 10
seconds. For samples/tests that modified the old option for TLS-specific
purpose, update the new option value as well.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-11-27 14:45:32 +01:00
Jukka Rissanen
5e4aa5e75e tests: net: all: Compile test network packet filter code
Add pkt_filter library to be compile tested by network all tests.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-11-25 16:06:56 +00:00
Jukka Rissanen
f53e6041b7 tests: net: all: Compile test tftp library code
Add tftp library to be compile tested by network all tests.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-11-25 16:06:56 +00:00
Jukka Rissanen
016b2f2237 tests: net: all: Compile test PTP library code
Add PTP library to be compile tested by network all tests.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-11-25 16:06:56 +00:00
Robert Lubos
7a9ca8e410 tests: net: dns_resolve: Add tests for dns_unpack_name()
Verify that dns_unpack_name() generates a valid DNS name when unpacking
records and that it returns an error in case of overflow.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-11-21 11:40:44 -05:00
Robert Lubos
396fcbf4f5 tests: net: socket: tcp: Add another test case for asynchronous connect
Verify that if the application triggers asynchronous connect with
non-blocking sockets, and starts to monitor the socket with poll()
immediately but with POLLIN only set, the poll() is still able to
report an error if the connection fails. As no POLLOUT is monitored, the
application won't know when the connection is done in case of success,
but it should still be notified in case of errors.

To achieve this, modify the existing test case to allow to specify what
events should be monitored by poll(). Additionally monitor the time
spent in poll() - an error should cause poll() to exit immediately,
not after the specified timeout.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-11-21 09:47:50 -05:00
Jukka Rissanen
9795ce7bba tests: net: ocpp: Fix uninitialized variable warning
According to the compiler, the ret variable might be uninitialized
in the function (looks like a false positive but fix it anyway).

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-11-21 12:01:31 +01:00
Jukka Rissanen
8046a24104 net: Fix network API calls that were not namespaced
Some of the networking calls were not namespaced so fix it.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-11-21 12:01:31 +01:00
Robert Lubos
61acbb986b tests: net: all: Ensure TLS sockets are built with CID support
Some CID-related functionalities of the DTLS sockets are conditionally
compiled, make sure that code is built with tests/net/all test suite.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-11-20 17:15:15 +00:00
Jukka Rissanen
f97e33eb38 tests: net: all: Verify OpenThread compilation
Try to catch various OpenThread related compilation issues.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-11-20 16:00:46 +00:00
Jakub Klimczak
f16f3f641e zvfs: Move fdtable into ZVFS
The file descriptor table is used in every area that expects to work on
files through descriptor indices. It can only be operated on through
functions whose names indicate a relationship with ZVFS (`zvfs_*fd*`).
The integer file descriptor mechanism shouldn't be separate from ZVFS.
This will make cooperation between different file access APIs much
simpler. This commit also makes preparations for the fdtable becoming
optional.

Signed-off-by: Jakub Klimczak <jklimczak@internships.antmicro.com>
2025-11-18 08:12:19 -05:00
Jukka Rissanen
1380739f25 tests: net: all: Add more compilation support
Make sure we test coap client/server, MQTT SN, telnet and
logging network backend when testing all network options.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-11-17 14:01:32 -05:00
Jukka Rissanen
b626c83d45 tests: net: socket: tls_configurations: err variable might be unused
Mark the err variable as possibly unsed depending on the enabled
config options.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-11-17 14:01:32 -05:00
Jukka Rissanen
13d84b136e tests: net: Add relevant Posix headers for networking
We need certain network related Posix header files so that the
network tests using Posix symbols compiles ok.
Previously the Posix symbols were introduced by network stack
automatically, but that is no longer the case.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-11-17 14:01:32 -05:00
Jukka Rissanen
d45cd6716b net: Convert network codebase to use renamed network APIs
Rename network symbols in network stack to use the renamed network APIs.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-11-17 14:01:32 -05:00
Josuah Demangeon
e6e7fc549e style: tests: apply coding style on CMakeLists.txt files
Apply the CMake style guidelines to CMakeList.txt files in tests/.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2025-11-17 13:48:03 -05:00
Robert Lubos
7e69575614 tests: net: socket: udp: Remove tests numbering
It shouldn't be needed to execute UDP sockets tests in a fixed order
(currently enforced by embedding the test number into the test case
name). In fact, this was only needed, as two test cases worked as
prerequisites for other tests, that should've been done in the setup()
function though.

Therefore, consolidate the two test cases which pre-configured the test
interface into a proper setup() function executed before the test
suite, and get rid of the confusing test case numbering.
There also was a race in TX time test due to incorrect mutex use, so fix
that by using semaphore instead.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-11-14 10:27:12 +02:00
Robert Lubos
f19e9667b4 tests: net: socket: udp: Add tests for UDP socket rebinding
Verify that UDP socket rebinding works fine for both, client and server
cases.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-11-14 10:27:12 +02:00
Julien Vermillard
4e54e9a806 net: lwm2m: get cache free slots
Add function to query LwM2M cache free slots on a given path.

Signed-off-by: Julien Vermillard <julien@clunkymachines.com>
2025-11-14 09:20:59 +01:00