diff options
author | Luke Pearson <luke.pearson@mongodb.com> | 2023-05-03 15:48:42 +1000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-05-03 06:28:16 +0000 |
commit | 87c8d9d758943cb65541d4bb4d8bd095b6d335cd (patch) | |
tree | ba78928d286256f4dacd8b5991c5481aad6fec71 /src | |
parent | 900438d02fe664d89002e8817276b1db2ad7cb6b (diff) | |
download | mongo-87c8d9d758943cb65541d4bb4d8bd095b6d335cd.tar.gz |
Import wiredtiger: d641e2829dfe88fcf9308abda679041a663c9bcc from branch mongodb-master
ref: 75ef679933..d641e2829d
for: 7.1.0-rc0
WT-11005 Add function to set a Python breakpoint with proper output.
Diffstat (limited to 'src')
-rw-r--r-- | src/third_party/wiredtiger/import.data | 2 | ||||
-rwxr-xr-x | src/third_party/wiredtiger/test/suite/wttest.py | 33 |
2 files changed, 34 insertions, 1 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index a484e95859e..807dfbb42ec 100644 --- a/src/third_party/wiredtiger/import.data +++ b/src/third_party/wiredtiger/import.data @@ -2,5 +2,5 @@ "vendor": "wiredtiger", "github": "wiredtiger/wiredtiger.git", "branch": "mongodb-master", - "commit": "75ef679933e826b07a3b5383f084dbc82770e424" + "commit": "d641e2829dfe88fcf9308abda679041a663c9bcc" } diff --git a/src/third_party/wiredtiger/test/suite/wttest.py b/src/third_party/wiredtiger/test/suite/wttest.py index b8ddd546e04..2419848e3c4 100755 --- a/src/third_party/wiredtiger/test/suite/wttest.py +++ b/src/third_party/wiredtiger/test/suite/wttest.py @@ -830,6 +830,39 @@ class WiredTigerTestCase(unittest.TestCase): self.assertEqual(ret, wiredtiger.WT_NOTFOUND) bkp_cursor.close() + # Set a Python breakpoint. When this function is called, + # the python debugger will be called as described here: + # https://docs.python.org/3/library/pdb.html + # + # This can be used instead of the Python built-in "breakpoint", + # so that the terminal has proper I/O and a prompt appears, etc. + # + # Since the actual breakpoint is in this method, the developer will + # probably need to single step to get back to their calling function. + def breakpoint(self): + import pdb, sys + # Restore I/O to the controlling tty so we can + # run the debugger. + if os.name == "nt": + # No solution has been tested here. + pass + else: + sys.stdin = open('/dev/tty', 'r') + sys.stdout = open('/dev/tty', 'w') + sys.stderr = open('/dev/tty', 'w') + self.printOnce(""" + ******** + You are now in the python debugger, type "help" for more information. + Typing "s" will single step, returning you to the calling function. Common commands: + list - show python source code + s - single step + n - next step + b file:number - set a breakpoint + p variable - print the value of a variable + c - continue + ********""") + pdb.set_trace() + @contextmanager def expectedStdout(self, expect): self.captureout.check(self) |