[lit][unit] set the default result start and pid
authorYuanfang Chen <yuanfang.chen@sony.com>
Thu, 28 Apr 2022 20:37:07 +0000 (13:37 -0700)
committerYuanfang Chen <yuanfang.chen@sony.com>
Thu, 28 Apr 2022 20:39:11 +0000 (13:39 -0700)
In case of interrupting, there were None. Fixes PR55176.

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

index 603e04d26ba3ed05bd05e0ec0ecdf37ad7d605ee..5feefaa84f12e74bd03222470169a2c0e81052a1 100644 (file)
@@ -224,7 +224,7 @@ class GoogleTest(TestFormat):
                 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 @@ class GoogleTest(TestFormat):
 
                         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)