diff options
author | Yao Qi <yao@codesourcery.com> | 2014-03-19 10:16:35 +0800 |
---|---|---|
committer | Yao Qi <yao@codesourcery.com> | 2014-03-26 21:11:08 +0800 |
commit | 0d4d0e772ac36d169d21951c46b0778ae7fa8d53 (patch) | |
tree | 909fa2d2ba498ccc12a88f12761fa3e63d7a26c9 /gdb/testsuite/gdb.base/completion.exp | |
parent | 29361eee1499fa208baf06df5c6aa1ef4c1b2516 (diff) | |
download | gdb-0d4d0e772ac36d169d21951c46b0778ae7fa8d53.zip gdb-0d4d0e772ac36d169d21951c46b0778ae7fa8d53.tar.gz gdb-0d4d0e772ac36d169d21951c46b0778ae7fa8d53.tar.bz2 |
Skip tests on completion and readline when readline lib isn't used
The completion feature and other features on readline depend on the
readline library. However, readline library is not always used, for
example, running testsuite like
make check RUNTESTFLAGS="--host_board=local-remote-host"
the input stream is not a tty, and GDB doesn't use readline library
as a result.
This patch is to skip tests on completion and readline if
'show editing' is off, which means readline isn't used. Note that
some tests in gdb.base/completion.exp test command complete, which
isn't related to readline, so these tests aren't affected by readline
library. This patch also moves these tests up, run them
unconditionally, and run the rest if readline library is used.
gdb/testsuite:
2014-03-26 Yao Qi <yao@codesourcery.com>
* lib/gdb.exp (readline_is_used): New proc.
* gdb.base/completion.exp: Move tests on command complete up.
Skip the rest of tests if readline is not used.
* gdb.ada/complete.exp: Skp the test if readline is not
used.
* gdb.base/filesym.exp: Likewise.
* gdb.base/macscp.exp: Likewise.
* gdb.base/readline-ask.exp: Likewise.
* gdb.base/readline.exp: Likewise.
* gdb.python/py-cmd.exp: Likewise.
* gdb.trace/tfile.exp: Likewise.
Diffstat (limited to 'gdb/testsuite/gdb.base/completion.exp')
-rw-r--r-- | gdb/testsuite/gdb.base/completion.exp | 121 |
1 files changed, 64 insertions, 57 deletions
diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp index d51a847..8d9eea5 100644 --- a/gdb/testsuite/gdb.base/completion.exp +++ b/gdb/testsuite/gdb.base/completion.exp @@ -69,6 +69,70 @@ if ![runto_main] then { set oldtimeout1 $timeout set timeout 30 +gdb_test_no_output "complete print values\[0\].x." \ + "field completion with invalid field" + +# If there is a non-deprecated completion, it should be returned. +gdb_test "complete sav" "save" "test non-deprecated completion" +# If there is only a deprecated completion, then it should be returned. +gdb_test "complete save-t" "save-tracepoints" "test deprecated completion" + + +# +# Tag name completion. +# + +gdb_test "complete ptype struct some_" "ptype struct some_struct" +gdb_test "complete ptype enum some_" "ptype enum some_enum" +gdb_test "complete ptype union some_" "ptype union some_union" + + +gdb_test "complete set gnutarget aut" "set gnutarget auto" + + +gdb_test "complete set cp-abi aut" "set cp-abi auto" + +# Test that completion of commands 'target FOO' works well. +set targets [list "core" "tfile" "exec"] + +# Test that completion of command 'target ctf' if GDB supports ctf +# target. +gdb_test_multiple "target ctf" "" { + -re "Undefined target command: \"ctf\"\. Try \"help target\"\.\r\n$gdb_prompt $" { + } + -re "No CTF directory specified.*\r\n$gdb_prompt $" { + lappend targets "ctf" + } +} + +foreach target_name ${targets} { + gdb_test "complete target ${target_name} ./gdb.base/completion" \ + "target ${target_name} \\./gdb.base/completion.*\\./gdb.base/completion0\\.o.*\\./gdb.base/completion1\\.o.*" +} + +# +# "set foo unlimited" completion. +# + +# A var_uinteger command. +gdb_test "complete set height " "set height unlimited" +gdb_test "complete set height u" "set height unlimited" + +# A var_integer command. +gdb_test "complete set listsize " "set listsize unlimited" +gdb_test "complete set listsize unl" "set listsize unlimited" + +# A var_zuinteger_unlimited command. +gdb_test "complete set trace-buffer-size " "set trace-buffer-size unlimited" +gdb_test "complete set trace-buffer-size unl" "set trace-buffer-size unlimited" + +# Tests below are about tab-completion, which doesn't work if readline +# library isn't used. Check it first. + +if { ![readline_is_used] } { + return -1 +} + set test "complete 'hfgfh'" send_gdb "hfgfh\t" gdb_test_multiple "" "$test" { @@ -672,63 +736,6 @@ gdb_test_multiple "" "$test" { } } -gdb_test_no_output "complete print values\[0\].x." \ - "field completion with invalid field" - -# If there is a non-deprecated completion, it should be returned. -gdb_test "complete sav" "save" "test non-deprecated completion" -# If there is only a deprecated completion, then it should be returned. -gdb_test "complete save-t" "save-tracepoints" "test deprecated completion" - - -# -# Tag name completion. -# - -gdb_test "complete ptype struct some_" "ptype struct some_struct" -gdb_test "complete ptype enum some_" "ptype enum some_enum" -gdb_test "complete ptype union some_" "ptype union some_union" - - -gdb_test "complete set gnutarget aut" "set gnutarget auto" - - -gdb_test "complete set cp-abi aut" "set cp-abi auto" - -# Test that completion of commands 'target FOO' works well. -set targets [list "core" "tfile" "exec"] - -# Test that completion of command 'target ctf' if GDB supports ctf -# target. -gdb_test_multiple "target ctf" "" { - -re "Undefined target command: \"ctf\"\. Try \"help target\"\.\r\n$gdb_prompt $" { - } - -re "No CTF directory specified.*\r\n$gdb_prompt $" { - lappend targets "ctf" - } -} - -foreach target_name ${targets} { - gdb_test "complete target ${target_name} ./gdb.base/completion" \ - "target ${target_name} ./gdb.base/completion\\.exp.*" -} - -# -# "set foo unlimited" completion. -# - -# A var_uinteger command. -gdb_test "complete set height " "set height unlimited" -gdb_test "complete set height u" "set height unlimited" - -# A var_integer command. -gdb_test "complete set listsize " "set listsize unlimited" -gdb_test "complete set listsize unl" "set listsize unlimited" - -# A var_zuinteger_unlimited command. -gdb_test "complete set trace-buffer-size " "set trace-buffer-size unlimited" -gdb_test "complete set trace-buffer-size unl" "set trace-buffer-size unlimited" - # Restore globals modified in this test... set timeout $oldtimeout1 |