mirror of
https://github.com/rsyslog/rsyslog.git
synced 2025-12-18 20:20:41 +01:00
testbench: add script for improved "failed test" log output
The main intent is to show only failed tests (not SKIPed ones) to make it easier to interpret test failures. This also limits the max output size of tests. This is especially important because of a bug in buildbot that leads to DoS when very large test logs are sent back to the build master (which then aborts). see also https://github.com/buildbot/buildbot/issues/4504
This commit is contained in:
parent
1a4351718d
commit
5b05b98816
46
devtools/gather-check-logs.sh
Executable file
46
devtools/gather-check-logs.sh
Executable file
@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
# gather logs generated by "make [dist]check"
|
||||
# this also limits log size so that buildbot does not abort
|
||||
# Copyright (C) 2020 by Rainer Gerhards, released under ASL 2.0
|
||||
|
||||
show_log() {
|
||||
if grep -q ":test-result: FAIL" "$1"; then
|
||||
printf "\nFAIL: ${1%%.trs} \
|
||||
########################################################\
|
||||
################################\n\n"
|
||||
logfile="${1%%trs}log"
|
||||
if [ -f "$logfile" ]; then
|
||||
lines="$(wc -l < $logfile)"
|
||||
if (( lines > 4000 )); then
|
||||
ls -l $logfile
|
||||
printf 'file is very large (%d lines), showing parts\n' $lines
|
||||
head -n 2000 < "$logfile"
|
||||
printf '\n\n... snip ...\n\n'
|
||||
tail -n 2000 < "$logfile"
|
||||
else
|
||||
cat "$logfile"
|
||||
fi
|
||||
else
|
||||
printf 'log FILE MISSING!\n'
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
append_summary() {
|
||||
echo file: $1 # emit file name just in case we have multiple!
|
||||
head -n12 "$1"
|
||||
}
|
||||
|
||||
export -f show_log
|
||||
export -f append_summary
|
||||
|
||||
############################## MAIN ENTRY POINT ##############################
|
||||
printf 'find failing tests\n'
|
||||
rm -f failed-tests.log
|
||||
|
||||
find . -name "*.trs" -exec bash -c 'show_log "$1" >> failed-tests.log' _ {} \;
|
||||
|
||||
if [ -f failed-tests.log ]; then
|
||||
# show summary stats so that we know how many failed
|
||||
find . -name test-suite.log -exec bash -c 'append_summary "$1" >>failed-tests.log' _ {} \;
|
||||
fi
|
||||
@ -33,15 +33,9 @@ echo CI_CHECK_CMD: $CI_CHECK_CMD
|
||||
make $CI_MAKE_CHECK_OPT ${CI_CHECK_CMD:-check}
|
||||
rc=$?
|
||||
|
||||
# find failing tests
|
||||
echo find failing tests
|
||||
head -n12 tests/test-suite.log >> failed.tests.log
|
||||
find . -name "*.trs" -exec bash -c 'if grep ":test-result: FAIL" "$1"; then printf "\nFAIL: ${1%%.trs} ########################################################################################\n\n" >> failed-tests.log; cat "${1%%trs}log" >> failed-tests.log; fi' _ {} \;
|
||||
if [ -f failed-tests.log ]; then
|
||||
# show summary stats so that we know how many failed
|
||||
echo in failed logs addition
|
||||
head -n12 tests/test-suite.log >> failed-tests.log
|
||||
fi
|
||||
printf 'STEP: find failing tests ====================================================\n'
|
||||
echo calling gather-check-logs
|
||||
devtools/gather-check-logs.sh
|
||||
|
||||
printf 'STEP: Codecov upload =======================================================\n'
|
||||
if [ "$CI_CODECOV_TOKEN" != "" ]; then
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user