[pushed,1/2,gdb/testsuite] Fix gdb.python/python.exp with --disable-tui

Message ID 20241203155403.17907-1-tdevries@suse.de
State Committed
Headers
Series [pushed,1/2,gdb/testsuite] Fix gdb.python/python.exp with --disable-tui |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 fail Patch failed to apply
linaro-tcwg-bot/tcwg_gdb_build--master-arm fail Patch failed to apply

Commit Message

Tom de Vries Dec. 3, 2024, 3:54 p.m. UTC
  When building gdb with --disable-tui, we run into:
...
(gdb) python print(type(gdb.TuiWindow))^M
Python Exception <class 'AttributeError'>: \
  module 'gdb' has no attribute 'TuiWindow'^M
Error occurred in Python: module 'gdb' has no attribute 'TuiWindow'^M
(gdb) FAIL: gdb.python/python.exp: gdb.TuiWindow is registered
...

Fix this by skipping the test for --disable-tui.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.python/python.exp | 4 ++++
 1 file changed, 4 insertions(+)


base-commit: 32e3f1a0aa0aec359d944da029ea7b7262d259cd
  

Patch

diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp
index e8eb9ec727b..19c8958b30c 100644
--- a/gdb/testsuite/gdb.python/python.exp
+++ b/gdb/testsuite/gdb.python/python.exp
@@ -567,6 +567,10 @@  if { [use_gdb_stub] == 0 } {
 # directly.
 foreach type {Instruction LazyString Membuf Record RecordFunctionSegment \
 		  RecordGap RecordInstruction TuiWindow} {
+    if { $type == "TuiWindow" && ![allow_tui_tests] } {
+	continue
+    }
+
     gdb_test "python print(type(gdb.$type))" "<class 'type'>" \
 	"gdb.$type is registered"
 }