You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2023/04/10 18:41:00 UTC

[jira] [Commented] (IMPALA-12045) generate_junitxml.py fails when the content contains ANSI escape sequences

    [ https://issues.apache.org/jira/browse/IMPALA-12045?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17710264#comment-17710264 ] 

ASF subversion and git services commented on IMPALA-12045:
----------------------------------------------------------

Commit 2f73239607b3497c8ae11cdb2fdbc4571aeb88bd in impala's branch refs/heads/master from Joe McDonnell
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=2f7323960 ]

IMPALA-12045: Strip ANSI escape sequences for JUnitXML

ANSI escape sequences do a variety of actions in the
terminal like adding color to compilation warnings.
generate_junitxml.py currently hits an error when trying
to generate JUnitXML for compilation output that contains
ANSI escape sequences.

This changes generate_junitxml.py to strip ANSI
escape sequences from the strings incorporated into
JUnitXML (e.g. the error output of a compiler).
The solution is based off the discussion at:
https://stackoverflow.com/questions/14693701

Testing:
 - A case where generate_junitxml.py was failing to
   generate JUnitXML now generates valid JUnitXML.
   The output still contains all the compiler warnings
   and information needed to diagnose the issue.

Change-Id: I9654a6b13350cb9582ec908b8807b630636a1ed0
Reviewed-on: http://gerrit.cloudera.org:8080/19708
Reviewed-by: Michael Smith <mi...@cloudera.com>
Reviewed-by: Wenzhe Zhou <wz...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>


> generate_junitxml.py fails when the content contains ANSI escape sequences
> --------------------------------------------------------------------------
>
>                 Key: IMPALA-12045
>                 URL: https://issues.apache.org/jira/browse/IMPALA-12045
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Infrastructure
>    Affects Versions: Impala 4.3.0
>            Reporter: Joe McDonnell
>            Priority: Major
>
> The Impala build tries to generate JUnitXML for compilation failures. This is currently failing with this error:
> {noformat}
> 14:25:30 Traceback (most recent call last):
> 14:25:30   File "Impala/bin/generate_junitxml.py", line 273, in <module>
> 14:25:30     main()
> 14:25:30   File "Impala/bin/generate_junitxml.py", line 268, in main
> 14:25:30     junit_log_file = junit_report.to_file()
> 14:25:30   File "Impala/bin/generate_junitxml.py", line 169, in to_file
> 14:25:30     f.write(unicode(self))
> 14:25:30   File "Impala/bin/generate_junitxml.py", line 206, in __unicode__
> 14:25:30     root_node_dom = minidom.parseString(root_node_unicode)
> 14:25:30   File "/usr/lib64/python2.7/xml/dom/minidom.py", line 1931, in parseString
> 14:25:30     return expatbuilder.parseString(string)
> 14:25:30   File "/usr/lib64/python2.7/xml/dom/expatbuilder.py", line 940, in parseString
> 14:25:30     return builder.parseString(string)
> 14:25:30   File "/usr/lib64/python2.7/xml/dom/expatbuilder.py", line 223, in parseString
> 14:25:30     parser.Parse(string, True)
> 14:25:30 xml.parsers.expat.ExpatError: not well-formed (invalid token): line 2, column 0{noformat}
> It appears to be related to ANSI escape sequences that add color to the compilation warning output. If we strip out the ANSI escape sequences, then the JUnitXML generation works.
> Here is a thread about solutions that strip ANSI escape characters: https://stackoverflow.com/questions/14693701/how-can-i-remove-the-ansi-escape-sequences-from-a-string-in-python



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org