This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
neels gerrit-no-reply at lists.osmocom.orgneels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-gsm-tester/+/21517 ) Change subject: report fragment: strip ansi colors from junit XML ...................................................................... report fragment: strip ansi colors from junit XML Jenkins does support showing ANSI colors on the web, but apparently not in the junit results output. Strip ansi colors from report fragment <system-out> text, to make it less annoying to read those on jenkins. Change-Id: I656ecc23bbfd3f25bdf012c890e0c998168844d3 --- M src/osmo_gsm_tester/core/log.py M src/osmo_gsm_tester/core/report.py 2 files changed, 6 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/17/21517/1 diff --git a/src/osmo_gsm_tester/core/log.py b/src/osmo_gsm_tester/core/log.py index e58ab96..932fbbf 100644 --- a/src/osmo_gsm_tester/core/log.py +++ b/src/osmo_gsm_tester/core/log.py @@ -23,6 +23,7 @@ import traceback import contextlib import atexit +import re from datetime import datetime # we need this for strftime as the one from time doesn't carry microsecond info from inspect import getframeinfo, stack diff --git a/src/osmo_gsm_tester/core/report.py b/src/osmo_gsm_tester/core/report.py index 35327ce..a56d4b3 100644 --- a/src/osmo_gsm_tester/core/report.py +++ b/src/osmo_gsm_tester/core/report.py @@ -41,11 +41,15 @@ invalid_xml_char_ranges_str = ['%s-%s' % (chr(low), chr(high)) for (low, high) in invalid_xml_char_ranges] invalid_xml_char_ranges_regex = re.compile('[%s]' % ''.join(invalid_xml_char_ranges_str)) +ansi_color_re = re.compile('\033[0-9;]{1,4}m') def escape_xml_invalid_characters(str): replacement_char = '\uFFFD' # Unicode replacement character return invalid_xml_char_ranges_regex.sub(replacement_char, escape(str)) +def strip_ansi_colors(text): + return ''.join(ansi_color_re.split(text)) + def hash_info_to_junit(testsuite, hash_info): properties = et.SubElement(testsuite, 'properties') for key, val in hash_info.items(): @@ -156,7 +160,7 @@ if report_fragment.output: sout = et.SubElement(el, 'system-out') - sout.text = escape_xml_invalid_characters(report_fragment.output) + sout.text = escape_xml_invalid_characters(strip_ansi_colors(report_fragment.output)) testsuite.append(el) testsuite.set('errors', str(errors)) -- To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/21517 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-gsm-tester Gerrit-Branch: master Gerrit-Change-Id: I656ecc23bbfd3f25bdf012c890e0c998168844d3 Gerrit-Change-Number: 21517 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201203/15c2ee35/attachment.htm>