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 C32A443E74; Tue, 16 Apr 2024 14:12:06 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 93AA54029E; Tue, 16 Apr 2024 14:12:06 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 6CA2C40262 for ; Tue, 16 Apr 2024 14:12:05 +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 0602C339; Tue, 16 Apr 2024 05:12:33 -0700 (PDT) Received: from [10.1.28.60] (FVFG51LCQ05N.cambridge.arm.com [10.1.28.60]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 07DF53F738; Tue, 16 Apr 2024 05:12:03 -0700 (PDT) Message-ID: Date: Tue, 16 Apr 2024 13:12:02 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/5] dts: fix InteractiveShell command prompt filtering Content-Language: en-GB To: =?UTF-8?Q?Juraj_Linke=C5=A1?= Cc: dev@dpdk.org, Jeremy Spewock , Paul Szczepanek , Jack Bond-Preston References: <20240412111136.3470304-1-luca.vizzarro@arm.com> <20240412111136.3470304-2-luca.vizzarro@arm.com> From: Luca Vizzarro In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed 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 Thank you for your review Juraj! On 16/04/2024 09:40, Juraj Linkeš wrote: >> When sending a command using an instance of InteractiveShell the output >> is meant to filter out the leading shell prompt. The filtering logic is >> present but the line is appended anyways. >> > > I don't think that's what's happening here. The output collecting > logic is "stop when we encounter a prompt, but not the prompt with the > command we sent". We could change the comment though. Yeah, I actually identified the behaviour better after writing this. Will update the commit body accordingly. And I mixed-up leading with trailing! This is meant to say "trailing shell prompt". >> @@ -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 > > If we do this, we'll only filter out the last prompt, which may not be > desirable, since the last prompt is there only because all of our > interactive shells force an extra prompt with _command_extra_chars. Could you please expand more on this? > One thing we could improve though is removing the distribution welcome > message from logs, or at least separate it from the first command sent > with the interactive shell. The second option will allow us to see > clearly that an interactive session has been established, although we > could just emit a shorter log (something like "Started a testpmd > session" and then flush the welcome screen output). I am not sure what you are referring to exactly, could you also expand more on this please? Given it's not particularly explained, I thought having two command prompts (especially a trailing one) was an error. The main reason behind this is that when we go to parse the port info, the last entry which is "device private info" appears to be open ended, and I couldn't gather much information from the testpmd source code. So I opted to parse everything until the end. With a trailing command prompt this meant that: device_private_info="....testpmd> ".