Skip to content

Make common tickers test more strict #7598

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

Closed
wants to merge 1 commit into from
Closed
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
18 changes: 9 additions & 9 deletions TESTS/mbed_hal/common_tickers/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,17 +206,17 @@ void ticker_interrupt_test(void)
* tick_count + ticker_timeout[i]. */
intf->set_interrupt(tick_count + ticker_timeout[i]);

/* Wait until ticker count reach value: tick_count + ticker_timeout[i] - TICKER_DELTA.
/* Wait until ticker count reach value: tick_count + ticker_timeout[i].
* Interrupt should not be fired. */
while (intf->read() < (tick_count + ticker_timeout[i] - TICKER_DELTA)) {
uint32_t last_flag = intFlag;
uint32_t last_read = intf->read();
while (last_read < (tick_count + ticker_timeout[i])) {

/* Indicate failure if interrupt has fired earlier. */
TEST_ASSERT_EQUAL_INT_MESSAGE(0, intFlag, "Interrupt fired too early");
}
TEST_ASSERT_EQUAL_INT_MESSAGE(0, last_flag, "Interrupt fired too early");

/* Wait until ticker count reach value: tick_count + ticker_timeout[i] + TICKER_DELTA.
* Interrupt should be fired after this time. */
while (intf->read() < (tick_count + ticker_timeout[i] + TICKER_DELTA)) {
/* Just wait. */
last_flag = intFlag;
last_read = intf->read();
}

TEST_ASSERT_EQUAL(1, intFlag);
Expand Down Expand Up @@ -342,7 +342,7 @@ void ticker_overflow_test(void)
intf->set_interrupt(tick_count + TICKER_INT_VAL);

/* Wait for the interrupt. */
while (intf->read() < (tick_count + TICKER_INT_VAL + TICKER_DELTA)) {
while (intf->read() < (tick_count + TICKER_INT_VAL)) {
/* Just wait. */
}

Expand Down