-
Notifications
You must be signed in to change notification settings - Fork 3k
tests-mbed_hal-sleep fix #7036
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
tests-mbed_hal-sleep fix #7036
Conversation
4fe81b5
to
074a59d
Compare
@@ -105,6 +105,11 @@ void sleep_usticker_test() | |||
|
|||
const ticker_irq_handler_type us_ticker_irq_handler_org = set_us_ticker_irq_handler(us_ticker_isr); | |||
|
|||
// call ticker_read_us to initialize ticker upper layer |
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.
looking at the lines above, there's if #0 - should also be removed
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.
To remove this, we need to have fix for MBED_ALL_STATS_ENABLED
@maciejbocianski Please provide details
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.
When MBED_ALL_STATS_ENABLED
is enable then sleep_manager_sleep_auto
function calls some extra logging code, what makes return from sleep
takes more time than expected
To enable sleep_usticker_test
test
We could disable this flag globally for all test, or create mechanism to selectively mark tests which should be running without extra log/stats
flags
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.
Could we just unset the flag instead?
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.
impossible to do, this flag is set globally for all tests
Jenkins code:
mbed_test_build_cmd=(mbed test --compile -m ${target} -t ${toolchain} -DMBED_HEAP_STATS_ENABLED=1 -DMBED_STACK_STATS_ENABLED=1 -DMBED_TRAP_ERRORS_ENABLED=1 -DMBED_ALL_STATS_ENABLED)
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.
@studavekar Please review
@studavekar @OPpuolitaival @SenRamakri Please review #7036 (comment) Having all stats on might cause some time increase. In this case, as we expect a target to be running back from sleep in a specific period of time, adding extra stats adds delay and causing our tests to be failing. I provide an example: a target from sleep should be running lets say <10us. If we enable stats, and they affect this functionality (adding some computation to the sleep functionality), this increases the time to be awake from 10us to higher numbers - not for all targets. This is a grey area (I dont think we got documented how stats affects functionality - shall we ?). If I know that lets say CPU stats can increase sleep times, then this should be stated in the documentation. How shall we fix this type of test? |
@0xc0170 I am not enough familiar with this that I can review |
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.
Blocking until internal conversation has been resolved.
After internal discussion, the CI flag will remain, and a mechanism will be added to bypass the delay causes by printing stats. This PR will need to be rebased once #7063 is in. |
Internal discussion appears complete
In my opinion this PR should be merged first. |
@maciejbocianski Making sure I understand correctly. I thought that #7063 was going to add a mechanism to bypass the additional time delay, and then this PR would use that mechanism to run the test with proper timings. Is this not correct? |
@maciejbocianski @cmonr - Added changes from #7063 in this PR itself will save us some time in CI and sequencing. Closing #7063 |
468b653
to
0504034
Compare
This fixes the problem (the commit 0504034), not on board with the adding new hook to just overwrite the read functionality - having stats on but just return 0. Flag The use for this API? One use case we have when a test is checking time requirement that stats break. |
TESTS/mbed_hal/sleep/main.cpp
Outdated
utest::v1::status_t greentea_test_setup(const size_t number_of_cases) | ||
{ | ||
GREENTEA_SETUP(60, "default_auto"); | ||
us_ticker_init(); | ||
#if DEVICE_LPTICKER | ||
lp_ticker_init(); | ||
#endif | ||
mbed_stats_ticker_read = disable_stats_read; |
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.
Rather than disabling the stats ticker, would it be possible the test to gracefully handle this case? This could be done either by decreasing the tolerance as in #7070 or by increasing delay time so the overhead of the stats read is proportionately less.
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.
Can be done, delta has to be increased as follows (additional 10-15us to cover worst case: nrf51):
/* Used for regular sleep mode, a target should be awake within 10 us. Define us delta value as follows:
* delta = default 10 us + worst ticker resolution + extra time for code execution + extra time for sleep time logging*/
static const uint32_t sleep_mode_delta_us = (10 + 4 + 5 + 10);
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.
Looks good for now (I still would expect one day to test 10us period - no logging included - "release")
@maciejbocianski Go ahead with the tolerance change, and once this PR is updated and re-approved, we can start CI. As a reminder, we need to get this in before #7073 can progress, and we need it in before we can generate RC2. |
0504034
to
48b9ad9
Compare
@deepika's changes has been removed |
build retriggered |
Looks like build completed successfully, but didn't report back. Going to retrigger. |
/morph build |
Halting CI builds until RC3 PRs are completed. Will resume after. |
/morph build |
1 similar comment
/morph build |
Build : FAILUREBuild number : 2295 |
Looks like this has some real build failures. |
Increases tolerance value for sleep_usticker_test to cover extra time needed for cpu stats computation (for more details see MBED_CPU_STATS_ENABLED). Prevent scheduling interrupt during ticker initialization (in lp_ticker_init) while test execution.
53548e2
2d9a48f
to
53548e2
Compare
fix was already pushed |
/morph build |
Build : SUCCESSBuild number : 2334 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 1958 |
Test : FAILUREBuild number : 2114 |
Going to restart this test since the NRF51 appears to have timed out quite a bit, but there might be legitimate errors with the K82F and KW41Z building with GCC ('Low power ticker frequency test' failed for both targets). /morph test |
Test : SUCCESSBuild number : 2136 |
Description
Pull request type