-
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 kv parsing bug in greentea client #13240
Fix kv parsing bug in greentea client #13240
Conversation
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.
Quoting @jamesbeyond last message on the old PR so we can continue on that discussion: Can you show where in the documentation the kv format is expected to handle both a \n and \r\n ending? The only spot in those links I can find is here: https://github.com/ARMmbed/mbed-os-tools/tree/master/packages/mbed-host-tests#design-draft and that states that:
I do see that there is more inconsistency on the GT C++ side: It appears the c++ client sends kv pairs with the \r\n: https://github.com/ARMmbed/mbed-os/blob/master/features/frameworks/greentea-client/source/greentea_test_env.cpp#L234 |
It looks like there is more inconsistency on the python as well: |
@dustin-crossman, thank you for your changes. |
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.
It looks fine to me. Do you have a test case that we could reproduce this bug to show it was the real issue?
CI started, lets see how tests go |
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,
I can see there are some inconsistent here and there. but for the design principle of the GreenTea, Only the pattern {{KEY;VALUE}}
is considered as valid. everything outside {{ }}
should/will be ignored. That is the reason why we don't want to enforce \n
part of the end token.
Further more make \n
compulsory clear breaks some windows user case. that is why I need this PR to be changed.
I proposed a much simpler change here: #13247
Test run: SUCCESSSummary: 6 of 6 test jobs passed |
I am closing this for now, lets review #13247 |
Summary of changes
Fixes kv-parsing bug in greentea client.
This commit was previously part of #13210 but was merged then reverted because discussion was not finalized.
Impact of changes
Migration actions required
Documentation
None
Pull request type
Test results
Test results provided as part of #13210
Reviewers
@0xc0170
@jamesbeyond