summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xci/lib-travisci.sh2
-rwxr-xr-xci/print-test-failures.sh55
-rwxr-xr-xci/util/extract-trash-dirs.sh50
3 files changed, 104 insertions, 3 deletions
diff --git a/ci/lib-travisci.sh b/ci/lib-travisci.sh
index ceecc88..06970f7 100755
--- a/ci/lib-travisci.sh
+++ b/ci/lib-travisci.sh
@@ -97,7 +97,7 @@ fi
export DEVELOPER=1
export DEFAULT_TEST_TARGET=prove
export GIT_PROVE_OPTS="--timer --jobs 3 --state=failed,slow,save"
-export GIT_TEST_OPTS="--verbose-log -x"
+export GIT_TEST_OPTS="--verbose-log -x --immediate"
export GIT_TEST_CLONE_2GB=YesPlease
if [ "$jobname" = linux-gcc ]; then
export CC=gcc-8
diff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh
index 4f261dd..d55460a 100755
--- a/ci/print-test-failures.sh
+++ b/ci/print-test-failures.sh
@@ -8,13 +8,24 @@
# Tracing executed commands would produce too much noise in the loop below.
set +x
-if ! ls t/test-results/*.exit >/dev/null 2>/dev/null
+cd t/
+
+if ! ls 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 t/test-results/*.exit
+case "$jobname" in
+osx-clang|osx-gcc)
+ # base64 in OSX doesn't wrap its output at 76 columns by
+ # default, but prints a single, very long line.
+ base64_opts="-b 76"
+ ;;
+esac
+
+combined_trash_size=0
+for TEST_EXIT in test-results/*.exit
do
if [ "$(cat "$TEST_EXIT")" != "0" ]
then
@@ -23,5 +34,45 @@ do
echo "$(tput setaf 1)${TEST_OUT}...$(tput sgr0)"
echo "------------------------------------------------------------------------"
cat "${TEST_OUT}"
+
+ test_name="${TEST_EXIT%.exit}"
+ test_name="${test_name##*/}"
+ trash_dir="trash directory.$test_name"
+ trash_tgz_b64="trash.$test_name.base64"
+ if [ -d "$trash_dir" ]
+ then
+ tar czp "$trash_dir" |base64 $base64_opts >"$trash_tgz_b64"
+
+ trash_size=$(wc -c <"$trash_tgz_b64")
+ if [ $trash_size -gt 1048576 ]
+ then
+ # larger than 1MB
+ echo "$(tput setaf 1)Didn't include the trash directory of '$test_name' in the trace log, it's too big$(tput sgr0)"
+ continue
+ fi
+
+ new_combined_trash_size=$(($combined_trash_size + $trash_size))
+ if [ $new_combined_trash_size -gt 1048576 ]
+ then
+ 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)"
+ continue
+ fi
+ combined_trash_size=$new_combined_trash_size
+
+ # DO NOT modify these two 'echo'-ed strings below
+ # without updating 'ci/util/extract-trash-dirs.sh'
+ # as well.
+ echo "$(tput setaf 1)Start of trash directory of '$test_name':$(tput sgr0)"
+ cat "$trash_tgz_b64"
+ echo "$(tput setaf 1)End of trash directory of '$test_name'$(tput sgr0)"
+ fi
fi
done
+
+if [ $combined_trash_size -gt 0 ]
+then
+ echo "------------------------------------------------------------------------"
+ echo "Trash directories embedded in this log can be extracted by running:"
+ echo
+ echo " curl https://api.travis-ci.org/v3/job/$TRAVIS_JOB_ID/log.txt |./ci/util/extract-trash-dirs.sh"
+fi
diff --git a/ci/util/extract-trash-dirs.sh b/ci/util/extract-trash-dirs.sh
new file mode 100755
index 0000000..8e67bec
--- /dev/null
+++ b/ci/util/extract-trash-dirs.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+error () {
+ echo >&2 "error: $@"
+ exit 1
+}
+
+find_embedded_trash () {
+ while read -r line
+ do
+ case "$line" in
+ *Start\ of\ trash\ directory\ of\ \'t[0-9][0-9][0-9][0-9]-*\':*)
+ test_name="${line#*\'}"
+ test_name="${test_name%\'*}"
+
+ return 0
+ esac
+ done
+
+ return 1
+}
+
+extract_embedded_trash () {
+ while read -r line
+ do
+ case "$line" in
+ *End\ of\ trash\ directory\ of\ \'$test_name\'*)
+ return
+ ;;
+ *)
+ printf '%s\n' "$line"
+ ;;
+ esac
+ done
+
+ error "unexpected end of input"
+}
+
+# Raw logs from Linux build jobs have CRLF line endings, while OSX
+# build jobs mostly have CRCRLF, except an odd line every now and
+# then that has CRCRCRLF. 'base64 -d' from 'coreutils' doesn't like
+# CRs and complains about "invalid input", so remove all CRs at the
+# end of lines.
+sed -e 's/\r*$//' | \
+while find_embedded_trash
+do
+ echo "Extracting trash directory of '$test_name'"
+
+ extract_embedded_trash |base64 -d |tar xzp
+done