Commit d7bb0d7d authored by Marco Clemencic's avatar Marco Clemencic Committed by Benedikt Hegner
Browse files

Add support for CTest stdout compression in XML reports

parent 19babbd0
......@@ -12,6 +12,7 @@ before_script:
- export PATH=/cvmfs/${PATH}
- export CMAKE_PREFIX_PATH=/cvmfs/
- export CCACHE_DIR=${PWD}/.ccache
- export CCACHE_CPP2=1
image: lhcbdev/centos7-build:latest
......@@ -80,6 +81,7 @@ test:
- ( make BUILDDIR=build test ARGS='-j4' || touch build/html/tests_failed ) | tee build/ctest.log
- mv build/html test_report
- mv build/ctest.log test_report
- mv build/Testing test_report
- test_report
......@@ -7,6 +7,8 @@ import re
import shutil
import bisect
import time
import base64
import zlib
from datetime import datetime, timedelta
from optparse import OptionParser
......@@ -69,6 +71,26 @@ def formatMeasurementText(txt, escape=False, preformat=True):
return txt
VALUE_DECODE = {'base64': base64.b64decode}
VALUE_DECOMP = {'gzip': zlib.decompress}
def dropCustomMeasurements(s):
Remove custom measurements (sections encompassed by
'<DartMeasurement ...></DartMeasurement>' tags) from the input string and
return the new value.
pos = s.find('<DartMeasurement')
while pos >= 0:
end_pos = s.find('</DartMeasurement>', pos)
if end_pos < 0:
break # no end tag, better not to drop the section
s = s[:pos] + s[end_pos + 18:] # 18 is the size of the end tag
pos = s.find('<DartMeasurement')
return s
# Some regular expression that is going to be used in the next functions
space_Re = re.compile(r"[ ]")
illegal_web_chars_Re = re.compile(r"[<>\'\"#]")
......@@ -742,19 +764,27 @@ def main():
# write the stdout
if Results.find("Measurement") is not None:
value = Results.find("Measurement").find("Value")
stdout = open(os.path.join(testCaseDir, "stdout"), "w")
if value is not None and value.text is not None:
stdout = open(os.path.join(testCaseDir, "stdout"), "w")
text = value.text
if 'encoding' in value.attrib:
text = VALUE_DECODE[value.attrib['encoding']](text)
if 'compression' in value.attrib:
text = VALUE_DECOMP[value.attrib['compression']](text)
text = dropCustomMeasurements(text)
text = formatMeasurementText(text, escape=True)
# no "Measurement" or no "Value" or no text
except AttributeError as x:
print 'WARNING: {0[id]}: AttributeError: {1}'.format(
summary, x)
text = '<i>no stdout</i>'
except KeyError as x:
print 'WARNING: {0[id]}: KeyError: {1}'.format(
summary, x)
# encoding or compressions unknown, keep original text
text = formatMeasurementText(value=text, escape=True)
with open(os.path.join(testCaseDir, "stdout"), "w") as stdout:
if "ctest" not in site.get("Generator"):
# write the other files
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment