Skip to content

tests tickers: adapt ticker_interrupt_test() test case for high frequency tickers #12218

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

Merged
merged 1 commit into from
Jan 9, 2020

Conversation

mprse
Copy link
Contributor

@mprse mprse commented Jan 8, 2020

Summary of changes

On some targets with very fast counters used for us ticker (e.g. 26 MHz) tested interrupt delays provided in the ticker_timeout array may be too short (execution of the set_interrupt() function takes longer than the tested delay).
We will skip tested ticker delay if the delay is less than assumed max set_interrupt() function execution time (20 us).

Also, the test array will be extended.

Tested on: K64F, NUCLEO_F429ZI, NRF52840_DK.

Impact of changes

Migration actions required

Documentation


Pull request type

[X] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[X] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers


@mprse mprse changed the title tests-mbed_hal-common_tickers: adapt ticker_interrupt_test() test case for high frequency tickers tests-mbed_hal-common_tickers: adapt ticker_interrupt_test() test case for high frequency tickers - WIP Jan 8, 2020
@ciarmcom ciarmcom requested review from a team January 8, 2020 14:00
@ciarmcom
Copy link
Member

ciarmcom commented Jan 8, 2020

@mprse, thank you for your changes.
@ARMmbed/mbed-os-hal @ARMmbed/mbed-os-test @ARMmbed/mbed-os-maintainers please review.

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 8, 2020

CI started

@0xc0170 0xc0170 removed the request for review from a team January 8, 2020 14:28
@mbed-ci
Copy link

mbed-ci commented Jan 8, 2020

Test run: SUCCESS

Summary: 5 of 5 test jobs passed
Build number : 1
Build artifacts

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 8, 2020

@mprse Who else should review this one?


/* Skip timeout if less than max allowed execution time of set_interrupt() - 20 us */
if (TICKS_TO_US(ticker_timeout[i], p_ticker_info->frequency) < (MAX_FUNC_EXEC_TIME_US + DELTA_FUNC_EXEC_TIME_US)) {
continue;
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is no extra print or something else ?
This test could go into this continue line without any real test...?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point! Added check at the end of the test case to ensure that at least 3 timeouts were tested.

@andrewc-arm
Copy link
Contributor

Thanks for the improvement, @mprse
I tested with the upcoming target of Samsung S5JS100 which has 26MHz clock and it passed your test reliably.

…e for high frequency tickers

On some targets with very fast counters used for us ticker (e.g. 26 MHz) tested interrupt delays provided in the ticker_timeout array may be too short (execution of the set_interrupt() function takes longer than the tested delay).
We will skip tested ticker delay if the delay is less than assumed max set_interrupt() function execution time (20 us).
Also, the test array will be extended.
@mprse mprse force-pushed the ticker_interrupt_test_fix branch from e98a9d6 to db8e776 Compare January 9, 2020 07:33
@mprse
Copy link
Contributor Author

mprse commented Jan 9, 2020

@mprse Who else should review this one?

@andrewc-arm Can you review this one?

Copy link
Contributor

@andrewc-arm andrewc-arm left a comment

Choose a reason for hiding this comment

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

I don't deeply understand the test code logic.
But as long as the test is extended and pass my partner's target board and other's boards then I am OK.

@@ -53,7 +53,7 @@ extern "C" {
#define TICKER_100_TICKS 100
#define TICKER_500_TICKS 500

#define MAX_FUNC_EXEC_TIME_US 30
#define MAX_FUNC_EXEC_TIME_US 20
Copy link
Contributor

Choose a reason for hiding this comment

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

@mprse
Could you kindly elaborate on this? I thought we wanted increase instead of decrease the time taken on execution.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I found this while adding this patch and fixed as a part of it. According to the requirements:

* * The ticker operations ticker_read, ticker_clear_interrupt, ticker_set_interrupt and ticker_fire_interrupt
* take less than 20us to complete - Verified by ::ticker_speed_test

So this value should be 20 us. This should not have an impact on S111 target since it is very fast. I also tested this with a few other targets with positive results.

Copy link
Contributor

@andrewc-arm andrewc-arm left a comment

Choose a reason for hiding this comment

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

Thank you. I am good with the change. BTW, I tested the 10 times for S5JS100 timer and they all passed. There is no more random failure due to timing.

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 9, 2020

CI started

@mbed-ci
Copy link

mbed-ci commented Jan 9, 2020

Test run: SUCCESS

Summary: 5 of 5 test jobs passed
Build number : 2
Build artifacts

@0xc0170 0xc0170 added release-version: 6.0.0-alpha-1 First pre-release version of 6.0.0 and removed needs: CI labels Jan 9, 2020
@0xc0170 0xc0170 merged commit d7b7223 into ARMmbed:master Jan 9, 2020
@0xc0170 0xc0170 changed the title tests-mbed_hal-common_tickers: adapt ticker_interrupt_test() test case for high frequency tickers - WIP tests tickers: adapt ticker_interrupt_test() test case for high frequency tickers Jan 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-version: 6.0.0-alpha-1 First pre-release version of 6.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants