Skip to content

framework: remove forbidden XML chars for text in the JUnit backend

Text in XML cannot include certain characters. The XML 1.0
Recommendation defines:

"

  [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] |
               [#x10000-#x10FFFF] /* any Unicode character, excluding
                                     the surrogate blocks, FFFE, and
                                     FFFF. */
"

This solves this kind of error:

"
  Traceback (most recent call last):
    File "./piglit", line 170, in <module>
      main()
    File "./piglit", line 166, in main
      sys.exit(runner(args))
    File "/piglit/framework/exceptions.py", line 49, in _inner
      return func(*args, **kwargs)
    File "/piglit/framework/programs/summary.py", line 271, in aggregate
      use_compression = backends.write(results, outfile)
    File "/piglit/framework/backends/__init__.py", line 201, in write
      return writer(results, file_path)
    File "/piglit/framework/backends/junit.py", line 483, in write_results
      writer(f, k, v)
    File "/piglit/framework/backends/junit.py", line 200, in __call__
      out.text = mola
    File "src/lxml/etree.pyx", line 1018, in lxml.etree._Element.text.__set__
    File "src/lxml/apihelpers.pxi", line 710, in lxml.etree._setNodeText
    File "src/lxml/apihelpers.pxi", line 698, in lxml.etree._createTextNode
    File "src/lxml/apihelpers.pxi", line 1493, in lxml.etree._utf8
  ValueError: All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters
"

Signed-off-by: Andres Gomez agomez@igalia.com

Edited by Andres Gomez

Merge request reports