Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/ci/print-test-failures.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / ci / print-test-failures.sh` 89 lines ยท 2579 bytes Raw Blame History 1 #!/bin/sh 2 # 3 # Print output of failing tests 4 # 5 6 . ${0%/*}/lib.sh 7 8 # Tracing executed commands would produce too much noise in the loop below. 9 set +x 10 11 cd "${TEST_OUTPUT_DIRECTORY:-t/}" 12 13 if ! ls test-results/*.exit >/dev/null 2>/dev/null 14 then 15 echo "Build job failed before the tests could have been run" 16 exit 17 fi 18 19 case "$jobname" in 20 osx-clang|osx-gcc) 21 # base64 in OSX doesn't wrap its output at 76 columns by 22 # default, but prints a single, very long line. 23 base64_opts="-b 76" 24 ;; 25 esac 26 27 combined_trash_size=0 28 for TEST_EXIT in test-results/*.exit 29 do 30 if [ "$(cat "$TEST_EXIT")" != "0" ] 31 then 32 TEST_OUT="${TEST_EXIT%exit}out" 33 echo "------------------------------------------------------------------------" 34 echo "$(tput setaf 1)${TEST_OUT}...$(tput sgr0)" 35 echo "------------------------------------------------------------------------" 36 cat "${TEST_OUT}" 37 38 test_name="${TEST_EXIT%.exit}" 39 test_name="${test_name##*/}" 40 trash_dir="trash directory.$test_name" 41 case "$CI_TYPE" in 42 github-actions) 43 mkdir -p failed-test-artifacts 44 echo "FAILED_TEST_ARTIFACTS=${TEST_OUTPUT_DIRECTORY:-t}/failed-test-artifacts" >>$GITHUB_ENV 45 cp "${TEST_EXIT%.exit}.out" failed-test-artifacts/ 46 tar czf failed-test-artifacts/"$test_name".trash.tar.gz "$trash_dir" 47 continue 48 ;; 49 gitlab-ci) 50 mkdir -p failed-test-artifacts 51 cp "${TEST_EXIT%.exit}.out" failed-test-artifacts/ 52 tar czf failed-test-artifacts/"$test_name".trash.tar.gz "$trash_dir" 53 continue 54 ;; 55 *) 56 echo "Unhandled CI type: $CI_TYPE" >&2 57 exit 1 58 ;; 59 esac 60 trash_tgz_b64="trash.$test_name.base64" 61 if [ -d "$trash_dir" ] 62 then 63 tar czp "$trash_dir" |base64 $base64_opts >"$trash_tgz_b64" 64 65 trash_size=$(wc -c <"$trash_tgz_b64") 66 if [ $trash_size -gt `1048576` ] 67 then 68 # larger than 1MB 69 echo "$(tput setaf 1)Didn't include the trash directory of '$test_name' in the trace log, it's too big$(tput sgr0)" 70 continue 71 fi 72 73 new_combined_trash_size=$(($combined_trash_size + $trash_size)) 74 if [ $new_combined_trash_size -gt `1048576` ] 75 then 76 echo "$(tput setaf 1)Didn't include the trash directory of '$test_name' in the trace log, there is plenty of trash in there already.$(tput sgr0)" 77 continue 78 fi 79 combined_trash_size=$new_combined_trash_size 80 81 # DO NOT modify these two 'echo'-ed strings below 82 # without updating 'ci/util/extract-trash-dirs.sh' 83 # as well. 84 echo "$(tput setaf 1)Start of trash directory of '$test_name':$(tput sgr0)" 85 cat "$trash_tgz_b64" 86 echo "$(tput setaf 1)End of trash directory of '$test_name'$(tput sgr0)" 87 fi 88 fi 89 done