From: Frantisek Sumsal Date: Tue, 2 Apr 2024 16:32:22 +0000 (+0200) Subject: test: don't hide exit code of the systemd-run process X-Git-Tag: v256-rc1~338^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d7b7bf1d488c6aa6dc2e0068e46fb61a8d75d1e;p=thirdparty%2Fsystemd.git test: don't hide exit code of the systemd-run process --- diff --git a/test/units/testsuite-54.sh b/test/units/testsuite-54.sh index 7618e92c9fa..3ed81f43592 100755 --- a/test/units/testsuite-54.sh +++ b/test/units/testsuite-54.sh @@ -8,13 +8,20 @@ set -eux systemd-analyze log-level debug -run_with_cred_compare() { +run_with_cred_compare() ( local cred="${1:?}" local exp="${2?}" + local log_file shift 2 - diff <(systemd-run -p SetCredential="$cred" --wait --pipe -- systemd-creds "$@") <(echo -ne "$exp") -} + log_file="$(mktemp)" + # shellcheck disable=SC2064 + trap "rm -f '$log_file'" RETURN + + set -o pipefail + systemd-run -p SetCredential="$cred" --wait --pipe -- systemd-creds "$@" | tee "$log_file" + diff "$log_file" <(echo -ne "$exp") +) # Sanity checks #