Skip to content

Commit

Permalink
enhance/fix test_run_shell_cmd_fail, need to take into account colore…
Browse files Browse the repository at this point in the history
…d output produced by run_shell_cmd for failing command
  • Loading branch information
boegel committed Oct 3, 2024
1 parent 377e66d commit e996c51
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions test/framework/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,12 +491,13 @@ def handler(signum, _):
# check error reporting output
stderr = stderr.getvalue()
patterns = [
r"^ERROR: Shell command failed!",
r"^\s+full command\s* -> kill -9 \$\$",
r"^\s+exit code\s* -> -9",
r"^\s+working directory\s* -> " + work_dir,
r"^\s+called from\s* -> 'test_run_shell_cmd_fail' function in .*/test/.*/run.py \(line [0-9]+\)",
r"^\s+output \(stdout \+ stderr\)\s* -> .*/run-shell-cmd-output/kill-.*/out.txt",
r"ERROR: Shell command failed!",
r"\s+full command\s* -> kill -9 \$\$",
r"\s+exit code\s* -> -9",
r"\s+working directory\s* -> " + work_dir,
r"\s+called from\s* -> 'test_run_shell_cmd_fail' function in .*/test/.*/run.py \(line [0-9]+\)",
r"\s+output \(stdout \+ stderr\)\s* -> .*/run-shell-cmd-output/kill-.*/out.txt",
r"\s+interactive shell script\s* -> .*/run-shell-cmd-output/kill-.*/cmd.sh",
]
for pattern in patterns:
regex = re.compile(pattern, re.M)
Expand Down Expand Up @@ -526,13 +527,14 @@ def handler(signum, _):
# check error reporting output
stderr = stderr.getvalue()
patterns = [
r"^ERROR: Shell command failed!",
r"^\s+full command\s+ -> kill -9 \$\$",
r"^\s+exit code\s+ -> -9",
r"^\s+working directory\s+ -> " + work_dir,
r"^\s+called from\s+ -> 'test_run_shell_cmd_fail' function in .*/test/.*/run.py \(line [0-9]+\)",
r"^\s+output \(stdout\)\s+ -> .*/run-shell-cmd-output/kill-.*/out.txt",
r"^\s+error/warnings \(stderr\)\s+ -> .*/run-shell-cmd-output/kill-.*/err.txt",
r"ERROR: Shell command failed!",
r"\s+full command\s+ -> kill -9 \$\$",
r"\s+exit code\s+ -> -9",
r"\s+working directory\s+ -> " + work_dir,
r"\s+called from\s+ -> 'test_run_shell_cmd_fail' function in .*/test/.*/run.py \(line [0-9]+\)",
r"\s+output \(stdout\)\s+ -> .*/run-shell-cmd-output/kill-.*/out.txt",
r"\s+error/warnings \(stderr\)\s+ -> .*/run-shell-cmd-output/kill-.*/err.txt",
r"\s+interactive shell script\s* -> .*/run-shell-cmd-output/kill-.*/cmd.sh",
]
for pattern in patterns:
regex = re.compile(pattern, re.M)
Expand Down

0 comments on commit e996c51

Please sign in to comment.