-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fix hal-sleep/sleep_manager Tests on Cypress Targets #13210
Conversation
@dustin-crossman, thank you for your changes. |
@dustin-crossman Can you extend the commit messages to contain details how is this fixing and what is it fixing? additional paragraph would be good to have there with 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.
Additional details in the commit messages
@@ -523,7 +523,7 @@ static int CurTok = 0; | |||
* | |||
* tok_eof ::= EOF (end of file) | |||
* tok_open ::= "{{" | |||
* tok_close ::= "}}" | |||
* tok_close ::= "}}\n" |
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.
Why this fix to Cypress targets need to change the behavior of greentea?
I doubt there will be unexpected consequences.
The Greentea message {{KEY;VALUE}}
is bidirectional, HOST
<-->TARGET
What if the HOST is windows sending {{KEY;VALUE}}\r\n
to target?
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.
As described here: #12434 (comment) this is a long standing green tea bug, though as far as I know it only caused failures on our targets.
The choice of line ending in the case of greentea shouldn't have anything to do with the host OS. It appears to be merely convention that greentea KV pairs are sent with the '\n'. See: https://github.com/ARMmbed/mbed-os-tools/blob/master/src/mbed_os_tools/test/host_tests_conn_proxy/conn_primitive.py#L39
I don't see any reason why a Greentea message would be sent with a \r\n ending unless someone was perhaps manually testing messages with a serial emulator but had the wrong settings.
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.
Mbed greentea sends all KV pairs in the following format:
"{{key,value}}\n"
Previously the greentea client code was not reading the final '\n' from
the UART as part of the HandleKV() call. This did not cause an
error when multiple KV pairs were being parsed because any whitespace
proceeding a message was ignored. Once the final KV pair was sent,
however, HandleKV() would only read up to the "}}" leaving the final
'\n' in the UART buffer.
The commit msg now should explain it. As the host is sending \n
we should read it as well.
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.
Hi @dustin-crossman,
Thanks for your updates. now I can fully understood the reason behind the change.
And I tried your changes, it is working on the automated test, but manual test on windows is not working as we expected. But I think manual test it is essential use case, I personally used it a lot during writing/debugging tests.
I am not sure why Greentea python tool put that \n
in the message in first place, maybe trying forcing flash the TX buffer? So lets leave it there as it is.
So I'd like to propose the changes to:
- in the doxy/docs we keep the end token to
}}
- in the code, you can let Greentea to read another char, but will ignore it rather than restrict it to
\n
- then add a inline comment, saying this to to matching with GT python code where you pointed out.
By doing this.
GT c++ is aligned with the GT python code
Your targets will have cleared RX buffer.
and manual test on windows or any platform will not get impact.
Also behavior of greentea unchanged ,and No docs/API updates are required.
What do you think?
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.
I'm not sure I really understand your goal here. I would think that the python greentea tool is the definitive place to look at for the format of a KV pair which states that a kv pair has a \n ending. Why not document that and keep all tools compliant with that?
It sounds like your manual tests are failing because they are sending \r\n. Why not fix that? Most serial emulators I've used have configurable line endings (on Windows or otherwise).
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.
Hi @dustin-crossman
My main goal here is try to fix the inconsistency of GT python, and GT C++ part (let your target pass), and reduced the impacts all GT users at same time.
It is not just me that using manual testing for GT, many other people also use it on windows. This change would break them as well. I would NOT expect all of them go and configure their windows serial terminals.
change the end token would means change behavior, that would means all the documents related to it need to be updated.
https://github.com/ARMmbed/mbed-os-5-docs/blob/development/docs/debugging-testing/testing/testing_greentea.md
https://github.com/ARMmbed/mbed-os-tools/tree/master/packages/mbed-greentea
https://github.com/ARMmbed/mbed-os-tools/tree/master/packages/mbed-host-tests
And possibly a new release of GT python tool.
That is huge trouble, not mention exist windows users might be stuck on this inconspicuous change looking for why.
I would say what I suggested is minimal changes with least effort, And resolved your targets failure, and no one got impacted.
Mbed greentea sends all KV pairs in the following format: "{{key,value}}\n" Previously the greentea client code was not reading the final '\n' from the UART as part of the HandleKV() call. This did not cause an error when multiple KV pairs were being parsed because any whitespace proceeding a message was ignored. Once the final KV pair was sent, however, HandleKV() would only read up to the "}}" leaving the final '\n' in the UART buffer.
During the sleep_usticker_test and the deepsleep_lpticker_test a sleep was placed above the main testing loop in order to give the device some time to finish the Green Tea UART transmissions before entering sleep mode. Since there is a Green Tea transmission at the end of each iteration of this test loop, this sleep should be called for each loop instead of just once before it.
decf2eb
to
0ae7516
Compare
Pull request has been modified.
@0xc0170 Added more details. Let me know if that looks good! |
Thank for the updated commit messages, looks fine to me now |
CI run meanwhile |
Test run: SUCCESSSummary: 6 of 6 test jobs passed |
It was not "ready for merge", not cool 😞 I realized right after merge. @jamesbeyond Please review and I can revert asap the second commit if there are issues and can be fixed via a new PR. |
Hi @0xc0170, I believe the discussion is on going, could you revert this one? |
@dustin-crossman I'll revert the commit on master soon. Please send a new PR and lets review it. |
Summary of changes
This fixes the mbed_hal-sleep and mbed_hal-sleep_manager tests that have been failing on Cypress targets.
See this issue for background: #12434
In particular my comment here has an explanation of the failures: #12434 (comment)
This PR would fix the first 2 issues from that comment. The third issue was fixed by #12978
Impact of changes
Migration actions required
Documentation
None
Pull request type
Test results
Test Reports:
GT_FT_KIT_062_BLE_GCC.txt
GT_FT_KIT_062_WIFI_BT_GCC.txt
GT_FT_KIT_062S2_43012_GCC.txt
GT_FT_P6S1_43012EVB_01_GCC.txt
GT_FT_P6S1_43438EVB_01_GCC.txt
GT_FT_PROTO_062_4343W_GCC.txt
Two types of failures are seen:
Reviewers