Skip to content

Commit

Permalink
test/system: ignore 127 if it is the expected rc
Browse files Browse the repository at this point in the history
Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Oct 18, 2023
1 parent b0a45a9 commit 6417104
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/system/helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -339,11 +339,18 @@ function run_podman() {
# Remember command args, for possible use in later diagnostic messages
MOST_RECENT_PODMAN_COMMAND="podman $*"

# BATS treats 127 as a special case, so we need to silence it when 127 is the
# expected rc: https://bats-core.readthedocs.io/en/stable/warnings/BW01.html
silence127=""
if [ $expected_rc -eq 127 ]; then
silence127="-127"
fi

# stdout is only emitted upon error; this printf is to help in debugging
printf "\n%s %s %s %s\n" "$(timestamp)" "$_LOG_PROMPT" "$PODMAN" "$*"
# BATS hangs if a subprocess remains and keeps FD 3 open; this happens
# if podman crashes unexpectedly without cleaning up subprocesses.
run timeout --foreground -v --kill=10 $PODMAN_TIMEOUT $PODMAN $_PODMAN_TEST_OPTS "$@" 3>/dev/null
run $silence127 timeout --foreground -v --kill=10 $PODMAN_TIMEOUT $PODMAN $_PODMAN_TEST_OPTS "$@" 3>/dev/null
# without "quotes", multiple lines are glommed together into one
if [ -n "$output" ]; then
echo "$(timestamp) $output"
Expand Down

0 comments on commit 6417104

Please sign in to comment.