* [PATCH] Skip tests on completion and readline when readline lib isn't used
@ 2014-03-26 5:49 Yao Qi
2014-03-26 12:32 ` Joel Brobecker
2014-05-01 16:27 ` [PUSHED 0/2] Make local-remote-host.exp force pseudo-tty allocation; add local-remote-host-notty.exp Pedro Alves
0 siblings, 2 replies; 7+ messages in thread
From: Yao Qi @ 2014-03-26 5:49 UTC (permalink / raw)
To: gdb-patches
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.
Is it OK?
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.
---
gdb/testsuite/gdb.ada/complete.exp | 23 +++---
gdb/testsuite/gdb.base/completion.exp | 123 ++++++++++++++++--------------
gdb/testsuite/gdb.base/filesym.exp | 6 ++
gdb/testsuite/gdb.base/macscp.exp | 119 +++++++++++++++---------------
gdb/testsuite/gdb.base/readline-ask.exp | 5 +
gdb/testsuite/gdb.base/readline.exp | 5 +
gdb/testsuite/gdb.python/py-cmd.exp | 18 +++--
gdb/testsuite/gdb.trace/tfile.exp | 8 +-
gdb/testsuite/lib/gdb.exp | 16 ++++
9 files changed, 187 insertions(+), 136 deletions(-)
diff --git a/gdb/testsuite/gdb.ada/complete.exp b/gdb/testsuite/gdb.ada/complete.exp
index 5b52f73..1e1ebaa 100644
--- a/gdb/testsuite/gdb.ada/complete.exp
+++ b/gdb/testsuite/gdb.ada/complete.exp
@@ -176,15 +176,18 @@ test_gdb_complete "<pck__my" \
# The verification we are trying to make involves the event loop,
# and using the "complete" command is not sufficient to reproduce
# the original problem.
-set test "interactive complete 'print some'"
-send_gdb "print some\t"
-gdb_test_multiple "" "$test" {
- -re "^print some_local_variable $" {
- send_gdb "\n"
- gdb_test_multiple "" "$test" {
- -re " = 1$eol$gdb_prompt $" {
- pass "$test"
- }
- }
+
+if { [readline_is_used] } {
+ set test "interactive complete 'print some'"
+ send_gdb "print some\t"
+ gdb_test_multiple "" "$test" {
+ -re "^print some_local_variable $" {
+ send_gdb "\n"
+ gdb_test_multiple "" "$test" {
+ -re " = 1$eol$gdb_prompt $" {
+ pass "$test"
+ }
+ }
+ }
}
}
diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp
index b7b9b8e..caa3115 100644
--- a/gdb/testsuite/gdb.base/completion.exp
+++ b/gdb/testsuite/gdb.base/completion.exp
@@ -69,6 +69,72 @@ 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] } {
+ # Restore globals modified in this test...
+ set timeout $oldtimeout1
+ return -1
+}
+
set test "complete 'hfgfh'"
send_gdb "hfgfh\t"
gdb_test_multiple "" "$test" {
@@ -687,63 +753,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
diff --git a/gdb/testsuite/gdb.base/filesym.exp b/gdb/testsuite/gdb.base/filesym.exp
index 5f43116..77e643b 100644
--- a/gdb/testsuite/gdb.base/filesym.exp
+++ b/gdb/testsuite/gdb.base/filesym.exp
@@ -22,6 +22,12 @@ if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
return -1
}
+if { ![readline_is_used] } {
+ unsupported "completion doesn't work when readline isn't used."
+ return -1
+}
+
+
# Test completion list for "filesy". We expect the immediate result to
# complete to "filesym"; completing again, we expect the symbol name and the
# filename (in that order).
diff --git a/gdb/testsuite/gdb.base/macscp.exp b/gdb/testsuite/gdb.base/macscp.exp
index e953c0d..9503e75 100644
--- a/gdb/testsuite/gdb.base/macscp.exp
+++ b/gdb/testsuite/gdb.base/macscp.exp
@@ -517,77 +517,80 @@ gdb_test "macro undef" \
"usage: macro undef.*" \
"macro undef with no arguments"
-# Completion tests.
-
-# The macro FIFTY_SEVEN is in scope at this point.
-send_gdb "p FIFTY_\t"
-gdb_expect {
- -re "^p FIFTY_SEVEN $" {
- send_gdb "\n"
- gdb_expect {
- -re "^.* = 57.*$gdb_prompt $" {
- pass "complete 'p FIFTY_SEVEN'"
- }
- -re ".*$gdb_prompt $" { fail "complete 'p FIFTY_SEVEN'" }
- timeout { fail "(timeout) complete 'p FIFTY_SEVEN'" }
+# Do completion tests if readline is used.
+
+if { [readline_is_used] } {
+
+ # The macro FIFTY_SEVEN is in scope at this point.
+ send_gdb "p FIFTY_\t"
+ gdb_expect {
+ -re "^p FIFTY_SEVEN $" {
+ send_gdb "\n"
+ gdb_expect {
+ -re "^.* = 57.*$gdb_prompt $" {
+ pass "complete 'p FIFTY_SEVEN'"
+ }
+ -re ".*$gdb_prompt $" { fail "complete 'p FIFTY_SEVEN'" }
+ timeout { fail "(timeout) complete 'p FIFTY_SEVEN'" }
}
}
- -re ".*$gdb_prompt $" { fail "complete 'p FIFTY_SEVEN'" }
- timeout { fail "(timeout) complete 'p FIFTY_SEVEN' 2" }
-}
+ -re ".*$gdb_prompt $" { fail "complete 'p FIFTY_SEVEN'" }
+ timeout { fail "(timeout) complete 'p FIFTY_SEVEN' 2" }
+ }
-# The macro TWENTY_THREE is not in scope.
-send_gdb "p TWENTY_\t"
-gdb_expect {
- -re "^p TWENTY_\\\x07$" {
- send_gdb "\n"
- gdb_expect {
- -re "No symbol \"TWENTY_\" in current context\\..*$gdb_prompt $" {
- pass "complete 'p TWENTY_'"
+ # The macro TWENTY_THREE is not in scope.
+ send_gdb "p TWENTY_\t"
+ gdb_expect {
+ -re "^p TWENTY_\\\x07$" {
+ send_gdb "\n"
+ gdb_expect {
+ -re "No symbol \"TWENTY_\" in current context\\..*$gdb_prompt $" {
+ pass "complete 'p TWENTY_'"
+ }
+ -re ".*$gdb_prompt $" { fail "complete 'p TWENTY_'" }
+ timeout { fail "(timeout) complete 'p TWENTY_'"}
}
- -re ".*$gdb_prompt $" { fail "complete 'p TWENTY_'" }
- timeout { fail "(timeout) complete 'p TWENTY_'"}
}
+ -re ".*$gdb_prompt $" { fail "complete 'p TWENTY_'" }
+ timeout { fail "(timeout) complete 'p TWENTY_' 2" }
}
- -re ".*$gdb_prompt $" { fail "complete 'p TWENTY_'" }
- timeout { fail "(timeout) complete 'p TWENTY_' 2" }
-}
-# The macro FORTY_EIGHT was undefined and thus is not in scope.
-send_gdb "p FORTY_\t"
-gdb_expect {
- -re "^p FORTY_\\\x07$" {
- send_gdb "\n"
- gdb_expect {
- -re "No symbol \"FORTY_\" in current context\\..*$gdb_prompt $" {
- pass "complete 'p FORTY_'"
- }
- -re ".*$gdb_prompt $" { fail "complete 'p FORTY_'" }
- timeout {fail "(timeout) complete 'p FORTY_'"}
+ # The macro FORTY_EIGHT was undefined and thus is not in scope.
+ send_gdb "p FORTY_\t"
+ gdb_expect {
+ -re "^p FORTY_\\\x07$" {
+ send_gdb "\n"
+ gdb_expect {
+ -re "No symbol \"FORTY_\" in current context\\..*$gdb_prompt $" {
+ pass "complete 'p FORTY_'"
+ }
+ -re ".*$gdb_prompt $" { fail "complete 'p FORTY_'" }
+ timeout {fail "(timeout) complete 'p FORTY_'"}
}
}
- -re ".*$gdb_prompt $" { fail "complete 'p FORTY_'" }
- timeout { fail "(timeout) complete 'p FORTY_' 2" }
-}
+ -re ".*$gdb_prompt $" { fail "complete 'p FORTY_'" }
+ timeout { fail "(timeout) complete 'p FORTY_' 2" }
+ }
-gdb_test_no_output "macro define TWENTY_THREE 25" \
- "defining TWENTY_THREE"
-
-# User-defined macros are always in scope.
-send_gdb "p TWENTY_\t"
-gdb_expect {
- -re "^p TWENTY_THREE $" {
- send_gdb "\n"
- gdb_expect {
- -re "^.* = 25.*$gdb_prompt $" {
- pass "complete 'p TWENTY_THREE'"
+ gdb_test_no_output "macro define TWENTY_THREE 25" \
+ "defining TWENTY_THREE"
+
+ # User-defined macros are always in scope.
+ send_gdb "p TWENTY_\t"
+ gdb_expect {
+ -re "^p TWENTY_THREE $" {
+ send_gdb "\n"
+ gdb_expect {
+ -re "^.* = 25.*$gdb_prompt $" {
+ pass "complete 'p TWENTY_THREE'"
+ }
+ -re ".*$gdb_prompt $" { fail "complete 'p TWENTY_THREE'"}
+ timeout { fail "(timeout) complete 'p TWENTY_THREE'" }
}
- -re ".*$gdb_prompt $" { fail "complete 'p TWENTY_THREE'"}
- timeout { fail "(timeout) complete 'p TWENTY_THREE'" }
}
+ -re ".*$gdb_prompt $" { fail "complete 'p TWENTY_THREE'" }
+ timeout { fail "(timeout) complete 'p TWENTY_THREE' 2" }
}
- -re ".*$gdb_prompt $" { fail "complete 'p TWENTY_THREE'" }
- timeout { fail "(timeout) complete 'p TWENTY_THREE' 2" }
}
# Splicing tests.
diff --git a/gdb/testsuite/gdb.base/readline-ask.exp b/gdb/testsuite/gdb.base/readline-ask.exp
index e15dcca..d0a349d 100644
--- a/gdb/testsuite/gdb.base/readline-ask.exp
+++ b/gdb/testsuite/gdb.base/readline-ask.exp
@@ -25,6 +25,11 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {debug}]
setenv INPUTRC $inputrc
clean_restart ${binfile}
+if { ![readline_is_used] } {
+ unsupported "completion doesn't work when readline isn't used."
+ return -1
+}
+
gdb_test_no_output "set width 50"
gdb_test_no_output "set height 3"
diff --git a/gdb/testsuite/gdb.base/readline.exp b/gdb/testsuite/gdb.base/readline.exp
index 3c7d4c1..ef7fa13 100644
--- a/gdb/testsuite/gdb.base/readline.exp
+++ b/gdb/testsuite/gdb.base/readline.exp
@@ -145,6 +145,11 @@ proc operate_and_get_next {name args} {
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
+if { ![readline_is_used] } {
+ unsupported "readline isn't used."
+ return -1
+}
+
set oldtimeout1 $timeout
set timeout 30
diff --git a/gdb/testsuite/gdb.python/py-cmd.exp b/gdb/testsuite/gdb.python/py-cmd.exp
index c48c8bf..a87aecb 100644
--- a/gdb/testsuite/gdb.python/py-cmd.exp
+++ b/gdb/testsuite/gdb.python/py-cmd.exp
@@ -177,14 +177,16 @@ gdb_test "complete expr_test bar\." \
"expr_test bar\.bc.*expr_test bar\.ij.*" \
"Test completion through complete command"
-set test "complete 'expr_test bar.i'"
-send_gdb "expr_test bar\.i\t\t"
-gdb_test_multiple "" "$test" {
- -re "expr_test bar\.ij \\\x07$" {
- send_gdb "\n"
- gdb_test_multiple "" $test {
- -re "invoked on = bar.ij.*$gdb_prompt $" {
- pass "$test"
+if { [readline_is_used] } {
+ set test "complete 'expr_test bar.i'"
+ send_gdb "expr_test bar\.i\t\t"
+ gdb_test_multiple "" "$test" {
+ -re "expr_test bar\.ij \\\x07$" {
+ send_gdb "\n"
+ gdb_test_multiple "" $test {
+ -re "invoked on = bar.ij.*$gdb_prompt $" {
+ pass "$test"
+ }
}
}
}
diff --git a/gdb/testsuite/gdb.trace/tfile.exp b/gdb/testsuite/gdb.trace/tfile.exp
index 634c2fc..c98e64c 100644
--- a/gdb/testsuite/gdb.trace/tfile.exp
+++ b/gdb/testsuite/gdb.trace/tfile.exp
@@ -148,6 +148,8 @@ gdb_test "interpreter-exec mi \"-trace-status\"" \
# Test completion works well.
-gdb_test "target tfile [file rootname $tfile_basic]\t" \
- "Assuming tracepoint.*" \
- "complete-command 'target tfile'"
+if { [readline_is_used] } {
+ gdb_test "target tfile [file rootname $tfile_basic]\t" \
+ "Assuming tracepoint.*" \
+ "complete-command 'target tfile'"
+}
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 61e476b..29c0d21 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1831,6 +1831,22 @@ proc supports_reverse {} {
return 0
}
+# Return 1 if readline library is used.
+
+proc readline_is_used { } {
+ global gdb_prompt
+
+ send_gdb "show editing\n"
+ gdb_expect {
+ -re ".*Editing of command lines as they are typed is on\..*$gdb_prompt $" {
+ return 1
+ }
+ -re ".*$gdb_prompt $" {
+ return 0
+ }
+ }
+}
+
# Return 1 if target is ELF.
gdb_caching_proc is_elf_target {
set me "is_elf_target"
--
1.7.7.6
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Skip tests on completion and readline when readline lib isn't used
2014-03-26 5:49 [PATCH] Skip tests on completion and readline when readline lib isn't used Yao Qi
@ 2014-03-26 12:32 ` Joel Brobecker
2014-03-26 13:13 ` Yao Qi
2014-05-01 16:27 ` [PUSHED 0/2] Make local-remote-host.exp force pseudo-tty allocation; add local-remote-host-notty.exp Pedro Alves
1 sibling, 1 reply; 7+ messages in thread
From: Joel Brobecker @ 2014-03-26 12:32 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
> 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.
Mostly OK, see below... Pre-approved with the small changes requested
below.
> ---
> gdb/testsuite/gdb.ada/complete.exp | 23 +++---
> gdb/testsuite/gdb.base/completion.exp | 123 ++++++++++++++++--------------
> gdb/testsuite/gdb.base/filesym.exp | 6 ++
> gdb/testsuite/gdb.base/macscp.exp | 119 +++++++++++++++---------------
> gdb/testsuite/gdb.base/readline-ask.exp | 5 +
> gdb/testsuite/gdb.base/readline.exp | 5 +
> gdb/testsuite/gdb.python/py-cmd.exp | 18 +++--
> gdb/testsuite/gdb.trace/tfile.exp | 8 +-
> gdb/testsuite/lib/gdb.exp | 16 ++++
> 9 files changed, 187 insertions(+), 136 deletions(-)
>
> diff --git a/gdb/testsuite/gdb.ada/complete.exp b/gdb/testsuite/gdb.ada/complete.exp
> index 5b52f73..1e1ebaa 100644
> --- a/gdb/testsuite/gdb.ada/complete.exp
> +++ b/gdb/testsuite/gdb.ada/complete.exp
> @@ -176,15 +176,18 @@ test_gdb_complete "<pck__my" \
> # The verification we are trying to make involves the event loop,
> # and using the "complete" command is not sufficient to reproduce
> # the original problem.
> -set test "interactive complete 'print some'"
> -send_gdb "print some\t"
> -gdb_test_multiple "" "$test" {
> - -re "^print some_local_variable $" {
> - send_gdb "\n"
> - gdb_test_multiple "" "$test" {
> - -re " = 1$eol$gdb_prompt $" {
> - pass "$test"
> - }
> - }
> +
> +if { [readline_is_used] } {
> + set test "interactive complete 'print some'"
> + send_gdb "print some\t"
> + gdb_test_multiple "" "$test" {
> + -re "^print some_local_variable $" {
> + send_gdb "\n"
> + gdb_test_multiple "" "$test" {
> + -re " = 1$eol$gdb_prompt $" {
> + pass "$test"
> + }
> + }
> + }
> }
> }
> diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp
> index b7b9b8e..caa3115 100644
> --- a/gdb/testsuite/gdb.base/completion.exp
> +++ b/gdb/testsuite/gdb.base/completion.exp
> @@ -69,6 +69,72 @@ 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] } {
> + # Restore globals modified in this test...
> + set timeout $oldtimeout1
> + return -1
You actually do not need to restore $timeout. It's automatically
restored at the start of every testcase (see lib/gdb.exp::gdb_init).
> +}
> +
> set test "complete 'hfgfh'"
> send_gdb "hfgfh\t"
> gdb_test_multiple "" "$test" {
> @@ -687,63 +753,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
>
> diff --git a/gdb/testsuite/gdb.base/filesym.exp b/gdb/testsuite/gdb.base/filesym.exp
> index 5f43116..77e643b 100644
> --- a/gdb/testsuite/gdb.base/filesym.exp
> +++ b/gdb/testsuite/gdb.base/filesym.exp
> @@ -22,6 +22,12 @@ if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
> return -1
> }
>
> +if { ![readline_is_used] } {
> + unsupported "completion doesn't work when readline isn't used."
> + return -1
> +}
> +
> +
> # Test completion list for "filesy". We expect the immediate result to
> # complete to "filesym"; completing again, we expect the symbol name and the
> # filename (in that order).
> diff --git a/gdb/testsuite/gdb.base/macscp.exp b/gdb/testsuite/gdb.base/macscp.exp
> index e953c0d..9503e75 100644
> --- a/gdb/testsuite/gdb.base/macscp.exp
> +++ b/gdb/testsuite/gdb.base/macscp.exp
> @@ -517,77 +517,80 @@ gdb_test "macro undef" \
> "usage: macro undef.*" \
> "macro undef with no arguments"
>
> -# Completion tests.
> -
> -# The macro FIFTY_SEVEN is in scope at this point.
> -send_gdb "p FIFTY_\t"
> -gdb_expect {
> - -re "^p FIFTY_SEVEN $" {
> - send_gdb "\n"
> - gdb_expect {
> - -re "^.* = 57.*$gdb_prompt $" {
> - pass "complete 'p FIFTY_SEVEN'"
> - }
> - -re ".*$gdb_prompt $" { fail "complete 'p FIFTY_SEVEN'" }
> - timeout { fail "(timeout) complete 'p FIFTY_SEVEN'" }
> +# Do completion tests if readline is used.
> +
> +if { [readline_is_used] } {
> +
> + # The macro FIFTY_SEVEN is in scope at this point.
> + send_gdb "p FIFTY_\t"
> + gdb_expect {
> + -re "^p FIFTY_SEVEN $" {
> + send_gdb "\n"
> + gdb_expect {
> + -re "^.* = 57.*$gdb_prompt $" {
> + pass "complete 'p FIFTY_SEVEN'"
> + }
> + -re ".*$gdb_prompt $" { fail "complete 'p FIFTY_SEVEN'" }
> + timeout { fail "(timeout) complete 'p FIFTY_SEVEN'" }
> }
> }
> - -re ".*$gdb_prompt $" { fail "complete 'p FIFTY_SEVEN'" }
> - timeout { fail "(timeout) complete 'p FIFTY_SEVEN' 2" }
> -}
> + -re ".*$gdb_prompt $" { fail "complete 'p FIFTY_SEVEN'" }
> + timeout { fail "(timeout) complete 'p FIFTY_SEVEN' 2" }
> + }
>
> -# The macro TWENTY_THREE is not in scope.
> -send_gdb "p TWENTY_\t"
> -gdb_expect {
> - -re "^p TWENTY_\\\x07$" {
> - send_gdb "\n"
> - gdb_expect {
> - -re "No symbol \"TWENTY_\" in current context\\..*$gdb_prompt $" {
> - pass "complete 'p TWENTY_'"
> + # The macro TWENTY_THREE is not in scope.
> + send_gdb "p TWENTY_\t"
> + gdb_expect {
> + -re "^p TWENTY_\\\x07$" {
> + send_gdb "\n"
> + gdb_expect {
> + -re "No symbol \"TWENTY_\" in current context\\..*$gdb_prompt $" {
> + pass "complete 'p TWENTY_'"
> + }
> + -re ".*$gdb_prompt $" { fail "complete 'p TWENTY_'" }
> + timeout { fail "(timeout) complete 'p TWENTY_'"}
> }
> - -re ".*$gdb_prompt $" { fail "complete 'p TWENTY_'" }
> - timeout { fail "(timeout) complete 'p TWENTY_'"}
> }
> + -re ".*$gdb_prompt $" { fail "complete 'p TWENTY_'" }
> + timeout { fail "(timeout) complete 'p TWENTY_' 2" }
> }
> - -re ".*$gdb_prompt $" { fail "complete 'p TWENTY_'" }
> - timeout { fail "(timeout) complete 'p TWENTY_' 2" }
> -}
>
> -# The macro FORTY_EIGHT was undefined and thus is not in scope.
> -send_gdb "p FORTY_\t"
> -gdb_expect {
> - -re "^p FORTY_\\\x07$" {
> - send_gdb "\n"
> - gdb_expect {
> - -re "No symbol \"FORTY_\" in current context\\..*$gdb_prompt $" {
> - pass "complete 'p FORTY_'"
> - }
> - -re ".*$gdb_prompt $" { fail "complete 'p FORTY_'" }
> - timeout {fail "(timeout) complete 'p FORTY_'"}
> + # The macro FORTY_EIGHT was undefined and thus is not in scope.
> + send_gdb "p FORTY_\t"
> + gdb_expect {
> + -re "^p FORTY_\\\x07$" {
> + send_gdb "\n"
> + gdb_expect {
> + -re "No symbol \"FORTY_\" in current context\\..*$gdb_prompt $" {
> + pass "complete 'p FORTY_'"
> + }
> + -re ".*$gdb_prompt $" { fail "complete 'p FORTY_'" }
> + timeout {fail "(timeout) complete 'p FORTY_'"}
> }
> }
> - -re ".*$gdb_prompt $" { fail "complete 'p FORTY_'" }
> - timeout { fail "(timeout) complete 'p FORTY_' 2" }
> -}
> + -re ".*$gdb_prompt $" { fail "complete 'p FORTY_'" }
> + timeout { fail "(timeout) complete 'p FORTY_' 2" }
> + }
>
> -gdb_test_no_output "macro define TWENTY_THREE 25" \
> - "defining TWENTY_THREE"
> -
> -# User-defined macros are always in scope.
> -send_gdb "p TWENTY_\t"
> -gdb_expect {
> - -re "^p TWENTY_THREE $" {
> - send_gdb "\n"
> - gdb_expect {
> - -re "^.* = 25.*$gdb_prompt $" {
> - pass "complete 'p TWENTY_THREE'"
> + gdb_test_no_output "macro define TWENTY_THREE 25" \
> + "defining TWENTY_THREE"
> +
> + # User-defined macros are always in scope.
> + send_gdb "p TWENTY_\t"
> + gdb_expect {
> + -re "^p TWENTY_THREE $" {
> + send_gdb "\n"
> + gdb_expect {
> + -re "^.* = 25.*$gdb_prompt $" {
> + pass "complete 'p TWENTY_THREE'"
> + }
> + -re ".*$gdb_prompt $" { fail "complete 'p TWENTY_THREE'"}
> + timeout { fail "(timeout) complete 'p TWENTY_THREE'" }
> }
> - -re ".*$gdb_prompt $" { fail "complete 'p TWENTY_THREE'"}
> - timeout { fail "(timeout) complete 'p TWENTY_THREE'" }
> }
> + -re ".*$gdb_prompt $" { fail "complete 'p TWENTY_THREE'" }
> + timeout { fail "(timeout) complete 'p TWENTY_THREE' 2" }
> }
> - -re ".*$gdb_prompt $" { fail "complete 'p TWENTY_THREE'" }
> - timeout { fail "(timeout) complete 'p TWENTY_THREE' 2" }
> }
>
> # Splicing tests.
> diff --git a/gdb/testsuite/gdb.base/readline-ask.exp b/gdb/testsuite/gdb.base/readline-ask.exp
> index e15dcca..d0a349d 100644
> --- a/gdb/testsuite/gdb.base/readline-ask.exp
> +++ b/gdb/testsuite/gdb.base/readline-ask.exp
> @@ -25,6 +25,11 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {debug}]
> setenv INPUTRC $inputrc
> clean_restart ${binfile}
>
> +if { ![readline_is_used] } {
> + unsupported "completion doesn't work when readline isn't used."
> + return -1
> +}
> +
> gdb_test_no_output "set width 50"
> gdb_test_no_output "set height 3"
>
> diff --git a/gdb/testsuite/gdb.base/readline.exp b/gdb/testsuite/gdb.base/readline.exp
> index 3c7d4c1..ef7fa13 100644
> --- a/gdb/testsuite/gdb.base/readline.exp
> +++ b/gdb/testsuite/gdb.base/readline.exp
> @@ -145,6 +145,11 @@ proc operate_and_get_next {name args} {
> gdb_start
> gdb_reinitialize_dir $srcdir/$subdir
>
> +if { ![readline_is_used] } {
> + unsupported "readline isn't used."
> + return -1
> +}
> +
> set oldtimeout1 $timeout
> set timeout 30
>
> diff --git a/gdb/testsuite/gdb.python/py-cmd.exp b/gdb/testsuite/gdb.python/py-cmd.exp
> index c48c8bf..a87aecb 100644
> --- a/gdb/testsuite/gdb.python/py-cmd.exp
> +++ b/gdb/testsuite/gdb.python/py-cmd.exp
> @@ -177,14 +177,16 @@ gdb_test "complete expr_test bar\." \
> "expr_test bar\.bc.*expr_test bar\.ij.*" \
> "Test completion through complete command"
>
> -set test "complete 'expr_test bar.i'"
> -send_gdb "expr_test bar\.i\t\t"
> -gdb_test_multiple "" "$test" {
> - -re "expr_test bar\.ij \\\x07$" {
> - send_gdb "\n"
> - gdb_test_multiple "" $test {
> - -re "invoked on = bar.ij.*$gdb_prompt $" {
> - pass "$test"
> +if { [readline_is_used] } {
> + set test "complete 'expr_test bar.i'"
> + send_gdb "expr_test bar\.i\t\t"
> + gdb_test_multiple "" "$test" {
> + -re "expr_test bar\.ij \\\x07$" {
> + send_gdb "\n"
> + gdb_test_multiple "" $test {
> + -re "invoked on = bar.ij.*$gdb_prompt $" {
> + pass "$test"
> + }
> }
> }
> }
> diff --git a/gdb/testsuite/gdb.trace/tfile.exp b/gdb/testsuite/gdb.trace/tfile.exp
> index 634c2fc..c98e64c 100644
> --- a/gdb/testsuite/gdb.trace/tfile.exp
> +++ b/gdb/testsuite/gdb.trace/tfile.exp
> @@ -148,6 +148,8 @@ gdb_test "interpreter-exec mi \"-trace-status\"" \
>
> # Test completion works well.
>
> -gdb_test "target tfile [file rootname $tfile_basic]\t" \
> - "Assuming tracepoint.*" \
> - "complete-command 'target tfile'"
> +if { [readline_is_used] } {
> + gdb_test "target tfile [file rootname $tfile_basic]\t" \
> + "Assuming tracepoint.*" \
> + "complete-command 'target tfile'"
> +}
> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
> index 61e476b..29c0d21 100644
> --- a/gdb/testsuite/lib/gdb.exp
> +++ b/gdb/testsuite/lib/gdb.exp
> @@ -1831,6 +1831,22 @@ proc supports_reverse {} {
> return 0
> }
>
> +# Return 1 if readline library is used.
> +
> +proc readline_is_used { } {
> + global gdb_prompt
> +
> + send_gdb "show editing\n"
> + gdb_expect {
> + -re ".*Editing of command lines as they are typed is on\..*$gdb_prompt $" {
> + return 1
> + }
> + -re ".*$gdb_prompt $" {
> + return 0
> + }
Can you use gdb_test_multiple, in this case?
Thank you,
--
Joel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Skip tests on completion and readline when readline lib isn't used
2014-03-26 12:32 ` Joel Brobecker
@ 2014-03-26 13:13 ` Yao Qi
0 siblings, 0 replies; 7+ messages in thread
From: Yao Qi @ 2014-03-26 13:13 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
On 03/26/2014 08:32 PM, Joel Brobecker wrote:
>> +if { ![readline_is_used] } {
>> > + # Restore globals modified in this test...
>> > + set timeout $oldtimeout1
>> > + return -1
> You actually do not need to restore $timeout. It's automatically
> restored at the start of every testcase (see lib/gdb.exp::gdb_init).
>
OK.
>> >
>> > +# Return 1 if readline library is used.
>> > +
>> > +proc readline_is_used { } {
>> > + global gdb_prompt
>> > +
>> > + send_gdb "show editing\n"
>> > + gdb_expect {
>> > + -re ".*Editing of command lines as they are typed is on\..*$gdb_prompt $" {
>> > + return 1
>> > + }
>> > + -re ".*$gdb_prompt $" {
>> > + return 0
>> > + }
> Can you use gdb_test_multiple, in this case?
Done. Patch below is pushed in.
--
Yao (é½å°§)
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.
---
gdb/testsuite/ChangeLog | 14 ++++
gdb/testsuite/gdb.ada/complete.exp | 23 ++++---
gdb/testsuite/gdb.base/completion.exp | 121 ++++++++++++++++---------------
gdb/testsuite/gdb.base/filesym.exp | 6 ++
gdb/testsuite/gdb.base/macscp.exp | 119 ++++++++++++++++---------------
gdb/testsuite/gdb.base/readline-ask.exp | 5 ++
gdb/testsuite/gdb.base/readline.exp | 5 ++
gdb/testsuite/gdb.python/py-cmd.exp | 18 +++--
gdb/testsuite/gdb.trace/tfile.exp | 8 ++-
gdb/testsuite/lib/gdb.exp | 15 ++++
10 files changed, 198 insertions(+), 136 deletions(-)
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 694efd6..45355f3 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,19 @@
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.
+
+2014-03-26 Yao Qi <yao@codesourcery.com>
+
* gdb.base/macscp.exp: Fix code format issues.
2014-03-25 Ulrich Weigand <uweigand@de.ibm.com>
diff --git a/gdb/testsuite/gdb.ada/complete.exp b/gdb/testsuite/gdb.ada/complete.exp
index 5b52f73..1e1ebaa 100644
--- a/gdb/testsuite/gdb.ada/complete.exp
+++ b/gdb/testsuite/gdb.ada/complete.exp
@@ -176,15 +176,18 @@ test_gdb_complete "<pck__my" \
# The verification we are trying to make involves the event loop,
# and using the "complete" command is not sufficient to reproduce
# the original problem.
-set test "interactive complete 'print some'"
-send_gdb "print some\t"
-gdb_test_multiple "" "$test" {
- -re "^print some_local_variable $" {
- send_gdb "\n"
- gdb_test_multiple "" "$test" {
- -re " = 1$eol$gdb_prompt $" {
- pass "$test"
- }
- }
+
+if { [readline_is_used] } {
+ set test "interactive complete 'print some'"
+ send_gdb "print some\t"
+ gdb_test_multiple "" "$test" {
+ -re "^print some_local_variable $" {
+ send_gdb "\n"
+ gdb_test_multiple "" "$test" {
+ -re " = 1$eol$gdb_prompt $" {
+ pass "$test"
+ }
+ }
+ }
}
}
diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp
index b7b9b8e..73e3a06 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" {
@@ -687,63 +751,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
diff --git a/gdb/testsuite/gdb.base/filesym.exp b/gdb/testsuite/gdb.base/filesym.exp
index 5f43116..77e643b 100644
--- a/gdb/testsuite/gdb.base/filesym.exp
+++ b/gdb/testsuite/gdb.base/filesym.exp
@@ -22,6 +22,12 @@ if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
return -1
}
+if { ![readline_is_used] } {
+ unsupported "completion doesn't work when readline isn't used."
+ return -1
+}
+
+
# Test completion list for "filesy". We expect the immediate result to
# complete to "filesym"; completing again, we expect the symbol name and the
# filename (in that order).
diff --git a/gdb/testsuite/gdb.base/macscp.exp b/gdb/testsuite/gdb.base/macscp.exp
index e953c0d..9503e75 100644
--- a/gdb/testsuite/gdb.base/macscp.exp
+++ b/gdb/testsuite/gdb.base/macscp.exp
@@ -517,77 +517,80 @@ gdb_test "macro undef" \
"usage: macro undef.*" \
"macro undef with no arguments"
-# Completion tests.
-
-# The macro FIFTY_SEVEN is in scope at this point.
-send_gdb "p FIFTY_\t"
-gdb_expect {
- -re "^p FIFTY_SEVEN $" {
- send_gdb "\n"
- gdb_expect {
- -re "^.* = 57.*$gdb_prompt $" {
- pass "complete 'p FIFTY_SEVEN'"
- }
- -re ".*$gdb_prompt $" { fail "complete 'p FIFTY_SEVEN'" }
- timeout { fail "(timeout) complete 'p FIFTY_SEVEN'" }
+# Do completion tests if readline is used.
+
+if { [readline_is_used] } {
+
+ # The macro FIFTY_SEVEN is in scope at this point.
+ send_gdb "p FIFTY_\t"
+ gdb_expect {
+ -re "^p FIFTY_SEVEN $" {
+ send_gdb "\n"
+ gdb_expect {
+ -re "^.* = 57.*$gdb_prompt $" {
+ pass "complete 'p FIFTY_SEVEN'"
+ }
+ -re ".*$gdb_prompt $" { fail "complete 'p FIFTY_SEVEN'" }
+ timeout { fail "(timeout) complete 'p FIFTY_SEVEN'" }
}
}
- -re ".*$gdb_prompt $" { fail "complete 'p FIFTY_SEVEN'" }
- timeout { fail "(timeout) complete 'p FIFTY_SEVEN' 2" }
-}
+ -re ".*$gdb_prompt $" { fail "complete 'p FIFTY_SEVEN'" }
+ timeout { fail "(timeout) complete 'p FIFTY_SEVEN' 2" }
+ }
-# The macro TWENTY_THREE is not in scope.
-send_gdb "p TWENTY_\t"
-gdb_expect {
- -re "^p TWENTY_\\\x07$" {
- send_gdb "\n"
- gdb_expect {
- -re "No symbol \"TWENTY_\" in current context\\..*$gdb_prompt $" {
- pass "complete 'p TWENTY_'"
+ # The macro TWENTY_THREE is not in scope.
+ send_gdb "p TWENTY_\t"
+ gdb_expect {
+ -re "^p TWENTY_\\\x07$" {
+ send_gdb "\n"
+ gdb_expect {
+ -re "No symbol \"TWENTY_\" in current context\\..*$gdb_prompt $" {
+ pass "complete 'p TWENTY_'"
+ }
+ -re ".*$gdb_prompt $" { fail "complete 'p TWENTY_'" }
+ timeout { fail "(timeout) complete 'p TWENTY_'"}
}
- -re ".*$gdb_prompt $" { fail "complete 'p TWENTY_'" }
- timeout { fail "(timeout) complete 'p TWENTY_'"}
}
+ -re ".*$gdb_prompt $" { fail "complete 'p TWENTY_'" }
+ timeout { fail "(timeout) complete 'p TWENTY_' 2" }
}
- -re ".*$gdb_prompt $" { fail "complete 'p TWENTY_'" }
- timeout { fail "(timeout) complete 'p TWENTY_' 2" }
-}
-# The macro FORTY_EIGHT was undefined and thus is not in scope.
-send_gdb "p FORTY_\t"
-gdb_expect {
- -re "^p FORTY_\\\x07$" {
- send_gdb "\n"
- gdb_expect {
- -re "No symbol \"FORTY_\" in current context\\..*$gdb_prompt $" {
- pass "complete 'p FORTY_'"
- }
- -re ".*$gdb_prompt $" { fail "complete 'p FORTY_'" }
- timeout {fail "(timeout) complete 'p FORTY_'"}
+ # The macro FORTY_EIGHT was undefined and thus is not in scope.
+ send_gdb "p FORTY_\t"
+ gdb_expect {
+ -re "^p FORTY_\\\x07$" {
+ send_gdb "\n"
+ gdb_expect {
+ -re "No symbol \"FORTY_\" in current context\\..*$gdb_prompt $" {
+ pass "complete 'p FORTY_'"
+ }
+ -re ".*$gdb_prompt $" { fail "complete 'p FORTY_'" }
+ timeout {fail "(timeout) complete 'p FORTY_'"}
}
}
- -re ".*$gdb_prompt $" { fail "complete 'p FORTY_'" }
- timeout { fail "(timeout) complete 'p FORTY_' 2" }
-}
+ -re ".*$gdb_prompt $" { fail "complete 'p FORTY_'" }
+ timeout { fail "(timeout) complete 'p FORTY_' 2" }
+ }
-gdb_test_no_output "macro define TWENTY_THREE 25" \
- "defining TWENTY_THREE"
-
-# User-defined macros are always in scope.
-send_gdb "p TWENTY_\t"
-gdb_expect {
- -re "^p TWENTY_THREE $" {
- send_gdb "\n"
- gdb_expect {
- -re "^.* = 25.*$gdb_prompt $" {
- pass "complete 'p TWENTY_THREE'"
+ gdb_test_no_output "macro define TWENTY_THREE 25" \
+ "defining TWENTY_THREE"
+
+ # User-defined macros are always in scope.
+ send_gdb "p TWENTY_\t"
+ gdb_expect {
+ -re "^p TWENTY_THREE $" {
+ send_gdb "\n"
+ gdb_expect {
+ -re "^.* = 25.*$gdb_prompt $" {
+ pass "complete 'p TWENTY_THREE'"
+ }
+ -re ".*$gdb_prompt $" { fail "complete 'p TWENTY_THREE'"}
+ timeout { fail "(timeout) complete 'p TWENTY_THREE'" }
}
- -re ".*$gdb_prompt $" { fail "complete 'p TWENTY_THREE'"}
- timeout { fail "(timeout) complete 'p TWENTY_THREE'" }
}
+ -re ".*$gdb_prompt $" { fail "complete 'p TWENTY_THREE'" }
+ timeout { fail "(timeout) complete 'p TWENTY_THREE' 2" }
}
- -re ".*$gdb_prompt $" { fail "complete 'p TWENTY_THREE'" }
- timeout { fail "(timeout) complete 'p TWENTY_THREE' 2" }
}
# Splicing tests.
diff --git a/gdb/testsuite/gdb.base/readline-ask.exp b/gdb/testsuite/gdb.base/readline-ask.exp
index e15dcca..d0a349d 100644
--- a/gdb/testsuite/gdb.base/readline-ask.exp
+++ b/gdb/testsuite/gdb.base/readline-ask.exp
@@ -25,6 +25,11 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {debug}]
setenv INPUTRC $inputrc
clean_restart ${binfile}
+if { ![readline_is_used] } {
+ unsupported "completion doesn't work when readline isn't used."
+ return -1
+}
+
gdb_test_no_output "set width 50"
gdb_test_no_output "set height 3"
diff --git a/gdb/testsuite/gdb.base/readline.exp b/gdb/testsuite/gdb.base/readline.exp
index 3c7d4c1..ef7fa13 100644
--- a/gdb/testsuite/gdb.base/readline.exp
+++ b/gdb/testsuite/gdb.base/readline.exp
@@ -145,6 +145,11 @@ proc operate_and_get_next {name args} {
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
+if { ![readline_is_used] } {
+ unsupported "readline isn't used."
+ return -1
+}
+
set oldtimeout1 $timeout
set timeout 30
diff --git a/gdb/testsuite/gdb.python/py-cmd.exp b/gdb/testsuite/gdb.python/py-cmd.exp
index c48c8bf..a87aecb 100644
--- a/gdb/testsuite/gdb.python/py-cmd.exp
+++ b/gdb/testsuite/gdb.python/py-cmd.exp
@@ -177,14 +177,16 @@ gdb_test "complete expr_test bar\." \
"expr_test bar\.bc.*expr_test bar\.ij.*" \
"Test completion through complete command"
-set test "complete 'expr_test bar.i'"
-send_gdb "expr_test bar\.i\t\t"
-gdb_test_multiple "" "$test" {
- -re "expr_test bar\.ij \\\x07$" {
- send_gdb "\n"
- gdb_test_multiple "" $test {
- -re "invoked on = bar.ij.*$gdb_prompt $" {
- pass "$test"
+if { [readline_is_used] } {
+ set test "complete 'expr_test bar.i'"
+ send_gdb "expr_test bar\.i\t\t"
+ gdb_test_multiple "" "$test" {
+ -re "expr_test bar\.ij \\\x07$" {
+ send_gdb "\n"
+ gdb_test_multiple "" $test {
+ -re "invoked on = bar.ij.*$gdb_prompt $" {
+ pass "$test"
+ }
}
}
}
diff --git a/gdb/testsuite/gdb.trace/tfile.exp b/gdb/testsuite/gdb.trace/tfile.exp
index 634c2fc..c98e64c 100644
--- a/gdb/testsuite/gdb.trace/tfile.exp
+++ b/gdb/testsuite/gdb.trace/tfile.exp
@@ -148,6 +148,8 @@ gdb_test "interpreter-exec mi \"-trace-status\"" \
# Test completion works well.
-gdb_test "target tfile [file rootname $tfile_basic]\t" \
- "Assuming tracepoint.*" \
- "complete-command 'target tfile'"
+if { [readline_is_used] } {
+ gdb_test "target tfile [file rootname $tfile_basic]\t" \
+ "Assuming tracepoint.*" \
+ "complete-command 'target tfile'"
+}
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 61e476b..0db3c90 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1831,6 +1831,21 @@ proc supports_reverse {} {
return 0
}
+# Return 1 if readline library is used.
+
+proc readline_is_used { } {
+ global gdb_prompt
+
+ gdb_test_multiple "show editing" "" {
+ -re ".*Editing of command lines as they are typed is on\..*$gdb_prompt $" {
+ return 1
+ }
+ -re ".*$gdb_prompt $" {
+ return 0
+ }
+ }
+}
+
# Return 1 if target is ELF.
gdb_caching_proc is_elf_target {
set me "is_elf_target"
--
1.7.7.6
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PUSHED 0/2] Make local-remote-host.exp force pseudo-tty allocation; add local-remote-host-notty.exp
2014-03-26 5:49 [PATCH] Skip tests on completion and readline when readline lib isn't used Yao Qi
2014-03-26 12:32 ` Joel Brobecker
@ 2014-05-01 16:27 ` Pedro Alves
2014-05-01 16:27 ` [PUSHED 2/2] New testsuite/boards/local-remote-host.exp board, now with editing on Pedro Alves
2014-05-01 16:27 ` [PUSHED 1/2] Rename testsuite/boards/local-remote-host.exp -> testsuite/boards/local-remote-host-notty.exp Pedro Alves
1 sibling, 2 replies; 7+ messages in thread
From: Pedro Alves @ 2014-05-01 16:27 UTC (permalink / raw)
To: gdb-patches; +Cc: Yao Qi
On 03/26/2014 05:47 AM, Yao Qi wrote:
> 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.
It's kind of lame that the board does that though. There are testing
setups that can't do better, so it's good to be able to good emulate
them, but unix-like setups can just use "ssh -t" when spawning
interactive programs.
I pushed the series below. With:
make check RUNTESTFLAGS="--host_board=local-remote-host" \
TESTS="gdb.ada/complete.exp \
gdb.base/filesym.exp \
gdb.base/macscp.exp \
gdb.base/readline-ask.exp \
gdb.base/readline.exp \
gdb.python/py-cmd.exp \
gdb.trace/tfile.exp"
(the tests you touched) we still get:
$ cat testsuite/gdb.sum| grep "^FAIL"
FAIL: gdb.trace/tfile.exp: target tfile tfile-basic.tf
FAIL: gdb.trace/tfile.exp: info tracepoints on trace file
FAIL: gdb.trace/tfile.exp: tfind 0 on trace file
FAIL: gdb.trace/tfile.exp: print nonconstglob on trace file
FAIL: gdb.trace/tfile.exp: tstatus on trace file
FAIL: gdb.trace/tfile.exp: target tfile tfile-error.tf
FAIL: gdb.trace/tfile.exp: tstatus on error trace file
FAIL: gdb.trace/tfile.exp: interpreter-exec mi "-target-select tfile tfile-basic.tf"
FAIL: gdb.trace/tfile.exp: -trace-status
FAIL: gdb.trace/tfile.exp: complete-command 'target tfile'
FAIL: gdb.base/readline-ask.exp: ask message (timeout)
FAIL: gdb.ada/complete.exp: compilation foo.adb
though that looks like forward progress anyhow. The tfile.exp issue
looks like completely unrelated.
Pedro Alves (2):
Rename testsuite/boards/local-remote-host.exp ->
testsuite/boards/local-remote-host-notty.exp
New testsuite/boards/local-remote-host.exp board, now with editing
on
gdb/testsuite/ChangeLog | 9 +++++
gdb/testsuite/boards/local-remote-host-notty.exp | 46 ++++++++++++++++++++++++
gdb/testsuite/boards/local-remote-host.exp | 38 +++++++-------------
3 files changed, 67 insertions(+), 26 deletions(-)
create mode 100644 gdb/testsuite/boards/local-remote-host-notty.exp
--
1.7.11.7
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PUSHED 2/2] New testsuite/boards/local-remote-host.exp board, now with editing on
2014-05-01 16:27 ` [PUSHED 0/2] Make local-remote-host.exp force pseudo-tty allocation; add local-remote-host-notty.exp Pedro Alves
@ 2014-05-01 16:27 ` Pedro Alves
2014-05-02 11:28 ` Yao Qi
2014-05-01 16:27 ` [PUSHED 1/2] Rename testsuite/boards/local-remote-host.exp -> testsuite/boards/local-remote-host-notty.exp Pedro Alves
1 sibling, 1 reply; 7+ messages in thread
From: Pedro Alves @ 2014-05-01 16:27 UTC (permalink / raw)
To: gdb-patches; +Cc: Yao Qi
This adds a variant of local-remote-host-notty.exp that forces
pseudo-tty allocation, so that readline/editing is enabled.
$ ssh localhost gdb -q
(gdb) show editing
Editing of command lines as they are typed is off.
(gdb)
vs:
$ ssh -t localhost gdb -q
(gdb) show editing
Editing of command lines as they are typed is on.
We now get, e.g.:
Running ../../../src/gdb/testsuite/gdb.base/filesym.exp ...
PASS: gdb.base/filesym.exp: complete on "filesy"
PASS: gdb.base/filesym.exp: completion list for "filesym"
PASS: gdb.base/filesym.exp: set breakpoint at filesym
gdb/testsuite/
2014-05-01 Pedro Alves <palves@redhat.com>
* boards/local-remote-host.exp: New file.
---
gdb/testsuite/ChangeLog | 4 ++++
gdb/testsuite/boards/local-remote-host.exp | 32 ++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+)
create mode 100644 gdb/testsuite/boards/local-remote-host.exp
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index bdd1fc2..e03d39a 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,9 @@
2014-05-01 Pedro Alves <palves@redhat.com>
+ * boards/local-remote-host.exp: New file.
+
+2014-05-01 Pedro Alves <palves@redhat.com>
+
* boards/local-remote-host.exp: Rename to ...
* boards/local-remote-host-notty.exp: ... this.
diff --git a/gdb/testsuite/boards/local-remote-host.exp b/gdb/testsuite/boards/local-remote-host.exp
new file mode 100644
index 0000000..4ed3ced
--- /dev/null
+++ b/gdb/testsuite/boards/local-remote-host.exp
@@ -0,0 +1,32 @@
+# Copyright 2014 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Like local-remote-host-notty, but with readline/editing enabled.
+
+load_board_description "local-remote-host-notty"
+
+# Like standard_spawn, but force pseudo-tty allocation, with 'ssh -t'.
+
+proc ${board}_spawn { board cmd } {
+ global board_info
+
+ set remote [board_info $board hostname]
+ set username [board_info $board username]
+ set RSH [board_info $board rsh_prog]
+
+ spawn $RSH -t -l $username $remote $cmd
+ set board_info($board,fileid) $spawn_id
+ return $spawn_id
+}
--
1.7.11.7
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PUSHED 2/2] New testsuite/boards/local-remote-host.exp board, now with editing on
2014-05-01 16:27 ` [PUSHED 2/2] New testsuite/boards/local-remote-host.exp board, now with editing on Pedro Alves
@ 2014-05-02 11:28 ` Yao Qi
0 siblings, 0 replies; 7+ messages in thread
From: Yao Qi @ 2014-05-02 11:28 UTC (permalink / raw)
To: Pedro Alves, gdb-patches
On 05/02/2014 12:27 AM, Pedro Alves wrote:
> +proc ${board}_spawn { board cmd } {
> + global board_info
> +
> + set remote [board_info $board hostname]
> + set username [board_info $board username]
> + set RSH [board_info $board rsh_prog]
> +
> + spawn $RSH -t -l $username $remote $cmd
> + set board_info($board,fileid) $spawn_id
> + return $spawn_id
> +}
Thanks for doing this, Pedro.
It is clever to pass '-t' option to RSH in ${board}_spawn. I thought
of passing '-t' to remote_spawn in dejagnu, but give up due the
complexity there.
--
Yao (é½å°§)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PUSHED 1/2] Rename testsuite/boards/local-remote-host.exp -> testsuite/boards/local-remote-host-notty.exp
2014-05-01 16:27 ` [PUSHED 0/2] Make local-remote-host.exp force pseudo-tty allocation; add local-remote-host-notty.exp Pedro Alves
2014-05-01 16:27 ` [PUSHED 2/2] New testsuite/boards/local-remote-host.exp board, now with editing on Pedro Alves
@ 2014-05-01 16:27 ` Pedro Alves
1 sibling, 0 replies; 7+ messages in thread
From: Pedro Alves @ 2014-05-01 16:27 UTC (permalink / raw)
To: gdb-patches; +Cc: Yao Qi
When testing with this board, stdin is not a tty, and so
readline/editing is disabled:
$ ssh localhost gdb -q
(gdb) show editing
Editing of command lines as they are typed is off.
(gdb)
Rename the file, to make room for a version of this board that forces a pseudo-tty.
gdb/testsuite/
2014-05-01 Pedro Alves <palves@redhat.com>
* boards/local-remote-host.exp: Rename to ...
* boards/local-remote-host-notty.exp: ... this.
---
gdb/testsuite/ChangeLog | 5 +++++
.../boards/{local-remote-host.exp => local-remote-host-notty.exp} | 0
2 files changed, 5 insertions(+)
rename gdb/testsuite/boards/{local-remote-host.exp => local-remote-host-notty.exp} (100%)
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 8078a42..bdd1fc2 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-05-01 Pedro Alves <palves@redhat.com>
+
+ * boards/local-remote-host.exp: Rename to ...
+ * boards/local-remote-host-notty.exp: ... this.
+
2014-04-28 Joel Brobecker <brobecker@adacore.com>
* gdb.ada/dyn_arrayidx: New testcase.
diff --git a/gdb/testsuite/boards/local-remote-host.exp b/gdb/testsuite/boards/local-remote-host-notty.exp
similarity index 100%
rename from gdb/testsuite/boards/local-remote-host.exp
rename to gdb/testsuite/boards/local-remote-host-notty.exp
--
1.7.11.7
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-05-02 11:28 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-26 5:49 [PATCH] Skip tests on completion and readline when readline lib isn't used Yao Qi
2014-03-26 12:32 ` Joel Brobecker
2014-03-26 13:13 ` Yao Qi
2014-05-01 16:27 ` [PUSHED 0/2] Make local-remote-host.exp force pseudo-tty allocation; add local-remote-host-notty.exp Pedro Alves
2014-05-01 16:27 ` [PUSHED 2/2] New testsuite/boards/local-remote-host.exp board, now with editing on Pedro Alves
2014-05-02 11:28 ` Yao Qi
2014-05-01 16:27 ` [PUSHED 1/2] Rename testsuite/boards/local-remote-host.exp -> testsuite/boards/local-remote-host-notty.exp Pedro Alves
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).