From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3602244178; Thu, 6 Jun 2024 23:34:34 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9D00A427D9; Thu, 6 Jun 2024 23:34:30 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 054CE40EAB for ; Thu, 6 Jun 2024 23:34:29 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D9554339; Thu, 6 Jun 2024 14:34:52 -0700 (PDT) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 68D693F792; Thu, 6 Jun 2024 14:34:27 -0700 (PDT) From: Luca Vizzarro To: dev@dpdk.org Cc: Jeremy Spewock , =?UTF-8?q?Juraj=20Linke=C5=A1?= , Luca Vizzarro , Paul Szczepanek Subject: [PATCH v5 1/5] dts: fix InteractiveShell command prompt filtering Date: Thu, 6 Jun 2024 22:34:16 +0100 Message-Id: <20240606213420.254260-2-luca.vizzarro@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240606213420.254260-1-luca.vizzarro@arm.com> References: <20240412111136.3470304-1-luca.vizzarro@arm.com> <20240606213420.254260-1-luca.vizzarro@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org When sending a command using an instance of InteractiveShell the output should filter out the trailing shell prompt when returning it. After every command two shell prompts are summoned. One is consumed as it is used as a delimiter for the command output. The second one is not consumed and left for the next command to be sent. Given that the consumed prompt is merely a delimiter, this should not be added to the returned output, as it may be mistakenly be interpreted as the command's own output. Bugzilla ID: 1411 Fixes: 88489c0501af ("dts: add smoke tests") Signed-off-by: Luca Vizzarro Reviewed-by: Paul Szczepanek --- dts/framework/remote_session/interactive_shell.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dts/framework/remote_session/interactive_shell.py b/dts/framework/remote_session/interactive_shell.py index 074a541279..aa5d2d9be8 100644 --- a/dts/framework/remote_session/interactive_shell.py +++ b/dts/framework/remote_session/interactive_shell.py @@ -132,11 +132,11 @@ def send_command(self, command: str, prompt: str | None = None) -> str: self._stdin.flush() out: str = "" for line in self._stdout: - out += line if prompt in line and not line.rstrip().endswith( command.rstrip() ): # ignore line that sent command break + out += line self._logger.debug(f"Got output: {out}") return out -- 2.34.1