🔧 Use current target name in failed test artifact

This commit is contained in:
Simon Schneegans
2022-08-29 21:19:10 +02:00
parent 40a42f244b
commit 21ceac571e
2 changed files with 10 additions and 11 deletions
+1 -4
View File
@@ -102,7 +102,4 @@ jobs:
if: failure() if: failure()
with: with:
name: log_${{ matrix.version }}_${{ matrix.session }} name: log_${{ matrix.version }}_${{ matrix.session }}
path: | path: tests/output/
fail.log
screen.png
crop.png
+9 -7
View File
@@ -89,14 +89,16 @@ do_in_pod() {
podman exec --user gnomeshell --workdir /home/gnomeshell "${POD}" set-env.sh "$@" podman exec --user gnomeshell --workdir /home/gnomeshell "${POD}" set-env.sh "$@"
} }
# This is called whenever a test fails. It prints an error message (given as first # This is called whenever a test fails. It prints an error message (given as second
# parameter), captures a screenshot to "fail.png" and stores a log in "fail.log". # parameter), saves a current screenshot, the current cropped target and a log to
# "tests/output/".
fail() { fail() {
echo "${1}" echo "${2}"
mv "${WORK_DIR}/crop.png" . mkdir "tests/output"
mv "${WORK_DIR}/screen.png" . mv "${WORK_DIR}/crop.png" "tests/output/${1}"
mv "${WORK_DIR}/screen.png" tests/output/
LOG=$(do_in_pod sudo journalctl) LOG=$(do_in_pod sudo journalctl)
echo "${LOG}" > fail.log echo "${LOG}" > tests/output/fail.log
exit 1 exit 1
} }
@@ -113,7 +115,7 @@ compare_with_target() {
DIFF=$(compare "${WORK_DIR}/crop.png" "${1}" -metric NCC "${WORK_DIR}/diff.png" 2>&1) || true DIFF=$(compare "${WORK_DIR}/crop.png" "${1}" -metric NCC "${WORK_DIR}/diff.png" 2>&1) || true
if (( $(echo "$DIFF < 0.9" |bc -l) )); then if (( $(echo "$DIFF < 0.9" |bc -l) )); then
fail "${2}" fail "${1}" "${2}"
fi fi
} }