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>
Tests for prometheus library support.
It contains integration and unit test
each metric types.
Signed-off-by: Mustafa Abdullah Kus <mustafa.kus@sparsetechnology.com>
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>
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>
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>
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>
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>
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>
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>
* 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Currently existing tests suites verify MQTT 3.1.1 functionality,
therefore group them together under "mqtt/v3_1_1" directory, so
that the test base can be extended easily in the future with MQTT 5.0
tests without collision.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Tweak some Kconfig variables to reduce the overall memory footprint of
the test application. For some reason x86 MMu throws errors when
accessing iterable section entries when the image size is too large.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The HTTP server tests are self-contained, they do not require network
environment to execute, hence should not specify "harness: net".
The consequence of specifying the harness was that HTTP server tests in
the CI were only built, and not executed, which doesn't make much sense.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add test cases verifying that request containing header frame with
priority flag set is processed properly.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add tests cases covering interaction with dynamic resources with
POST/GET requests.
Simplify HTTP2 request generation to facilitate adding more tests.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add test case verifying that the server keeps the connection open if no
Connection: close header is present in the request.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Remove pointless helper functions, the test code can simply be included
in the test case w/o code duplication.
Clarify the naming of existing test cases. Backward compatibility simply
tests HTTP1. The upgrade test wasn't really testing HTTP upgrade, so
rename the test case too. Add a new test case actually verifying HTTP
upgrade.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Do some cleanup regarding naming used in the test suite to prepare it
for adding more test cases.
Extract common setup/teardown into respective before and after ztest
functions to simplify test code. Proper before and after functions also
ensure that individual test case failure does not disrupt other tests
operation.
Split the tests into two separate test suites, one for those which
require pre-setup and second for those which don't.
Finally, enable receive timeout on the client socket to ensure tests
won't stall in case of errors.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
"prototype" is ambiguous in this regard, as it doesn't really tell what
the test suite is testing. As tests in this test suite verify core HTTP
server functionality, rename it to "core".
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
CONTINUATION frames are tricky, because individual header fields can be
split between HEADERS frame and CONTINUATION frame, or two CONTINUATION
frames. Therefore, some extra logic is needed when header parsing
returns -EAGAIN, as we may need to remove the CONTINUATION frame header
from the stream before proceeding with headers parsing.
This commit implements the above logic and additionally adds more checks
to detect when CONTINUATION frame is expected. Not receiving a
CONTINUATION frame when expect should be treated as a protocol error.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
For HTTP2-specific structures and enums, use "http2_" prefix to clearly
indicate the distinction from the generic HTTP stuff.
Additionally, some structures/enums describing HTTP2 protocol details
had "server" in the name, while in reality they describe nothing
server-specific. Hence, drop the "server" part where applicable.
Remove unused macros.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This reverts commit 93973e2ead.
PR #73978 introduced a regression.
Unfortunately this PR cannot be reverted without reverting also
Let's revert both PRs to stabilize main again towards the 3.7 release.
For more details on the issue see
https://github.com/zephyrproject-rtos/zephyr/issues/75205
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
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>
This test explicity enables the POSIX_API which is
not compatible with native_posix.
Let's exclude this target.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Add tests suite covering HTTP2 HPACK header compression and Huffman
encoding.
Note - many HPACK encoding/decoding cases in tests look similar, but
there are subtle differences in HPACK header used. For decoding, we
should be able to decode all of them. For encoding, we only test what
we support (no dynamic indexing).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>