Skip to content

Conversation

karlj
Copy link

@karlj karlj commented Aug 29, 2016

I was running htrun on Linux Mint 17.3 and even though only new line characters were being written from the DUT, htrun was reading in a carriage return character and new line character. I added an optional carriage return character to the regex that searches for KV tokens.

class KiViBufferWalker():
"""! Simple auxiliary class used to walk through a buffer and search for KV tokens """
def __init__(self):
self.KIVI_REGEX = r"\{\{([\w\d_-]+);([^\}]+)\}\}\n"
Copy link
Contributor

@mazimkhan mazimkhan Sep 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the key value protocol is based on start {{ and end }} tags. I would suggest removing \n. That way it will be more robust to match. Even if on some platform \n goes missing.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about doing that, but #104 put the newline character in.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bridadan in #104 your have add \n to the K,V regex. I think K,V protocol and \n and \r are different things. If htrun should send after receiving a \n then we should received until \n and then do the parsing. So that K,V parsing is independent of these terminating characters and also since data in K,V has nothing to do with serial limitation. In future this protocol can be on network interface as well.

So the work around for preventing DAPLINK bad state should be in the place where we are receiving data i.e. receive until \n.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mazimkhan Could you clarify a bit? I'm not sure what you mean. Are you saying you want to completely remove \n and/or \r from the KV regex?

The \n had been there before, but at when point @PrzemekWirkus had removed it, which caused issues in DAPLink, so I just added it back in that PR.

Copy link
Contributor

@mazimkhan mazimkhan Sep 10, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. It can be removed from the regex. But used after receiving characters to see if one line is received. To satisfy DAPlink limitation.
Basically process complete lines terminated with \n one at a time. Also this can only work if target writes one K,V at a time and waits for a response. If it sends two in a row (or printfs) and host test responds to the first one then this situation can not be avoided. If this situation is really a limitation then perhaps this should also be part of the test guidelines.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@karlj @bridadan created PR #128 for making regex \n free.

@mazimkhan
Copy link
Contributor

closing as fix added in #128

@mazimkhan mazimkhan closed this Sep 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants