Skip to content

tests/posix_semaphore: unify and increase allowed test4 margin#11467

Merged
miri64 merged 1 commit intoRIOT-OS:masterfrom
kaspar030:increase_posix_semaphore_timeout
May 6, 2019
Merged

tests/posix_semaphore: unify and increase allowed test4 margin#11467
miri64 merged 1 commit intoRIOT-OS:masterfrom
kaspar030:increase_posix_semaphore_timeout

Conversation

@kaspar030
Copy link
Contributor

Contribution description

The test configured tight margins for how much too long a semaphore wait can take. This is becoming a maintenance burden.

Instead of adding more special cases, this PR changes the allowed margin to 1ms (which is 0.1percent of the 1sec delay). This should be high enough to not trip over slightly inaccurate timers or slow platforms, but high enough to show fundamental problems with the interaction between timers and posix semaphores.

Remember, this should test semaphores, not timer subsystem accuracy.

Testing procedure

Validate soundness, execute tests on some boards (or let CI do it),

Issues/PRs references

#11449

@kaspar030 kaspar030 added Area: tests Area: tests and testing framework Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: run tests If set, CI server will run tests on hardware for the labeled PR labels Apr 30, 2019
@kaspar030 kaspar030 requested a review from cladmi April 30, 2019 09:46
@cladmi
Copy link
Contributor

cladmi commented Apr 30, 2019

As mentioned IRL I am for a change like this. Would just like a justification as a comment and the PR commit description.

Previously, there was a very tight allowed margin (100us), then some
special cases for platforms for which the test would otherwise fail,
increasing the margin.
This turned out to be a maintanance burden, as each slightly special
board needed a PR adding the special case.

This commit sets a quite large margin (1000us, 0.1% of total delay),
which should be large enough to not trip over platform-induced timer
inaccuracies, but still verify that the module is using timers
correctly.

(This is not a timer accuracy test.)
@kaspar030 kaspar030 force-pushed the increase_posix_semaphore_timeout branch from 3c13e1f to a9cd943 Compare May 6, 2019 12:54
@kaspar030
Copy link
Contributor Author

  • added a comment and verbose commit message

Copy link
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

@miri64 miri64 merged commit 98f97af into RIOT-OS:master May 6, 2019
@kaspar030
Copy link
Contributor Author

Thanks @miri64!

@kaspar030 kaspar030 deleted the increase_posix_semaphore_timeout branch May 6, 2019 13:56
/*
* Allowed margin for waiting too long.
*
* Waiting too short is forbidden by POSIX, but is checked elsewhere.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is checked here, not elsewhere:

    if (elapsed < exp) {
        printf("first: waited only %s usec => FAILED\n", uint64_str);
    }

Copy link
Member

@miri64 miri64 May 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What it is "it"?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check in the code that verifies it does not wait too short.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: run tests If set, CI server will run tests on hardware for the labeled PR Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants