Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] gdb/testsuite: Adjust command completion output when TUI is disabled
@ 2020-06-23  6:27 Sandra Loosemore
  2020-06-23  8:39 ` Andrew Burgess
  2020-06-23 12:06 ` Pedro Alves
  0 siblings, 2 replies; 3+ messages in thread
From: Sandra Loosemore @ 2020-06-23  6:27 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 289 bytes --]

This is another almost-obvious testsuite fix, for one of the 
command-completion tests that was failing due to an incorrect assumption 
that TUI commands are always present.  OK to commit, or is this just a 
poorly-designed testcase that we should rewrite some other way instead?

-Sandra

[-- Attachment #2: tui-commands.patch --]
[-- Type: text/x-patch, Size: 2202 bytes --]

commit 8e0cc2870a30390e745110d4c8181f010d09c17f
Author: Sandra Loosemore <sandra@codesourcery.com>
Date:   Mon Jun 22 23:01:19 2020 -0700

    Adjust command completion output when TUI is disabled
    
    The history-scrolling commands "+", "-", "<" and ">" are only known to
    GDB when TUI is enabled.  This means the "complete pipe " command
    produces different output depending on whether TUI is present, which
    in turn caused
    
    FAIL: gdb.base/shell.exp: cmd complete "pipe "
    
    This patch provides different patterns for that test depending on
    whether or not TUI is available.
    
    2020-06-23  Sandra Loosemore  <sandra@codesourcery.com>
    
    	gdb/testsuite/
    	* lib/completion-support.exp (test_gdb_completion_offers_commands):
    	Adjust for omitted commands when TUI is disabled.

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index d6c43e6..38f2188 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2020-06-23  Sandra Loosemore  <sandra@codesourcery.com>
+
+	* lib/completion-support.exp (test_gdb_completion_offers_commands):
+	Adjust for omitted commands when TUI is disabled.
+
 2020-06-22  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
 
 	* gdb.base/default-args.exp: New test.
diff --git a/gdb/testsuite/lib/completion-support.exp b/gdb/testsuite/lib/completion-support.exp
index 18eac82..51436cc 100644
--- a/gdb/testsuite/lib/completion-support.exp
+++ b/gdb/testsuite/lib/completion-support.exp
@@ -555,10 +555,19 @@ proc test_gdb_completion_offers_commands {input_line} {
     # Force showing two commands.
     gdb_test_no_output "set max-completions 2" ""
 
-    test_gdb_complete_multiple $input_line "" "" {
-	"!"
-	"+"
-    } "" "" 1
+    # TUI adds additional commands to the possible completions, so we
+    # need different patterns depending on whether or not it is enabled.
+    if { [skip_tui_tests] } {
+	test_gdb_complete_multiple $input_line "" "" {
+	    "!"
+	    "actions"
+	} "" "" 1
+    } else {
+	test_gdb_complete_multiple $input_line "" "" {
+	    "!"
+	    "+"
+	} "" "" 1
+    }
 
     # Restore.
     gdb_test_no_output "set max-completions $max_completions" ""

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] gdb/testsuite: Adjust command completion output when TUI is disabled
  2020-06-23  6:27 [patch] gdb/testsuite: Adjust command completion output when TUI is disabled Sandra Loosemore
@ 2020-06-23  8:39 ` Andrew Burgess
  2020-06-23 12:06 ` Pedro Alves
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Burgess @ 2020-06-23  8:39 UTC (permalink / raw)
  To: Sandra Loosemore; +Cc: gdb-patches

* Sandra Loosemore <sandra@codesourcery.com> [2020-06-23 00:27:45 -0600]:

> This is another almost-obvious testsuite fix, for one of the
> command-completion tests that was failing due to an incorrect assumption
> that TUI commands are always present.  OK to commit, or is this just a
> poorly-designed testcase that we should rewrite some other way instead?
> 
> -Sandra

> commit 8e0cc2870a30390e745110d4c8181f010d09c17f
> Author: Sandra Loosemore <sandra@codesourcery.com>
> Date:   Mon Jun 22 23:01:19 2020 -0700
> 
>     Adjust command completion output when TUI is disabled
>     
>     The history-scrolling commands "+", "-", "<" and ">" are only known to
>     GDB when TUI is enabled.  This means the "complete pipe " command
>     produces different output depending on whether TUI is present, which
>     in turn caused
>     
>     FAIL: gdb.base/shell.exp: cmd complete "pipe "
>     
>     This patch provides different patterns for that test depending on
>     whether or not TUI is available.
>     
>     2020-06-23  Sandra Loosemore  <sandra@codesourcery.com>
>     
>     	gdb/testsuite/
>     	* lib/completion-support.exp (test_gdb_completion_offers_commands):
>     	Adjust for omitted commands when TUI is disabled.

LGTM.

Thanks,
Andrew


> 
> diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
> index d6c43e6..38f2188 100644
> --- a/gdb/testsuite/ChangeLog
> +++ b/gdb/testsuite/ChangeLog
> @@ -1,3 +1,8 @@
> +2020-06-23  Sandra Loosemore  <sandra@codesourcery.com>
> +
> +	* lib/completion-support.exp (test_gdb_completion_offers_commands):
> +	Adjust for omitted commands when TUI is disabled.
> +
>  2020-06-22  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
>  
>  	* gdb.base/default-args.exp: New test.
> diff --git a/gdb/testsuite/lib/completion-support.exp b/gdb/testsuite/lib/completion-support.exp
> index 18eac82..51436cc 100644
> --- a/gdb/testsuite/lib/completion-support.exp
> +++ b/gdb/testsuite/lib/completion-support.exp
> @@ -555,10 +555,19 @@ proc test_gdb_completion_offers_commands {input_line} {
>      # Force showing two commands.
>      gdb_test_no_output "set max-completions 2" ""
>  
> -    test_gdb_complete_multiple $input_line "" "" {
> -	"!"
> -	"+"
> -    } "" "" 1
> +    # TUI adds additional commands to the possible completions, so we
> +    # need different patterns depending on whether or not it is enabled.
> +    if { [skip_tui_tests] } {
> +	test_gdb_complete_multiple $input_line "" "" {
> +	    "!"
> +	    "actions"
> +	} "" "" 1
> +    } else {
> +	test_gdb_complete_multiple $input_line "" "" {
> +	    "!"
> +	    "+"
> +	} "" "" 1
> +    }
>  
>      # Restore.
>      gdb_test_no_output "set max-completions $max_completions" ""



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] gdb/testsuite: Adjust command completion output when TUI is disabled
  2020-06-23  6:27 [patch] gdb/testsuite: Adjust command completion output when TUI is disabled Sandra Loosemore
  2020-06-23  8:39 ` Andrew Burgess
@ 2020-06-23 12:06 ` Pedro Alves
  1 sibling, 0 replies; 3+ messages in thread
From: Pedro Alves @ 2020-06-23 12:06 UTC (permalink / raw)
  To: Sandra Loosemore, gdb-patches

On 6/23/20 7:27 AM, Sandra Loosemore wrote:
> This is another almost-obvious testsuite fix, for one of the command-completion tests that was failing due to an incorrect assumption that TUI commands are always present.  OK to commit, or is this just a poorly-designed testcase that we should rewrite some other way instead?

With my "I wrote that" hat on, I don't see any other way to write that
test.  We want to check that TAB on an empty input line completes
all commands.  "+" only happens to be the one that sorts second in
the all-commands set.  The only way that I think we could get rid of the
TUI vs non-TUI difference is if we limit the number of completions to 1
instead of 2.  Then only "!" shows up.  But the "1 completion match only"
case makes GDB behave differently (it completes immediately), so I don't
think that's a good idea.

Thus, I think your patch is OK.

Thanks,
Pedro Alves



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-06-23 12:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-23  6:27 [patch] gdb/testsuite: Adjust command completion output when TUI is disabled Sandra Loosemore
2020-06-23  8:39 ` Andrew Burgess
2020-06-23 12:06 ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox