[testsuite] skip tab-completion tests if no readline

Message ID ae3d90cf-0096-18fc-a004-68c6888c50b7@codesourcery.com
State New
Headers show
Series
  • [testsuite] skip tab-completion tests if no readline
Related show

Commit Message

Sandra Loosemore Sept. 19, 2018, 4:23 a.m.
I found a bunch of borked tab-completion tests when running tests on a 
remote Windows host, where the input stream is not a tty and has no 
readline support.  I've copied the test for readline support verbatim 
from the older gdb.base/completion.exp testcase into these newer 
testcases.  OK to commit?

-Sandra

Comments

Tom Tromey Sept. 19, 2018, 12:52 p.m. | #1
>>>>> "Sandra" == Sandra Loosemore <sandra@codesourcery.com> writes:


Sandra> I found a bunch of borked tab-completion tests when running tests on a
Sandra> remote Windows host, where the input stream is not a tty and has no
Sandra> readline support.  I've copied the test for readline support verbatim
Sandra> from the older gdb.base/completion.exp testcase into these newer
Sandra> testcases.  OK to commit?

Thank you.  This is ok.

Tom
Tom Tromey Sept. 19, 2018, 12:56 p.m. | #2
>>>>> "Sandra" == Sandra Loosemore <sandra@codesourcery.com> writes:


Sandra> I found a bunch of borked tab-completion tests when running tests on a
Sandra> remote Windows host, where the input stream is not a tty and has no
Sandra> readline support.  I've copied the test for readline support verbatim
Sandra> from the older gdb.base/completion.exp testcase into these newer
Sandra> testcases.  OK to commit?

Actually, I had a couple thoughts just as I hit send...

Sandra>  # This file is part of the gdb testsuite.
 
Sandra> +# Tests below are about tab-completion, which doesn't work if readline
Sandra> +# library isn't used.  Check it first.
Sandra> +
Sandra> +if { ![readline_is_used] } {
Sandra> +    return -1
Sandra> +}

Perhaps the early returns should call "untested".  I'm on the fence
about this, sometimes it is done, sometimes not.  I don't know if it
matters to anybody -- I never really look at these lines.

https://sourceware.org/gdb/wiki/GDBTestcaseCookbook#A.22untested.22_calls

Second, this particular check runs early.  I wonder if readline_is_used
actually works at this spot, because I would imagine gdb isn't running yet.
What does "runtest cpls-ops.exp" do?

Tom
Sandra Loosemore Sept. 20, 2018, 2:18 a.m. | #3
On 09/19/2018 06:56 AM, Tom Tromey wrote:
> [snip]

> 

> Perhaps the early returns should call "untested".  I'm on the fence

> about this, sometimes it is done, sometimes not.  I don't know if it

> matters to anybody -- I never really look at these lines.

> 

> https://sourceware.org/gdb/wiki/GDBTestcaseCookbook#A.22untested.22_calls

> 

> Second, this particular check runs early.  I wonder if readline_is_used

> actually works at this spot, because I would imagine gdb isn't running yet.

> What does "runtest cpls-ops.exp" do?


Ooops, my bad.  :-(  I'd checked that the failures went away, but hadn't 
looked closely at the logs to see that it was complaining about an error 
there.

I've fixed it by moving the check after gdb is started, and also added 
the "untested" calls.  This is the version of the patch I've checked in.

-Sandra
commit 4ee9b0c53a8055b869dfe424846bc00eb0cd0c8f
Author: Sandra Loosemore <sandra@codesourcery.com>
Date:   Wed Sep 19 19:05:39 2018 -0700

    Skip GDB tab-completion tests if no readline.
    
    2018-09-18  Sandra Loosemore  <sandra@codesourcery.com>
    
    	gdb/testsuite/
    	* gdb.base/complete-empty.exp: Skip tab-completion tests if
    	no readline.
    	* gdb.base/utf8-identifiers.exp: Likewise.
    	* gdb.cp/cpcompletion.exp: Likewise.
    	* gdb.linespec/cpcompletion.exp: Likewise.
    	* gdb.linespec/cpls-abi-tag.exp: Likewise.
    	* gdb.linespec/cpls-ops.exp: Likewise.

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 37f252e..53173c2 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,13 @@
+2018-09-18  Sandra Loosemore  <sandra@codesourcery.com>
+
+	* gdb.base/complete-empty.exp: Skip tab-completion tests if
+	no readline.
+	* gdb.base/utf8-identifiers.exp: Likewise.
+	* gdb.cp/cpcompletion.exp: Likewise.
+	* gdb.linespec/cpcompletion.exp: Likewise.
+	* gdb.linespec/cpls-abi-tag.exp: Likewise.
+	* gdb.linespec/cpls-ops.exp: Likewise.
+
 2018-09-19  Richard Bunt  <richard.bunt@arm.com>
 	    Chris January  <chris.january@arm.com>
 
diff --git a/gdb/testsuite/gdb.base/complete-empty.exp b/gdb/testsuite/gdb.base/complete-empty.exp
index 6a78538..57e5aae 100644
--- a/gdb/testsuite/gdb.base/complete-empty.exp
+++ b/gdb/testsuite/gdb.base/complete-empty.exp
@@ -20,6 +20,14 @@ load_lib completion-support.exp
 gdb_exit
 gdb_start
 
+# Tests below are about tab-completion, which doesn't work if readline
+# library isn't used.  Check it first.
+
+if { ![readline_is_used] } {
+    untested "no tab completion support without readline"
+    return -1
+}
+
 # Start of tests.
 
 # Test TAB with no input.
diff --git a/gdb/testsuite/gdb.base/utf8-identifiers.exp b/gdb/testsuite/gdb.base/utf8-identifiers.exp
index 12fe376..a1cc182 100644
--- a/gdb/testsuite/gdb.base/utf8-identifiers.exp
+++ b/gdb/testsuite/gdb.base/utf8-identifiers.exp
@@ -56,6 +56,14 @@ gdb_test "continue" \
 # names getting in the way of completion.
 gdb_test_no_output "nosharedlibrary"
 
+# Tests below are about tab-completion, which doesn't work if readline
+# library isn't used.  Check it first.
+
+if { ![readline_is_used] } {
+    untested "no tab completion support without readline"
+    return -1
+}
+
 # Test linespec completion.
 
 # A unique completion.
diff --git a/gdb/testsuite/gdb.cp/cpcompletion.exp b/gdb/testsuite/gdb.cp/cpcompletion.exp
index 9ec3bbf..73aa3fd 100644
--- a/gdb/testsuite/gdb.cp/cpcompletion.exp
+++ b/gdb/testsuite/gdb.cp/cpcompletion.exp
@@ -59,6 +59,14 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
 
+# Tests below are about tab-completion, which doesn't work if readline
+# library isn't used.  Check it first.
+
+if { ![readline_is_used] } {
+    untested "no tab completion support without readline"
+    return -1
+}
+
 # Test that completion is restricted by class name (all methods)
 test_class_complete Foo "" "complete class methods" \
     [list Foo Foofoo get_foo set_foo ~Foo]
diff --git a/gdb/testsuite/gdb.linespec/cpcompletion.exp b/gdb/testsuite/gdb.linespec/cpcompletion.exp
index d8aa5b2..48e1e0b 100644
--- a/gdb/testsuite/gdb.linespec/cpcompletion.exp
+++ b/gdb/testsuite/gdb.linespec/cpcompletion.exp
@@ -24,6 +24,14 @@ if {[prepare_for_testing "failed to prepare" $testfile \
     return -1
 }
 
+# Tests below are about tab-completion, which doesn't work if readline
+# library isn't used.  Check it first.
+
+if { ![readline_is_used] } {
+    untested "no tab completion support without readline"
+    return -1
+}
+
 # Disable the completion limit for the whole testcase.
 gdb_test_no_output "set max-completions unlimited"
 
diff --git a/gdb/testsuite/gdb.linespec/cpls-abi-tag.exp b/gdb/testsuite/gdb.linespec/cpls-abi-tag.exp
index e188637..b69f85f 100644
--- a/gdb/testsuite/gdb.linespec/cpls-abi-tag.exp
+++ b/gdb/testsuite/gdb.linespec/cpls-abi-tag.exp
@@ -26,6 +26,14 @@ if {[prepare_for_testing "failed to prepare" $testfile \
     return -1
 }
 
+# Tests below are about tab-completion, which doesn't work if readline
+# library isn't used.  Check it first.
+
+if { ![readline_is_used] } {
+    untested "no tab completion support without readline"
+    return -1
+}
+
 gdb_test_no_output "set max-completions unlimited"
 
 # Check that the explicit location completer manages to find the next
diff --git a/gdb/testsuite/gdb.linespec/cpls-ops.exp b/gdb/testsuite/gdb.linespec/cpls-ops.exp
index 355735e..cc66c85 100644
--- a/gdb/testsuite/gdb.linespec/cpls-ops.exp
+++ b/gdb/testsuite/gdb.linespec/cpls-ops.exp
@@ -24,6 +24,14 @@ if {[prepare_for_testing "failed to prepare" $testfile \
     return -1
 }
 
+# Tests below are about tab-completion, which doesn't work if readline
+# library isn't used.  Check it first.
+
+if { ![readline_is_used] } {
+    untested "no tab completion support without readline"
+    return -1
+}
+
 gdb_test_no_output "set max-completions unlimited"
 
 # Check that the explicit location completer manages to find the next

Patch

commit b4262306c3d11c87c11c873d3bd6065fcb6b0625
Author: Sandra Loosemore <sandra@codesourcery.com>
Date:   Tue Sep 18 21:10:55 2018 -0700

    Skip GDB tab-completion tests if no readline.
    
    2018-09-18  Sandra Loosemore  <sandra@codesourcery.com>
    
    	gdb/testsuite/
            * gdb.base/complete-empty.exp: Skip tab-completion tests if
    	no readline.
            * gdb.base/utf8-identifiers.exp: Likewise.
            * gdb.cp/cpcompletion.exp: Likewise.
            * gdb.linespec/cpcompletion.exp: Likewise.
            * gdb.linespec/cpls-abi-tag.exp: Likewise.
            * gdb.linespec/cpls-ops.exp: Likewise.

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 701d979..6ec2f86 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,13 @@ 
+2018-09-18  Sandra Loosemore  <sandra@codesourcery.com>
+
+        * gdb.base/complete-empty.exp: Skip tab-completion tests if
+	no readline.
+        * gdb.base/utf8-identifiers.exp: Likewise.
+        * gdb.cp/cpcompletion.exp: Likewise.
+        * gdb.linespec/cpcompletion.exp: Likewise.
+        * gdb.linespec/cpls-abi-tag.exp: Likewise.
+        * gdb.linespec/cpls-ops.exp: Likewise.
+
 2018-09-18  Sergio Durigan Junior  <sergiodj@redhat.com>
 
 	* gdb.arch/amd64-invalid-stack-top.exp: Expect optional
diff --git a/gdb/testsuite/gdb.base/complete-empty.exp b/gdb/testsuite/gdb.base/complete-empty.exp
index 6a78538..c97b1fd 100644
--- a/gdb/testsuite/gdb.base/complete-empty.exp
+++ b/gdb/testsuite/gdb.base/complete-empty.exp
@@ -15,6 +15,13 @@ 
 
 # This file is part of the gdb testsuite.
 
+# 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
+}
+
 load_lib completion-support.exp
 
 gdb_exit
diff --git a/gdb/testsuite/gdb.base/utf8-identifiers.exp b/gdb/testsuite/gdb.base/utf8-identifiers.exp
index 12fe376..6afc884 100644
--- a/gdb/testsuite/gdb.base/utf8-identifiers.exp
+++ b/gdb/testsuite/gdb.base/utf8-identifiers.exp
@@ -56,6 +56,13 @@  gdb_test "continue" \
 # names getting in the way of completion.
 gdb_test_no_output "nosharedlibrary"
 
+# 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
+}
+
 # Test linespec completion.
 
 # A unique completion.
diff --git a/gdb/testsuite/gdb.cp/cpcompletion.exp b/gdb/testsuite/gdb.cp/cpcompletion.exp
index 9ec3bbf..0a5e804 100644
--- a/gdb/testsuite/gdb.cp/cpcompletion.exp
+++ b/gdb/testsuite/gdb.cp/cpcompletion.exp
@@ -15,6 +15,13 @@ 
 
 # This file is part of the gdb testsuite.
 
+# 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
+}
+
 load_lib completion-support.exp
 
 # A helper procedure to test location completions restricted by
diff --git a/gdb/testsuite/gdb.linespec/cpcompletion.exp b/gdb/testsuite/gdb.linespec/cpcompletion.exp
index d8aa5b2..1fc5390 100644
--- a/gdb/testsuite/gdb.linespec/cpcompletion.exp
+++ b/gdb/testsuite/gdb.linespec/cpcompletion.exp
@@ -15,6 +15,13 @@ 
 
 # This file is part of the gdb testsuite.
 
+# 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
+}
+
 load_lib completion-support.exp
 
 standard_testfile cpls.cc cpls2.cc cpls-hyphen.cc
diff --git a/gdb/testsuite/gdb.linespec/cpls-abi-tag.exp b/gdb/testsuite/gdb.linespec/cpls-abi-tag.exp
index e188637..a3a2e56 100644
--- a/gdb/testsuite/gdb.linespec/cpls-abi-tag.exp
+++ b/gdb/testsuite/gdb.linespec/cpls-abi-tag.exp
@@ -17,6 +17,13 @@ 
 
 # Test ABI tag support in linespecs.
 
+# 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
+}
+
 load_lib completion-support.exp
 
 standard_testfile cpls-abi-tag.cc
diff --git a/gdb/testsuite/gdb.linespec/cpls-ops.exp b/gdb/testsuite/gdb.linespec/cpls-ops.exp
index 355735e..ccd89a3 100644
--- a/gdb/testsuite/gdb.linespec/cpls-ops.exp
+++ b/gdb/testsuite/gdb.linespec/cpls-ops.exp
@@ -15,6 +15,13 @@ 
 
 # This file is part of the gdb testsuite.
 
+# 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
+}
+
 load_lib completion-support.exp
 
 standard_testfile cpls-ops.cc