diff options
Diffstat (limited to 'llvm/utils')
-rw-r--r-- | llvm/utils/lit/lit/Test.py | 11 | ||||
-rw-r--r-- | llvm/utils/lit/lit/llvm/config.py | 2 | ||||
-rw-r--r-- | llvm/utils/lit/tests/Inputs/shtest-env/lit.cfg | 2 | ||||
-rw-r--r-- | llvm/utils/lit/tests/Inputs/shtest-shell/lit.cfg | 2 | ||||
-rw-r--r-- | llvm/utils/lit/tests/Inputs/shtest-timeout/lit.cfg | 2 | ||||
-rw-r--r-- | llvm/utils/lit/tests/lit.cfg | 2 | ||||
-rw-r--r-- | llvm/utils/lit/tests/shtest-timeout.py | 3 |
7 files changed, 13 insertions, 11 deletions
diff --git a/llvm/utils/lit/lit/Test.py b/llvm/utils/lit/lit/Test.py index 9fa9064dc68..a10419f33fa 100644 --- a/llvm/utils/lit/lit/Test.py +++ b/llvm/utils/lit/lit/Test.py @@ -378,10 +378,15 @@ class Test: fil.write(testcase_xml) if self.result.code.isFailure: fil.write(">\n\t<failure ><![CDATA[") - if type(self.result.output) == unicode: - encoded_output = self.result.output.encode("utf-8", 'ignore') - else: + # In Python2, 'str' and 'unicode' are distinct types, but in Python3, the type 'unicode' does not exist + # and instead 'bytes' is distinct + # in Python3, there's no unicode + if isinstance(self.result.output, str): encoded_output = self.result.output + elif isinstance(self.result.output, bytes): + encoded_output = self.result.output.decode("utf-8", 'ignore') + else: + encoded_output = self.result.output.encode("utf-8", 'ignore') # In the unlikely case that the output contains the CDATA terminator # we wrap it by creating a new CDATA block fil.write(encoded_output.replace("]]>", "]]]]><![CDATA[>")) diff --git a/llvm/utils/lit/lit/llvm/config.py b/llvm/utils/lit/lit/llvm/config.py index 550ba363009..74c5f27c279 100644 --- a/llvm/utils/lit/lit/llvm/config.py +++ b/llvm/utils/lit/lit/llvm/config.py @@ -299,7 +299,7 @@ class LLVMConfig(object): 'count'), verbatim=True, unresolved='fatal'), ToolSubst(r'\| \bnot\b', command=FindTool('not'), verbatim=True, unresolved='fatal')] - self.config.substitutions.append(('%python', "'%s'" % (sys.executable))) + self.config.substitutions.append(('%python', '"%s"' % (sys.executable))) self.add_tool_substitutions( tool_patterns, [self.config.llvm_tools_dir]) diff --git a/llvm/utils/lit/tests/Inputs/shtest-env/lit.cfg b/llvm/utils/lit/tests/Inputs/shtest-env/lit.cfg index 1b4715e79ac..1e2d050754a 100644 --- a/llvm/utils/lit/tests/Inputs/shtest-env/lit.cfg +++ b/llvm/utils/lit/tests/Inputs/shtest-env/lit.cfg @@ -6,4 +6,4 @@ config.test_source_root = None config.test_exec_root = None config.environment['FOO'] = '1' config.environment['BAR'] = '2' -config.substitutions.append(('%{python}', "'%s'" % (sys.executable))) +config.substitutions.append(('%{python}', '"%s"' % (sys.executable))) diff --git a/llvm/utils/lit/tests/Inputs/shtest-shell/lit.cfg b/llvm/utils/lit/tests/Inputs/shtest-shell/lit.cfg index 14767f28463..3231dedc714 100644 --- a/llvm/utils/lit/tests/Inputs/shtest-shell/lit.cfg +++ b/llvm/utils/lit/tests/Inputs/shtest-shell/lit.cfg @@ -4,4 +4,4 @@ config.suffixes = ['.txt'] config.test_format = lit.formats.ShTest() config.test_source_root = None config.test_exec_root = None -config.substitutions.append(('%{python}', "'%s'" % (sys.executable))) +config.substitutions.append(('%{python}', '"%s"' % (sys.executable))) diff --git a/llvm/utils/lit/tests/Inputs/shtest-timeout/lit.cfg b/llvm/utils/lit/tests/Inputs/shtest-timeout/lit.cfg index 74f6771b923..96bf18170a8 100644 --- a/llvm/utils/lit/tests/Inputs/shtest-timeout/lit.cfg +++ b/llvm/utils/lit/tests/Inputs/shtest-timeout/lit.cfg @@ -29,4 +29,4 @@ config.test_exec_root = config.test_source_root config.target_triple = '(unused)' src_root = os.path.join(config.test_source_root, '..') config.environment['PYTHONPATH'] = src_root -config.substitutions.append(('%{python}', "'%s'" % (sys.executable))) +config.substitutions.append(('%{python}', '"%s"' % (sys.executable))) diff --git a/llvm/utils/lit/tests/lit.cfg b/llvm/utils/lit/tests/lit.cfg index 75cba3f4f04..01a3431b435 100644 --- a/llvm/utils/lit/tests/lit.cfg +++ b/llvm/utils/lit/tests/lit.cfg @@ -40,7 +40,7 @@ config.substitutions.append(('%{inputs}', os.path.join( src_root, 'tests', 'Inputs'))) config.substitutions.append(('%{lit}', "%%{python} %s" % ( os.path.join(lit_path, 'lit.py'),))) -config.substitutions.append(('%{python}', "'%s'" % (sys.executable))) +config.substitutions.append(('%{python}', '"%s"' % (sys.executable))) # Enable coverage.py reporting, assuming the coverage module has been installed diff --git a/llvm/utils/lit/tests/shtest-timeout.py b/llvm/utils/lit/tests/shtest-timeout.py index 2f1fc3d17c0..70b1dee887a 100644 --- a/llvm/utils/lit/tests/shtest-timeout.py +++ b/llvm/utils/lit/tests/shtest-timeout.py @@ -1,8 +1,5 @@ # REQUIRES: python-psutil -# PR33944 -# XFAIL: windows - # FIXME: This test is fragile because it relies on time which can # be affected by system performance. In particular we are currently # assuming that `short.py` can be successfully executed within 2 |