diff mbox

Don't check target_info exists noargs in commands.exp

Message ID 1413167285-14378-1-git-send-email-yao@codesourcery.com
State New
Headers show

Commit Message

Yao Qi Oct. 13, 2014, 2:28 a.m. UTC
I am confused by the noargs checking at each proc in commands.exp,

    if [target_info exists noargs] {
        verbose "Skipping progvar_simple_while_test because of noargs."
        return
    }
    gdb_test_no_output "set args 5" "set args in progvar_simple_while_test"
    if { ![runto factorial] } then { gdb_suppress_tests }
    # Don't depend upon argument passing, since most simulators don't
    # currently support it.  Bash value variable to be what we want.
    gdb_test "p value=5" ".*" "set value to 5 in progvar_simple_if_test #2"

They are conflicting to me.  If the argument passing can't be done on
the target, we skip this test, why do we still have to set value below?
On the other hand, the test case is compiled with -DFAKEARGV, it doesn't
get anything from argv[1], why do we need to skip it if noargs is true?

I don't find any useful clues from the git log, as the code is quite
old, predating import to sourceware cvs.  However, I find something
useful from the ChangeLog.

Thu Jul 20 13:28:36 1995  Jeffrey A. Law  <law@rtl.cygnus.com>

        .....
        * gdb.base/commands.exp: Protect tests which need arguments with
        $noargs conditionals.

Mon Apr 21 13:38:58 1997  Fred Fish  <fnf@cygnus.com>

        * gdb.base/run.c: Use FAKEARGV to build test executable that
        does not require a command line arg, since most simulators
        don't currently support passing such an arg into the simulated
        program.
        * gdb.base/commands.exp: Change tests to insert the proper
        value as the arg to the first recursive factorial call.  Change
        compilation line to define FAKEARGV at compile time.

Jeff added noargs checking as argument is passed to the inferior.  Then,
I presume Fred wanted to run this test on simulators which don't support
argument passing, and change the code not get input from argv.  (I guess)
noargs wasn't set in simulator board files at that moment.

Since Fred changed test to set input by gdb, instead of getting input
from argv, the test should be able to run on target doesn't support
argument passing, such as simulator and gdbserver.

This patch is to remove these checks to noargs.  I run commands.exp with
these board files, and no fail is found

 - unix and native-gdbserver
 - arm-none-eabi with qemu
 - gdbserver on arm-linux-gnueabi with qemu

gdb/testsuite:

2014-10-13  Yao Qi  <yao@codesourcery.com>

	* gdb.base/commands.exp (gdbvar_complex_if_while_test): Don't check
	'target_info exists noargs'.
	(progvar_simple_if_test): Likewise.
	(progvar_simple_while_test): Likewise.
	(progvar_complex_if_while_test): Likewise.
	(if_while_breakpoint_command_test): Likewise.
	(infrun_breakpoint_command_test): Likewise.
	(user_defined_command_test): Likewise.
	(watchpoint_command_test): Likewise.
	(deprecated_command_test): Likewise.
	(bp_deleted_in_command_test): Likewise.
---
 gdb/testsuite/gdb.base/commands.exp | 48 -------------------------------------
 1 file changed, 48 deletions(-)

Comments

Pedro Alves Oct. 15, 2014, 2:05 p.m. UTC | #1
Hi Yao.

Makes sense to me.   Though it looks to me like to be
thorough we should remove all the "set args ..." lines too, like:

>      gdb_test_no_output "set args 5" "set args in progvar_simple_while_test"
                           ^^^^^^^^^^
>      if { ![runto factorial] } then { gdb_suppress_tests }
>      # Don't depend upon argument passing, since most simulators don't

and several more as visible in the patch.

Thanks,
Pedro Alves

> @@ -102,11 +92,6 @@ proc progvar_simple_while_test {} {
>  proc progvar_complex_if_while_test {} {
>      global gdb_prompt
>  
> -    if [target_info exists noargs] { 
> -        verbose "Skipping progvar_simple_if_while_test because of noargs."
> -        return
> -    }
> -
>      gdb_test_no_output "set args 4" \
>  	"set args in progvar_complex_if_while_test"
>      if { ![runto factorial] } then { gdb_suppress_tests }
> @@ -121,10 +106,6 @@ proc progvar_complex_if_while_test {} {
>  }
>  
>  proc if_while_breakpoint_command_test {} {
> -    if [target_info exists noargs] { 
> -        verbose "Skipping if_while_breakpoint_command_test because of noargs."
> -        return
> -    }
>  
>      gdb_test_no_output "set args 5" \
>  	"set args in if_while_breakpoint_command_test"
> @@ -162,10 +143,6 @@ proc if_while_breakpoint_command_test {} {
>  # subsection "Breakpoint command lists".
>  
>  proc infrun_breakpoint_command_test {} {
> -    if [target_info exists noargs] { 
> -        verbose "Skipping infrun_breakpoint_command_test because of noargs."
> -        return
> -    }
>  
>      gdb_test_no_output "set args 6" \
>  	"set args in infrun_breakpoint_command_test"
> @@ -197,10 +174,6 @@ proc infrun_breakpoint_command_test {} {
>  }
>  
>  proc breakpoint_command_test {} {
> -    if [target_info exists noargs] { 
> -        verbose "Skipping breakpoint_command_test because of noargs."
> -        return
> -    }
>  
>      gdb_test_no_output "set args 6" "set args in breakpoint_command_test"
>      if { ![runto factorial] } then { gdb_suppress_tests; }
> @@ -268,14 +241,8 @@ proc user_defined_command_test {} {
>  }
>  
>  proc watchpoint_command_test {} {
> -    global noargs
>      global gdb_prompt
>  
> -    if [target_info exists noargs] { 
> -        verbose "Skipping watchpoint_command_test because of noargs."
> -        return
> -    }
> -
>      # Disable hardware watchpoints if necessary.
>      if [target_info exists gdb,no_hardware_watchpoints] {
>  	gdb_test_no_output "set can-use-hw-watchpoints 0" ""
> @@ -348,11 +315,6 @@ proc watchpoint_command_test {} {
>  proc test_command_prompt_position {} {
>      global gdb_prompt
>  
> -    if [target_info exists noargs] { 
> -        verbose "Skipping test_command_prompt_position because of noargs."
> -        return
> -    }
> -
>      if { ![runto factorial] } then { gdb_suppress_tests; }
>      # Don't depend upon argument passing, since most simulators don't
>      # currently support it.  Bash value variable to be what we want.
> @@ -446,11 +408,6 @@ proc deprecated_command_test {} {
>  
>  proc bp_deleted_in_command_test {} {
>      global gdb_prompt
> -    
> -    if [target_info exists noargs] { 
> -        verbose "Skipping bp_deleted_in_command_test because of noargs."
> -        return
> -    }
>  
>      gdb_test_no_output "set args 1" \
>  	"set args in bp_deleted_in_command_test"
> @@ -498,11 +455,6 @@ proc bp_deleted_in_command_test {} {
>  
>  proc temporary_breakpoint_commands {} {
>      global gdb_prompt
> -    
> -    if [target_info exists noargs] { 
> -        verbose "Skipping temporary_breakpoint_commands because of noargs."
> -        return
> -    }
>  
>      gdb_test_no_output "set args 1" \
>  	"set args in temporary_breakpoint_commands"
>
diff mbox

Patch

diff --git a/gdb/testsuite/gdb.base/commands.exp b/gdb/testsuite/gdb.base/commands.exp
index ef86059..0003895 100644
--- a/gdb/testsuite/gdb.base/commands.exp
+++ b/gdb/testsuite/gdb.base/commands.exp
@@ -59,11 +59,6 @@  proc gdbvar_complex_if_while_test {} {
 proc progvar_simple_if_test {} {
     global gdb_prompt
 
-    if [target_info exists noargs] { 
-        verbose "Skipping progvar_simple_if_test because of noargs."
-        return
-    }
-
     if { ![runto factorial] } then { gdb_suppress_tests; }
     # Don't depend upon argument passing, since most simulators don't
     # currently support it.  Bash value variable to be what we want.
@@ -82,11 +77,6 @@  proc progvar_simple_if_test {} {
 proc progvar_simple_while_test {} {
     global gdb_prompt
 
-    if [target_info exists noargs] { 
-        verbose "Skipping progvar_simple_while_test because of noargs."
-        return
-    }
-
     gdb_test_no_output "set args 5" "set args in progvar_simple_while_test"
     if { ![runto factorial] } then { gdb_suppress_tests }
     # Don't depend upon argument passing, since most simulators don't
@@ -102,11 +92,6 @@  proc progvar_simple_while_test {} {
 proc progvar_complex_if_while_test {} {
     global gdb_prompt
 
-    if [target_info exists noargs] { 
-        verbose "Skipping progvar_simple_if_while_test because of noargs."
-        return
-    }
-
     gdb_test_no_output "set args 4" \
 	"set args in progvar_complex_if_while_test"
     if { ![runto factorial] } then { gdb_suppress_tests }
@@ -121,10 +106,6 @@  proc progvar_complex_if_while_test {} {
 }
 
 proc if_while_breakpoint_command_test {} {
-    if [target_info exists noargs] { 
-        verbose "Skipping if_while_breakpoint_command_test because of noargs."
-        return
-    }
 
     gdb_test_no_output "set args 5" \
 	"set args in if_while_breakpoint_command_test"
@@ -162,10 +143,6 @@  proc if_while_breakpoint_command_test {} {
 # subsection "Breakpoint command lists".
 
 proc infrun_breakpoint_command_test {} {
-    if [target_info exists noargs] { 
-        verbose "Skipping infrun_breakpoint_command_test because of noargs."
-        return
-    }
 
     gdb_test_no_output "set args 6" \
 	"set args in infrun_breakpoint_command_test"
@@ -197,10 +174,6 @@  proc infrun_breakpoint_command_test {} {
 }
 
 proc breakpoint_command_test {} {
-    if [target_info exists noargs] { 
-        verbose "Skipping breakpoint_command_test because of noargs."
-        return
-    }
 
     gdb_test_no_output "set args 6" "set args in breakpoint_command_test"
     if { ![runto factorial] } then { gdb_suppress_tests; }
@@ -268,14 +241,8 @@  proc user_defined_command_test {} {
 }
 
 proc watchpoint_command_test {} {
-    global noargs
     global gdb_prompt
 
-    if [target_info exists noargs] { 
-        verbose "Skipping watchpoint_command_test because of noargs."
-        return
-    }
-
     # Disable hardware watchpoints if necessary.
     if [target_info exists gdb,no_hardware_watchpoints] {
 	gdb_test_no_output "set can-use-hw-watchpoints 0" ""
@@ -348,11 +315,6 @@  proc watchpoint_command_test {} {
 proc test_command_prompt_position {} {
     global gdb_prompt
 
-    if [target_info exists noargs] { 
-        verbose "Skipping test_command_prompt_position because of noargs."
-        return
-    }
-
     if { ![runto factorial] } then { gdb_suppress_tests; }
     # Don't depend upon argument passing, since most simulators don't
     # currently support it.  Bash value variable to be what we want.
@@ -446,11 +408,6 @@  proc deprecated_command_test {} {
 
 proc bp_deleted_in_command_test {} {
     global gdb_prompt
-    
-    if [target_info exists noargs] { 
-        verbose "Skipping bp_deleted_in_command_test because of noargs."
-        return
-    }
 
     gdb_test_no_output "set args 1" \
 	"set args in bp_deleted_in_command_test"
@@ -498,11 +455,6 @@  proc bp_deleted_in_command_test {} {
 
 proc temporary_breakpoint_commands {} {
     global gdb_prompt
-    
-    if [target_info exists noargs] { 
-        verbose "Skipping temporary_breakpoint_commands because of noargs."
-        return
-    }
 
     gdb_test_no_output "set args 1" \
 	"set args in temporary_breakpoint_commands"