[llvm] 0e554eb - [lit][unit] set the default result start and pid

Yuanfang Chen via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 28 13:39:32 PDT 2022


Author: Yuanfang Chen
Date: 2022-04-28T13:39:11-07:00
New Revision: 0e554ebf029f8cc20925357fee7a5f0abbb6650f

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

LOG: [lit][unit] set the default result start and pid

In case of interrupting, there were None. Fixes PR55176.

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 603e04d26ba3e..5feefaa84f12e 100644
--- a/llvm/utils/lit/lit/formats/googletest.py
+++ b/llvm/utils/lit/lit/formats/googletest.py
@@ -224,7 +224,7 @@ def remove_gtest(tests):
                 discovered_tests.append(test)
                 continue
 
-            start_time = test.result.start
+            start_time = test.result.start or 0.0
 
             # Load json file to retrieve results.
             with open(test.gtest_json_file, encoding='utf-8') as f:
@@ -260,7 +260,7 @@ def remove_gtest(tests):
 
                         elapsed_time = float(testinfo['time'][:-1])
                         res = lit.Test.Result(returnCode, output, elapsed_time)
-                        res.pid = test.result.pid
+                        res.pid = test.result.pid or 0
                         res.start = start_time
                         start_time = start_time + elapsed_time
                         subtest.setResult(res)


        


More information about the llvm-commits mailing list