[llvm] ab0574d - Print more information when JSON parsing fails for unittests.

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 23 14:58:05 PDT 2022


Author: Eli Friedman
Date: 2022-08-23T14:57:49-07:00
New Revision: ab0574dac3f907fbee79f5081a822ec81824c74a

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

LOG: Print more information when JSON parsing fails for unittests.

Trying to figure out intermittent failure on reverse-iteration buildbot.

Added: 
    

Modified: 
    llvm/utils/lit/lit/formats/googletest.py

Removed: 
    


################################################################################
diff  --git a/llvm/utils/lit/lit/formats/googletest.py b/llvm/utils/lit/lit/formats/googletest.py
index 2383afcbddd21..1e38a83af63b4 100644
--- a/llvm/utils/lit/lit/formats/googletest.py
+++ b/llvm/utils/lit/lit/formats/googletest.py
@@ -239,7 +239,11 @@ def remove_gtest(tests):
 
             # Load json file to retrieve results.
             with open(test.gtest_json_file, encoding='utf-8') as f:
-                testsuites = json.load(f)['testsuites']
+                try:
+                    testsuites = json.load(f)['testsuites']
+                except json.JSONDecodeError as e:
+                    raise RuntimeError("Failed to parse json file: " +
+                                       test.gtest_json_file + "\n" + e.doc)
                 for testcase in testsuites:
                     for testinfo in testcase['testsuite']:
                         # Ignore disabled tests.


        


More information about the llvm-commits mailing list