[Lldb-commits] [lldb] 3da9396 - [lldb] Improve diagnostics in lldb-repro when replay fails

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 13 14:38:41 PDT 2020


Author: Jonas Devlieghere
Date: 2020-08-13T14:38:34-07:00
New Revision: 3da939686c216f8d16a6aaae7831f4bb18c83483

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

LOG: [lldb] Improve diagnostics in lldb-repro when replay fails

 - Print the replay invocation.
 - Keep the reproducer around.
 - Return the "opposite" exit code so we don't have to rely on FileCheck
   to fail the test when the expected exit code is non-zero.

Added: 
    

Modified: 
    lldb/utils/lldb-repro/lldb-repro.py

Removed: 
    


################################################################################
diff  --git a/lldb/utils/lldb-repro/lldb-repro.py b/lldb/utils/lldb-repro/lldb-repro.py
index 2b7b23f8cf29..928e1008984b 100755
--- a/lldb/utils/lldb-repro/lldb-repro.py
+++ b/lldb/utils/lldb-repro/lldb-repro.py
@@ -62,9 +62,14 @@ def main():
     # exit code and return that for tests that expect a non-zero exit code.
     exit_code_path = os.path.join(reproducer_path, 'exit_code.txt')
     if sys.argv[1] == "replay":
+        replay_exit_code = exit_code
         with open(exit_code_path, 'r') as f:
-            assert exit_code == 0
             exit_code = int(f.read())
+        if replay_exit_code != 0:
+            print("error: replay failed with exit code {}".format(replay_exit_code))
+            print("invocation: " + " ".join(new_args))
+            # Return 1 if the expected exit code is 0 or vice versa.
+            return 1 if (exit_code == 0) else 0
         shutil.rmtree(reproducer_path, True)
     elif sys.argv[1] == "capture":
         with open(exit_code_path, 'w') as f:


        


More information about the lldb-commits mailing list