Skip to content

Commit e996c51

Browse files
committed
enhance/fix test_run_shell_cmd_fail, need to take into account colored output produced by run_shell_cmd for failing command
1 parent 377e66d commit e996c51

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

test/framework/run.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -491,12 +491,13 @@ def handler(signum, _):
491491
# check error reporting output
492492
stderr = stderr.getvalue()
493493
patterns = [
494-
r"^ERROR: Shell command failed!",
495-
r"^\s+full command\s* -> kill -9 \$\$",
496-
r"^\s+exit code\s* -> -9",
497-
r"^\s+working directory\s* -> " + work_dir,
498-
r"^\s+called from\s* -> 'test_run_shell_cmd_fail' function in .*/test/.*/run.py \(line [0-9]+\)",
499-
r"^\s+output \(stdout \+ stderr\)\s* -> .*/run-shell-cmd-output/kill-.*/out.txt",
494+
r"ERROR: Shell command failed!",
495+
r"\s+full command\s* -> kill -9 \$\$",
496+
r"\s+exit code\s* -> -9",
497+
r"\s+working directory\s* -> " + work_dir,
498+
r"\s+called from\s* -> 'test_run_shell_cmd_fail' function in .*/test/.*/run.py \(line [0-9]+\)",
499+
r"\s+output \(stdout \+ stderr\)\s* -> .*/run-shell-cmd-output/kill-.*/out.txt",
500+
r"\s+interactive shell script\s* -> .*/run-shell-cmd-output/kill-.*/cmd.sh",
500501
]
501502
for pattern in patterns:
502503
regex = re.compile(pattern, re.M)
@@ -526,13 +527,14 @@ def handler(signum, _):
526527
# check error reporting output
527528
stderr = stderr.getvalue()
528529
patterns = [
529-
r"^ERROR: Shell command failed!",
530-
r"^\s+full command\s+ -> kill -9 \$\$",
531-
r"^\s+exit code\s+ -> -9",
532-
r"^\s+working directory\s+ -> " + work_dir,
533-
r"^\s+called from\s+ -> 'test_run_shell_cmd_fail' function in .*/test/.*/run.py \(line [0-9]+\)",
534-
r"^\s+output \(stdout\)\s+ -> .*/run-shell-cmd-output/kill-.*/out.txt",
535-
r"^\s+error/warnings \(stderr\)\s+ -> .*/run-shell-cmd-output/kill-.*/err.txt",
530+
r"ERROR: Shell command failed!",
531+
r"\s+full command\s+ -> kill -9 \$\$",
532+
r"\s+exit code\s+ -> -9",
533+
r"\s+working directory\s+ -> " + work_dir,
534+
r"\s+called from\s+ -> 'test_run_shell_cmd_fail' function in .*/test/.*/run.py \(line [0-9]+\)",
535+
r"\s+output \(stdout\)\s+ -> .*/run-shell-cmd-output/kill-.*/out.txt",
536+
r"\s+error/warnings \(stderr\)\s+ -> .*/run-shell-cmd-output/kill-.*/err.txt",
537+
r"\s+interactive shell script\s* -> .*/run-shell-cmd-output/kill-.*/cmd.sh",
536538
]
537539
for pattern in patterns:
538540
regex = re.compile(pattern, re.M)

0 commit comments

Comments
 (0)