Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

lit on Windows crashes when launched from bash implementation using Python3 #39673

Open Quuxplusone opened 5 years ago

Quuxplusone commented 5 years ago
Bugzilla Link PR40702
Status NEW
Importance P normal
Reported by Leonid Skvortsov (lvs@ispras.ru)
Reported on 2019-02-12 05:18:03 -0800
Last modified on 2019-02-12 05:49:36 -0800
Version trunk
Hardware PC other
CC daniel@zuster.org, llvm-bugs@lists.llvm.org, lvs@ispras.ru
Fixed by commit(s)
Attachments crlf.patch (813 bytes, text/plain)
Blocks
Blocked by
See also
Created attachment 21471
possible fix

Currently, when using Windows with a bash implementation, for example MSYS2,
test scripts are opened with the 'byte' flag to avoid Python adding \r\n line
endings. This works in Python 2.7, but in Python 3 it results in an error like
this:

Traceback (most recent call last):
  File "/home/lvs/safecompiler/lit/lit/run.py", line 202, in _execute_test_impl
    result = test.config.test_format.execute(test, lit_config)
  File "/home/lvs/safecompiler/lit/lit/formats/shtest.py", line 25, in execute
    self.execute_external)
  File "/home/lvs/safecompiler/lit/lit/TestRunner.py", line 1576, in executeShTest
    res = _runShTest(test, litConfig, useExternalSh, script, tmpBase)
  File "/home/lvs/safecompiler/lit/lit/TestRunner.py", line 1522, in _runShTest
    res = executeScript(test, litConfig, tmpBase, script, execdir)
  File "/home/lvs/safecompiler/lit/lit/TestRunner.py", line 1102, in executeScript
    f.write('{ ' + '; } &&\n{ '.join(commands) + '; }')

Attached is a possible patch for this bug.
Quuxplusone commented 5 years ago

Attached crlf.patch (813 bytes, text/plain): possible fix