Author: Jonas Devlieghere Date: 2025-02-10T14:46:03-08:00 New Revision: d81b604656c189a9d4e9f0d14b0f4d52f454deac
URL: https://github.com/llvm/llvm-project/commit/d81b604656c189a9d4e9f0d14b0f4d52f454deac DIFF: https://github.com/llvm/llvm-project/commit/d81b604656c189a9d4e9f0d14b0f4d52f454deac.diff LOG: [lldb] Add a test for terminal dimensions (#126598) 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). Added: lldb/test/API/driver/terminal/TestTerminalDimensions.py Modified: Removed: ################################################################################ diff --git a/lldb/test/API/driver/terminal/TestTerminalDimensions.py b/lldb/test/API/driver/terminal/TestTerminalDimensions.py new file mode 100644 index 000000000000000..9ab3745613994a6 --- /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)) + + # Tests clear all the settings so we lose the launch values. Resize the + # window to update the settings. These new values need to be diff erent + # 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"]) _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits