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 487F14401B; Mon, 13 May 2024 16:58:24 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DE661402EC; Mon, 13 May 2024 16:58:23 +0200 (CEST) Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) by mails.dpdk.org (Postfix) with ESMTP id 538A9402CD for ; Mon, 13 May 2024 16:58:22 +0200 (CEST) Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-a59a352bbd9so734394866b.1 for ; Mon, 13 May 2024 07:58:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pantheon.tech; s=google; t=1715612302; x=1716217102; 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=2pBIEr4ubx7GA+WCNoG6W94vmQuroBSUTfgs16MVuLw=; b=CyEFIMzNCI2/lyUGgDm32nWCxuHIj66Nh/v7jrGR/NNFp4gmGWQiGcfgRFb/htT/SB xMfurSar6GyaUtmbutAYr5jYT7Rf3ZfdjCosV1G0/UMWFk/hT+Kbog6o1PIRThhqocC7 82sb7WfjBOziye5cXORSAzqb0YquT1s0xjpdtZkbXlsU0LDPL/p4MZEhYnhlifTVJjeJ rLuoNxYmxrnDfVxIV2cJoL0EwxvMQppewbtqkklqI+xo1v3ultXlOYiEUgLcEjhD3Bpp GGBgYpoY6NiVQ1himKbCfup1twLguSmsODQvXEBph3fEwOkJmbrKFyAeq+7rtt0ZOe19 beqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715612302; x=1716217102; 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=2pBIEr4ubx7GA+WCNoG6W94vmQuroBSUTfgs16MVuLw=; b=G4ZLgeIB/fAbzBZHw30IAHQdatUD3NrPedx0ro9ExjGH28epS2uN86DWZkJSAGmvYc I/MJPHLo0SZQaivqGwGNPzNAEz5lIEJKeHeCZCggz7n0t9eUIJP/JzFsPlcGK6GLNQaI WXSW7KY2aaQK2t53LYXbLqLJmugIpn9MMI54tjj+wVkHROHtmSY0+9ZuOdcfEuS5KwRp aeASjnhwvzlyoP8x4WKfmtsXqbmG5uhlAKPeA/BzUFNJ/KdYgNaZa8+5XTet4Ou7NQIB D0nRgZk6Cm+a/Gz252zdPqkBB7OGRJvn63DyO43bD6WSSm1aDKdcPbpohYuYHUFkSIW0 28UQ== X-Forwarded-Encrypted: i=1; AJvYcCXZsnrTuvYuUpnOMdLGM/oiwsPxTLVrT7uT5ZZeqcw21gtZv8lh3l8mW6+5tyM89tgPCc2bXBI+cGeloik= X-Gm-Message-State: AOJu0YwfZytTqAk5WskP58JpzNIdzZEa80VNkiz2FQDGb5I7lvYIZpy7 cO8hrz4Jtnk3a8ptk2iyTay1J6rEMg5JBOx3r2YnVQJJkydszoVIksUktREHsjPQmJ5+ZFcTKGc 0eS+/SOaETnV/YuiEgwMYEze64gHgQgGX+kHaRQ== X-Google-Smtp-Source: AGHT+IHwf59G+EHxfDY90SwRbDD6oO3LK3LJ/o/TGDblJZLnaOPR+V+daLOv3tjroatjB1m9qvbOUqPOP4R2CFc3LMU= X-Received: by 2002:a17:907:720f:b0:a59:9ed5:eefc with SMTP id a640c23a62f3a-a5a2d30ba12mr1151954666b.32.1715612301947; Mon, 13 May 2024 07:58:21 -0700 (PDT) MIME-Version: 1.0 References: <20240312172558.11844-1-jspewock@iol.unh.edu> <20240501161623.26672-1-jspewock@iol.unh.edu> <20240501161623.26672-2-jspewock@iol.unh.edu> In-Reply-To: <20240501161623.26672-2-jspewock@iol.unh.edu> From: =?UTF-8?Q?Juraj_Linke=C5=A1?= Date: Mon, 13 May 2024 16:58:11 +0200 Message-ID: Subject: Re: [PATCH v2 1/3] dts: Improve output gathering in interactive shells To: jspewock@iol.unh.edu Cc: Luca.Vizzarro@arm.com, wathsala.vithanage@arm.com, yoan.picchi@foss.arm.com, paul.szczepanek@arm.com, probb@iol.unh.edu, thomas@monjalon.net, Honnappa.Nagarahalli@arm.com, dev@dpdk.org 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 Other than the one minor documentation nitpick, Reviewed-by: Juraj Linke=C5=A1 > diff --git a/dts/framework/remote_session/interactive_shell.py b/dts/fram= ework/remote_session/interactive_shell.py > @@ -124,20 +130,34 @@ def send_command(self, command: str, prompt: str | = None =3D None) -> str: > > Returns: > All output in the buffer before expected string. > + > + Raises: > + InteractiveSSHSessionDeadError: The session died while execu= ting the command. > + InteractiveSSHTimeoutError: If command was sent but prompt c= ould not be found in > + the output before the timeout. > """ > self._logger.info(f"Sending: '{command}'") > if prompt is None: > prompt =3D self._default_prompt > - self._stdin.write(f"{command}{self._command_extra_chars}\n") > - self._stdin.flush() > out: str =3D "" > - for line in self._stdout: > - out +=3D line > - if prompt in line and not line.rstrip().endswith( > - command.rstrip() > - ): # ignore line that sent command > - break > - self._logger.debug(f"Got output: {out}") > + try: > + self._stdin.write(f"{command}{self._command_extra_chars}\n") > + self._stdin.flush() > + for line in self._stdout: > + out +=3D line > + if line.rstrip().endswith(prompt): > + break We should document the (currently) hidden assumption of us needing to use the extra command chars to force another prompt in the docstring. > + except TimeoutError as e: > + self._logger.exception(e) > + self._logger.debug( > + f"Prompt ({prompt}) was not found in output from command= before timeout." > + ) > + raise InteractiveSSHTimeoutError(command) from e > + except OSError as e: > + self._logger.exception(e) > + raise InteractiveSSHSessionDeadError(self._interactive_sessi= on.hostname) from e > + finally: > + self._logger.debug(f"Got output: {out}") > return out > > def close(self) -> None: > -- > 2.44.0 >