[llvm-bugs] [Bug 41302] New: lit produces corrupt output file with python 2.7.9 if test output contains control bytes

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Mar 29 06:05:14 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=41302

            Bug ID: 41302
           Summary: lit produces corrupt output file with python 2.7.9 if
                    test output contains control bytes
           Product: Test Suite
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: lit
          Assignee: unassignedbugs at nondot.org
          Reporter: felix at berlakovich.at
                CC: daniel at zuster.org, llvm-bugs at lists.llvm.org

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 at 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 at 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 at 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 at vlbs01:~/lnt/sandbox/test-2019-03-28_19-55-21$

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190329/3dd706f1/attachment.html>


More information about the llvm-bugs mailing list