[Lldb-commits] [lldb] 9dbce77 - [lldb] Update PythonDataObjectsTests for new exception formatting

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 15 15:53:25 PDT 2023


Author: Jonas Devlieghere
Date: 2023-03-15T15:53:18-07:00
New Revision: 9dbce774eea515e400954f1d0ffbd858c839b546

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

LOG: [lldb] Update PythonDataObjectsTests for new exception formatting

PythonDataObjectsTest.TestExceptions started failing because the output
of the python traceback printers is now consistent between python and
cpython [1]. Work around the issue by supporting both variants.

Thanks to Ismail for identifying the root cause.

[1] https://github.com/python/cpython/issues/85203

Added: 
    

Modified: 
    lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp b/lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
index 2bf713e085760..733b919e28607 100644
--- a/lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
+++ b/lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
@@ -802,10 +802,13 @@ def main():
 
   PythonScript lol(script2);
 
-  EXPECT_THAT_EXPECTED(lol(),
-                       llvm::Failed<PythonException>(testing::Property(
-                           &PythonException::ReadBacktrace,
-                           testing::ContainsRegex("unprintable MyError"))));
+  EXPECT_THAT_EXPECTED(
+      lol(),
+      llvm::Failed<PythonException>(testing::Property(
+          &PythonException::ReadBacktrace,
+          testing::AnyOf(
+              testing::ContainsRegex("MyError: <exception str\\(\\) failed>"),
+              testing::ContainsRegex("unprintable MyError")))));
 
 #endif
 }


        


More information about the lldb-commits mailing list