From eaafe6c0eb8825d761adae98aec658bc8768f5c8 Mon Sep 17 00:00:00 2001 From: Marc Bonnici Date: Wed, 22 Nov 2017 11:21:31 +0000 Subject: [PATCH] SSH/Gem5Connection: Only remove echo in gem5_shell if required Only attempt to remove echoed commands from the shell during parsing if gem5 is actually echoing commands otherwise this can cause incorrect filtering. --- devlib/utils/ssh.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/devlib/utils/ssh.py b/devlib/utils/ssh.py index 8aad005..158d9b8 100644 --- a/devlib/utils/ssh.py +++ b/devlib/utils/ssh.py @@ -727,11 +727,11 @@ class Gem5Connection(TelnetConnection): output = output[command_index + len(command):].strip() - # It is possible that gem5 will echo the command. Therefore, we need to - # remove that too! - command_index = output.find(command) - if command_index != -1: - output = output[command_index + len(command):].strip() + # If the gem5 system echoes the executed command, we need to remove that too! + if self.strip_echoed_commands: + command_index = output.find(command) + if command_index != -1: + output = output[command_index + len(command):].strip() gem5_logger.debug("gem5_shell output: {}".format(output))