summaryrefslogtreecommitdiffstats
path: root/.travis_run_task.sh
diff options
context:
space:
mode:
authorMartin Babinsky <mbabinsk@redhat.com>2017-01-05 10:10:06 +0100
committerMartin Babinsky <mbabinsk@redhat.com>2017-01-05 16:21:51 +0100
commit0ef55a91ef9c591cee3a7e1ff0e391cdc32423c3 (patch)
tree244f66c42542e11fe3dcc36ee33b4d6eebb2f441 /.travis_run_task.sh
parent4abd3f554a436e6446ba59c75c09fb0ff8b7fe4a (diff)
downloadfreeipa-0ef55a91ef9c591cee3a7e1ff0e391cdc32423c3.tar.gz
freeipa-0ef55a91ef9c591cee3a7e1ff0e391cdc32423c3.tar.xz
freeipa-0ef55a91ef9c591cee3a7e1ff0e391cdc32423c3.zip
Trim the test runner log to show only pytest failures/errors
If we get to the `run-tests` phase, we no longer care about messages from previous steps so we can truncate the log output to only show pytest failures/errors, reducing log size. As a fallback, the previous behaviour to print last 5000 log lines was kept in the case the CI tests fail during setup. Reviewed-By: Stanislav Laznicka <slaznick@redhat.com> Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
Diffstat (limited to '.travis_run_task.sh')
-rwxr-xr-x.travis_run_task.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/.travis_run_task.sh b/.travis_run_task.sh
index a9144b522..9fd1c1cb8 100755
--- a/.travis_run_task.sh
+++ b/.travis_run_task.sh
@@ -8,6 +8,17 @@ PYTHON="/usr/bin/python${TRAVIS_PYTHON_VERSION}"
test_set=""
developer_mode_opt="--developer-mode"
+function truncate_log_to_test_failures() {
+ # chop off everything in the CI_RESULTS_LOG preceding pytest error output
+ # if there are pytest errors in the log
+ error_fail_regexp='\(=== ERRORS ===\)\|\(=== FAILURES ===\)'
+
+ if grep -e "$error_fail_regexp" $CI_RESULTS_LOG > /dev/null
+ then
+ sed -i "/$error_fail_regexp/,\$!d" $CI_RESULTS_LOG
+ fi
+}
+
if [[ "$TASK_TO_RUN" == "lint" ]]
then
if [[ "$TRAVIS_EVENT_TYPE" == "pull_request" ]]
@@ -35,3 +46,8 @@ ipa-docker-test-runner -l $CI_RESULTS_LOG \
--container-image $TEST_RUNNER_IMAGE \
--git-repo $TRAVIS_BUILD_DIR \
$TASK_TO_RUN $test_set
+
+if $?
+then
+ truncate_log_to_test_failures
+fi