pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/41982?usp=email )

Change subject: Revert "testenv: less cluttered output for failed cmds"
......................................................................

Revert "testenv: less cluttered output for failed cmds"

This reverts commit 648954ff1ab94620833b484d8131d001c61faa78.

Change-Id: I84f954e7f7d6c3b8051d29d8fc20060d7075852c
Related: OS#6935
---
M _testenv/testenv/cmd.py
1 file changed, 11 insertions(+), 4 deletions(-)

Approvals:
  Jenkins Builder: Verified
  osmith: Looks good to me, approved




diff --git a/_testenv/testenv/cmd.py b/_testenv/testenv/cmd.py
index bde0bf3..c14f694 100644
--- a/_testenv/testenv/cmd.py
+++ b/_testenv/testenv/cmd.py
@@ -1,11 +1,10 @@
-# Copyright 2026 sysmocom - s.f.m.c. GmbH
+# Copyright 2024 sysmocom - s.f.m.c. GmbH
 # SPDX-License-Identifier: GPL-3.0-or-later
 import logging
 import os
 import os.path
 import re
 import subprocess
-import sys
 import testenv
 import testenv.testsuite

@@ -80,6 +79,15 @@
         env_extra["TESTENV_QEMU_SCRIPTS"] = os.path.join(testenv.data_dir, 
"scripts/qemu")


+def exit_error_cmd(completed, error_msg):
+    """:param completed: return from run_cmd() below"""
+
+    logging.error(error_msg)
+    logging.debug(f"Command: {completed.args}")
+    logging.debug(f"Returncode: {completed.returncode}")
+    raise RuntimeError("shell command related error, find details right above 
this python trace")
+
+
 def generate_env(env={}, podman=False):
     ret = dict(env_extra)
     path = os.path.join(testenv.data_dir, "scripts")
@@ -131,5 +139,4 @@
     if p.returncode == 0 or not check:
         return p

-    logging.error(f"Command failed unexpectedly (returncode: {p.returncode})")
-    sys.exit(1)
+    exit_error_cmd(p, "Command failed unexpectedly")

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/41982?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I84f954e7f7d6c3b8051d29d8fc20060d7075852c
Gerrit-Change-Number: 41982
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to