<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - lit produces corrupt output file with python 2.7.9 if test output contains control bytes"
   href="https://bugs.llvm.org/show_bug.cgi?id=41302">41302</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>lit produces corrupt output file with python 2.7.9 if test output contains control bytes
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Test Suite
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>lit
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>felix@berlakovich.at
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>daniel@zuster.org, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>During my tests with SPEC2006 CINT, the omnetpp test is failing (not relevant).
When it fails it outputs a weird character in the error message: FP Comparison
failed, not a numeric difference between 'M' and '▒'

When run with Python 2.7.9, lit subsequently fails to import the resulting
output.json file:

********************
Testing Time: 37.90s
Traceback (most recent call last):
  File "/home/teamcity/llvm/build/debug/bin/llvm-lit", line 37, in <module>
    main(builtin_parameters)
  File "/home/teamcity/llvm/src/utils/lit/lit/main.py", line 193, in main
    main_with_tmp(builtinParameters)
  File "/home/teamcity/llvm/src/utils/lit/lit/main.py", line 535, in
main_with_tmp
    write_test_results(run, litConfig, testing_time, opts.output_path)
  File "/home/teamcity/llvm/src/utils/lit/lit/main.py", line 153, in
write_test_results
    json.dump(data, f, indent=2, sort_keys=True)
  File "/usr/lib/python2.7/json/__init__.py", line 189, in dump
    for chunk in iterable:
  File "/usr/lib/python2.7/json/encoder.py", line 434, in _iterencode
    for chunk in _iterencode_dict(o, _current_indent_level):
  File "/usr/lib/python2.7/json/encoder.py", line 408, in _iterencode_dict
    for chunk in chunks:
  File "/usr/lib/python2.7/json/encoder.py", line 332, in _iterencode_list
    for chunk in chunks:
  File "/usr/lib/python2.7/json/encoder.py", line 390, in _iterencode_dict
    yield _encoder(value)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x90 in position 1243:
invalid start byte

Inspecting the output file with cat shows that it is truncated:
teamcity@vlbs01:~/lnt/sandbox/test-2019-03-28_19-55-21$ cat outputWk9Mpd.json
{
  "__version__": [
    0,
    8,
    0
  ],
  "elapsed": 37.904776096343994,
  "tests": [
    {
      "code": "FAIL",
      "elapsed": 37.9047110080719,
      "name": "test-suite ::
External/SPEC/CINT2006/471.omnetpp/471.omnetpp.test",
      "output": teamcity@vlbs01:~/lnt/sandbox/test-2019-03-28_19-55-21$


When run with Python 3.4.2 everything works as expected. The resulting output
file looks as follows:
teamcity@vlbs01:~/lnt/sandbox/test-2019-03-28_19-55-21$ cat outputWk9Mpd.json
{
  "__version__": [
    0,
    8,
    0
  ],
  "elapsed": 37.67633867263794,
  "tests": [
    {
      "code": "FAIL",
      "elapsed": 37.676236152648926,
      "name": "test-suite ::
External/SPEC/CINT2006/471.omnetpp/471.omnetpp.test",
      "output":
"\n/home/teamcity/lnt/sandbox/test-2019-03-28_19-55-21/tools/timeit-target
--limit-core 0 --limit-cpu 7200 --timeout 7200 --limit-file-size 104857600
--limit-rss-size 838860800 --redirect-stdout
/home/teamcity/lnt/sandbox/test-2019-03-28_19-55-21/External/SPEC/CINT2006/471.omnetpp/omnetpp.log
--redirect-input /dev/null --chdir
/home/teamcity/lnt/sandbox/test-2019-03-28_19-55-21/External/SPEC/CINT2006/471.omnetpp
--summary
/home/teamcity/lnt/sandbox/test-2019-03-28_19-55-21/External/SPEC/CINT2006/471.omnetpp/Output/471.omnetpp.test.time
/home/teamcity/lnt/sandbox/test-2019-03-28_19-55-21/External/SPEC/CINT2006/471.omnetpp/471.omnetpp
-f data/train/input/omnetpp.ini\ncd
/home/teamcity/lnt/sandbox/test-2019-03-28_19-55-21/External/SPEC/CINT2006/471.omnetpp
; /home/teamcity/lnt/sandbox/test-2019-03-28_19-55-21/tools/fpcmp -r 0.00001 -a
0.000001 data/train/output/omnetpp.log omnetpp.log\ncd
/home/teamcity/lnt/sandbox/test-2019-03-28_19-55-21/External/SPEC/CINT2006/471.omnetpp
; /home/teamcity/lnt/sandbox/test-2019-03-28_19-55-21/tools/fpcmp -r 0.00001 -a
0.000001 data/train/output/omnetpp.sca
omnetpp.sca\n\nb\"/home/teamcity/lnt/sandbox/test-2019-03-28_19-55-21/tools/fpcmp:
FP Comparison failed, not a numeric difference between 'M' and '\\x90'\\n\""
    }
  ]
}
teamcity@vlbs01:~/lnt/sandbox/test-2019-03-28_19-55-21$</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>