Git fork

ci/lib: support custom output directories when creating test artifacts

Update `create_failed_test_artifacts ()` so that it can handle arbitrary
test output directories. This fixes creation of these artifacts for
macOS on GitLab CI, which uses a separate output directory already. This
will also be used by our out-of-tree builds with Meson.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Patrick Steinhardt and committed by
Junio C Hamano
714c134d 5c466770

+6 -6
+6 -6
ci/lib.sh
··· 180 180 } 181 181 182 182 create_failed_test_artifacts () { 183 - mkdir -p t/failed-test-artifacts 183 + mkdir -p "${TEST_OUTPUT_DIRECTORY:-t}"/failed-test-artifacts 184 184 185 - for test_exit in t/test-results/*.exit 185 + for test_exit in "${TEST_OUTPUT_DIRECTORY:-t}"/test-results/*.exit 186 186 do 187 187 test 0 != "$(cat "$test_exit")" || continue 188 188 ··· 191 191 printf "\\e[33m\\e[1m=== Failed test: ${test_name} ===\\e[m\\n" 192 192 echo "The full logs are in the 'print test failures' step below." 193 193 echo "See also the 'failed-tests-*' artifacts attached to this run." 194 - cat "t/test-results/$test_name.markup" 194 + cat "${TEST_OUTPUT_DIRECTORY:-t}/test-results/$test_name.markup" 195 195 196 - trash_dir="t/trash directory.$test_name" 197 - cp "t/test-results/$test_name.out" t/failed-test-artifacts/ 198 - tar czf t/failed-test-artifacts/"$test_name".trash.tar.gz "$trash_dir" 196 + trash_dir="${TEST_OUTPUT_DIRECTORY:-t}/trash directory.$test_name" 197 + cp "${TEST_OUTPUT_DIRECTORY:-t}/test-results/$test_name.out" "${TEST_OUTPUT_DIRECTORY:-t}"/failed-test-artifacts/ 198 + tar czf "${TEST_OUTPUT_DIRECTORY:-t}/failed-test-artifacts/$test_name.trash.tar.gz" "$trash_dir" 199 199 done 200 200 } 201 201