[travis] Fold successful tests and some noise

This commit is contained in:
Matthias Kuhn 2017-03-05 00:27:02 +01:00
parent 633c258def
commit 5fd933e7e5
4 changed files with 107 additions and 55 deletions

View File

@ -38,7 +38,6 @@ matrix:
- txt2tags
- xvfb
- clang-3.8
- grc
- os: linux

View File

@ -1,53 +0,0 @@
# A readme that explains the configuration options can be found here
# http://korpus.juls.savba.sk/~garabik/software/grc/README.txt
####################
# Early exit, lines that do not need to be processed further
####################
# DEFAULT: the final FAILED line in failed nose tests
regexp=^FAILED (failures=[0-9])$
colours=default
count=stop
-
###################
# Failed test block
###################
# YELLOW: A test failed, start a yellow block
regexp=^FAIL[:\!].*
colours=yellow
count=block
-
# YELLOW END: End block on next successful test
regexp=^PASS
colours=default
count=unblock
-
# YELLOW END: End block on next successful test
regexp=^Ran
colours=default
count=unblock
-
####################
# Unit test name (title)
####################
# RED: test name
regexp=.*Test.*\*\*\*Failed.*sec
colours=red
-
####################
# Successful tests
####################
# DARK GRAY: passed tests should be unobtrusive
regexp=.*Test.*Passed.*sec
colours="\033[90m"
-
# DARK GRAY: Start test lines should be unobtrusive
regexp=\s{8}Start.*
colours="\033[90m"

View File

@ -32,6 +32,6 @@ if [ "$CACHE_WARMING" = true ] ; then
xvfb-run ctest -V -R NOTESTS -S ./qgis-test-travis.ctest --output-on-failure
false
else
grc -c ${TRAVIS_BUILD_DIR}/ci/travis/linux/.grc.colors \
python ${TRAVIS_BUILD_DIR}/ci/travis/scripts/ctest2travis.py \
xvfb-run ctest -V -E "$(cat ${DIR}/blacklist.txt | sed -r '/^(#.*?)?$/d' | paste -sd '|' -)" -S ./qgis-test-travis.ctest --output-on-failure
fi

106
ci/travis/scripts/ctest2travis.py Executable file
View File

@ -0,0 +1,106 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
***************************************************************************
ctest2travis.py
---------------------
Date : March 2017
Copyright : (C) 2017 by Matthias Kuhn
Email : matthias@opengis.ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""
__author__ = 'Matthias Kuhn'
__date__ = 'March 2017'
__copyright__ = '(C) 2017, Matthias Kuhn'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'
# This script parses output from ctest and injects
#
# - Colors for failing unit tests and test cases
#
# - `travis_fold` control sequences to hide uninteresting output by default
import sys
import re
import shlex
import subprocess
from termcolor import colored
fold_stack = list()
def start_fold(tag):
sys.stdout.write('travis_fold:start:{}\n'.format(tag))
fold_stack.append(tag)
def end_fold():
tag = fold_stack.pop()
sys.stdout.write('travis_fold:end:{}\n'.format(tag))
test_count = 0
def start_test_fold():
global test_count
sys.stdout.write('Running tests')
start_fold('test.{}'.format(test_count))
test_count += 1
in_failing_test = False
in_failure = False
p = subprocess.Popen(sys.argv[1:], stdout=subprocess.PIPE)
for line in p.stdout:
updated_line = line.decode('utf-8')
if re.match('Run dashboard with model Experimental', updated_line):
start_fold('build')
updated_line = 'Compiling\n{}'.format(updated_line)
elif re.match('Test project /home/travis/build/qgis/QGIS/build', updated_line):
end_fold() # tag=build
start_test_fold()
if re.search('\*\*\*Failed', updated_line) or re.search('\*\*\*Timeout', updated_line):
end_fold()
updated_line = colored(updated_line, 'red')
in_failing_test = True
if in_failing_test:
if re.match(' Start', updated_line):
start_test_fold()
in_failing_test = False
elif in_failure:
if re.match('PASS', updated_line) or re.match('Ran', updated_line):
in_failure = False
else:
updated_line = colored(updated_line, 'yellow')
else:
if re.match('FAIL[:\!].*', updated_line):
updated_line = colored(updated_line, 'yellow')
in_failure = True
if not in_failing_test and re.search('[0-9]+% tests passed, [0-9]+ tests failed out of', updated_line):
end_fold()
if re.match('Submit files', updated_line):
start_fold('submit')
elif re.search('Test results submitted to', updated_line):
end_fold()
sys.stdout.write(updated_line)
exit(p.wait())