-
Notifications
You must be signed in to change notification settings - Fork 3k
test: add us ticker test #4690
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
test: add us ticker test #4690
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test seems like it would apply just as well to the lp_ticker. Maybe it could be combined with #4628 and applied to both the us_ticker and the lp_ticker?
TESTS/mbed_hal/us_ticker/main.cpp
Outdated
Case cases[] = { | ||
Case("us ticker - Init", test_us_ticker_init, greentea_failure_handler), | ||
Case("us ticker - Read", test_us_ticker_read, greentea_failure_handler), | ||
Case("us ticker - Read wiht loop", test_us_ticker_read_loop, greentea_failure_handler), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type - should be "with"
TESTS/mbed_hal/us_ticker/main.cpp
Outdated
complete = false; | ||
ticker_set_handler(us_ticker, us_ticker_handler_test); | ||
timestamp_t future_timestamp = us_ticker_read() + 5000UL; | ||
ticker_insert_event_us(us_ticker, &event, future_timestamp, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the ticker_* layer here adds extra code that could interfere with testing of the hal. You might consider using the us_ticker_* API here directly, so changes in ticker_* don't effect hal testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was the intention but current us ticker API does not provide this, the handler calls directly upper layer, and there is not API to redirect this. Only the upper layer provides that.
We can set interrupt, but handling ISR is in the handler that calls the upper layer. We can remove this test, and the upper layer then exercises set_interrupt() ?
It could be via weak, but then we would not exercise IRQ handler. Therefore I can just remove this code from here completely, and set interrupt needs to be tested via upper layer tests
As stated above, yes this could be refactored, I'll do that, rebase soon |
I pushed an update. @c1728p9 now exercises HAL ticker API.
|
This test exercises ticker API - init should be executed just once - read timestamp Set interrupt should be tested via upper layer, as it does not provide API to change handler that is invoked in the ISR ticker handler.
Rebased, now using setup handler to setup interface (lp vs us ticker), as @c1728p9 proposed. Tested with K64F, same result as previously, all OK |
/morph test |
@studavekar It looks like this did not report to github properly. |
This is due to java process crash , re-triggering request /morph test |
Result: FAILUREYour command has finished executing! Here's what you wrote!
OutputExample Build failed! |
/morph test |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
/morph test-nightly |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
This test exercises us ticker API
Disable interrupt shall be also tested, should be proparly in its own test,
as it is the very last function to be executed (we dont have API to reenable interrupts), thus cant be in the same test unit.
Need to add documentation to this test.
This is very basic test, init version that can expand. I can add disable also but it is own file, was thinking something like this:
I can refactor this to be us ticker and lp ticker tests (via that ticker data API), would our test allow it? This would be the idea:
ticker_lpus/ticker_header_test.h - would contain definitions for both
ticker_lpus/lp_ticker/main.cpp - this would use lp ticker data
ticker_lp_us/us_ticker/main.cpp - this would use us ticker data
Tested with ARM on K64F and NCS36510 so far, more testing required.
cc @pan- @c1728p9 Anyone else interested in tickers?