-
Notifications
You must be signed in to change notification settings - Fork 463
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
Some debug tests like are UnavailableHaltedTest broken #520
Comments
Oh, and by the way. I think the reason I can reproduce it reliably is that we always run these tests with "-d3" passed to OpenOCD. So the amount of debug logs is increased. This may be the reason why people could have difficulties with reproducing this. |
They aren't always reliable. See #520.
FWIW, even with |
…rsing log file Quick and dirty fix for riscv-software-src#520
The patch with the suggested fixes: #522 |
…rsing log file Quick and dirty fix for riscv-software-src#520
…rsing log file Quick and dirty fix for riscv-software-src#520
Looks like the patch fixes this issue, so closing the ticket |
@timsifive , @en-sc , @AnastasiyaChernikova FYI.
The effects of the issue can be observed in riscv-collab/riscv-openocd#928 (though this commit has nothing to do with the issue, the root cause seems to be in the test suite itself).
Basically, If I take current riscv-openocd TOT most Unavailable... tests begin to fail in my environment. I've debugged the issue for a while now and I think I understand the root cause.
The problem is with
def command(self, cmd)
function fromdebug/testlib.py
. What this function does is it tries to obtain results of OpenOCD command by parsing OpenOCD log instead of fetching the result directly (more on that later). Moreover, instead of sending only one command - we actually send 2 "commands". One real command and another is an artificial "command-like" comment to enforce OpenOCD to print prompt-like construct. The issue is that this approach does not always work.Here are some examples (taken from log files after the failure).
Example 1
Prompt for
# 7x
never matched.Example 2
Another, more hilarious example is the following:
Here the prompt is matched. But the output is not parsed correctly, leading to the following error:
This happens because targets state is parsed like this:
Note: these are but a few examples. The number of situations resulting in test failure is quite large. Though it all comes down to incorrect parsing of the result.
TLDR
Proposed solution:
Instead of parsing OpenOCD log files (and connecting to a pipe for an input) I suggest to communicate with OpenOCD via TCL-rpc server. TCL-RPC server is almost the same that ordinary telnet server, but it is more suitable for machine-machine interaction (we have a special watermark to indicate message end). We don't need to parse OpenOCD logs to get instruction results - we can fetch the result string directly.
P.S: I'll try to propose a patch to address the issue. This may take some time, though. So if anyone has an urgent desire to fix this - don't be shy ).
The text was updated successfully, but these errors were encountered: