[gdb/testsuite] Add -q to INTERNAL_GDBFLAGS
Whenever we start gdb in the testsuite, we have the rather verbose: ... $ gdb GNU gdb (GDB) 14.0.50.20230405-git Copyright (C) 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word". (gdb) ... This makes gdb.log longer than necessary and harder to read. We do need to test that the output is produced, but that should be limited to one or a few test-cases. Fix this by adding -q to INTERNAL_GDBFLAGS, such that we simply have: ... $ gdb -q (gdb) ... Tested on x86_64-linux.
This commit is contained in:
parent
929a05081e
commit
31c5028017
8 changed files with 128 additions and 93 deletions
|
@ -101,7 +101,10 @@ save_vars { env(TERM) } {
|
|||
setenv TERM ansi
|
||||
|
||||
# Start GDB and confirm that the version string is styled.
|
||||
check_gdb_startup_version_string version
|
||||
save_vars { INTERNAL_GDBFLAGS env(HOME) env(XDG_CONFIG_HOME) } {
|
||||
set INTERNAL_GDBFLAGS [string map {"-q" ""} $INTERNAL_GDBFLAGS]
|
||||
check_gdb_startup_version_string version
|
||||
}
|
||||
|
||||
# Create an empty directory we can use as HOME for some of the
|
||||
# tests below. When we set XDG_CONFIG_HOME we still need to point
|
||||
|
@ -120,7 +123,7 @@ save_vars { env(TERM) } {
|
|||
|
||||
# Now arrange to use the fake home directory early init file.
|
||||
save_vars { INTERNAL_GDBFLAGS env(HOME) env(XDG_CONFIG_HOME) } {
|
||||
set INTERNAL_GDBFLAGS [string map {"-nx" ""} $INTERNAL_GDBFLAGS]
|
||||
set INTERNAL_GDBFLAGS [string map {"-nx" "" "-q" ""} $INTERNAL_GDBFLAGS]
|
||||
|
||||
# Now test GDB when using the HOME directory.
|
||||
set env(HOME) $home_dir
|
||||
|
@ -144,7 +147,7 @@ save_vars { env(TERM) } {
|
|||
|
||||
# Now arrange to use the fake home directory startup file.
|
||||
save_vars { INTERNAL_GDBFLAGS env(HOME) env(XDG_CONFIG_HOME) } {
|
||||
set INTERNAL_GDBFLAGS [string map {"-nx" ""} $INTERNAL_GDBFLAGS]
|
||||
set INTERNAL_GDBFLAGS [string map {"-nx" "" "-q" ""} $INTERNAL_GDBFLAGS]
|
||||
|
||||
# Now test GDB when using the HOME directory.
|
||||
set env(HOME) $home_dir
|
||||
|
|
|
@ -84,4 +84,7 @@ proc test_libsegfault {} {
|
|||
}
|
||||
}
|
||||
|
||||
test_libsegfault
|
||||
save_vars { ::INTERNAL_GDBFLAGS } {
|
||||
set ::INTERNAL_GDBFLAGS [string map {"-q" ""} $::INTERNAL_GDBFLAGS]
|
||||
test_libsegfault
|
||||
}
|
||||
|
|
|
@ -172,12 +172,16 @@ proc test_fg_execution_pagination_cancel { how } {
|
|||
}
|
||||
}
|
||||
|
||||
if {[probe_can_run_cmdline] > 0} {
|
||||
test_fg_execution_pagination_return
|
||||
if ![target_info exists gdb,nointerrupts] {
|
||||
test_fg_execution_pagination_cancel "ctrl-c"
|
||||
save_vars { INTERNAL_GDBFLAGS } {
|
||||
set INTERNAL_GDBFLAGS [string map {"-q" ""} $INTERNAL_GDBFLAGS]
|
||||
|
||||
if {[probe_can_run_cmdline] > 0} {
|
||||
test_fg_execution_pagination_return
|
||||
if ![target_info exists gdb,nointerrupts] {
|
||||
test_fg_execution_pagination_cancel "ctrl-c"
|
||||
}
|
||||
test_fg_execution_pagination_cancel "quit"
|
||||
}
|
||||
test_fg_execution_pagination_cancel "quit"
|
||||
}
|
||||
|
||||
set GDBFLAGS $saved_gdbflags
|
||||
|
|
|
@ -459,7 +459,12 @@ proc test_disassembler_error_handling { } {
|
|||
# startup process).
|
||||
proc test_startup_version_string { } {
|
||||
gdb_exit
|
||||
gdb_spawn
|
||||
|
||||
save_vars { ::INTERNAL_GDBFLAGS } {
|
||||
set ::INTERNAL_GDBFLAGS [string map {"-q" ""} $::INTERNAL_GDBFLAGS]
|
||||
|
||||
gdb_spawn
|
||||
}
|
||||
|
||||
# Deliberate use of base STYLE proc here as the style of the
|
||||
# startup version string can't (currently) be controlled.
|
||||
|
|
|
@ -165,4 +165,7 @@ proc test_with_self { } {
|
|||
return 0
|
||||
}
|
||||
|
||||
do_self_tests captured_main test_with_self
|
||||
save_vars { INTERNAL_GDBFLAGS } {
|
||||
set INTERNAL_GDBFLAGS [string map {"-q" ""} $INTERNAL_GDBFLAGS]
|
||||
do_self_tests captured_main test_with_self
|
||||
}
|
||||
|
|
|
@ -27,92 +27,96 @@ if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} {
|
|||
return -1
|
||||
}
|
||||
|
||||
global GDBFLAGS
|
||||
set saved_gdbflags $GDBFLAGS
|
||||
set GDBFLAGS [concat $GDBFLAGS " -ex \"set height 0\""]
|
||||
set GDBFLAGS [concat $GDBFLAGS " -ex \"set width 0\""]
|
||||
set GDBFLAGS [concat $GDBFLAGS " -ex \"python p = list()\""]
|
||||
set prompt_func "python def foo(x): global p; p.append(x); return \'(Foo) \'"
|
||||
set GDBFLAGS [concat $GDBFLAGS " -ex \"$prompt_func\""]
|
||||
set GDBFLAGS [concat $GDBFLAGS " -ex \"python gdb.prompt_hook=foo\""]
|
||||
save_vars { INTERNAL_GDBFLAGS } {
|
||||
set INTERNAL_GDBFLAGS [string map {"-q" ""} $INTERNAL_GDBFLAGS]
|
||||
|
||||
set tmp_gdbflags $GDBFLAGS
|
||||
set gdb_prompt_fail $gdb_prompt
|
||||
global GDBFLAGS
|
||||
set saved_gdbflags $GDBFLAGS
|
||||
set GDBFLAGS [concat $GDBFLAGS " -ex \"set height 0\""]
|
||||
set GDBFLAGS [concat $GDBFLAGS " -ex \"set width 0\""]
|
||||
set GDBFLAGS [concat $GDBFLAGS " -ex \"python p = list()\""]
|
||||
set prompt_func "python def foo(x): global p; p.append(x); return \'(Foo) \'"
|
||||
set GDBFLAGS [concat $GDBFLAGS " -ex \"$prompt_func\""]
|
||||
set GDBFLAGS [concat $GDBFLAGS " -ex \"python gdb.prompt_hook=foo\""]
|
||||
|
||||
global gdb_prompt
|
||||
# Does not include the space at the end of the prompt.
|
||||
# gdb_test expects it not to be there.
|
||||
set gdb_prompt "\[(\]Foo\[)\]"
|
||||
set tmp_gdbflags $GDBFLAGS
|
||||
set gdb_prompt_fail $gdb_prompt
|
||||
|
||||
with_test_prefix "set editing on" {
|
||||
set GDBFLAGS [concat $tmp_gdbflags " -ex \"set editing on\""]
|
||||
prompt_gdb_start
|
||||
gdb_test "python x = len(p); print (gdb.execute(\"show prompt\", to_string = True))" \
|
||||
".*prompt is \"$gdb_prompt \".*" \
|
||||
"show prompt gets the correct result"
|
||||
gdb_test "python print ('%d %d' % (x, len(p)))" "1 2" \
|
||||
"retrieving the prompt causes no extra prompt_hook calls"
|
||||
gdb_test "python print (\"'\" + str(p\[0\]) + \"'\")" "'$gdb_prompt_fail '" \
|
||||
"prompt_hook argument is default prompt."
|
||||
gdb_exit
|
||||
}
|
||||
global gdb_prompt
|
||||
# Does not include the space at the end of the prompt.
|
||||
# gdb_test expects it not to be there.
|
||||
set gdb_prompt "\[(\]Foo\[)\]"
|
||||
|
||||
with_test_prefix "set editing off" {
|
||||
set GDBFLAGS [concat $tmp_gdbflags " -ex \"set editing off\""]
|
||||
prompt_gdb_start
|
||||
gdb_test "python x = len(p); print (gdb.execute(\"show prompt\", to_string = True))" \
|
||||
".*prompt is \"$gdb_prompt \".*" \
|
||||
"show prompt gets the correct result 2"
|
||||
gdb_test "python print ('%d %d' % (x, len(p)))" "1 2" \
|
||||
"retrieving the prompt causes no extra prompt_hook calls 2"
|
||||
gdb_test "python print (\"'\" + str(p\[0\]) + \"'\")" "'$gdb_prompt_fail '" \
|
||||
"prompt_hook argument is default prompt. 2"
|
||||
gdb_exit
|
||||
}
|
||||
with_test_prefix "set editing on" {
|
||||
set GDBFLAGS [concat $tmp_gdbflags " -ex \"set editing on\""]
|
||||
prompt_gdb_start
|
||||
gdb_test "python x = len(p); print (gdb.execute(\"show prompt\", to_string = True))" \
|
||||
".*prompt is \"$gdb_prompt \".*" \
|
||||
"show prompt gets the correct result"
|
||||
gdb_test "python print ('%d %d' % (x, len(p)))" "1 2" \
|
||||
"retrieving the prompt causes no extra prompt_hook calls"
|
||||
gdb_test "python print (\"'\" + str(p\[0\]) + \"'\")" "'$gdb_prompt_fail '" \
|
||||
"prompt_hook argument is default prompt."
|
||||
gdb_exit
|
||||
}
|
||||
|
||||
with_test_prefix "set editing off" {
|
||||
set GDBFLAGS [concat $tmp_gdbflags " -ex \"set editing off\""]
|
||||
prompt_gdb_start
|
||||
gdb_test "python x = len(p); print (gdb.execute(\"show prompt\", to_string = True))" \
|
||||
".*prompt is \"$gdb_prompt \".*" \
|
||||
"show prompt gets the correct result 2"
|
||||
gdb_test "python print ('%d %d' % (x, len(p)))" "1 2" \
|
||||
"retrieving the prompt causes no extra prompt_hook calls 2"
|
||||
gdb_test "python print (\"'\" + str(p\[0\]) + \"'\")" "'$gdb_prompt_fail '" \
|
||||
"prompt_hook argument is default prompt. 2"
|
||||
gdb_exit
|
||||
}
|
||||
|
||||
if {![can_spawn_for_attach]} {
|
||||
set GDBFLAGS $saved_gdbflags
|
||||
return 0
|
||||
}
|
||||
|
||||
set test_spawn_id [spawn_wait_for_attach $binfile]
|
||||
set testpid [spawn_id_get_pid $test_spawn_id]
|
||||
|
||||
set GDBFLAGS [concat $tmp_gdbflags " -ex \"set pagination off\""]
|
||||
set GDBFLAGS [concat $GDBFLAGS " -ex \"set editing on\""]
|
||||
set GDBFLAGS [concat $GDBFLAGS " -ex \"attach $testpid\""]
|
||||
set GDBFLAGS [concat $GDBFLAGS " -ex \"continue&\""]
|
||||
|
||||
# sync_execution = 1 is_running = 1
|
||||
with_test_prefix "sync_execution = 1, is_running = 1" {
|
||||
prompt_gdb_start
|
||||
gdb_test "python x = len(p); print (gdb.execute(\"show prompt\", to_string = True))" \
|
||||
".*prompt is \"$gdb_prompt \".*" \
|
||||
"show prompt gets the correct result 3"
|
||||
gdb_test "python print ('%d %d' % (x, len(p)))" "1 2" \
|
||||
"retrieving the prompt causes no extra prompt_hook calls 3"
|
||||
gdb_test "python print (\"'\" + str(p\[0\]) + \"'\")" "'$gdb_prompt_fail '" \
|
||||
"prompt_hook argument is default prompt. 3"
|
||||
gdb_exit
|
||||
}
|
||||
|
||||
set GDBFLAGS [concat $tmp_gdbflags " -ex \"set pagination off\""]
|
||||
set GDBFLAGS [concat $GDBFLAGS " -ex \"set editing on\""]
|
||||
set GDBFLAGS [concat $GDBFLAGS " -ex \"attach $testpid\""]
|
||||
set GDBFLAGS [concat $GDBFLAGS " -ex \"interrupt\""]
|
||||
|
||||
# sync_execution = 1 is_running = 0
|
||||
with_test_prefix "sync_execution = 1, is_running = 0" {
|
||||
prompt_gdb_start
|
||||
gdb_test "python x = len(p); print (gdb.execute(\"show prompt\", to_string = True))" \
|
||||
".*prompt is \"$gdb_prompt \".*" \
|
||||
"show prompt gets the correct result 4"
|
||||
gdb_test "python print ('%d %d' % (x, len(p)))" "1 2" \
|
||||
"retrieving the prompt causes no extra prompt_hook calls 4"
|
||||
gdb_test "python print (\"'\" + str(p\[0\]) + \"'\")" "'$gdb_prompt_fail '" \
|
||||
"prompt_hook argument is default prompt. 4"
|
||||
gdb_exit
|
||||
}
|
||||
|
||||
if {![can_spawn_for_attach]} {
|
||||
set GDBFLAGS $saved_gdbflags
|
||||
return 0
|
||||
kill_wait_spawned_process $test_spawn_id
|
||||
}
|
||||
|
||||
set test_spawn_id [spawn_wait_for_attach $binfile]
|
||||
set testpid [spawn_id_get_pid $test_spawn_id]
|
||||
|
||||
set GDBFLAGS [concat $tmp_gdbflags " -ex \"set pagination off\""]
|
||||
set GDBFLAGS [concat $GDBFLAGS " -ex \"set editing on\""]
|
||||
set GDBFLAGS [concat $GDBFLAGS " -ex \"attach $testpid\""]
|
||||
set GDBFLAGS [concat $GDBFLAGS " -ex \"continue&\""]
|
||||
|
||||
# sync_execution = 1 is_running = 1
|
||||
with_test_prefix "sync_execution = 1, is_running = 1" {
|
||||
prompt_gdb_start
|
||||
gdb_test "python x = len(p); print (gdb.execute(\"show prompt\", to_string = True))" \
|
||||
".*prompt is \"$gdb_prompt \".*" \
|
||||
"show prompt gets the correct result 3"
|
||||
gdb_test "python print ('%d %d' % (x, len(p)))" "1 2" \
|
||||
"retrieving the prompt causes no extra prompt_hook calls 3"
|
||||
gdb_test "python print (\"'\" + str(p\[0\]) + \"'\")" "'$gdb_prompt_fail '" \
|
||||
"prompt_hook argument is default prompt. 3"
|
||||
gdb_exit
|
||||
}
|
||||
|
||||
set GDBFLAGS [concat $tmp_gdbflags " -ex \"set pagination off\""]
|
||||
set GDBFLAGS [concat $GDBFLAGS " -ex \"set editing on\""]
|
||||
set GDBFLAGS [concat $GDBFLAGS " -ex \"attach $testpid\""]
|
||||
set GDBFLAGS [concat $GDBFLAGS " -ex \"interrupt\""]
|
||||
|
||||
# sync_execution = 1 is_running = 0
|
||||
with_test_prefix "sync_execution = 1, is_running = 0" {
|
||||
prompt_gdb_start
|
||||
gdb_test "python x = len(p); print (gdb.execute(\"show prompt\", to_string = True))" \
|
||||
".*prompt is \"$gdb_prompt \".*" \
|
||||
"show prompt gets the correct result 4"
|
||||
gdb_test "python print ('%d %d' % (x, len(p)))" "1 2" \
|
||||
"retrieving the prompt causes no extra prompt_hook calls 4"
|
||||
gdb_test "python print (\"'\" + str(p\[0\]) + \"'\")" "'$gdb_prompt_fail '" \
|
||||
"prompt_hook argument is default prompt. 4"
|
||||
gdb_exit
|
||||
}
|
||||
|
||||
set GDBFLAGS $saved_gdbflags
|
||||
kill_wait_spawned_process $test_spawn_id
|
||||
|
|
|
@ -216,6 +216,7 @@ if ![info exists INTERNAL_GDBFLAGS] {
|
|||
[join [list \
|
||||
"-nw" \
|
||||
"-nx" \
|
||||
"-q" \
|
||||
{-iex "set height 0"} \
|
||||
{-iex "set width 0"}]]
|
||||
|
||||
|
@ -2302,6 +2303,14 @@ proc default_gdb_start { } {
|
|||
# that case, this case is hit.
|
||||
verbose "GDB initialized."
|
||||
}
|
||||
-re "^$gdb_prompt $" {
|
||||
# Output with -q.
|
||||
verbose "GDB initialized."
|
||||
}
|
||||
-re "^\033\\\[.2004h$gdb_prompt $" {
|
||||
# Output with -q, and bracketed paste mode enabled, see above.
|
||||
verbose "GDB initialized."
|
||||
}
|
||||
-re "$gdb_prompt $" {
|
||||
perror "GDB never initialized."
|
||||
unset gdb_spawn_id
|
||||
|
|
|
@ -265,6 +265,10 @@ proc default_mi_gdb_start { { flags {} } } {
|
|||
# We have a new format mi startup prompt.
|
||||
verbose "GDB initialized."
|
||||
}
|
||||
-re "^(=\[^\r\n\]*\r\n)*$mi_gdb_prompt$" {
|
||||
# Output with -q.
|
||||
verbose "GDB initialized."
|
||||
}
|
||||
-re ".*unrecognized option.*for a complete list of options." {
|
||||
untested "skip mi tests (not compiled with mi support)."
|
||||
remote_close host
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue