Skip to content
13 changes: 10 additions & 3 deletions src/integrationtest/integrationtest_drunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,8 +613,8 @@ class RunResult:
cwd=run_dir
)

# print out each line of captured output, as well as add it to the string that we
# pass back to the user, subject to the verbosity level that the user has requested
# print out each line of captured output, subject to the verbosity level that the
# user has requested, as well as add it to the string that we pass back to the user
tmp_string = request.config.getoption("--dunerc-fullprint-watch-string")
full_printout_watch_string = tmp_string.replace("_SPC_", " ")
full_printout_activated = False
Expand Down Expand Up @@ -643,7 +643,9 @@ class RunResult:

# check for errors and warnings for all verbosity levels
if should_be_printed == False:
if ("error" in line.lower() and (not "In error" in line and not "Endpoint" in line)) or "warning" in line.lower():
lc_line = line.lower()
if ("error" in lc_line and (not "In error" in line and not "Endpoint" in line)) \
or "warning" in lc_line or "critical" in lc_line:
should_be_printed = True

# check for basic transition messages, if that level of verbosity is requested
Expand Down Expand Up @@ -673,6 +675,11 @@ class RunResult:
rc_process.communicate()
proc_returncode = rc_process.returncode

# store the full dunerc console output in a log file for reference and checking
with open(f"{run_dir}/log_{getpass.getuser()}_drunc_console_output.txt", "w", encoding="utf-8") as ff:

@PawelPlesniak PawelPlesniak Jul 24, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is exactly what is needed, but I suggest an extension here. Investigating the logfile, mani ANSI escape characters associated with the use of the rich output with color coding is including additional verbosity as

�[2;34m[2026/07/24 11:47:01 UTC]�[0m �[1;32mINFO      �[0m �[2;37mshell.py:158                            �[0m �[2;37mdrunc.unified_shell                               �[0m User pplesnia �[32mstarting the unified_shell�[0m
�[2;34m[2026/07/24 11:47:01 UTC]�[0m �[1;32mINFO      �[0m �[2;37mshell.py:214                            �[0m �[2;37mdrunc.unified_shell                               �[0m �[32mSetting up the SSH_SHELL process manager�[0m with configuration �[32mssh-standalone�[0m
�[2;34m[2026/07/24 11:47:01 UTC]�[0m �[1;32mINFO      �[0m �[2;37mshell.py:231                            �[0m �[2;37mdrunc.unified_shell                               �[0m Starting process manager
�[2;34m[2026/07/24 11:47:01 UTC]�[0m �[1;32mINFO      �[0m �[2;37mprocess_manager.py:111                  �[0m �[2;37mdrunc.process_manager                             �[0m process_manager communicating through address �[1;92m10.73.136.70�[0m�[1;32m:�[0m�[1;36m38319�[0m
�[2;34m[2026/07/24 11:47:01 UTC]�[0m �[1;32mINFO      �[0m �[2;37mshell.py:291                            �[0m �[2;37mdrunc.unified_shell                               �[0m Setting up the controller interface

There was a similar case of this when @emmuhamm overhauled the python logging framework, and the stripping of this was implemented in daqsystemtest in this PR. Would it be possible to implement this?

no_ansi_output = re.sub(r"\x1b\[[0-9;]*m", "", full_output)
ff.write(no_ansi_output)

# construct a CompletedProcess instance to be passed back to the user. In this way,
# user code does not need to change in response to the change in this code from
# using subprocess.run() to subprocess.Popen().
Expand Down
7 changes: 4 additions & 3 deletions src/integrationtest/log_file_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ def logs_are_error_free(log_file_names, show_all_problems=True, print_logfilenam
["RAN:", "LogLevel=error"]
)

# 21-Jul-2026, KAB: phrases that we always want to exclude
excluded_substring_map.setdefault("drunc", []).extend(["Substate.*In error.*Endpoint"])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the movtivation for excluding the phrase "Endpoint" or "Substate" here?


all_ok=True
#print("") # Clear potential dot from pytest
for log in log_file_names:
Expand All @@ -121,13 +124,11 @@ def logs_are_error_free(log_file_names, show_all_problems=True, print_logfilenam
match_obj = re.search(exclusion_key, log.name)
if match_obj:
exclusions += excluded_substring_map[exclusion_key]
break
for required_key in required_substring_map.keys():
match_obj = re.search(required_key, log.name)
if match_obj:
requireds += required_substring_map[required_key]
break


single_ok=log_has_no_errors(log, print_logfilename_for_problems, exclusions, requireds,
print_required_message_report, verbosity_helper)

Expand Down