Skip to content

Commit 714c134

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5c46677 commit 714c134

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

ci/lib.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,9 @@ handle_failed_tests () {
180180
}
181181

182182
create_failed_test_artifacts () {
183-
mkdir -p t/failed-test-artifacts
183+
mkdir -p "${TEST_OUTPUT_DIRECTORY:-t}"/failed-test-artifacts
184184

185-
for test_exit in t/test-results/*.exit
185+
for test_exit in "${TEST_OUTPUT_DIRECTORY:-t}"/test-results/*.exit
186186
do
187187
test 0 != "$(cat "$test_exit")" || continue
188188

@@ -191,11 +191,11 @@ create_failed_test_artifacts () {
191191
printf "\\e[33m\\e[1m=== Failed test: ${test_name} ===\\e[m\\n"
192192
echo "The full logs are in the 'print test failures' step below."
193193
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"
195195

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"
199199
done
200200
}
201201

0 commit comments

Comments
 (0)