@@ -8,33 +8,36 @@ set -e
. ${0%/*}/lib-ci-type.sh
. ${0%/*}/lib-tput.sh
-cd t/
-
-if ! ls test-results/*.exit >/dev/null 2>/dev/null
+if ! ls t/test-results/*.exit >/dev/null 2>/dev/null
then
echo "Build job failed before the tests could have been run"
exit
fi
-for TEST_EXIT in test-results/*.exit
+for TEST_EXIT in t/test-results/*.exit
do
if [ "$(cat "$TEST_EXIT")" != "0" ]
then
- TEST_OUT="${TEST_EXIT%exit}out"
+ TEST_NAME="${TEST_EXIT%.exit}"
+ TEST_NAME="${TEST_NAME##*/}"
+ TEST_OUT="${TEST_NAME}.out"
+ TEST_MARKUP="${TEST_NAME}.markup"
+
echo "------------------------------------------------------------------------"
- echo "$(tput setaf 1)${TEST_OUT}...$(tput sgr0)"
+ echo "$(tput setaf 1)test-results/${TEST_OUT}...$(tput sgr0)"
echo "------------------------------------------------------------------------"
- cat "${TEST_OUT}"
+ cat "t/test-results/${TEST_OUT}"
- test_name="${TEST_EXIT%.exit}"
- test_name="${test_name##*/}"
- trash_dir="trash directory.$test_name"
+ trash_dir="trash directory.$TEST_NAME"
case "$CI_TYPE" in
github-actions)
- mkdir -p failed-test-artifacts
+ mkdir -p t/failed-test-artifacts
echo "FAILED_TEST_ARTIFACTS=t/failed-test-artifacts" >>$GITHUB_ENV
- cp "${TEST_EXIT%.exit}.out" failed-test-artifacts/
- tar czf failed-test-artifacts/"$test_name".trash.tar.gz "$trash_dir"
+ cp "t/test-results/${TEST_OUT}" t/failed-test-artifacts/
+ (
+ cd t &&
+ tar czf failed-test-artifacts/"$TEST_NAME".trash.tar.gz "$trash_dir"
+ )
;;
esac
fi
Change the logic in ci/print-test-failures.sh so that we don't need to "cd" at the top-level, we'll now only do so for the "tar" command. This way we can remove some duplicate code added in aea8879a6ac (travis-ci: include the trash directories of failed tests in the trace log, 2018-08-01), i.e. not have both a $TEST_NAME and $test_name. The output is exactly the same as before, i.e. "test-results/" was included in the heading. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- ci/print-test-failures.sh | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-)