This is an archive of the discontinued LLVM Phabricator instance.

[lit, python3] Update lit error logging to work correctly in python3 and other test fixes
ClosedPublic

Authored by stella.stamenova on Aug 7 2018, 10:29 AM.

Details

Summary

In Python2 'unicode' is a distinct type from 'str', but in Python3 'unicode' does not exist and instead all 'str' objects are Unicode string. This change updates the logic in the test logging for lit to correctly process each of the types, and more importantly, to not just fail in Python3.

This change also reverses the use of quotes in several of the cfg files. By using '""' we are guaranteeing that the resulting path will work correctly on Windows while "''" only works correctly sometimes. This also fixes one of the failing tests.

Diff Detail

Repository
rL LLVM

Event Timeline

We have a function somewhere in lit utils that does this, but I’m OOO so I
can’t look for it. Can you try to find it?

We have a function somewhere in lit utils that does this, but I’m OOO so I
can’t look for it. Can you try to find it?

You are thinking of to_string in util.py. I could use it here, but the code in Test.py explicitly ignores any errors from the encode/decode calls while to_string raises an exception when it fails to encode. I could modify to_string to take an optional parameter to determine whether to raise an exception instead of having some of the same functionality in Test.py.

No that’s fine, only makes sense to use it if it fits naturally. As long as
you tried. Lgtm as is

This revision was not accepted when it landed; it landed in state Needs Review.Aug 7 2018, 1:55 PM
This revision was automatically updated to reflect the committed changes.