13 import xml.sax.saxutils
as XSS
14 from collections
import defaultdict
29 bad_chars = re.compile(
"[\x00-\x08\x0b\x0c\x0e-\x1f\ud800-\udfff\ufffe\uffff]")
33 return "".join(
"[NON-XML-CHAR-0x%2X]" % ord(c)
for c
in match.group())
35 return bad_chars.sub(quote, data)
40 return "CTEST_FULL_OUTPUT"
45 head_line = report.head_line
49 for k, v
in report.user_properties
50 if f
"{head_line}.{k}" not in results
56 results[f
"{report.head_line}.outcome"] = report.outcome
58 results.setdefault(f
"{report.head_line}.outcome",
"passed")
61 if report.when ==
"call":
62 results[f
"{report.head_line}.duration"] = round(report.duration, 2)
66 if not hasattr(session,
"items"):
69 if os.environ.get(
"DISABLE_CTEST_MEASUREMENTS") ==
"1":
73 outcomes = defaultdict(list)
75 if key.endswith(
".outcome"):
76 outcomes[results[key]].append(key[:-8])
78 (f
"outcome.{outcome}", sorted(tests))
for outcome, tests
in outcomes.items()
81 ignore_keys = {
"test_fixture_setup.completed_process"}
83 '<DartMeasurement type="text/string" name="{name}">{value}</DartMeasurement>'
88 for key, value
in results.items()
89 if not any(key.endswith(ignore_key)
for ignore_key
in ignore_keys)
and value
92 for key, value
in to_print:
95 key = key.replace(
"/",
"_")
96 print(template.format(name=key, value=sanitized_value), end=
"")