[llvm] ea7968b - [lit][test] explicitly use utf-8 encoding to write testing json file

Yuanfang Chen via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 15 16:43:11 PDT 2022


Author: Yuanfang Chen
Date: 2022-07-15T16:42:50-07:00
New Revision: ea7968bf76ceea83b4acea49ea8366edd90452e3

URL: https://github.com/llvm/llvm-project/commit/ea7968bf76ceea83b4acea49ea8366edd90452e3
DIFF: https://github.com/llvm/llvm-project/commit/ea7968bf76ceea83b4acea49ea8366edd90452e3.diff

LOG: [lit][test] explicitly use utf-8 encoding to write testing json file

Related test failure:
https://lab.llvm.org/buildbot/#/builders/178/builds/2527/steps/13/logs/FAIL__lit___googletest-timeout_py

Added: 
    

Modified: 
    llvm/utils/lit/tests/Inputs/googletest-cmd-wrapper/DummySubDir/OneTest.exe
    llvm/utils/lit/tests/Inputs/googletest-crash/DummySubDir/OneTest.py
    llvm/utils/lit/tests/Inputs/googletest-format/DummySubDir/OneTest.py
    llvm/utils/lit/tests/Inputs/googletest-timeout/DummySubDir/OneTest.py

Removed: 
    


################################################################################
diff  --git a/llvm/utils/lit/tests/Inputs/googletest-cmd-wrapper/DummySubDir/OneTest.exe b/llvm/utils/lit/tests/Inputs/googletest-cmd-wrapper/DummySubDir/OneTest.exe
index 9b498b52ac9d..7dcccb53570a 100644
--- a/llvm/utils/lit/tests/Inputs/googletest-cmd-wrapper/DummySubDir/OneTest.exe
+++ b/llvm/utils/lit/tests/Inputs/googletest-cmd-wrapper/DummySubDir/OneTest.exe
@@ -42,7 +42,7 @@ dummy_output = """\
 }"""
 
 json_filename = os.environ['GTEST_OUTPUT'].split(':', 1)[1]
-with open(json_filename, 'w') as f:
+with open(json_filename, 'w', encoding='utf-8') as f:
     if os.environ['GTEST_SHARD_INDEX'] == '0':
         f.write(output)
     else:

diff  --git a/llvm/utils/lit/tests/Inputs/googletest-crash/DummySubDir/OneTest.py b/llvm/utils/lit/tests/Inputs/googletest-crash/DummySubDir/OneTest.py
index 1ff9f02e1c67..61530493caa5 100644
--- a/llvm/utils/lit/tests/Inputs/googletest-crash/DummySubDir/OneTest.py
+++ b/llvm/utils/lit/tests/Inputs/googletest-crash/DummySubDir/OneTest.py
@@ -44,7 +44,7 @@
     exit_code = 1
 else:
     json_filename = os.environ['GTEST_OUTPUT'].split(':', 1)[1]
-    with open(json_filename, 'w') as f:
+    with open(json_filename, 'w', encoding='utf-8') as f:
         f.write(dummy_output)
     exit_code = 0
 

diff  --git a/llvm/utils/lit/tests/Inputs/googletest-format/DummySubDir/OneTest.py b/llvm/utils/lit/tests/Inputs/googletest-format/DummySubDir/OneTest.py
index 32859c7e5375..120d7c0d67e2 100644
--- a/llvm/utils/lit/tests/Inputs/googletest-format/DummySubDir/OneTest.py
+++ b/llvm/utils/lit/tests/Inputs/googletest-format/DummySubDir/OneTest.py
@@ -93,7 +93,7 @@
 }"""
 
 json_filename = os.environ['GTEST_OUTPUT'].split(':', 1)[1]
-with open(json_filename, 'w') as f:
+with open(json_filename, 'w', encoding='utf-8') as f:
     if os.environ['GTEST_SHARD_INDEX'] == '0':
         print('[ RUN      ] FirstTest.subTestB', flush=True)
         print('I am subTest B output', file=sys.stderr, flush=True)

diff  --git a/llvm/utils/lit/tests/Inputs/googletest-timeout/DummySubDir/OneTest.py b/llvm/utils/lit/tests/Inputs/googletest-timeout/DummySubDir/OneTest.py
index d64d1dc14882..6a698938dc72 100644
--- a/llvm/utils/lit/tests/Inputs/googletest-timeout/DummySubDir/OneTest.py
+++ b/llvm/utils/lit/tests/Inputs/googletest-timeout/DummySubDir/OneTest.py
@@ -50,7 +50,7 @@
 if os.environ['GTEST_SHARD_INDEX'] == '0':
     test_name = os.environ['GTEST_FILTER']
     if test_name == 'QuickSubTest':
-        with open(json_filename, 'w') as f:
+        with open(json_filename, 'w', encoding='utf-8') as f:
             f.write(output)
         exit_code = 0
     elif test_name == 'InfiniteLoopSubTest':
@@ -61,7 +61,7 @@
     else:
         raise SystemExit("error: invalid test name: %r" % (test_name,))
 else:
-    with open(json_filename, 'w') as f:
+    with open(json_filename, 'w', encoding='utf-8') as f:
         f.write(dummy_output)
     exit_code = 0
 


        


More information about the llvm-commits mailing list