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 049B5439FE; Mon, 29 Jan 2024 14:10:26 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 89A6D40DCD; Mon, 29 Jan 2024 14:10:26 +0100 (CET) Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) by mails.dpdk.org (Postfix) with ESMTP id ABBC7402C2 for ; Mon, 29 Jan 2024 14:10:24 +0100 (CET) Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-55783b7b47aso3100989a12.0 for ; Mon, 29 Jan 2024 05:10:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pantheon.tech; s=google; t=1706533824; x=1707138624; 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=J0lHV9lwbttwY2nN+//hEMbWpp2EqnyDwIB7QCRwA/s=; b=mTo/dk5P9Die05d/e9+S1ep/5qOpTZtmOzHOkoelr4QbeMke+mKQtMXzFHrhwZGZYX JgHbFXLAFQ0nEyDgNMFyMSDpsED9EedLbmb4Jh1P4vhtyPBY0i9pvX3I3wo6gLROEvhZ Z5yreBeJVOHA5RxDEevjzWB7uzFmENN8QtrQCDQBtuhTgFzJ6iDoOiJ7ZpKhNpE73rOX 8xLJYkeoIFluA72r6cLJtKfZYoxAJyDDqM9X3jzw4AWaAP91tR8gQygcNaTuJG9qYMzy sNF2fR6AJaNM1gCiAEhgTyFoc4s6HttsCAn7J5LwTyL0mVvQ7tsnYX8UD4vYRpiUcebW i3WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706533824; x=1707138624; 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=J0lHV9lwbttwY2nN+//hEMbWpp2EqnyDwIB7QCRwA/s=; b=lNPX6KVWAPQhMcYMFeSPvTISQppXEYd++4FGOIKueGCqMvksNvsnQZ4BUw5U70KF7t EjmIQHI19ryDiZB+0HdJJcZ79xw2rFhrDptfsaJ8L24PVIm+As9em6nDTC3+yNPNrgOw w32b7W+yp1QNaJv6V5G4Hz0HVTIh9iaaNMMRIFxeHvb+8vBDHo/ZduQKc3vx6fh7fwiD YnTYv2M2xh/fzKZ2v7Er1//ptGG4tVM+GpGinvvikCCXTVQlO3ea9TzRMwjs7OVGmPvl 0ipSDfOp9GS8jkJzBtkNPpRE4TtI5GNLW1Kny7Y7fjDqAatuRFKaAEj2NgTz0M0uTD+N 6tNQ== X-Gm-Message-State: AOJu0YzzCiy0/x21A3fzXn9gRTcJ5WeOiuEwZOtW1ZVvbxw1Hcu7Cg5p sikH6wajQnXy6AvTNT28iONItyNGLeQ3eXA8nzBhAx1EM4teNGNX1ydgNROGfq4WHTs1sD55uN2 wVklyWiW0RDMrE5bMDn13DZG1wG2WDSIh9X9XRw== X-Google-Smtp-Source: AGHT+IEqKGGUp/WMa0ls4nMDMn6VFNq18Q2tAXmzRo1bNJ1UEbHvdBZEY5KdLKHHcgxAOu5nFQS6w2R1rpqldMCbQiQ= X-Received: by 2002:a17:906:abca:b0:a35:72ed:fce5 with SMTP id kq10-20020a170906abca00b00a3572edfce5mr3375256ejb.14.1706533824235; Mon, 29 Jan 2024 05:10:24 -0800 (PST) MIME-Version: 1.0 References: <20240122182611.1904974-1-luca.vizzarro@arm.com> <20240122182611.1904974-5-luca.vizzarro@arm.com> In-Reply-To: <20240122182611.1904974-5-luca.vizzarro@arm.com> From: =?UTF-8?Q?Juraj_Linke=C5=A1?= Date: Mon, 29 Jan 2024 14:10:13 +0100 Message-ID: Subject: Re: [PATCH 4/4] dts: log stderr with failed remote commands To: Luca Vizzarro Cc: dev@dpdk.org, Paul Szczepanek 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 Mon, Jan 22, 2024 at 7:26=E2=80=AFPM Luca Vizzarro wrote: > > Add the executed command stderr to RemoteCommandExecutionError. So that > it is logged as an error, instead of just as debug. Here's I'd add logged additionally as an error, as this sounds as if we're changing debug to error. > > Reviewed-by: Paul Szczepanek > Signed-off-by: Luca Vizzarro > --- > dts/framework/exception.py | 10 +++++++--- > dts/framework/remote_session/remote_session.py | 2 +- > 2 files changed, 8 insertions(+), 4 deletions(-) > > diff --git a/dts/framework/exception.py b/dts/framework/exception.py > index 658eee2c38..9fc3fa096a 100644 > --- a/dts/framework/exception.py > +++ b/dts/framework/exception.py > @@ -130,20 +130,24 @@ class RemoteCommandExecutionError(DTSError): > #: The executed command. > command: str > _command_return_code: int > + _command_stderr: str > I'd change the order here (and all other places) so that stderr is before the return code. > - def __init__(self, command: str, command_return_code: int): > + def __init__(self, command: str, command_return_code: int, command_s= tderr: str): > """Define the meaning of the first two arguments. > > Args: > command: The executed command. > command_return_code: The return code of the executed command= . > + command_stderr: The stderr of the executed command. > """ > self.command =3D command > self._command_return_code =3D command_return_code > + self._command_stderr =3D command_stderr > > def __str__(self) -> str: > - """Include both the command and return code in the string repres= entation.""" > - return f"Command {self.command} returned a non-zero exit code: {= self._command_return_code}" > + """Include the command, its return code and stderr in the string= representation.""" > + return (f"Command '{self.command}' returned a non-zero exit code= : " > + f"{self._command_return_code}\n{self._command_stderr}") We should mention that the last string is the stderr output. Maybe we just add 'Stderr:' before {self._command_stderr}. And maybe we should put quotes around {self._command_stderr}. > > > class RemoteDirectoryExistsError(DTSError): > diff --git a/dts/framework/remote_session/remote_session.py b/dts/framewo= rk/remote_session/remote_session.py > index 2059f9a981..345439f2de 100644 > --- a/dts/framework/remote_session/remote_session.py > +++ b/dts/framework/remote_session/remote_session.py > @@ -157,7 +157,7 @@ def send_command( > ) > self._logger.debug(f"stdout: '{result.stdout}'") > self._logger.debug(f"stderr: '{result.stderr}'") > - raise RemoteCommandExecutionError(command, result.return_cod= e) > + raise RemoteCommandExecutionError(command, result.return_cod= e, result.stderr) > self._logger.debug(f"Received from '{command}':\n{result}") > self.history.append(result) > return result > -- > 2.34.1 >