-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[lldb] Add a test for terminal dimensions #126598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add a test for the term-width and term-height settings.
@llvm/pr-subscribers-lldb Author: Jonas Devlieghere (JDevlieghere) ChangesAdd a test for the term-width and term-height settings. Full diff: https://github.com/llvm/llvm-project/pull/126598.diff 1 Files Affected:
diff --git a/lldb/test/API/driver/terminal/TestTerminalDimensions.py b/lldb/test/API/driver/terminal/TestTerminalDimensions.py
new file mode 100644
index 000000000000000..264cfa5950bfd33
--- /dev/null
+++ b/lldb/test/API/driver/terminal/TestTerminalDimensions.py
@@ -0,0 +1,22 @@
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+from lldbsuite.test.lldbpexpect import PExpectTest
+
+
+class TerminalDimensionsTest(PExpectTest):
+ NO_DEBUG_INFO_TESTCASE = True
+
+ @skipIfAsan
+ def test(self):
+ """Test that the lldb driver correctly reports the (PExpect) terminal dimension."""
+ self.launch(dimensions=(40, 40), timeout=1)
+
+ # Tests clear all the settings so we lose the launch values. Resize the
+ # window to update the settings. These new values need to be different
+ # to trigger a SIGWINCH.
+ self.child.setwinsize(20, 60)
+
+ self.expect("settings show term-height", ["term-height (unsigned) = 20"])
+ self.expect("settings show term-width", ["term-width (unsigned) = 60"])
|
@skipIfAsan | ||
def test(self): | ||
"""Test that the lldb driver correctly reports the (PExpect) terminal dimension.""" | ||
self.launch(dimensions=(40, 40), timeout=1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do the dimensions matter if they'll get cleared and then reset later in the test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They matter in the sense that they need to be different (noted in the comment below). I. need to remove the , timeout=1
because that was just for local debugging.
Add a test for the `term-width` and `term-height` settings. I thought I was hitting bug because in my statusline test I was getting the default values when running under PExpect. It turned out hat the issue is that we clear the settings at the start of the test. The Editline tests aren't affected by this because Editline provides its own functions to get the terminal dimensions and explicitly does not rely on LLDB's settings (presumably exactly because of this behavior).
Add a test for the `term-width` and `term-height` settings. I thought I was hitting bug because in my statusline test I was getting the default values when running under PExpect. It turned out hat the issue is that we clear the settings at the start of the test. The Editline tests aren't affected by this because Editline provides its own functions to get the terminal dimensions and explicitly does not rely on LLDB's settings (presumably exactly because of this behavior).
Add a test for the `term-width` and `term-height` settings. I thought I was hitting bug because in my statusline test I was getting the default values when running under PExpect. It turned out hat the issue is that we clear the settings at the start of the test. The Editline tests aren't affected by this because Editline provides its own functions to get the terminal dimensions and explicitly does not rely on LLDB's settings (presumably exactly because of this behavior).
Add a test for the
term-width
andterm-height
settings. I thought I was hitting bug because in my statusline test I was getting the default values when running under PExpect. It turned out hat the issue is that we clear the settings at the start of the test. The Editline tests aren't affected by this because Editline provides its own functions to get the terminal dimensions and explicitly does not rely on LLDB's settings (presumably exactly because of this behavior).