Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: coap_client: optimize/reduce sleep time #79369

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Oct 4, 2024

  1. 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 <[email protected]>
    fgervais committed Oct 4, 2024
    Configuration menu
    Copy the full SHA
    ce26fb6 View commit details
    Browse the repository at this point in the history