diff mbox series

arm/lib: Do not log FVP return codes < 0

Message ID 20221014092823.2888861-1-peter.hoyes@arm.com
State New
Headers show
Series arm/lib: Do not log FVP return codes < 0 | expand

Commit Message

Peter Hoyes Oct. 14, 2022, 9:28 a.m. UTC
From: Peter Hoyes <Peter.Hoyes@arm.com>

If a process is terminated using a signal, in Python its return code is
-N, where N is the signal number (e.g. -15 for SIGTERM). Currently, all
non-zero return codes are printed using logger.info, which gives the
impression of an abnormal termination even when the process was
explicitly terminated by FVPRunner.

Instead, only log return codes greater than zero.

Issue-Id: SCM-5314
Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>
Change-Id: I1a1e9d8aa3f26c14b48be718498bcb14707950b7
---
 meta-arm/lib/fvp/runner.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Jon Mason Oct. 14, 2022, 1:44 p.m. UTC | #1
On Fri, 14 Oct 2022 10:28:23 +0100, Peter Hoyes wrote:
> If a process is terminated using a signal, in Python its return code is
> -N, where N is the signal number (e.g. -15 for SIGTERM). Currently, all
> non-zero return codes are printed using logger.info, which gives the
> impression of an abnormal termination even when the process was
> explicitly terminated by FVPRunner.
> 
> Instead, only log return codes greater than zero.

Applied, thanks!

[1/1] arm/lib: Do not log FVP return codes < 0
      commit: d87c445b2420617013ff1acf2af17cb378fd8b16

Best regards,
diff mbox series

Patch

diff --git a/meta-arm/lib/fvp/runner.py b/meta-arm/lib/fvp/runner.py
index c5c795dd..28351a39 100644
--- a/meta-arm/lib/fvp/runner.py
+++ b/meta-arm/lib/fvp/runner.py
@@ -108,7 +108,10 @@  class FVPRunner:
             console.expect(pexpect.EOF, timeout=5.0)
             console.close()
 
-        if self._fvp_process and self._fvp_process.returncode:
+        if self._fvp_process and self._fvp_process.returncode and \
+                self._fvp_process.returncode > 0:
+            # Return codes < 0 indicate that the process was explicitly
+            # terminated above.
             self._logger.info(f"FVP quit with code {self._fvp_process.returncode}")
             return self._fvp_process.returncode
         else: