Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions tests/posix_semaphore/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,16 +236,16 @@ void test3(void)
sem_post(&s1);
}

#ifdef BOARD_NATIVE
/* native can sometime take more time to respond as it is not real time */
#define TEST4_TIMEOUT_EXCEEDED_MARGIN (300)
#elif CPU_FAM_NRF51
/* nrf51 based boards needs a slightly higher margin value. Using 105us makes
test4 result more reliable. */
#define TEST4_TIMEOUT_EXCEEDED_MARGIN (105)
#else
#define TEST4_TIMEOUT_EXCEEDED_MARGIN (100)
#endif /* BOARD_NATIVE */
/*
* Allowed margin for waiting too long.
*
* Waiting too short is forbidden by POSIX, but is checked elsewhere.

Copy link
Copy Markdown
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);
    }

@miri64 miri64 May 6, 2019

Copy link
Copy Markdown
Member

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
Copy Markdown
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.

*
* This allows waiting a little (0.1%) longer than exactly 1000000us.
* The value should be large enough to not trip over timer inaccuracies, but
* small enough to catch any fundamental problems.
*/
#define TEST4_TIMEOUT_EXCEEDED_MARGIN (1000)

void test4(void)
{
Expand Down