[gdb/testsuite] Add missing skip_tui_tests

When building gdb with --disable-tui, we run into:
...
(gdb) frame apply all -- -^M
Undefined command: "-".  Try "help".^M
(gdb) ERROR: Undefined command "frame apply all -- -".
UNRESOLVED: gdb.base/options.exp: test-frame-apply: frame apply all -- -
...

Fix this by detecting whether tui is supported, and skipping the tui-related
tests otherwise.  Same in some gdb.tui test-cases.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2021-07-13  Tom de Vries  <tdevries@suse.de>

	* gdb.base/options.exp: Skip tui-related tests when tui is not
	supported.
	* gdb.python/tui-window-disabled.exp: Same.
	* gdb.python/tui-window.exp: Same.
This commit is contained in:
Tom de Vries 2021-07-14 06:52:44 +02:00
parent fac3b6a2e0
commit 90d7916ac1
3 changed files with 31 additions and 12 deletions

View file

@ -46,6 +46,8 @@ if { ![readline_is_used] } {
return -1
}
set tui_supported_p [expr ![skip_tui_tests]]
# Check the completion result, as returned by the "maintenance show
# test-options-completion-result" command. TEST is used as test name.
proc check_completion_result {expected test} {
@ -320,6 +322,8 @@ proc_with_prefix test-backtrace {} {
# Basic option-machinery + "frame apply" command integration tests.
proc_with_prefix test-frame-apply {} {
global tui_supported_p
test_gdb_complete_unique "frame apply all" "frame apply all"
gdb_test "frame apply level 0-" \
@ -376,12 +380,14 @@ proc_with_prefix test-frame-apply {} {
test_gdb_completion_offers_commands "$cmd -- "
}
# '-' is a valid TUI command.
test_error_cmd2 $cmd " -- -" \
"Cannot enable the TUI when output is not a terminal"
test_gdb_complete_unique \
"$cmd -- -" \
"$cmd -- -"
if { $tui_supported_p } {
# '-' is a valid TUI command.
test_error_cmd2 $cmd " -- -" \
"Cannot enable the TUI when output is not a terminal"
test_gdb_complete_unique \
"$cmd -- -" \
"$cmd -- -"
}
test_error_cmd2 $cmd " -foo" \
"Undefined command: \"-foo\". Try \"help\"\\."
@ -393,6 +399,7 @@ proc_with_prefix test-frame-apply {} {
# Basic option-machinery + "thread apply" command integration tests.
proc_with_prefix test-thread-apply {} {
global tui_supported_p
test_gdb_complete_unique "thread apply all" "thread apply all"
test_gdb_complete_unique "taas" "taas"
@ -457,12 +464,14 @@ proc_with_prefix test-thread-apply {} {
test_gdb_completion_offers_commands "$cmd -- "
}
# '-' is a valid TUI command.
test_invalid_cmd "$cmd" " -- -" \
"Cannot enable the TUI when output is not a terminal"
test_gdb_complete_unique \
"$cmd -- -" \
"$cmd -- -"
if { $tui_supported_p } {
# '-' is a valid TUI command.
test_invalid_cmd "$cmd" " -- -" \
"Cannot enable the TUI when output is not a terminal"
test_gdb_complete_unique \
"$cmd -- -" \
"$cmd -- -"
}
test_invalid_cmd $cmd " -foo" \
"Undefined command: \"-foo\". Try \"help\"\\."

View file

@ -30,6 +30,11 @@ if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} {
return -1
}
clean_restart
if {[skip_tui_tests]} {
return
}
# Copy the Python script to where the tests are being run.
set remote_python_file [gdb_remote_download host \
${srcdir}/${subdir}/${testfile}.py]

View file

@ -25,6 +25,11 @@ if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} {
return -1
}
clean_restart
if {[skip_tui_tests]} {
return
}
Term::clean_restart 24 80 $testfile
# Skip all tests if Python scripting is not enabled.