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 5615A43E6F; Tue, 16 Apr 2024 10:48:43 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CCC19402CF; Tue, 16 Apr 2024 10:48:42 +0200 (CEST) Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) by mails.dpdk.org (Postfix) with ESMTP id C691F4029E for ; Tue, 16 Apr 2024 10:48:40 +0200 (CEST) Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-56e6acb39d4so5458671a12.1 for ; Tue, 16 Apr 2024 01:48:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pantheon.tech; s=google; t=1713257320; x=1713862120; darn=dpdk.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=XN1eN0aN67WY5P9P31regy02VqqKBsVCOtQ/eHfWZ0A=; b=NWRSj2Af9n1sQddI1wOSQHFt4UbPnTLSXHSAhRkvSQkSQeqntnsXX6i5JLrmvlZyK4 5ae72EQ5TjK3tDCBnzLD6ninLand1xQhx3DY1VEe6g93PSDH4SHWCgb81GuAY9Go7q4z 2FFYbGfYtp+cZniXbyDGw9UtTni3oCm9Yt+BhzbhDNlvFo38NO1xupgTWBwTJcQiA9ir madtKcg8EgsELLETMzr2JfzVGcigLrLHKKsUWLC67Zc/zJYqeAEV6JXFcuoeZ9ljBqxW 38VRh4e78x3JxY+XBOzCy/QHuU94GS5Wm84WPmEUHVWahcd3hVniW7GNCMobafc9p69E zokQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713257320; x=1713862120; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XN1eN0aN67WY5P9P31regy02VqqKBsVCOtQ/eHfWZ0A=; b=AxpBrONPg5nhCFKcdwPj+XaUpc/ostZvjrhosYeSpy672gMPJKA7yzCwxdMV9J2rgS uQmjMrvrqb/DmZxA+zKsgXdxdns1i5GzR9B8H2xsMc0+BBkoMsfb/KX3e/s2/+Nd7J5U diy6dYCJJiovA6FZxTKU9++1pguCrVFL8uJHtShGN9Kofyr3/JjmwDBCV3r35Yapc7Xq M+TYeLcw1+3rjQss1OLqmP5utWfODxmyAAeiPqz1wrH2fZ6a+/tIlm7wL/IGWfAOZu74 gRJ91GTio7IqyQ9YsF85nHru38LjgQ+6bKss4Qwgsp5jyUOtRt+ip8iBS7KPIQGyWtw3 n9JA== X-Gm-Message-State: AOJu0Yz6COlhjK2IYU2veT73OAoVQldswklXJJ1eY9Qq0j2ZcDaH3K3m QrGvcuxMCL5gXwRfPurVfnp36Nnju9Kuc5B/ZeV1dMszXJf83UOH7PBE0p/Nl2YFaxzhVBDjkOM KeV+b9NhLPMTQJkYAxkvVzcVASNnGYno3XVqULw== X-Google-Smtp-Source: AGHT+IHggSidMib0QoLY5/TZS8ELV8vaCtgmNtwwfPcnDYh4kLMgGYSSjtU7c2KdFBPrvq3yeLY5o/MElTrzSOPpuGs= X-Received: by 2002:a17:906:c105:b0:a4e:cd5c:da72 with SMTP id do5-20020a170906c10500b00a4ecd5cda72mr8924108ejc.63.1713257320571; Tue, 16 Apr 2024 01:48:40 -0700 (PDT) MIME-Version: 1.0 References: <20240412111136.3470304-1-luca.vizzarro@arm.com> <20240412111136.3470304-3-luca.vizzarro@arm.com> In-Reply-To: <20240412111136.3470304-3-luca.vizzarro@arm.com> From: =?UTF-8?Q?Juraj_Linke=C5=A1?= Date: Tue, 16 Apr 2024 10:48:29 +0200 Message-ID: Subject: Re: [PATCH 2/5] dts: skip first line of send_command output To: Luca Vizzarro Cc: dev@dpdk.org, Jeremy Spewock , Paul Szczepanek , Jack Bond-Preston Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 On Fri, Apr 12, 2024 at 1:11=E2=80=AFPM Luca Vizzarro wrote: > > The first line of the InteractiveShell send_command method is generally > the command input field. This sometimes is unwanted, therefore this > commit enables the possibility of omitting the first line from the > returned output. > Oh, the first commit message was confusing. It said leading prompt which I understood to be the first prompt (the one with the command). I see that this commit actually addresses what I thought the first commit was trying to do. > Signed-off-by: Luca Vizzarro > Reviewed-by: Paul Szczepanek > Reviewed-by: Jack Bond-Preston > --- > dts/framework/remote_session/interactive_shell.py | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/dts/framework/remote_session/interactive_shell.py b/dts/fram= ework/remote_session/interactive_shell.py > index 8a9bf96ea9..e290a083e9 100644 > --- a/dts/framework/remote_session/interactive_shell.py > +++ b/dts/framework/remote_session/interactive_shell.py > @@ -105,7 +105,9 @@ def _start_application(self, get_privileged_command: = Callable[[str], str] | None > start_command =3D get_privileged_command(start_command) > self.send_command(start_command) > > - def send_command(self, command: str, prompt: str | None =3D None) ->= str: > + def send_command( > + self, command: str, prompt: str | None =3D None, skip_first_line= : bool =3D False Do we generally want or don't want to include the first line? When do we absolutely not want to include it? > + ) -> str: > """Send `command` and get all output before the expected ending = string. > > Lines that expect input are not included in the stdout buffer, s= o they cannot > @@ -121,6 +123,7 @@ def send_command(self, command: str, prompt: str | No= ne =3D None) -> str: > command: The command to send. > prompt: After sending the command, `send_command` will be ex= pecting this string. > If :data:`None`, will use the class's default prompt. > + skip_first_line: Skip the first line when capturing the outp= ut. > > Returns: > All output in the buffer before expected string. > @@ -132,6 +135,9 @@ def send_command(self, command: str, prompt: str | No= ne =3D None) -> str: > self._stdin.flush() > out: str =3D "" > for line in self._stdout: > + if skip_first_line: > + skip_first_line =3D False > + continue Is there ever a reason to distinguish between the first line and the line with the command on it? > if prompt in line and not line.rstrip().endswith( > command.rstrip() > ): # ignore line that sent command > -- > 2.34.1 >