From a0407a6ecfdb983e9feeacb4dc50a6000863a5d2 Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Fri, 18 Apr 2025 14:22:38 +0200 Subject: [PATCH] ci/vkd3d: fail shell pipeline when part of it fails We use pipes in several places and don't want to ignore their failures. A couple of exceptions are allowed with explicit `|| true`. Part-of: --- .gitlab-ci/vkd3d-runner.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci/vkd3d-runner.sh b/.gitlab-ci/vkd3d-runner.sh index d35dfda19e7..401baa50f89 100755 --- a/.gitlab-ci/vkd3d-runner.sh +++ b/.gitlab-ci/vkd3d-runner.sh @@ -3,7 +3,7 @@ . "${SCRIPTS_DIR}/setup-test-env.sh" -set -eu +set -eu -o pipefail comma_separated() { local IFS=, @@ -51,7 +51,10 @@ fi # Gather the list expected failures EXPECTATIONFILE="$RESULTS_DIR/$GPU_VERSION-vkd3d-fails.txt" if [ -f "$INSTALL/$GPU_VERSION-vkd3d-fails.txt" ]; then - grep -vE '^(#|$)' "$INSTALL/$GPU_VERSION-vkd3d-fails.txt" | sort > "$EXPECTATIONFILE" + # Ignore the grep "failure" if the file exists but contains only comments + # or empty lines; the expectation file used will be empty in this case, + # which is not a problem. + grep -vE '^(#|$)' "$INSTALL/$GPU_VERSION-vkd3d-fails.txt" | sort > "$EXPECTATIONFILE" || true else printf "%s\n" "$GPU_VERSION-vkd3d-fails.txt not found, assuming a \"no failures\" baseline." touch "$EXPECTATIONFILE" @@ -90,7 +93,9 @@ printf "%s\n" "Running vkd3d-proton testsuite..." LOGFILE="$RESULTS_DIR/vkd3d-proton-log.txt" TEST_LOGS="/test-logs" -(cd /vkd3d-proton-tests && tests/test-runner.sh ./d3d12 --jobs "${FDO_CI_CONCURRENT:-4}" --output-dir "$TEST_LOGS" | tee "$LOGFILE") +pushd /vkd3d-proton-tests +tests/test-runner.sh ./d3d12 --jobs "${FDO_CI_CONCURRENT:-4}" --output-dir "$TEST_LOGS" | tee "$LOGFILE" || true +popd printf '\n\n' @@ -108,8 +113,8 @@ if [ ${#flakes_seen[@]} -gt 0 ]; then printf >&2 ' %s\n' "${flakes_seen[@]}" fi -# Collect all the failures -fails_lines=$(grep -oE "^FAILED .+$" "$LOGFILE" | cut -d' ' -f2 | sort) +# Collect all the failures; ignore grep "failure" if there are none +fails_lines=$(grep -oE "^FAILED .+$" "$LOGFILE" | cut -d' ' -f2 | sort) || true if [ -n "$fails_lines" ]; then mapfile -t fails < <(echo "$fails_lines") else