aea8879a6a
The trash directory of a failed test might contain invaluable information about the cause of the failure, but we have no access to the trash directories of Travis CI build jobs. The only feedback we get from there is the build job's trace log, so... Modify 'ci/print-test-failures.sh' to create a tar.gz archive of the trash directory of each failed test, encode that archive with base64, and print the resulting block of ASCII text, so it gets embedded in the trace log. Furthermore, run tests with '--immediate' to faithfully preserve the failed state. Extracting the trash directories from the trace log turned out to be a bit of a hassle, partly because of the size of these logs (usually resulting in several hundreds or even thousands of lines of base64-encoded text), and partly because these logs have CRLF, CRCRLF and occasionally even CRCRCRLF line endings, which cause 'base64 -d' from coreutils to complain about "invalid input". For convenience add a small script 'ci/util/extract-trash-dirs.sh', which will extract and unpack all base64-encoded trash directories embedded in the log fed to its standard input, and include an example command to be copy-pasted into a terminal to do it all at the end of the failure report. A few of our tests create sizeable trash directories, so limit the size of each included base64-encoded block, let's say, to 1MB. And just in case something fundamental gets broken and a lot of tests fail at once, don't include trash directories when the combined size of the included base64-encoded blocks would exceed 1MB. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
51 lines
949 B
Bash
Executable File
51 lines
949 B
Bash
Executable File
#!/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
|