-
Notifications
You must be signed in to change notification settings - Fork 3k
tests-mbed_hal-sleep: finish UART transmission before sleep test #8257
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
Conversation
There is no problem with this test during the morph, but some issue has been noticed while testing new Jenkins CI in Oulu on NRF52_DK. I was able to reproduce the issue locally. The difference between morph and local run is that CPU statistics are enabled on morph. This makes the difference and test passes. The sleep test case perform sleep for 100 us, 200 us, ... ,1000 us in loop (us ticker wakes the board) and verifies if sleep time matches the assumption. I got the following results: sleep wake-up after 100 us ~100 us ok 200 us ~200 us ok 300 us ~300 us ok 400 us ~400 us ok 500 us ~14 us (??) When requested sleep time is equal to 500 us some unexpected interrupt occurs which wakeup the board and force the test to fail. Register state just after exit from sleep: Control and State Register: 0x00400000 (ISRPENDING - Interrupt pending flag is set). NVIC Interrupt Set-pending Register[0]: 0x00000004 (UARTE0_UART0_IRQn) or 0x00000200 (TIMER1_IRQn - timer used by us ticker). UART interrupt is generated because of green-tea transmission. We know that it is performed while test is executed since we need to wait before going into deep-sleep since otherwise the transmission will be broken. So to take care of UART interrupt we need to wait before sleep test in the same way like it is done in deep-sleep test.
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.
@mprse I can confirm this fix works on the new Oulu CI. NRF52_DK pass all the tests
Good job for digging out the real reason caused this problem!
Another thing is could you improved the error thrown out from the test in:
https://github.com/ARMmbed/mbed-os/blob/master/TESTS/mbed_hal/sleep/main.cpp#L159
https://github.com/ARMmbed/mbed-os/blob/master/TESTS/mbed_hal/sleep/main.cpp#L200
https://github.com/ARMmbed/mbed-os/blob/master/TESTS/mbed_hal/sleep/main.cpp#L244
The test error messages are not really helping:
[1537949816.01][CONN][RXD] >>> Running case #1: 'sleep - source of wake-up - us ticker'...
[1537949816.01][CONN][INF] found KV pair in stream: {{__testcase_name;deep-sleep - high-speed clocks are turned off}}, queued...
[1537949816.12][CONN][RXD] :161::FAIL: Expression Evaluated To FALSE
[1537949816.12][CONN][INF] found KV pair in stream: {{__testcase_start;sleep - source of wake-up - us ticker}}, queued...
[1537949816.22][CONN][RXD] :161::FAIL: Expression Evaluated To FALSE
[1537949816.22][CONN][RXD] :161::FAIL: Expression Evaluated To FALSE
[1537949816.34][CONN][INF] found KV pair in stream: {{__testcase_finish;sleep - source of wake-up - us ticker;0;3}}, queued...
[1537949816.40][CONN][RXD] >>> 'sleep - source of wake-up - us ticker': 0 passed, 3 failed with reason 'Test Cases Failed'
it didn't give much info, like what is the sleep time, what is the expected, what is the actual value etc.
Maybe we could use TEST_ASSERT_MESAGE macro instead?
Hi |
@jamesbeyond Ohh, I forgot to add some additional info about the failure. I will add this on Monday. |
@jamesbeyond Fixed as suggested. |
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! Thanks
/morph build |
Build : SUCCESSBuild number : 3207 Triggering tests/morph test |
Test : SUCCESSBuild number : 3007 |
Exporter Build : ABORTEDBuild number : 2798 |
Aborted early, there's at least one failure not related to this patch, I am trying to reproduce this locally |
/morph export-build |
Exporter Build : FAILUREBuild number : 2819 |
/morph export-build |
Exporter Build : SUCCESSBuild number : 2833 |
Description
There is no problem with this test during the morph, but some issue has been noticed while testing new Jenkins CI in Oulu on NRF52_DK.
I was able to reproduce the issue locally. The difference between morph and local run is that CPU statistics are enabled on morph. This makes the difference and test passes.
The sleep test case perform sleep for 100 us, 200 us, ... ,1000 us in loop (us ticker wakes the board) and verifies if sleep time matches the assumption.
I got the following results in case of failure:
When requested sleep time is equal to
500 us
some unexpected interrupt occurs which wake-up the board and force the test to fail.Register state just after exit from sleep:
Control and State Register: 0x00400000 (ISRPENDING - Interrupt pending flag is set).
NVIC Interrupt Set-pending Register[0]: 0x00000004 (UARTE0_UART0_IRQn) or 0x00000200 (TIMER1_IRQn - timer used by us ticker).
UART interrupt is generated because of green-tea transmission. We know that it is performed while test is executed since we need to wait before going into deep-sleep because otherwise the transmission will be broken. So to take care of UART interrupt we need to wait before sleep test in the same way like it is done in deep-sleep test.
Pull request type
@jamesbeyond Can you confirm that this patch fixes problem with this test on the new Jenkins CI?